Ubuntu系统编译
软件配置
安装环境包
sudo apt update
sudo apt-get install git ssh make gcc libssl-dev liblz4-tool \
expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \
unzip device-tree-compiler libncurses-dev
sudo pip install python-pip pyelftools
SDK获取
发送邮件至 support@neardi.com 获取相关开发资料
下载完成后,在解压前先查看 MD5 码和Neardi-3588-SDK-Linux-${Version}.tar.gz.md5sum中是否一致:
$ md5sum Neardi-3588-SDK-Linux-${Version}.tar.gz
******************************** Neardi-3588-SDK-Linux-${Version}.tar.gz
解压:
tar zxvf Neardi-3588-SDK-Linux-${Version}.tar.gz
提取:
cd Neardi-3588-SDK-Linux-${Version}
git reset --hard
切换分支:
branch | explain |
---|---|
LZ16000002 | Neardi master branch |
git checkout LZ16000002
编译 SDK
选择配置
boardConfig | explain |
---|---|
BoardConfig-rk3588-neardi-linux-lkd3588-f0.mk | OV13855x2 + EV101WXM-N10 10.1inc + HDMI1 + HDMI2 + HDMIIN |
BoardConfig-rk3588-neardi-linux-lkd3588-f3.mk | OV13855x2 + DV215FHM-NM0 21.5inc + HDMI1-8k + HDMI2 + DP |
BoardConfig-rk3588-neardi-linux-lkd3588-f4.mk | OV13855x2 + DV215FHM-NM0 21.5inc + HDMI1 + HDMI2 + HDMI3 + DP |
./build.sh lunch BoardConfig-rk3588-neardi-linux-lkd3588-f0.mk
打包固件
RK 固件,是以 Rockchip 专有格式打包的固件,使用 Rockchip 提供的工具可以烧写到 eMMC 或者 SD 卡中(注:若无特殊说明,WIKI 上提及的固件默认为 RK 固件)。
# 打包 RK 固件
./build.sh updateimg
生成的完整固件会保存到 rockdev/update.img
。
分区说明
parameter 分区表
parameter.txt 文件中包含了固件的分区信息:
路径:device/rockchip/rk3588/parameter.txt
FIRMWARE_VER: 1.0
MACHINE_MODEL: RK3588
MACHINE_ID: 007
MANUFACTURER: RK3588
MAGIC: 0x5041524B
ATAG: 0x00200800
MACHINE: 0xffffffff
CHECK_MASK: 0x80
PWR_HLD: 0,0,A,0,1
TYPE: GPT
CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),-@0x00078000(rootfs:grow)
uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
uuid:boot=7A3F0000-0000-446A-8000-702F00006273
CMDLINE 属性是我们关注的地方,以 uboot 为例, 0x00002000@0x00004000(uboot) 中 0x00004000 为uboot 分区的起始位置,0x00002000 为分区的大小,以此类推。
package-file
package-file 文件用于打包固件时确定需要的分区镜像和镜像路径,同时它需要与 parameter.txt 文件保持一致。
路径:tools/linux/Linux_Pack_Firmware/rockdev/rk3588-package-file
# NAME Relative path
#
#HWDEF HWDEF
package-file package-file
bootloader Image/MiniLoaderAll.bin
parameter Image/parameter.txt
uboot Image/uboot.img
misc Image/misc.img
boot Image/boot.img
recovery Image/recovery.img
rootfs Image/rootfs.img
backup RESERVED
FAQ
编译错误
lz4错误
Incorrect parameters
Usage :
lz4 [arg] [input] [output]
input : a filename
with no FILE, or when FILE is - or stdin, read standard input
Arguments :
-1 : Fast compression (default)
-9 : High compression
-d : decompression (default for .lz4 extension)
-z : force compression
-f : overwrite output without prompting
-h/-H : display help/long help and exit
arch/arm64/boot/Makefile:31: recipe for target 'arch/arm64/boot/Image.lz4' failed
make[2]: *** [arch/arm64/boot/Image.lz4] Error 1
make[2]: *** Deleting file 'arch/arm64/boot/Image.lz4'
arch/arm64/Makefile:170: recipe for target 'Image.lz4' failed
make[1]: *** [Image.lz4] Error 2
make[1]: *** Waiting for unfinished jobs....
解决方法,重新手动安装lz4:
git clone https://github.com/lz4/lz4.git
cd lz4
make
sudo make install