Pull grub changes back as some devices still need them.

This commit is contained in:
fewtarius 2024-01-11 14:17:37 +00:00
parent f3a4f8d692
commit e20a00f7fa
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
3 changed files with 37 additions and 0 deletions

View file

@ -674,6 +674,20 @@ update_bootmenu() {
fi
fi
fi
if [ -n "${GRUB_DEFAULT}" -a -f /flash/EFI/BOOT/grub.cfg ]; then
if grep -q "^menuentry \"${GRUB_DEFAULT}\"" /flash/EFI/BOOT/grub.cfg 2>/dev/null; then
crnt_default="$(awk '/^set default/ {print substr($2,9,19)}' /flash/EFI/BOOT/grub.cfg)"
if [ ! "$crnt_default" = "\"${GRUB_DEFAULT}\"" ]; then
progress "Updating /flash/EFI/BOOT/grub.cfg [$crnt_default -> \"${GRUB_DEFAULT}\"]"
mount -o remount,rw /flash
sed -e "s/^set default=.*/set default=\"${GRUB_DEFAULT}\"/" -i /flash/EFI/BOOT/grub.cfg
rm -f /flash/grub.cfg
mount -o remount,ro /flash
fi
fi
fi
}
check_out_of_space() {

View file

@ -326,6 +326,17 @@ LABEL linux
KERNEL /KERNEL
APPEND boot=UUID=$UUID_SYSTEM disk=UUID=$UUID_STORAGE $SYSLINUX_PARAMETERS @EXTRA_CMDLINE@
EOF
cat << EOF > $TMPDIR/part1/EFI/BOOT/grub.cfg
set timeout="0"
set default="${DISTRO}"
menuentry "${DISTRO}" {
search --set -f /KERNEL
linux /KERNEL boot=UUID=$UUID_SYSTEM disk=UUID=$UUID_STORAGE @EXTRA_CMDLINE@
}
EOF
# uefi boot / hybrid mode
cp /usr/share/syslinux/bootx64.efi $TMPDIR/part1/EFI/BOOT
cp /usr/share/syslinux/ldlinux.e64 $TMPDIR/part1/EFI/BOOT

View file

@ -166,6 +166,15 @@ LABEL run
APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} portable ${EXTRA_CMDLINE}
EOF
cat << EOF > "${LE_TMP}/grub.cfg"
set timeout="0"
set default="Run"
menuentry "Run" {
search --set -f /KERNEL
linux /KERNEL boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} grub_portable ${EXTRA_CMDLINE}
}
EOF
mcopy "${LE_TMP}/syslinux.cfg" ::
# install syslinux
@ -183,6 +192,7 @@ EOF
mcopy "${TOOLCHAIN}/share/syslinux/bootx64.efi" ::/EFI/BOOT
mcopy "${TOOLCHAIN}/share/syslinux/ldlinux.e64" ::/EFI/BOOT
mcopy "${TOOLCHAIN}/share/grub/bootia32.efi" ::/EFI/BOOT
mcopy "${LE_TMP}/grub.cfg" ::/EFI/BOOT
elif [ "${BOOTLOADER}" = "bcm2835-bootloader" ]; then
# create bootloader configuration
@ -265,7 +275,9 @@ if [ "${PROJECT}" = "Generic" ]; then
# change syslinux default to 'run'
echo "image: modifying files on part1 for open virtual appliance..."
sed -e "/DEFAULT/ s/installer/run/" -i "${LE_TMP}/syslinux.cfg"
sed -e "/set default=/s/\"Installer\"/\"Run\"/" -i "${LE_TMP}/grub.cfg"
mcopy "${LE_TMP}/syslinux.cfg" :: >"${SAVE_ERROR}" 2>&1 || show_error
mcopy "${LE_TMP}/grub.cfg" ::/EFI/BOOT >"${SAVE_ERROR}" 2>&1 || show_error
sync
# run fsck
echo "image: checking filesystem on part1..."