Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 1 | mmcdev=0 |
| 2 | mmcrootfstype=ext4 rootwait |
| 3 | finduuid=part uuid ${boot} ${bootpart} uuid |
| 4 | args_mmc=run finduuid;setenv bootargs console=${console} |
| 5 | ${optargs} |
| 6 | root=PARTUUID=${uuid} rw |
| 7 | rootfstype=${mmcrootfstype} |
Nishanth Menon | 4fc0ce3 | 2023-08-25 13:02:47 -0500 | [diff] [blame] | 8 | #ifndef CONFIG_BOOTSTD |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 9 | loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr |
Nishanth Menon | 4fc0ce3 | 2023-08-25 13:02:47 -0500 | [diff] [blame] | 10 | #endif |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 11 | bootscript=echo Running bootscript from mmc${mmcdev} ...; |
| 12 | source ${loadaddr} |
| 13 | bootenvfile=uEnv.txt |
| 14 | importbootenv=echo Importing environment from mmc${mmcdev} ...; |
| 15 | env import -t ${loadaddr} ${filesize} |
| 16 | loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} |
| 17 | loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} |
Andrew Davis | 1d9b5a5 | 2023-07-14 11:22:31 +0530 | [diff] [blame] | 18 | loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} |
| 19 | get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} |
Nishanth Menon | 3f66e3a | 2023-08-25 13:02:46 -0500 | [diff] [blame] | 20 | envboot=if mmc dev ${mmcdev}; then |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 21 | if mmc rescan; then |
| 22 | echo SD/MMC found on device ${mmcdev}; |
Nishanth Menon | 4fc0ce3 | 2023-08-25 13:02:47 -0500 | [diff] [blame] | 23 | if test -n "${loadbootscript}" && run loadbootscript; then |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 24 | run bootscript; |
| 25 | else |
| 26 | if run loadbootenv; then |
| 27 | echo Loaded env from ${bootenvfile}; |
| 28 | run importbootenv; |
| 29 | fi; |
| 30 | if test -n $uenvcmd; then |
| 31 | echo Running uenvcmd ...; |
| 32 | run uenvcmd; |
| 33 | fi; |
| 34 | fi; |
| 35 | fi; |
Nishanth Menon | 3f66e3a | 2023-08-25 13:02:46 -0500 | [diff] [blame] | 36 | fi; |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 37 | mmcloados= |
| 38 | if test ${boot_fdt} = yes || test ${boot_fdt} = try; then |
Andrew Davis | 1d9b5a5 | 2023-07-14 11:22:31 +0530 | [diff] [blame] | 39 | if run get_fdt_mmc; then |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 40 | bootz ${loadaddr} - ${fdtaddr}; |
| 41 | else |
| 42 | if test ${boot_fdt} = try; then |
| 43 | bootz; |
| 44 | else |
| 45 | echo WARN: Cannot load the DT; |
| 46 | fi; |
| 47 | fi; |
| 48 | else |
| 49 | bootz; |
| 50 | fi; |
Nishanth Menon | 3f66e3a | 2023-08-25 13:02:46 -0500 | [diff] [blame] | 51 | mmcboot=if mmc dev ${mmcdev}; then |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 52 | devnum=${mmcdev}; |
| 53 | devtype=mmc; |
| 54 | if mmc rescan; then |
| 55 | echo SD/MMC found on device ${mmcdev}; |
| 56 | if run loadimage; then |
| 57 | run args_mmc; |
| 58 | if test ${boot_fit} -eq 1; then |
| 59 | run run_fit; |
| 60 | else |
| 61 | run mmcloados; |
| 62 | fi; |
| 63 | fi; |
Nishanth Menon | 3f66e3a | 2023-08-25 13:02:46 -0500 | [diff] [blame] | 64 | fi; |
| 65 | fi; |
Neha Malcom Francis | a2e532c | 2023-03-15 10:57:43 +0530 | [diff] [blame] | 66 | |
Vignesh Raghavendra | 654916a | 2023-07-25 13:09:20 +0530 | [diff] [blame] | 67 | init_mmc=run args_all args_mmc |
| 68 | get_overlay_mmc= |
| 69 | fdt address ${fdtaddr}; |
| 70 | fdt resize 0x100000; |
| 71 | for overlay in $name_overlays; |
| 72 | do; |
Vignesh Raghavendra | 6c87099 | 2023-07-25 13:09:21 +0530 | [diff] [blame] | 73 | load mmc ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay} && |
Vignesh Raghavendra | 654916a | 2023-07-25 13:09:20 +0530 | [diff] [blame] | 74 | fdt apply ${dtboaddr}; |
| 75 | done; |
| 76 | get_kern_mmc=load mmc ${bootpart} ${loadaddr} |
| 77 | ${bootdir}/${name_kern} |
| 78 | get_fit_mmc=load mmc ${bootpart} ${addr_fit} |
| 79 | ${bootdir}/${name_fit} |
| 80 | partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs} |