]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: total_compute: Dynamically detect block device
authorLeo Yan <leo.yan@arm.com>
Fri, 25 Oct 2024 17:18:19 +0000 (18:18 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 4 Nov 2024 20:50:44 +0000 (14:50 -0600)
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@arm.com>
board/armltd/total_compute/total_compute.env

index 9dd50819ea69fa6be68d06a3f33e32f1dbbe7ad8..93460aa5dcbe6cc42e4ead4fe6c85e480cf507b2 100644 (file)
@@ -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