by
crocket » Wed Dec 30, 2020 11:14 am
I set up `cross-aarch64-unknown-linux-gnu/gcc-6.5.0` on gentoo linux with
Code: Select all
sudo crossdev --stable --gcc 6.5.0 --target aarch64-unknown-linux-gnu
According to
https://github.com/friendlyarm/sd-fuse_ ... -kernel.sh, I needed the following commands against nanopi-r2-v5.4.y branch of
https://github.com/friendlyarm/kernel-rockchipCode: Select all
make CROSS_COMPILE=aarch64-unknown-linux-gnu- ARCH=arm64 nanopi-r2_linux_defconfig
make CROSS_COMPILE=aarch64-unknown-linux-gnu- ARCH=arm64 -j8
After executing the commands, I got vmlinux and arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2-rev[0-9][0-9].dtb.
https://github.com/crust-firmware/meta/issues/2 taught me to work around u-boot compilation issue with the following commands. u-boot doesn't compile without these commands because it conflicts with dtc.
Code: Select all
find . -name 'libfdt*.h' -exec sed -i 's/ _LIBFDT_/ LIBFDT_/g' {} +
find . -name 'fdt.h' -exec sed -i 's/ _FDT_H/ FDT_H/g' {} +
https://github.com/friendlyarm/sd-fuse_ ... d-uboot.sh taught me to execute the following commands against nanopi-r2-v2014.10 branch of
https://github.com/friendlyarm/uboot-rockchipCode: Select all
make CROSS_COMPILE=aarch64-unknown-linux-gnu- nanopi_r2_defconfig
make CROSS_COMPILE=aarch64-unknown-linux-gnu- -j8
After compiling u-boot, I am seeing the following output files.
- uboot.img
- trust.img
- rk3328_loader_v1.16.250.bin
According to
http://opensource.rock-chips.com/wiki_Boot_option, uboot.img and trust.img are for boot flow 1 which involves rockchip miniloader instead of u-boot TPL and u-boot SPL. rk3328_loader_v1.16.250.bin seems to be for firmware update via USB. I don't want to think about firmware update via USB until I get NanoPi R2S to work.
From the output of `make CROSS_COMPILE=aarch64-unknown-linux-gnu- -j8`, I discovered that `rk3328_loader_v1.16.250.bin` was made by `./tools/boot_merger ./tools/rk_tools/RKBOOT/RK3328MINIALL.ini`
`./tools/rk_tools/RKBOOT/RK3328MINIALL.ini` made me realize I needed to execute the following commands to obtain idbloader.img.
Code: Select all
./tools/mkimage -n rk3328 -T rksd -d ./tools/rk_tools/bin/rk33/rk3328_ddr_333MHz_v1.16.bin idbloader.img
cat ./tools/rk_tools/bin/rk33/rk322xh_miniloader_v2.50.bin >> idbloader.img
However, `./tools/mkimage -T rksd ...` fails because rksd is not a supported image type. Thus, I had to build upstream u-boot with the following commands.
Code: Select all
make CROSS_COMPILE=aarch64-unknown-linux-gnu- defconfig
make CROSS_COMPILE=aarch64-unknown-linux-gnu- -j8
Then, I executed
Code: Select all
/path/to/upstream_u-boot/tools/mkimage -n rk3328 -T rksd -d ./tools/rk_tools/bin/rk33/rk3328_ddr_333MHz_v1.16.bin idbloader.img
cat ./tools/rk_tools/bin/rk33/rk322xh_miniloader_v2.50.bin >> idbloader.img
At this point, I finished building u-boot and linux kernel. But, I haven't yet tested them.