[PATCH v1 6/8] arm: total_compute: Dynamically detect block device

Leo Yan leo.yan at arm.com
Fri Oct 25 19:18:19 CEST 2024


Dynamically detect block device in the boot command, this allows to
support both MMC and virtio block devices.

Signed-off-by: Leo Yan <leo.yan at arm.com>
---
 board/armltd/total_compute/total_compute.env | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/board/armltd/total_compute/total_compute.env b/board/armltd/total_compute/total_compute.env
index 9dd50819ea..93460aa5dc 100644
--- a/board/armltd/total_compute/total_compute.env
+++ b/board/armltd/total_compute/total_compute.env
@@ -4,21 +4,28 @@ load_addr=0xa0000000
 initrd_addr_r=0x88000000
 
 bootcmd=
-    if part number mmc 0 vbmeta is_avb; then
-        echo 'MMC with vbmeta partition detected.';
+    virtio scan;
+    if virtio info; then
+        blk_dev=virtio;
+    else;
+        blk_dev=mmc;
+    fi;
+    echo block device is ${blk_dev};
+    if part number ${blk_dev} 0 vbmeta is_avb; then
+        echo '${blk_dev} with vbmeta partition detected.';
         echo 'Starting Android Verified boot...';
-        avb init mmc 0;
+        avb init ${blk_dev} 0;
         if avb verify; then
             set bootargs $bootargs $avb_bootargs;
-            part start mmc 0 boot boot_start;
-            part size mmc 0 boot boot_size;
-            mmc read ${load_addr} ${boot_start} ${boot_size};
+            part start ${blk_dev} 0 boot boot_start;
+            part size ${blk_dev} 0 boot boot_size;
+            ${blk_dev} read ${load_addr} ${boot_start} ${boot_size};
             bootm ${load_addr} ${load_addr} ${fdt_addr_r};
         else;
             echo 'AVB verification failed.';
             exit;
         fi;
-    elif part number mmc 0 system is_non_avb_android; then
+    elif part number ${blk_dev} 0 system is_non_avb_android; then
         echo 'Booting Android non-AVB...';
         booti ${kernel_addr_r} ${initrd_addr_r} ${fdt_addr_r};
     elif iminfo ${load_addr}; then
-- 
2.34.1



More information about the U-Boot mailing list