| fdt_addr=0x43000000 |
| image=Image |
| script=boot.scr |
| mmc_root="PARTUUID=70672ec3-5eee-49ff-b3b1-eb1fbd406bf5" |
| sd_root="/dev/mmcblk1p2" |
| |
| # Check boot device to decide which root partition to use |
| if test ${bootdev} = 1; then |
| setenv root ${sd_root} |
| else |
| setenv root ${mmc_root} |
| fi |
| |
| if test ${baseboardid} = 1; then |
| setenv fdt_file fsl-imx8mq-phanbell.dtb |
| elif test ${baseboardid} = 2; then |
| setenv fdt_file fsl-imx8mq-yorktown.dtb |
| else |
| # EVT Boards have quirky baseboard ID resistors, so fall back |
| # to phanbell if we're unsure what the board is. |
| echo "Unknown baseboard revision, selecting phanbell dtb." |
| setenv fdt_file fsl-imx8mq-phanbell.dtb |
| fi |
| |
| cmdline="console=ttymxc0,115200 console=tty0 earlycon=ec_imx6q,0x30860000,115200 root=${root} rootfstype=ext4 rw rootwait init=/sbin/init net.ifnames=0 pci=pcie_bus_perf" |
| |
| ext2load mmc ${bootdev}:1 ${loadaddr} ${image} |
| setenv bootargs ${cmdline} ${extra_bootargs} |
| |
| #Load base device tree. |
| ext2load mmc ${bootdev}:1 ${fdt_addr} ${fdt_file} |
| fdt addr ${fdt_addr} |
| fdt resize |
| |
| # Load overlays to arbitrary address beyond fdt location (will apply them later). |
| setexpr fdtovaddr ${fdt_addr} + F000 |
| |
| # Parse overlays.txt and apply individual overlays. |
| if ext2load mmc ${bootdev}:1 ${fdtovaddr} overlays.txt && env import -t ${fdtovaddr} ${filesize} && test -n ${overlay}; then |
| echo loaded overlay.txt: ${overlay} |
| for ov in ${overlay}; do |
| if ext2load mmc ${bootdev}:1 ${fdtovaddr} ${ov}.dtbo && fdt apply ${fdtovaddr}; then |
| echo overlay of ${ov} successful |
| else |
| echo overlay failed, reverting to original device tree |
| ext2load mmc ${bootdev}:1 ${fdt_addr} ${fdt_file} |
| booti ${loadaddr} - ${fdt_addr} |
| fi |
| done |
| fi |
| |
| booti ${loadaddr} - ${fdt_addr} |