aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/imx6
diff options
context:
space:
mode:
authorTim Harvey <tharvey@gateworks.com>2020-04-01 10:23:12 -0700
committerPetr Štetiar <ynezz@true.cz>2020-04-03 12:17:45 +0200
commitff6b092121ba96745553584f5a5b0897805edfc6 (patch)
tree1ca056a6965c210d66e4d02e9bcfad46607a831d /target/linux/imx6
parent4298339b238ae9be0692e800042cc25a61f87fad (diff)
downloadupstream-ff6b092121ba96745553584f5a5b0897805edfc6.tar.gz
upstream-ff6b092121ba96745553584f5a5b0897805edfc6.tar.bz2
upstream-ff6b092121ba96745553584f5a5b0897805edfc6.zip
imx6: bootscript: use partition UUID for rootfs if possible
Specifying root filesystem by device is non-deterministic for several reasons: - USB device unmeration order is not garunteeed for USB storage devs - MMC devs ordering is determined by the instance of the MMC host controller including non-storage SDIO devices which can throw off numbering depending on kernel versions. It is recommended to use partition UUID Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Diffstat (limited to 'target/linux/imx6')
-rw-r--r--target/linux/imx6/image/bootscript-ventana34
1 files changed, 20 insertions, 14 deletions
diff --git a/target/linux/imx6/image/bootscript-ventana b/target/linux/imx6/image/bootscript-ventana
index 941afb519a..734f74a30c 100644
--- a/target/linux/imx6/image/bootscript-ventana
+++ b/target/linux/imx6/image/bootscript-ventana
@@ -1,4 +1,4 @@
-echo "Gateworks Ventana OpenWrt Boot script v1.01"
+echo "Gateworks Ventana OpenWrt Boot script v1.02"
# set some defaults
# set some defaults
@@ -9,7 +9,7 @@ setenv bootargs console=${console},${baudrate}
setenv loadaddr 10800000
setenv fdt_addr 18000000
-# detect dtype and bootdev by looking for kernel on media the bootloader
+# detect dtype by looking for kernel on media the bootloader
# has mounted (in order of preference: usb/mmc/sata)
#
# This assumes the bootloader has already started the respective subsystem
@@ -31,18 +31,9 @@ else
fi
echo "detected dtype:$dtype"
fi
-if test -n "$bootdev" ; then
- echo "Using bootdev from env: $bootdev"
-else
- if itest.s "x${dtype}" == "xmmc" ; then
- bootdev=mmcblk0p1
- else
- bootdev=sda1
- fi
-fi
+echo "Booting from ${dtype}..."
if itest.s "x${dtype}" == "xnand" ; then
- echo "Booting from NAND..."
# fix partition name
# OpenWrt kernel bug prevents partition name of 'rootfs' from booting
# instead name the partition ubi which is what is looked for by
@@ -52,9 +43,24 @@ if itest.s "x${dtype}" == "xnand" ; then
setenv fsload ubifsload
setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
else
- echo "Booting from block device ${bootdev}..."
setenv fsload "${fs}load ${dtype} ${disk}:1"
- setenv root "root=/dev/${bootdev} rootfstype=${fs} rootwait rw"
+ part uuid ${dtype} ${disk}:1 uuid
+ if test -z "${uuid}"; then
+ # fallback to bootdev
+ if test -n "$bootdev" ; then
+ echo "Using bootdev from env: $bootdev"
+ else
+ if itest.s "x${dtype}" == "xmmc" ; then
+ bootdev=mmcblk0p1
+ else
+ bootdev=sda1
+ fi
+ fi
+ setenv root "root=/dev/${bootdev}"
+ else
+ setenv root "root=PARTUUID=${uuid}"
+ fi
+ setenv root "$root rootfstype=${fs} rootwait rw"
fi
setenv bootargs "${bootargs}" "${root}" "${video}" "${extra}"