[PATCH] uboot-sunxi: use UUID of bootdev and bootpart
Jan-Niklas Burfeind
git at aiyionpri.me
Thu Dec 15 06:18:33 PST 2022
instead of the hardcoded `mmcblk0p2` to support devices with multiple
mmcs, like the NanoPi R1.
Fixes: e6d9f6fdff ("sunxi: add support for FriendlyARM NanoPi R1")
Signed-off-by: Jan-Niklas Burfeind <git at aiyionpri.me>
---
Good afternoon.
I just had a discussion with karlp in openwrt-devel, where we talked
about the problem and our potential solutions to it.
For starters, this resolves #11104 and likely both #10080 and #11469 as
well.
The NanoPi R1 comes with an internal emmc, which is identified as
mmcblk0 about half the time. This breaks the boot process and results
often enough in a reboot, which is likely part of the reason this did not get
attention earlier, as booting does often just take longer but only
rarely fails completely.
Anyway. This is one of two discussed approaches to eliminate the
problem. There is another by karlp referenced below [1].
There are two core treats,the two patches differ in:
- this patch relies on UUIDs, karlps does use labels
- this patch changes default bootscript to match the a64 variant more,
his does add a uenv, which I really like
I'd like to know, whether it would be worthwhile to take his patch or
mine, or combine the two and have a uenv `anymmc` that introduces UUIDs.
Looking for previous uboot-sunxi contributors I found ynezz did the very
same thing for a64 in
5f2ff607e2 ("uboot-sunxi: a64: allow booting directly from eMMC")
Thanks and have a nice afternoon
Jan-Niklas
package/boot/uboot-sunxi/uEnv-default.txt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/package/boot/uboot-sunxi/uEnv-default.txt b/package/boot/uboot-sunxi/uEnv-default.txt
index e024954516..36e41c59b1 100644
--- a/package/boot/uboot-sunxi/uEnv-default.txt
+++ b/package/boot/uboot-sunxi/uEnv-default.txt
@@ -1,6 +1,8 @@
setenv fdt_high ffffffff
-setenv loadkernel fatload mmc 0 \$kernel_addr_r uImage
-setenv loaddtb fatload mmc 0 \$fdt_addr_r dtb
-setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait
+setenv mmc_rootpart 2
+part uuid mmc ${mmc_bootdev}:${mmc_rootpart} uuid
+setenv loadkernel fatload mmc \$mmc_bootdev \$kernel_addr_r uImage
+setenv loaddtb fatload mmc \$mmc_bootdev \$fdt_addr_r dtb
+setenv bootargs console=ttyS0,115200 earlyprintk root=PARTUUID=${uuid} rootwait
setenv uenvcmd run loadkernel \&\& run loaddtb \&\& bootm \$kernel_addr_r - \$fdt_addr_r
run uenvcmd
--
2.39.0
More information about the openwrt-devel
mailing list