From 1e005718e9f72866b7bc6e5358414403ec82b745 Mon Sep 17 00:00:00 2001 From: Coelacanthus Date: Mon, 23 May 2022 23:27:56 +0800 Subject: [PATCH] feat: mkimg now learned compressed kernel support --- 0002-riscv-fix-compressed-kernel-boot.patch | 25 ++++++++++++++ mkimg.sh | 36 +++++++++++++++++---- 2 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 0002-riscv-fix-compressed-kernel-boot.patch mode change 100644 => 100755 mkimg.sh diff --git a/0002-riscv-fix-compressed-kernel-boot.patch b/0002-riscv-fix-compressed-kernel-boot.patch new file mode 100644 index 0000000..0cda638 --- /dev/null +++ b/0002-riscv-fix-compressed-kernel-boot.patch @@ -0,0 +1,25 @@ +From a24e04bd50c229d529c7d6efa5d0397abe68911d Mon Sep 17 00:00:00 2001 +From: Coelacanthus +Date: Mon, 23 May 2022 23:23:55 +0800 +Subject: [PATCH] riscv: fix compressed kernel boot + +--- + include/configs/qemu-riscv.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h +index 618c3b63d4..11a6cdb8a6 100644 +--- a/include/configs/qemu-riscv.h ++++ b/include/configs/qemu-riscv.h +@@ -58,6 +58,8 @@ + "scriptaddr=0x88100000\0" \ + "pxefile_addr_r=0x88200000\0" \ + "ramdisk_addr_r=0x88300000\0" \ ++ "kernel_comp_addr_r=0x90000000\0" \ ++ "kernel_comp_size=0x4000000\0" \ + BOOTENV + #endif + +-- +2.36.1 + diff --git a/mkimg.sh b/mkimg.sh old mode 100644 new mode 100755 index b32af3d..fd0b509 --- a/mkimg.sh +++ b/mkimg.sh @@ -6,6 +6,26 @@ . /usr/share/makepkg/util.sh colorize +toggle-systemd-firstboot() { + msg2 "Toggle systemd-firstboot..." + sudo rm ./qcow2/etc/{machine-id,localtime,hostname,shadow,locale.conf} + sudo arch-chroot qcow2 mkdir -p /etc/systemd/system/systemd-firstboot.service.d + sudo arch-chroot qcow2 cat << EOF | tee /etc/systemd/system/systemd-firstboot.service.d/install.conf +[Service] +ExecStart= +ExecStart=/usr/bin/systemd-firstboot --prompt + +[Install] +WantedBy=sysinit.target +EOF + sudo arch-chroot qcow2 systemctl enable systemd-firstboot.service +} + +use-fixed-password() { + msg2 "Using fixed password..." + : # set in rootfs +} + msg "Building dracut-hook package..." git clone https://aur.archlinux.org/dracut-hook.git @@ -20,6 +40,8 @@ pushd u-boot git checkout v2022.04 msg2 "Apply binutils 2.38 compitible patch" git apply ../0001-riscv-fix-compitible-with-binutils-2.38.patch +msg2 "Apply compressed kernel patch" +git apply ../0002-riscv-fix-compressed-kernel-boot.patch make \ CROSS_COMPILE=riscv64-linux-gnu- \ qemu-riscv64_smode_defconfig @@ -36,7 +58,7 @@ git cherry-pick -n 5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c make \ CROSS_COMPILE=riscv64-linux-gnu- \ - PLATFORM=generic \ + PLATFORM=generic \ FW_PAYLOAD_PATH=../u-boot/u-boot.bin popd @@ -76,9 +98,9 @@ sudo pacman \ --noconfirm \ -S linux linux-firmware dracut -arch-chroot -mkdir -p boot/extlinux -cat << EOF | tee boot/extlinux/extlinux.conf +sudo arch-chroot qcow2 dracut --force --add "qemu qemu-net" --regenerate-all +sudo arch-chroot qcow2 mkdir -p boot/extlinux +sudo arch-chroot qcow2 cat << EOF | tee boot/extlinux/extlinux.conf menu title Arch RISC-V QEMU Boot timeout 100 default linux @@ -96,8 +118,10 @@ yes y | sudo pacman \ --sysroot ./rootfs \ --sync --clean --clean -msg2 "Remove initialized files to toggle systemd-firstboot..." -rm ./rootfs/etc/{machine-id,localtime,hostname,shadow,locale.conf} +# Using fixed password for systemd-firstboot don't ask password for unknown reason +# https://github.com/CoelacanthusHex/archriscv-scriptlet/issues/1 +#toggle-systemd-firstboot +use-fixed-password msg2 "Unmount..." sudo umount qcow2