bootloader: remove extlinux/syslinux path
This is a first pass through the bootloader, that removes the extlinux and syslinux install/cleanup path. Change-Id: Ifb107796cdb6748430a124bf13ced93db9689bff
This commit is contained in:
parent
a4354d14d4
commit
f6748a4cd4
@ -2,10 +2,7 @@
|
|||||||
bootloader
|
bootloader
|
||||||
==========
|
==========
|
||||||
|
|
||||||
Installs ``grub[2]`` on boot partition on the system. In case GRUB2 is
|
Installs ``grub[2]`` on boot partition on the system.
|
||||||
not available in the system, a fallback to Extlinux will happen. It's
|
|
||||||
also possible to enforce the use of Extlinux by exporting a
|
|
||||||
``DIB_EXTLINUX`` variable to the environment.
|
|
||||||
|
|
||||||
Arguments
|
Arguments
|
||||||
=========
|
=========
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
# dib-lint: disable=safe_sudo
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
[ -n "$TARGET_ROOT" ]
|
|
||||||
|
|
||||||
source $_LIB/img-functions
|
|
||||||
|
|
||||||
if [ -d $TARGET_ROOT/boot/extlinux ] ; then
|
|
||||||
CONF=$TARGET_ROOT/boot/extlinux/extlinux.conf
|
|
||||||
elif [ -d $TARGET_ROOT/boot/syslinux ] ; then
|
|
||||||
CONF=$TARGET_ROOT/boot/syslinux/syslinux.cfg
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Dig up the initrd and kernel to use.
|
|
||||||
select_boot_kernel_initrd $TARGET_ROOT
|
|
||||||
|
|
||||||
# Serial console on Power is hvc0
|
|
||||||
if [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]] ; then
|
|
||||||
SERIAL_CONSOLE="hvc0"
|
|
||||||
else
|
|
||||||
SERIAL_CONSOLE="ttyS0,115200"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo sh -c "cat > $CONF <<_EOF_
|
|
||||||
DEFAULT linux
|
|
||||||
|
|
||||||
LABEL linux
|
|
||||||
KERNEL /boot/$KERNEL
|
|
||||||
APPEND ro root=LABEL=${DIB_ROOT_LABEL} console=tty0 console=${SERIAL_CONSOLE} nofb nomodeset gfxpayload=text
|
|
||||||
INITRD /boot/$RAMDISK
|
|
||||||
_EOF_"
|
|
@ -9,111 +9,71 @@ fi
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
BOOT_DEV=$IMAGE_BLOCK_DEVICE
|
if [ ${DIB_EXTLINUX:-0} != "0" ]; then
|
||||||
|
echo "DIB_EXTLINUX no longer supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Some distros have pre-installed grub in some other way, and want to
|
||||||
|
# skip this.
|
||||||
|
if [[ -f "/tmp/grub/install" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
BOOT_DEV=$IMAGE_BLOCK_DEVICE
|
||||||
# All available devices, handy for some bootloaders...
|
# All available devices, handy for some bootloaders...
|
||||||
declare -A DEVICES
|
declare -A DEVICES
|
||||||
eval DEVICES=( $IMAGE_BLOCK_DEVICES )
|
eval DEVICES=( $IMAGE_BLOCK_DEVICES )
|
||||||
|
|
||||||
function install_extlinux {
|
# Right now we can't use pkg-map to branch by arch, so tag an
|
||||||
install-packages -m bootloader extlinux
|
# architecture specific virtual package so we can install the
|
||||||
|
# rigth thing based on distribution.
|
||||||
echo "Installing Extlinux..."
|
if [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
|
|
||||||
# Find and install mbr.bin
|
|
||||||
for MBR in /usr/share/syslinux/mbr.bin /usr/lib/syslinux/mbr.bin \
|
|
||||||
/usr/lib/extlinux/mbr.bin /usr/lib/EXTLINUX/mbr.bin ; do
|
|
||||||
if [ -f $MBR ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ ! -f $MBR ]; then
|
|
||||||
echo "mbr.bin (from EXT/SYSLINUX) not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
dd if=$MBR of=$BOOT_DEV
|
|
||||||
|
|
||||||
# Find any pre-created extlinux install directory
|
|
||||||
for EXTDIR in /boot/extlinux /boot/syslinux ; do
|
|
||||||
if [ -d $EXTDIR ] ; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ ! -d $EXTDIR ] ; then
|
|
||||||
# No install directory found so default to /boot/syslinux
|
|
||||||
EXTDIR=/boot/syslinux
|
|
||||||
mkdir -p $EXTDIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Finally install extlinux
|
|
||||||
extlinux --install $EXTDIR
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_grub2 {
|
|
||||||
|
|
||||||
# Check for offline installation of grub
|
|
||||||
if [ -f "/tmp/grub/install" ] ; then
|
|
||||||
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 distribution.
|
|
||||||
elif [[ "$ARCH" =~ "ppc" ]]; then
|
|
||||||
install-packages -m bootloader grub-ppc64
|
install-packages -m bootloader grub-ppc64
|
||||||
elif [[ "${DIB_BLOCK_DEVICE}" == "mbr" ||
|
elif [[ "${DIB_BLOCK_DEVICE}" == "mbr" ||
|
||||||
"${DIB_BLOCK_DEVICE}" == "gpt" ]]; then
|
"${DIB_BLOCK_DEVICE}" == "gpt" ]]; then
|
||||||
install-packages -m bootloader grub-pc
|
install-packages -m bootloader grub-pc
|
||||||
elif [[ "${DIB_BLOCK_DEVICE}" == "efi" ]]; then
|
elif [[ "${DIB_BLOCK_DEVICE}" == "efi" ]]; then
|
||||||
install-packages -e -m bootloader grub-efi-$ARCH
|
install-packages -e -m bootloader grub-efi-$ARCH
|
||||||
install-packages -m bootloader grub-efi grub-efi-$ARCH
|
install-packages -m bootloader grub-efi grub-efi-$ARCH
|
||||||
else
|
else
|
||||||
echo "Failure: I'm not sure what bootloader to install"
|
echo "Failure: I'm not sure what bootloader to install"
|
||||||
echo "Ensure you have included a block-device-* element"
|
echo "Ensure you have included a block-device-* element"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XXX: grub-probe on the nbd0/loop0 device returns nothing - workaround, manually
|
GRUBNAME=$(type -p grub-install) || echo "trying grub2-install"
|
||||||
# specify modules. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1073731
|
if [ -z "$GRUBNAME" ]; then
|
||||||
GRUBNAME=$(type -p grub-install) || echo "trying grub2-install"
|
|
||||||
if [ -z "$GRUBNAME" ]; then
|
|
||||||
GRUBNAME=$(type -p grub2-install)
|
GRUBNAME=$(type -p grub2-install)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type grub2-mkconfig >/dev/null; then
|
if type grub2-mkconfig >/dev/null; then
|
||||||
GRUB_MKCONFIG="grub2-mkconfig"
|
GRUB_MKCONFIG="grub2-mkconfig"
|
||||||
else
|
else
|
||||||
GRUB_MKCONFIG="grub-mkconfig"
|
GRUB_MKCONFIG="grub-mkconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If no GRUB2 is found, fallback to extlinux
|
echo "Installing GRUB2..."
|
||||||
if [ -z "$GRUBNAME" ] || [ $($GRUBNAME --version | grep "0.97" | wc -l) -ne 0 ]; then
|
|
||||||
echo "No GRUB2 found. Fallback to Extlinux..."
|
|
||||||
install_extlinux
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing GRUB2..."
|
# When using EFI image-based builds, particularly rhel element
|
||||||
|
# based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv
|
||||||
# When using EFI image-based builds, particularly rhel element
|
# as a dangling symlink to /boot/efi because we have extracted
|
||||||
# based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv
|
# it from the root fs, but we didn't populate the separate EFI
|
||||||
# as a dangling symlink to /boot/efi because we have extracted
|
# boot partition from the image. grub2-install calls rename()
|
||||||
# it from the root fs, but we didn't populate the separate EFI
|
# on this file, so if it's a dangling symlink it errors. Just
|
||||||
# boot partition from the image. grub2-install calls rename()
|
# remove it if it exists.
|
||||||
# on this file, so if it's a dangling symlink it errors. Just
|
if [[ -L /boot/grub2/grubenv ]]; then
|
||||||
# remove it if it exists.
|
|
||||||
if [[ -L /boot/grub2/grubenv ]]; then
|
|
||||||
rm -f /boot/grub2/grubenv
|
rm -f /boot/grub2/grubenv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We need --force so grub does not fail due to being installed on the
|
# We need --force so grub does not fail due to being installed on the
|
||||||
# root partition of a block device.
|
# root partition of a block device.
|
||||||
GRUB_OPTS=${GRUB_OPTS:-"--force"}
|
GRUB_OPTS=${GRUB_OPTS:-"--force"}
|
||||||
# XXX: This is buggy:
|
# XXX: This is buggy:
|
||||||
# - --target=i386-pc is invalid for non-i386/amd64 architectures
|
# - --target=i386-pc is invalid for non-i386/amd64 architectures
|
||||||
# - and for UEFI too.
|
# - and for UEFI too.
|
||||||
# GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
# GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
||||||
if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then
|
if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then
|
||||||
# /sys/ comes from the host machine. If the host machine is using EFI
|
# /sys/ comes from the host machine. If the host machine is using EFI
|
||||||
# but the image being built doesn't have EFI boot-images installed we
|
# but the image being built doesn't have EFI boot-images installed we
|
||||||
# should set the --target to use a BIOS-based boot-image.
|
# should set the --target to use a BIOS-based boot-image.
|
||||||
@ -143,16 +103,16 @@ function install_grub2 {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ARCH" =~ "ppc" ]] ; then
|
if [[ "$ARCH" =~ "ppc" ]] ; then
|
||||||
# For PPC (64-Bit regardless of Endian-ness), we use the "boot"
|
# For PPC (64-Bit regardless of Endian-ness), we use the "boot"
|
||||||
# partition as the one to point grub-install to, not the loopback
|
# partition as the one to point grub-install to, not the loopback
|
||||||
# device. ppc has a dedicated PReP boot partition.
|
# device. ppc has a dedicated PReP boot partition.
|
||||||
# For grub2 < 2.02~beta3 this needs to be a /dev/mapper/... node after
|
# For grub2 < 2.02~beta3 this needs to be a /dev/mapper/... node after
|
||||||
# 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
|
||||||
# This set of modules is sufficient for all installs (mbr/gpt/efi)
|
# This set of modules is sufficient for all installs (mbr/gpt/efi)
|
||||||
modules="part_msdos part_gpt lvm"
|
modules="part_msdos part_gpt lvm"
|
||||||
if [[ ${DIB_BLOCK_DEVICE} == "mbr" || ${DIB_BLOCK_DEVICE} == "gpt" ]]; then
|
if [[ ${DIB_BLOCK_DEVICE} == "mbr" || ${DIB_BLOCK_DEVICE} == "gpt" ]]; then
|
||||||
@ -183,107 +143,99 @@ function install_grub2 {
|
|||||||
$GRUBNAME --modules="$modules" $extra_options $GRUB_OPTS $BOOT_DEV
|
$GRUBNAME --modules="$modules" $extra_options $GRUB_OPTS $BOOT_DEV
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
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'
|
||||||
# helper.
|
# helper.
|
||||||
if [ -d /boot/grub2 ]; then
|
if [ -d /boot/grub2 ]; then
|
||||||
GRUB_CFG=/boot/grub2/grub.cfg
|
GRUB_CFG=/boot/grub2/grub.cfg
|
||||||
elif [ -d /boot/grub ]; then
|
elif [ -d /boot/grub ]; then
|
||||||
GRUB_CFG=/boot/grub/grub.cfg
|
GRUB_CFG=/boot/grub/grub.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Override the root device to the default label, and disable uuid
|
# Override the root device to the default label, and disable uuid
|
||||||
# lookup.
|
# lookup.
|
||||||
echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub
|
echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub
|
||||||
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=auto' >>/etc/default/grub
|
echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub
|
||||||
|
|
||||||
# NOTE(ianw) : 2021-05-11
|
# NOTE(ianw) : 2021-05-11
|
||||||
# On Fedora there has been a switch to BLS
|
# On Fedora there has been a switch to BLS
|
||||||
# https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault
|
# https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault
|
||||||
# which means that kernel-install will have created entries in
|
# which means that kernel-install will have created entries in
|
||||||
# /boot/loader/entries/...
|
# /boot/loader/entries/...
|
||||||
# and, as the wiki page says
|
# and, as the wiki page says
|
||||||
#
|
#
|
||||||
# The main issue appears to be that a number of places document
|
# The main issue appears to be that a number of places document
|
||||||
# a way to pass kernel options that is no longer working with
|
# a way to pass kernel options that is no longer working with
|
||||||
# BLS, i.e. edit /etc/default/grub before running
|
# BLS, i.e. edit /etc/default/grub before running
|
||||||
# grub2-mkconfig.
|
# grub2-mkconfig.
|
||||||
#
|
#
|
||||||
# i.e. exactly what we're doing above to override the root device
|
# i.e. exactly what we're doing above to override the root device
|
||||||
# in particular. Override grub2 to use it's old config format and
|
# in particular. Override grub2 to use it's old config format and
|
||||||
# remove any BLS entries the kernel install made.
|
# remove any BLS entries the kernel install made.
|
||||||
#
|
#
|
||||||
# I imagine at some point we will reworking things in a more
|
# I imagine at some point we will reworking things in a more
|
||||||
# general sense to support BLS if that's what everything is
|
# general sense to support BLS if that's what everything is
|
||||||
# switching to.
|
# switching to.
|
||||||
#
|
#
|
||||||
if [[ ${DISTRO_NAME} = fedora ]]; then
|
if [[ ${DISTRO_NAME} = fedora ]]; then
|
||||||
echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub
|
echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub
|
||||||
rm -rf /boot/loader/
|
rm -rf /boot/loader/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then
|
if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then
|
||||||
SERIAL_CONSOLE="${DIB_BOOTLOADER_SERIAL_CONSOLE}"
|
SERIAL_CONSOLE="${DIB_BOOTLOADER_SERIAL_CONSOLE}"
|
||||||
elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
||||||
# Serial console on Power is hvc0
|
# Serial console on Power is hvc0
|
||||||
SERIAL_CONSOLE="hvc0"
|
SERIAL_CONSOLE="hvc0"
|
||||||
elif [[ "arm64" =~ "$ARCH" ]]; then
|
elif [[ "arm64" =~ "$ARCH" ]]; then
|
||||||
SERIAL_CONSOLE="ttyAMA0,115200"
|
SERIAL_CONSOLE="ttyAMA0,115200"
|
||||||
else
|
else
|
||||||
SERIAL_CONSOLE="ttyS0,115200"
|
SERIAL_CONSOLE="ttyS0,115200"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=${SERIAL_CONSOLE} no_timer_check"
|
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=${SERIAL_CONSOLE} no_timer_check"
|
||||||
|
|
||||||
echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT} ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"" >>/etc/default/grub
|
echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT} ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"" >>/etc/default/grub
|
||||||
echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub
|
echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub
|
||||||
|
|
||||||
# os-prober leaks /dev/sda into config file in dual-boot host
|
# os-prober leaks /dev/sda into config file in dual-boot host
|
||||||
# Disable grub-os-prober to avoid the issue while running
|
# Disable grub-os-prober to avoid the issue while running
|
||||||
# grub-mkconfig
|
# grub-mkconfig
|
||||||
# Setting a flag to track whether the entry is already there in grub config
|
# Setting a flag to track whether the entry is already there in grub config
|
||||||
PROBER_DISABLED=
|
PROBER_DISABLED=
|
||||||
if ! grep -qe "^\s*GRUB_DISABLE_OS_PROBER=true" /etc/default/grub; then
|
if ! grep -qe "^\s*GRUB_DISABLE_OS_PROBER=true" /etc/default/grub; then
|
||||||
PROBER_DISABLED=true
|
PROBER_DISABLED=true
|
||||||
echo 'GRUB_DISABLE_OS_PROBER=true' >> /etc/default/grub
|
echo 'GRUB_DISABLE_OS_PROBER=true' >> /etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# GRUB_MKCONFIG call needs to happen after we configure
|
# GRUB_MKCONFIG call needs to happen after we configure
|
||||||
# /etc/default/grub above. Without this we can set inappropriate
|
# /etc/default/grub above. Without this we can set inappropriate
|
||||||
# root device labels and then images don't boot.
|
# root device labels and then images don't boot.
|
||||||
#
|
#
|
||||||
# This produces a legacy config which both bios and uefi can boot
|
# This produces a legacy config which both bios and uefi can boot
|
||||||
# Later we copy the final config to an efi specific location to
|
# Later we copy the final config to an efi specific location to
|
||||||
# support uefi specific functionality like secure boot.
|
# support uefi specific functionality like secure boot.
|
||||||
$GRUB_MKCONFIG -o $GRUB_CFG
|
$GRUB_MKCONFIG -o $GRUB_CFG
|
||||||
|
|
||||||
# Remove the fix to disable os_prober
|
# Remove the fix to disable os_prober
|
||||||
if [ -n "$PROBER_DISABLED" ]; then
|
if [ -n "$PROBER_DISABLED" ]; then
|
||||||
sed -i '$d' /etc/default/grub
|
sed -i '$d' /etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# grub-mkconfig generates a config with the device in it,
|
# Fix efi specific instructions in grub config file
|
||||||
# This shouldn't be needed, but old code has bugs
|
if [ -d /sys/firmware/efi ]; then
|
||||||
DIB_RELEASE=${DIB_RELEASE:-}
|
|
||||||
if [ "$DIB_RELEASE" = 'wheezy' ]; then
|
|
||||||
sed -i "s%search --no.*%%" $GRUB_CFG
|
|
||||||
sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix efi specific instructions in grub config file
|
|
||||||
if [ -d /sys/firmware/efi ]; then
|
|
||||||
sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG
|
sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# when using efi, and having linux16/initrd16, it needs to be replaced
|
# when using efi, and having linux16/initrd16, it needs to be replaced
|
||||||
# by linuxefi/initrdefi. When building images on a non-efi system,
|
# by linuxefi/initrdefi. When building images on a non-efi system,
|
||||||
# the 16 suffix is added to linux/initrd entries, but we need it to be
|
# the 16 suffix is added to linux/initrd entries, but we need it to be
|
||||||
# linuxefi/initrdefi for the image to boot under efi
|
# linuxefi/initrdefi for the image to boot under efi
|
||||||
if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
|
if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
|
||||||
sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG
|
sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG
|
||||||
|
|
||||||
# Finally copy the grub.cfg to the EFI specific dir to support
|
# Finally copy the grub.cfg to the EFI specific dir to support
|
||||||
@ -293,12 +245,5 @@ function install_grub2 {
|
|||||||
if [ -d /boot/efi/$EFI_BOOT_DIR ] ; then
|
if [ -d /boot/efi/$EFI_BOOT_DIR ] ; then
|
||||||
cp $GRUB_CFG /boot/efi/$EFI_BOOT_DIR/grub.cfg
|
cp $GRUB_CFG /boot/efi/$EFI_BOOT_DIR/grub.cfg
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
DIB_EXTLINUX=${DIB_EXTLINUX:-0}
|
|
||||||
if [ "$DIB_EXTLINUX" != "0" ]; then
|
|
||||||
install_extlinux
|
|
||||||
else
|
|
||||||
install_grub2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
Removed support for ``extlinux`` and ``grub`` (as opposed to
|
||||||
|
``grub2``) support from the bootloader element.
|
Loading…
Reference in New Issue
Block a user