Choose appropriate bootloader for block-device
In the prior change we added block-device-[mbr|gpt|efi] elements to create appropriate disk-layouts. This adds an environment flag to each so the bootloader can install the right thing. The EFI install path is updated to work with this (this part a copy of I572937945adbb5adaa5cb09200752e323c2c9531) We do some basic sanity checking in the block-device elements; e.g. mbr is not suitable for aarch64, and efi is not suitable for power. This updates the bootloader to install EFI where appropriate Co-Authored-By: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Change-Id: Ib80acbfd9a12efd976c3fa15a5d1081eb0799305
This commit is contained in:
parent
adb0341064
commit
7b4c8abce3
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Arch gate
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ "ppc64 ppc64le ppc64el" =~ "$ARCH" ]]; then
|
||||||
|
echo "block-device-efi is not supported on Power; use block-device-gpt or block-device-mbr"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DIB_BLOCK_DEVICE=efi
|
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Arch gate
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ "arm64 aarch64" =~ $ARCH ]]; then
|
||||||
|
echo "block-device-gpt is not supported on AARCH64; use block-device-efi"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DIB_BLOCK_DEVICE=gpt
|
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Arch gate
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ "arm64 aarch64" =~ $ARCH ]]; then
|
||||||
|
echo "block-device-mbr is not supported on AARCH64; use block-device-efi"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DIB_BLOCK_DEVICE=mbr
|
@ -55,13 +55,21 @@ function install_grub2 {
|
|||||||
# Check for offline installation of grub
|
# Check for offline installation of grub
|
||||||
if [ -f "/tmp/grub/install" ] ; then
|
if [ -f "/tmp/grub/install" ] ; then
|
||||||
source /tmp/grub/install
|
source /tmp/grub/install
|
||||||
# Right now we can't use pkg-map to branch by arch, so tag an architecture
|
|
||||||
# specific virtual package so we can install the rigth thing based on
|
# Right now we can't use pkg-map to branch by arch, so tag an
|
||||||
# distribution.
|
# architecture specific virtual package so we can install the
|
||||||
|
# rigth thing based on distribution.
|
||||||
elif [[ "$ARCH" =~ "ppc" ]]; then
|
elif [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
install-packages -m bootloader grub-ppc64
|
install-packages -m bootloader grub-ppc64
|
||||||
else
|
elif [[ "${DIB_BLOCK_DEVICE}" == "mbr" ||
|
||||||
|
"${DIB_BLOCK_DEVICE}" == "gpt" ]]; then
|
||||||
install-packages -m bootloader grub-pc
|
install-packages -m bootloader grub-pc
|
||||||
|
elif [[ "${DIB_BLOCK_DEVICE}" == "efi" ]]; then
|
||||||
|
install-packages -m bootloader grub-efi-$ARCH
|
||||||
|
else
|
||||||
|
echo "Failure: I'm not sure what bootloader to install"
|
||||||
|
echo "Ensure you have included a block-device-* element"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XXX: grub-probe on the nbd0/loop0 device returns nothing - workaround, manually
|
# XXX: grub-probe on the nbd0/loop0 device returns nothing - workaround, manually
|
||||||
@ -127,7 +135,27 @@ function install_grub2 {
|
|||||||
# that a dev/loopXpN node will work fine.
|
# that a dev/loopXpN node will work fine.
|
||||||
$GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram
|
$GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram
|
||||||
else
|
else
|
||||||
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV
|
# This set of modules is sufficient for all installs (mbr/gpt/efi)
|
||||||
|
modules="part_msdos part_gpt lvm"
|
||||||
|
extra_options=""
|
||||||
|
if [[ ${DIB_BLOCK_DEVICE} == "mbr" || ${DIB_BLOCK_DEVICE} == "gpt" ]]; then
|
||||||
|
modules="$modules biosdisk"
|
||||||
|
elif [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
|
||||||
|
# This tells the EFI install to put the EFI binaries into
|
||||||
|
# the generic /BOOT directory and avoids trying to update
|
||||||
|
# nvram settings.
|
||||||
|
extra_options="--removable"
|
||||||
|
# We need to manually set the target if it's different to
|
||||||
|
# the host. Setup for EFI
|
||||||
|
case $ARCH in
|
||||||
|
"x86_64"|"amd64")
|
||||||
|
GRUB_OPTS="--target=x86_64-efi"
|
||||||
|
;;
|
||||||
|
# At this point, we don't need to override the target
|
||||||
|
# for any other architectures.
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
$GRUBNAME --modules="$modules" $extra_options $GRUB_OPTS $BOOT_DEV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This might be better factored out into a per-distro 'install-bootblock'
|
# This might be better factored out into a per-distro 'install-bootblock'
|
||||||
@ -144,7 +172,7 @@ function install_grub2 {
|
|||||||
echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
|
echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
|
||||||
echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub
|
echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub
|
||||||
echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub
|
echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub
|
||||||
echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub
|
echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub
|
||||||
|
|
||||||
# Serial console on Power is hvc0
|
# Serial console on Power is hvc0
|
||||||
if [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
if [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
||||||
|
@ -3,16 +3,19 @@
|
|||||||
"gentoo": {
|
"gentoo": {
|
||||||
"dkms_package": "",
|
"dkms_package": "",
|
||||||
"extlinux": "syslinux",
|
"extlinux": "syslinux",
|
||||||
"grub-pc": "grub"
|
"grub-pc": "grub",
|
||||||
|
"grub-efi": "grub"
|
||||||
},
|
},
|
||||||
"suse": {
|
"suse": {
|
||||||
"dkms_package": "",
|
"dkms_package": "",
|
||||||
"extlinux": "syslinux",
|
"extlinux": "syslinux",
|
||||||
"grub-pc": "grub2"
|
"grub-pc": "grub2",
|
||||||
|
"grub-efi": "grub2"
|
||||||
},
|
},
|
||||||
"redhat": {
|
"redhat": {
|
||||||
"extlinux": "syslinux-extlinux",
|
"extlinux": "syslinux-extlinux",
|
||||||
"grub-pc": "grub2-tools grub2",
|
"grub-pc": "grub2-tools grub2",
|
||||||
|
"grub-efi": "grub2-tools grub2-efi",
|
||||||
"grub-ppc64": "grub2-tools grub2"
|
"grub-ppc64": "grub2-tools grub2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -20,6 +23,8 @@
|
|||||||
"dkms_package": "dkms",
|
"dkms_package": "dkms",
|
||||||
"extlinux": "extlinux",
|
"extlinux": "extlinux",
|
||||||
"grub-pc": "grub-pc",
|
"grub-pc": "grub-pc",
|
||||||
|
"grub-efi-amd64": "grub-efi",
|
||||||
|
"grub-efi-arm64": "grub-efi-arm64",
|
||||||
"grub-ppc64": "grub-ieee1275"
|
"grub-ppc64": "grub-ieee1275"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user