# This is a boot script for U-Boot with generic root parameters used by yocto machine configuration file. # Generate boot.scr: # mkimage -c none -A arm -T script -d boot.cmd.default boot.scr # ################ fitimage_name=@@FIT_IMAGE@@ kernel_name=@@KERNEL_IMAGE@@ ramdisk_name=@@RAMDISK_IMAGE1@@ rootfs_name=@@RAMDISK_IMAGE@@ @@PRE_BOOTENV@@ for boot_target in ${boot_targets}; do echo "Trying to load boot images from ${boot_target}" if test "${boot_target}" = "jtag" ; then fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ fi if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" || test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1"; then setenv bootdev mmcblk${devnum}p fi if test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then setenv bootdev sda fi if test -e ${devtype} ${devnum}:${distro_bootpart} /@@UENV_TEXTFILE@@; then fatload ${devtype} ${devnum}:${distro_bootpart} @@UENV_MMC_LOAD_ADDRESS@@ @@UENV_TEXTFILE@@; echo "Importing environment(@@UENV_TEXTFILE@@) from ${boot_target}..." env import -t @@UENV_MMC_LOAD_ADDRESS@@ $filesize if test -n $uenvcmd; then echo "Running uenvcmd ..."; run uenvcmd; fi fi echo "Checking for /${fitimage_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${fitimage_name}; then fatload ${devtype} ${devnum}:${distro_bootpart} @@FIT_IMAGE_LOAD_ADDRESS@@ ${fitimage_name}; echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" bootm @@FIT_IMAGE_LOAD_ADDRESS@@; fi echo "Checking for /${kernel_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${kernel_name}; then echo "Loading ${kernel_name} at @@KERNEL_LOAD_ADDRESS@@"; fatload ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ ${kernel_name}; fi echo "Checking for /system.dtb" if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then echo "Loading system.dtb at @@DEVICETREE_ADDRESS@@"; fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; fi echo "Checking for /devicetree/openamp.dtbo" if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then echo "Loading and merging openamp.dtbo into device tree at @@DEVICETREE_OVERLAY_ADDRESS@@"; fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; fdt addr @@DEVICETREE_ADDRESS@@ fdt resize 8192 fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ fi echo "Checking for /${ramdisk_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${ramdisk_name} && test "${skip_tinyramdisk}" != "yes"; then echo "Loading ${ramdisk_name} at @@RAMDISK_IMAGE_ADDRESS@@"; fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${ramdisk_name}; fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ fi echo "Checking for /${rootfs_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${rootfs_name} && test "${skip_ramdisk}" != "yes"; then echo "Loading ${rootfs_name} at @@RAMDISK_IMAGE_ADDRESS@@"; fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name}; fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ fi fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_SD@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ fi if test "${boot_target}" = "xspi0" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then sf probe 0 0 0; sf read @@FIT_IMAGE_LOAD_ADDRESS@@ @@QSPI_FIT_IMAGE_OFFSET@@ @@QSPI_FIT_IMAGE_SIZE@@ echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" bootm @@FIT_IMAGE_LOAD_ADDRESS@@; echo "Booting using Fit image failed" sf read @@KERNEL_LOAD_ADDRESS@@ @@QSPI_KERNEL_OFFSET@@ @@QSPI_KERNEL_SIZE@@ sf read @@RAMDISK_IMAGE_ADDRESS@@ @@QSPI_RAMDISK_OFFSET@@ @@QSPI_RAMDISK_SIZE@@ fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; echo "Booting using Separate images failed" fi if test "${boot_target}" = "nand" || test "${boot_target}" = "nand0"; then nand info; nand read @@FIT_IMAGE_LOAD_ADDRESS@@ @@NAND_FIT_IMAGE_OFFSET@@ @@NAND_FIT_IMAGE_SIZE@@ echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" bootm @@FIT_IMAGE_LOAD_ADDRESS@@; echo "Booting using Fit image failed" nand read @@KERNEL_LOAD_ADDRESS@@ @@NAND_KERNEL_OFFSET@@ @@NAND_KERNEL_SIZE@@ nand read @@RAMDISK_IMAGE_ADDRESS@@ @@NAND_RAMDISK_OFFSET@@ @@NAND_RAMDISK_SIZE@@ fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; echo "Booting using Separate images failed" fi done