
fafactx
V1
2023/04/27阅读:12主题:默认主题
独立编译Layerscape平台芯片常用命令
回到Layerscpae资源汇总
这里记录Layerscape芯片设计的所有有用资源和经验。如需要进群交流请加群,私信获取。
编译PBL+FIP
获取相关源码
项目 | 源码地址 |
---|---|
rcw | https://github.com/nxp-qoriq/rcw.git |
optee | https://github.com/nxp-qoriq/optee_os.git |
atf | https://github.com/nxp-qoriq/atf.git |
u-boot | https://github.com/nxp-qoriq/u-boot.git |
linux | https://github.com/nxp-qoriq/linux.git |
安装arm32和arm64交叉工具链
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install gcc-aarch64-linux-gnu
32-bit Arm:(Armv7 / 32-bit mode of Armv8)
$ sudo apt-get install gcc-arm-linux-gnueabihf
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ export ARCH=arm
64-bit Arm:
$ sudo apt-get install gcc-aarch64-linux-gnu
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ export ARCH=arm64
编译rcw
git clone https://github.com/nxp-qoriq/rcw.git
cd rcw
git checkout -b LSDK-21.08 LSDK-21.08
make -j$(nproc)
编译u-boot
git clone https://github.com/nxp-qoriq/u-boot.git
cd u-boot
git checkout -b LSDK-21.08 LSDK-21.08
make distclean
make lx2160ardb_tfa_defconfig
make -j$(nproc)
编译bl2获取pbl文件
git clone https://github.com/nxp-qoriq/atf.git
cd atf
git checkout -b LSDK-21.08 LSDK-21.08
cp ../rcw/lx2160ardb_rev2/XGGFF_PP_HHHH_RR_19_5_2/rcw_2200_750_3200_19_5_2.bin ./
make -j$(nproc) PLAT=lx2160ardb bl2 BOOT_MODE=sd pbl RCW=./rcw_2200_750_3200_19_5_2.bin
Note:生成PBL文件在./build/lx2160ardb/release/bl2_sd.pbl
• <platform> = ls1012ardb | ls1012afrdm | ls1012afrwy | ls1043ardb | ls1046ardb |
ls1088ardb | ls2088ardb | lx2160ardb_rev2 | lx2162aqds
• <boot_mode> = nor, nand, sd, emmc, qspi, flexspi_nor
编译OP-TEE(optional)
git clone https://github.com/nxp-qoriq/optee_os.git
cd optee_os
git checkout -b LSDK-21.08 LSDK-21.08
export ARCH=arm
export CROSS_COMPILE64=aarch64-linux-gnu-
make -j$(nproc) CFG_ARM64_core=y PLATFORM=ls-lx2160ardb
aarch64-linux-gnu-objcopy -v -O binary out/arm-plat-ls/core/tee.elf out/arm-plat-ls/core/tee.bin
编译FIP
cd atf
cp ../optee_os/out/arm-plat-ls/core/tee.bin ./
cp ../u-boot/u-boot.bin ./
export ARCH=arm64
export CROSS_COMPILE64=aarch64-linux-gnu-
# 如使用optee
make -j$(nproc) PLAT=lx2160ardb fip BL33=./u-boot.bin SPD=opteed BL32=./tee.bin
# 不用optee
make -j$(nproc) PLAT=lx2160ardb fip BL33=./u-boot.bin
fip image 位置:atf/build/lx2160ardb/release/fip.bin
编译linux
git clone https://github.com/nxp-qoriq/linux.git
cd linux
git checkout -b LSDK-21.08 LSDK-21.08
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig lsdk.config
make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
修改设备树文件vim arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts
make dtbsImage.gz: arch/arm64/boot/.
dtb fsl-lx2160a-rdb.dtb : arch/arm64/boot/dts/freescale/
optional:生成uImage
cd arch/arm64/boot
mkimage -A arm64 -O linux -T kernel -C gzip -a 0x80080000 -e 0x80080000 -n Linux -d Image.gz uImage
作者介绍

fafactx
V1