14d02d206SPhilipp TomsichHere is the step-by-step to boot to U-Boot on RK3368-uQ7
24d02d206SPhilipp Tomsich
34d02d206SPhilipp TomsichGet the Source and build ATF
44d02d206SPhilipp Tomsich============================
54d02d206SPhilipp Tomsich
64d02d206SPhilipp Tomsich  > git clone git://git.theobroma-systems.com/arm-trusted-firmware.git
74d02d206SPhilipp Tomsich  > cd arm-trusted-firmware
84d02d206SPhilipp Tomsich  > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3368 bl31
94d02d206SPhilipp Tomsich  > cp build/rk3368/release/bl31.bin ../u-boot/bl31-rk3368.bin
104d02d206SPhilipp Tomsich
114d02d206SPhilipp TomsichConfigure U-Boot
124d02d206SPhilipp Tomsich================
134d02d206SPhilipp Tomsich
144d02d206SPhilipp Tomsich  > cd ../u-boot
154d02d206SPhilipp Tomsich  > make lion-rk3368_defconfig
164d02d206SPhilipp Tomsich
174d02d206SPhilipp TomsichBuild the TPL/SPL stage
184d02d206SPhilipp Tomsich=======================
194d02d206SPhilipp Tomsich
204d02d206SPhilipp Tomsich  > make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm
214d02d206SPhilipp Tomsich  > tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img
224d02d206SPhilipp Tomsich  > cat spl/u-boot-spl-dtb.bin >> spl-3368.img
234d02d206SPhilipp Tomsich
244d02d206SPhilipp TomsichBuild the full U-Boot and a FIT image including the ATF
254d02d206SPhilipp Tomsich=======================================================
264d02d206SPhilipp Tomsich
274d02d206SPhilipp Tomsich  > make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm u-boot.itb
284d02d206SPhilipp Tomsich
29*cc8fb2f7SKlaus GogerFlash the image
30*cc8fb2f7SKlaus Goger===============
31*cc8fb2f7SKlaus Goger
32*cc8fb2f7SKlaus GogerCopy the SPL to offset 32k and the FIT image containing the payloads
33*cc8fb2f7SKlaus Goger(U-Boot proper, ATF, devicetree) to offset 256k card.
34*cc8fb2f7SKlaus Goger
35*cc8fb2f7SKlaus GogerSD-Card
36*cc8fb2f7SKlaus Goger-------
374d02d206SPhilipp Tomsich
384d02d206SPhilipp Tomsich  > dd if=spl-3368.img of=/dev/sdb seek=64
394d02d206SPhilipp Tomsich  > dd if=u-boot.itb of=/dev/sdb seek=512
404d02d206SPhilipp Tomsich
41*cc8fb2f7SKlaus GogereMMC
42*cc8fb2f7SKlaus Goger----
43*cc8fb2f7SKlaus Goger
44*cc8fb2f7SKlaus Gogerrkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with
45*cc8fb2f7SKlaus Gogerhelp of the Rockchip loader binary.
46*cc8fb2f7SKlaus Goger
47*cc8fb2f7SKlaus Goger  > git clone https://github.com/rockchip-linux/rkdeveloptool
48*cc8fb2f7SKlaus Goger  > cd rkdeveloptool
49*cc8fb2f7SKlaus Goger  > autoreconf -i && && ./configure && make
50*cc8fb2f7SKlaus Goger  > git clone https://github.com/rockchip-linux/rkbin.git
51*cc8fb2f7SKlaus Goger  > ./rkdeveloptool db rkbin/rk33/rk3368_loader_v2.00.256.bin
52*cc8fb2f7SKlaus Goger  > ./rkdeveloptool wl 64 ../spl.img
53*cc8fb2f7SKlaus Goger  > ./rkdeveloptool wl 512 ../u-boot.itb
54*cc8fb2f7SKlaus Goger
554d02d206SPhilipp Tomsich
564d02d206SPhilipp TomsichIf everything went according to plan, you should see the following
574d02d206SPhilipp Tomsichoutput on UART0:
584d02d206SPhilipp Tomsich
594d02d206SPhilipp Tomsich<debug_uart> U-Boot TPL board init
604d02d206SPhilipp TomsichTrying to boot from BOOTROM
614d02d206SPhilipp TomsichReturning to boot ROM...
624d02d206SPhilipp TomsichTrying to boot from MMC1
634d02d206SPhilipp TomsichNOTICE:  BL31: v1.3(release):v1.2-1320-gbf43a443
644d02d206SPhilipp TomsichNOTICE:  BL31: Built : 18:04:47, Jul  5 2017
654d02d206SPhilipp Tomsich
664d02d206SPhilipp Tomsich
674d02d206SPhilipp TomsichU-Boot 2017.07-00158-g2395e99858 (Jul 18 2017 - 21:03:31 +0200)
684d02d206SPhilipp Tomsich
694d02d206SPhilipp TomsichModel: Theobroma Systems RK3368-uQ7 SoM
704d02d206SPhilipp TomsichDRAM:  2 GiB
714d02d206SPhilipp TomsichMMC:   dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0
724d02d206SPhilipp TomsichUsing default environment
734d02d206SPhilipp Tomsich
744d02d206SPhilipp TomsichIn:    serial@ff180000
754d02d206SPhilipp TomsichOut:   serial@ff180000
764d02d206SPhilipp TomsichErr:   serial@ff180000
774d02d206SPhilipp TomsichNet:
784d02d206SPhilipp TomsichWarning: ethernet@ff290000 (eth0) using random MAC address - d2:69:35:7e:d0:1e
794d02d206SPhilipp Tomsicheth0: ethernet@ff290000
804d02d206SPhilipp TomsichHit any key to stop autoboot:  2
81