feat(steps-guix): build linux64 kernel and switch via jump with backup

This commit is contained in:
vxtls 2026-02-22 20:31:36 -05:00
parent 8703b089ef
commit 6b10401b65
4 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,32 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2026 Luo Yanpan
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
new_kernel="/boot/vmlinuz-linux64"
current_kernel="/boot/vmlinuz"
backup_kernel="/boot/vmlinuz-32bit.backup"
if [ ! -f "${new_kernel}" ]; then
echo "Missing new kernel image: ${new_kernel}" >&2
exit 1
fi
if [ -f "${current_kernel}" ]; then
cp -af "${current_kernel}" "${backup_kernel}"
fi
cp -af "${new_kernel}" "${current_kernel}"
sync
mkdir -p /etc
if [ "${BARE_METAL}" = True ]; then
kexec -l "${current_kernel}" \
--append="root=/dev/sda1 rootfstype=ext3 init=/init rw rootwait"
else
kexec -l "${current_kernel}" --console-serial \
--append="console=ttyS0 root=/dev/sda1 rootfstype=ext3 init=/init rw rootwait"
fi
kexec -e

View file

@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: 2026 Luo Yanpan
#
# SPDX-License-Identifier: GPL-3.0-or-later
: "${KERNEL_SYSROOT:=/kernel-toolchain}"
: "${KERNEL_TARGET:=x86_64-unknown-linux-musl}"
kernel_env() {
export PATH="${KERNEL_SYSROOT}/bin:${PATH}"
export HOSTCFLAGS="-I${KERNEL_SYSROOT}/include"
export HOSTLDFLAGS="-L${KERNEL_SYSROOT}/lib"
export LD_LIBRARY_PATH="${KERNEL_SYSROOT}/lib:${LD_LIBRARY_PATH}"
}
kernel_make() {
kernel_env
make "${MAKEJOBS}" \
ARCH=x86_64 \
CROSS_COMPILE="${KERNEL_SYSROOT}/bin/${KERNEL_TARGET}-" \
"$@"
}
src_prepare() {
default
}
src_configure() {
kernel_make defconfig
}
src_compile() {
kernel_make
}
src_install() {
install -D -m 644 arch/x86/boot/bzImage \
"${DESTDIR}/boot/vmlinuz-linux64"
}

View file

@ -0,0 +1 @@
f https://linux-libre.fsfla.org/pub/linux-libre/releases/6.12.74-gnu/linux-libre-6.12.74-gnu.tar.xz d0071b065a7a5ba5ea9f638828beb113774f9f043182cbf2c6b205d403f074f5

View file

@ -9,3 +9,5 @@ build: argp-standalone-1.4.1
build: musl-fts-1.2.7
build: musl-obstack-1.2.3
build: elfutils-0.194
build: linux-6.12.74
jump: linux64