aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/x86
diff options
context:
space:
mode:
authorJax Jiang <jax.jiang.007@gmail.com>2022-02-11 01:46:55 +0800
committerChristian Lamparter <chunkeey@gmail.com>2022-02-24 20:45:12 +0100
commit1050e66c8f7c67ab8b3d1895e2559f03baeb2345 (patch)
treebbb5471d905e7163bc6905bd3f0e5d0b4ee6081e /target/linux/x86
parent83f2f1ad5840eae4bd265ffc46f1982571514123 (diff)
downloadupstream-1050e66c8f7c67ab8b3d1895e2559f03baeb2345.tar.gz
upstream-1050e66c8f7c67ab8b3d1895e2559f03baeb2345.tar.bz2
upstream-1050e66c8f7c67ab8b3d1895e2559f03baeb2345.zip
x86: grub2: search for the "kernel" filesystem on all disks
Previously, grub2 was hardcoded to always look on "hd0" for the kernel. This works well when the system only had a single disk. But if there was a second disk/stick present, it may have look on the wrong drive because of enumeration races. This patch utilizes grub2 search function to look for a filesystem with the label "kernel". This works thanks to existing setup in scripts/gen_image_generic.sh. Which sets the "kernel" label on both the fat and ext4 filesystem variants. Signed-off-by: Jax Jiang <jax.jiang.007@gmail.com> Suggested-by: Alberto Bursi <bobafetthotmail@gmail.com> (MX100 WA) (word wrapped, slightly rewritten commit message, removed MX100 WA) Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/x86')
-rw-r--r--target/linux/x86/base-files/lib/upgrade/platform.sh10
-rw-r--r--target/linux/x86/image/grub-efi.cfg2
2 files changed, 1 insertions, 11 deletions
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 94bf80b144..d8f2eba97e 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -65,16 +65,6 @@ platform_do_bootloader_upgrade() {
"/dev/$diskdev" \
&& touch /tmp/boot/boot/grub/upgraded
- case "$(board_name)" in
- cisco-mx100-hw)
- # If the MX100 is booted UEFI AND the SATA HDD exists, we need to change
- # grub's root= to hd1 for it to boot correctly, otherwise we can keep it hd0.
- if [ -d /sys/firmware/efi ] && [ "$(ls -a /dev/sd[a-z] | wc -w)" -gt 1 ] ; then
- sed -i "s|hd0,${parttable}1|hd1,${parttable}1|g" /tmp/boot/boot/grub/grub.cfg
- fi
- ;;
- esac
-
umount /tmp/boot
fi
}
diff --git a/target/linux/x86/image/grub-efi.cfg b/target/linux/x86/image/grub-efi.cfg
index 14d30e88e4..bbb31f7747 100644
--- a/target/linux/x86/image/grub-efi.cfg
+++ b/target/linux/x86/image/grub-efi.cfg
@@ -3,7 +3,7 @@
set default="0"
set timeout="@TIMEOUT@"
-set root='(hd0,gpt1)'
+search -l kernel -s root
menuentry "@TITLE@" {
linux /boot/vmlinuz @GPT_ROOTPART@ @CMDLINE@ noinitrd