[openwrt/openwrt] mvebu: clearfog: use partition uuid for root= bootarg

LEDE Commits lede-commits at lists.infradead.org
Fri Mar 2 12:52:54 PST 2018


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/9a820765924a311b7d7c8ccc740c86370c7efd26

commit 9a820765924a311b7d7c8ccc740c86370c7efd26
Author: Josua Mayer <josua.mayer97 at gmail.com>
AuthorDate: Thu Oct 19 09:22:11 2017 +0200

    mvebu: clearfog: use partition uuid for root= bootarg
    
    U-Boot already knows where it found the boot.scr, and
    figuring out the partition UUID becomes trivial at this point.
    This change allows booting OpenWrt from whatever storage it has been
    flashed to: SD card, eMMC, USB disk or SATA disk.
    
    Signed-off-by: Josua Mayer <josua.mayer97 at gmail.com>
    [replace lede with openwrt, redact commit message]
    Signed-off-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
---
 target/linux/mvebu/image/cfbase-boot.script | 13 +++++++------
 target/linux/mvebu/image/cfpro-boot.script  | 13 +++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/target/linux/mvebu/image/cfbase-boot.script b/target/linux/mvebu/image/cfbase-boot.script
index 89fa1dc..6ab6e36 100644
--- a/target/linux/mvebu/image/cfbase-boot.script
+++ b/target/linux/mvebu/image/cfbase-boot.script
@@ -7,13 +7,14 @@
 # removed once U-Boot is able to detect the board variant.
 setenv fdtfile armada-388-clearfog-base.dtb
 
-# generate bootargs for rootfs on MMC
-if test "${devtype}" = "mmc"; then
-	setexpr openwrt_rootpart ${distro_bootpart} + 1
-	setenv bootargs ${bootargs} root=/dev/mmcblk${devnum}p${openwrt_rootpart} rootfstype=auto rootwait
-fi
+# rootfs is always on the next partition
+setexpr openwrt_rootpart ${distro_bootpart} + 1
+
+# figure out partition uuid to pass to the kernel as root=
+part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid
 
-# here one could add logic for other rootfs device types such as scsi and usb
+# generate bootargs (rootfs)
+setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait
 
 # add console= option to bootargs, if any
 if test -n "${console}"; then
diff --git a/target/linux/mvebu/image/cfpro-boot.script b/target/linux/mvebu/image/cfpro-boot.script
index 1588c15..5971b0d 100644
--- a/target/linux/mvebu/image/cfpro-boot.script
+++ b/target/linux/mvebu/image/cfpro-boot.script
@@ -3,13 +3,14 @@
 # This script assumes that there is a boot partition, 
 # and that the root partition is always the next one.
 
-# generate bootargs for rootfs on MMC
-if test "${devtype}" = "mmc"; then
-	setexpr openwrt_rootpart ${distro_bootpart} + 1
-	setenv bootargs ${bootargs} root=/dev/mmcblk${devnum}p${openwrt_rootpart} rootfstype=auto rootwait
-fi
+# rootfs is always on the next partition
+setexpr openwrt_rootpart ${distro_bootpart} + 1
+
+# figure out partition uuid to pass to the kernel as root=
+part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid
 
-# here one could add logic for other rootfs device types such as scsi and usb
+# generate bootargs (rootfs)
+setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait
 
 # add console= option to bootargs, if any
 if test -n "${console}"; then



More information about the lede-commits mailing list