mkimg: add options to specify alternative kernel and additional cmdline (to build imgs for [unsupported] boards (#18)
This commit is contained in:
parent
e5bbb17401
commit
b18ac49ea5
1 changed files with 23 additions and 8 deletions
31
mkimg
31
mkimg
|
@ -13,6 +13,9 @@ build_firmware=1
|
|||
varbose_arg=
|
||||
rootfs="archriscv-$(date --rfc-3339=date).tar.zst"
|
||||
fstype=ext4
|
||||
kernel=linux
|
||||
kernel_suffix=""
|
||||
cmdline=""
|
||||
|
||||
uboot_version=v2023.10
|
||||
opensbi_version=v1.3.1
|
||||
|
@ -32,13 +35,15 @@ Create Arch RISC-V distro image.
|
|||
-p PASSWORD set root password to PASSWORD instead of passwd in rootfs
|
||||
-r ROOTFS specify rootfs file name
|
||||
-t FSTYPE specify rootfs filesystem type (default: ext4)
|
||||
-k KERNEL specify kernel package name (default: linux)
|
||||
-c CMDLINE append CMDLINE to kernel command line
|
||||
-v verbose mode
|
||||
EOF
|
||||
}
|
||||
|
||||
parse-args() {
|
||||
local OPTIND=1
|
||||
while getopts 'hvfdr:t:p:' opt; do
|
||||
while getopts 'hvfdr:t:p:k:c:' opt; do
|
||||
case $opt in
|
||||
h) show_help
|
||||
exit 0
|
||||
|
@ -56,6 +61,10 @@ parse-args() {
|
|||
;;
|
||||
t) fstype=$OPTARG
|
||||
;;
|
||||
k) kernel=$OPTARG
|
||||
;;
|
||||
c) cmdline=$OPTARG
|
||||
;;
|
||||
*) show_help >&2
|
||||
exit 1
|
||||
;;
|
||||
|
@ -165,9 +174,15 @@ popd
|
|||
|
||||
msg "Install kernel package..."
|
||||
|
||||
if [[ $kernel != linux ]]
|
||||
then
|
||||
kernel_suffix="${kernel#linux}"
|
||||
echo -e "[unsupported]\nInclude = /etc/pacman.d/mirrorlist" | sudo tee -a mnt/etc/pacman.conf
|
||||
fi
|
||||
|
||||
sudo systemd-nspawn -D mnt pacman \
|
||||
--noconfirm --needed \
|
||||
-Syu linux linux-firmware
|
||||
-Syu $kernel linux-firmware
|
||||
|
||||
sudo mkdir -p mnt/boot/extlinux
|
||||
cat << EOF | sudo tee mnt/boot/extlinux/extlinux.conf
|
||||
|
@ -177,15 +192,15 @@ default linux-fallback
|
|||
|
||||
label linux
|
||||
menu label Linux linux
|
||||
kernel /boot/vmlinuz-linux
|
||||
initrd /boot/initramfs-linux.img
|
||||
append earlyprintk rw root=UUID=$uuid rootwait console=ttyS0
|
||||
kernel /boot/vmlinuz-linux$kernel_suffix
|
||||
initrd /boot/initramfs-linux$kernel_suffix.img
|
||||
append earlyprintk rw root=UUID=$uuid rootwait console=ttyS0,115200 $cmdline
|
||||
|
||||
label linux-fallback
|
||||
menu label Linux linux (fallback initramfs)
|
||||
kernel /boot/vmlinuz-linux
|
||||
initrd /boot/initramfs-linux-fallback.img
|
||||
append earlyprintk rw root=UUID=$uuid rootwait console=ttyS0
|
||||
kernel /boot/vmlinuz-linux$kernel_suffix
|
||||
initrd /boot/initramfs-linux$kernel_suffix-fallback.img
|
||||
append earlyprintk rw root=UUID=$uuid rootwait console=ttyS0,115200 $cmdline
|
||||
EOF
|
||||
|
||||
cat << EOF | sudo tee mnt/etc/systemd/network/default.network
|
||||
|
|
Loading…
Add table
Reference in a new issue