x86: add support for Meraki MX100
[openwrt/staging/stintel.git] / target / linux / x86 / base-files / lib / upgrade / platform.sh
index d8f2eba97ecbab9c18ddd82ba4a37a37485896f4..94bf80b144d30c7223da5f13d681009f3d12aa75 100644 (file)
@@ -65,6 +65,16 @@ 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
 }