diff options
-rw-r--r-- | setup-disk.in | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/setup-disk.in b/setup-disk.in index 82bccb5..f5f19c6 100644 --- a/setup-disk.in +++ b/setup-disk.in @@ -199,8 +199,8 @@ has_bootopt() { # setup grub bootloader setup_grub() { - local mnt="$1" root="$2" modules="$3" - shift 3 + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" + shift 4 local disks="${@}" for disk in $disks; do @@ -213,7 +213,7 @@ setup_grub() { cat > "$mnt"/boot/grub/grub.cfg <<- EOF set timeout=2 menuentry "Alpine Linux" { - linux /boot/vmlinuz $modules root=$root + linux /boot/vmlinuz $modules root=$root $kernel_opts initrd /boot/initramfs-$KERNEL_FLAVOR } EOF @@ -221,9 +221,8 @@ setup_grub() { # setup syslinux bootloader setup_syslinux() { - local mnt="$1" root="$2" modules="$3" extlinux_raidopt="$4" - shift 4 - local kernel_opts="$@" + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" bootdev="$5" + local exlinux_raidopt= sed -e "s:^root=.*:root=$root:" \ -e "s:^default_kernel_opts=.*:default_kernel_opts=\"$kernel_opts\":" \ @@ -233,6 +232,13 @@ setup_syslinux() { sed -i -e "s:^default=.*:default=xen-grsec:" \ "$mnt"/etc/update-extlinux.conf fi + + # Check if we boot from raid so we can pass proper option to + # extlinux later. + if [ -e "/sys/block/${bootdev#/dev/}/md" ]; then + extlinux_raidopt="--raid" + fi + extlinux $extlinux_raidopt --install "$mnt"/boot } @@ -269,12 +275,6 @@ install_mounted_root() { boot_fs=$(find_mount_fs "$mnt_boot") supported_boot_fs "$boot_fs" || return 1 - # Check if we boot from raid so we can pass proper option to - # extlinux later. - if [ -e "/sys/block/${bootdev#/dev/}/md" ]; then - extlinux_raidopt="--raid" - fi - # check if our root is on raid so we can feed mkinitfs and # bootloader conf with the proper kernel module params for dev in $rootdev $pvs; do @@ -357,8 +357,8 @@ install_mounted_root() { rm -f "$mnt"/var/lib/apk/installed "$mnt"/lib/apk/db/installed echo "Installing system on $rootdev:" case "$ARCH" in - ppc64le) setup_grub $mnt $root $modules $disks;; - *) setup_syslinux $mnt $root $modules $extlinux_raidopt $kernel_opts;; + ppc64le) setup_grub "$mnt" "$root" "$modules" "$kernel_opts" $disks;; + *) setup_syslinux "$mnt" "$root" "$modules" "$kernel_opts" "$bootdev";; esac # apk reads config from target root so we need to copy the config |