summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2018-06-12 17:18:21 +0200
committerRicardo Salveti <ricardo@opensourcefoundries.com>2018-06-13 22:17:02 -0300
commitc0daf31bc9e01ae4975fb14b6f514195066661f2 (patch)
tree2d3b184c15086de50257db628210e7b5e7ea1ddd
parente3ce5aa201c222e1c2effa50e566e673ff4eedbb (diff)
u-boot-ostree-scr: use distro boot variables by default
Distro boot makes sure that the variables ${devtype} ${devnum} and ${distro_bootpart} are set according to the location where the boot script has been found. Make use of those variables by default. If a device happens not to provide them, it is probably not using the default distro boot mechanism and needs custom handling anyway. This allows to boot from internal eMMC, external SD card or from a USB mass storage device. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--recipes-bsp/u-boot/u-boot-ostree-scr/boot.cmd8
-rw-r--r--recipes-bsp/u-boot/u-boot-ostree-scr/uEnv.txt.in8
2 files changed, 11 insertions, 5 deletions
diff --git a/recipes-bsp/u-boot/u-boot-ostree-scr/boot.cmd b/recipes-bsp/u-boot/u-boot-ostree-scr/boot.cmd
index dc13f85..f1c911c 100644
--- a/recipes-bsp/u-boot/u-boot-ostree-scr/boot.cmd
+++ b/recipes-bsp/u-boot/u-boot-ostree-scr/boot.cmd
@@ -1,3 +1,9 @@
-fatload mmc 0:1 $loadaddr /uEnv.txt
+if test ${distro_bootpart} != 1
+then
+ echo "Boot partition needs to be the first partition"
+ exit
+fi
+
+fatload ${devtype} ${devnum}:1 $loadaddr /uEnv.txt
env import -t $loadaddr $filesize
run bootcmd
diff --git a/recipes-bsp/u-boot/u-boot-ostree-scr/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-ostree-scr/uEnv.txt.in
index d70de05..034c4c6 100644
--- a/recipes-bsp/u-boot/u-boot-ostree-scr/uEnv.txt.in
+++ b/recipes-bsp/u-boot/u-boot-ostree-scr/uEnv.txt.in
@@ -1,6 +1,6 @@
-bootcmd_dtb=fatload mmc 0:1 ${fdt_addr_r} /${fdtfile}
-bootcmd_otenv=ext4load mmc 0:2 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
-bootcmd_load_k=ext4load mmc 0:2 ${kernel_addr_r} "/boot"${kernel_image}
-bootcmd_load_r=ext4load mmc 0:2 ${ramdisk_addr_r} "/boot"${ramdisk_image}; setenv ramdisk_size ${filesize}
+bootcmd_dtb=fatload ${devtype} ${devnum}:1 ${fdt_addr_r} /${fdtfile}
+bootcmd_otenv=ext4load ${devtype} ${devnum}:2 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
+bootcmd_load_k=ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} "/boot"${kernel_image}
+bootcmd_load_r=ext4load ${devtype} ${devnum}:2 ${ramdisk_addr_r} "/boot"${ramdisk_image}; setenv ramdisk_size ${filesize}
bootcmd_run=@@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r}
bootcmd=run bootcmd_dtb; run bootcmd_otenv; run bootcmd_load_k; run bootcmd_load_r; run bootcmd_run