硬件信息: friefly3399一块,2GB内存/16Gemmc。
软件信息: ubuntu18.04虚拟机,内部有firefly的SDK包。
参考资料:[ROC-RK3399-PC Pro] 手把手教你移植主线U-Boot(基于v2022.04-rc5版本)_Neutionwei的博客-CSDN博客
目标移植uboot2022.10到firefly3399开发板
git clone git@github.com:u-boot/u-boot.git
zhi@ubuntu:~/3399/system/2022-11-27$ git clone git@github.com:u-boot/u-boot.git
Cloning into 'u-boot'...
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.
1.ssh-keygen -t rsa -C xxxx@qq.com (注意修改,是自己的github账号的邮箱地址)
2.ssh -v git@github.com
3.ssh-agent -s
4.ssh-add ~/.ssh/id_rsa (出错(Could not open a connection to your authentication agent.)继续第5步,没错则跳过5,6)
5.eval `ssh-agent -s`
6.ssh-add ~/.ssh/id_rsa
7.cat ~/.ssh/id_rsa.pub 打印出来的数据,贴到github中的账号中去。
8.打开自己的github的账号,在settings下,SSH and GPG keys下new SSH key,title随便取一个名字,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。
9. 验证:ssh -T git@github.com 提示successfully 即表示成功
git clone git@github.com:u-boot/u-boot.git
cd uboot/
git tag 使用空格打印出更多
git checkout -b v2022.10-rc5 v2022.10-rc5
我自己的环境有一个编译器,是firefly中自带的。
1.查找一下,发现有该编译器
zhi@ubuntu:~/3399/system/rk3399_linux_release_v2.5.1_20210301$ find -name aarch64-linux-gnu*
2.没有的话,可以自行下载
git clone https://gitlab.com/firefly-linux/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu
3.设置环境变量PATH,根据自己的目录更改吧
export PATH=/home/zhi/3399/system/rk3399_linux_release_v2.5.1_20210301/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin:$PATH
4. 查看命令是否正常
aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/zhi/3399/system/rk3399_linux_release_v2.5.1_20210301/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/6.3.1/lto-wrapper
Target: aarch64-linux-gnu
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/snapshots/gcc.git~linaro-6.3-2017.05/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/sysroots/aarch64-linux-gnu --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
cd configs
ls | grep 3399
evb-rk3399_defconfig
ficus-rk3399_defconfig
firefly-rk3399_defconfig
khadas-edge-captain-rk3399_defconfig
khadas-edge-rk3399_defconfig
khadas-edge-v-rk3399_defconfig
leez-rk3399_defconfig
nanopc-t4-rk3399_defconfig
nanopi-m4-2gb-rk3399_defconfig
nanopi-m4b-rk3399_defconfig
nanopi-m4-rk3399_defconfig
nanopi-neo4-rk3399_defconfig
nanopi-r4s-rk3399_defconfig
orangepi-rk3399_defconfig
pinebook-pro-rk3399_defconfig
puma-rk3399_defconfig
rock960-rk3399_defconfig
rock-pi-4c-rk3399_defconfig
rock-pi-4-rk3399_defconfig
rock-pi-n10-rk3399pro_defconfig
rockpro64-rk3399_defconfig
roc-pc-mezzanine-rk3399_defconfig
roc-pc-rk3399_defconfig
cd ../
make firefly-rk3399_defconfig
make CROSS_COMPILE=aarch64-linux-gnu-
unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1
sudo apt install swig
scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: No such file or directory
# include
^~~~~~~~~~
sudo apt-get install python3-distutils -y
sudo apt install python3-dev -y
make CROSS_COMPILE=aarch64-linux-gnu-
./"arch/arm/mach-rockchip/make_fit_atf.py" \
arch/arm/dts/rk3399-firefly.dtb > u-boot.its
WARNING: BL31 file bl31.elf NOT found, resulting binary is non-functional
WARNING: Please read Building section in doc/README.rockchip
MKIMAGE u-boot.itb
===================== WARNING ======================
This board uses CONFIG_SPL_FIT_GENERATOR. Please migrate
to binman instead, to avoid the proliferation of
arch-specific scripts with no tests.
====================================================
CFGCHK u-boot.cfg
OFCHK .config
BINMAN all
编译完成后打印了一个警告,意思是说没找到
bl31.elf
文件cd ../ (到uboot外面去)
git clone git@github.com:ARM-software/arm-trusted-firmware.git
cd arm-trusted-firmware
make realclean
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
make[1]: arm-none-eabi-gcc: Command not found
没有命令了,安装就好
sudo apt-get install gcc-arm-none-eabi
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
cd ../u-boot/
export BL31=/home/zhi/3399/system/2022-11-27/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf
make CROSS_COMPILE=aarch64-linux-gnu-
没有警告了!!!!
./"arch/arm/mach-rockchip/make_fit_atf.py" \
arch/arm/dts/rk3399-firefly.dtb > u-boot.its
MKIMAGE u-boot.itb
BINMAN all
需要用到两个文件,我把它们拷贝到windows共享目录中
cp idbloader.img /mnt/hgfs/vm_share/rk3399/
cp u-boot.itb /mnt/hgfs/vm_share/rk3399/
4.1 以上步骤只是记录我移植的过程,中间的原理没有关注,只能是说移植的步骤基本完成,但是实际每个人每个虚拟机遇到的问题应该会有差异,建议百度解决。
4.2 基本还算是比较顺利,花时2小时左右吧.
4.3 有什么问题也欢迎私信我讨论,但是我本人技术也很渣啦,不一定能帮大家解决。