Jun Nie | 494bab2 | 2019-05-08 14:38:35 +0800 | [diff] [blame] | 1 | This document describes the instruction to build and flash ATF/OPTEE/U-Boot on |
| 2 | pico-imx7d board. U-Boot is loaded as part of FIP image by ATF in this setup. |
| 3 | The boot sequence is ATF -> OPTEE -> U-Boot -> Linux. U-Boot is in non-secure |
| 4 | world in this case. |
| 5 | |
| 6 | - Build u-boot |
Tom Rini | 30a61f5 | 2020-05-26 14:36:49 -0400 | [diff] [blame] | 7 | Set environment variable of CROSS_COMPILE for your toolchain |
Jun Nie | 494bab2 | 2019-05-08 14:38:35 +0800 | [diff] [blame] | 8 | $ make pico-imx7d_bl33_defconfig |
| 9 | $ make all |
| 10 | |
| 11 | - Download and build OPTEE |
| 12 | $ git clone git@github.com:OP-TEE/optee_os.git |
| 13 | $ make PLATFORM=imx PLATFORM_FLAVOR=mx7dpico_mbl CFG_BOOT_SECONDARY_REQUEST=y ARCH=arm |
| 14 | |
| 15 | - Download and build ATF |
| 16 | $ git clone https://git.linaro.org/landing-teams/working/mbl/arm-trusted-firmware.git -b linaro-imx7 |
| 17 | $ make DEBUG=1 PLAT=picopi ARCH=aarch32 ARM_ARCH_MAJOR=7 \ |
| 18 | CROSS_COMPILE=arm-linux-gnueabihf- LOG_LEVEL=50 V=1 \ |
| 19 | CRASH_REPORTING=1 AARCH32_SP=optee all |
| 20 | Save file content in this link to file pico-imx7d.cfg: |
| 21 | http://git.linaro.org/landing-teams/working/mbl/u-boot.git/tree/board/technexion/pico-imx7d/pico-imx7d.cfg?h=linaro-imx |
| 22 | $ u-boot/tools/mkimage -n pico-imx7d.cfg -T imximage -e 0x9df00000 -d \ |
| 23 | build/picopi/debug/bl2.bin bl2.imx |
| 24 | |
| 25 | - Create FIP image |
| 26 | Create a fiptool_images/ folder in ATF folder, copy u-boot.bin in u-boot |
| 27 | folder and tee*.bin in optee out/arm-plat-imx/core/tee/ folder to |
| 28 | fiptool_images. Run below command in ATF folder to generate FIP image. |
| 29 | $ make -C tools/fiptool/ |
| 30 | $ tools/fiptool/fiptool create --tos-fw fiptool_images/tee-header_v2.bin \ |
| 31 | --tos-fw-extra1 fiptool_images/tee-pager_v2.bin \ |
| 32 | --tos-fw-extra2 fiptool_images/tee-pageable_v2.bin \ |
| 33 | --nt-fw fiptool_images/u-boot.bin \ |
| 34 | fip.bin |
| 35 | |
| 36 | - Burn the images to eMMC for test. |
| 37 | Run below command in atf folder: |
| 38 | $ dd if=build/picopi/debug/bl2.bin.imx of=/dev/disk/by-id/usb-<your device> bs=1024 seek=1;sync |
| 39 | $ dd if=fip.bin of=/dev/disk/by-id/usb-<your device> bs=1024 seek=1;sync |
| 40 | |
| 41 | - Test |
| 42 | Just boot up your board and wait for u-boot start up after ATF's log. |
| 43 | For booting Linux in FIT image, please reference the FIT files in |
| 44 | u-boot doc/uImage.FIT/ folder. |