MPC- LS中LS1043 内核编译---1 默认版本

1.LSDK的构造

设备要求: ubuntu 14/16/18

1.1源代码

源代码获取地址:https://lsdk.github.io/
在LS1043中 ,共有五个image需要刷写:

  1. RCW: reset配置字
  2. U-boot:boot loader
  3. PPA: 优先保护程序
  4. Fman: Frame manager hardware accelerator
  5. Linux:linux image
    创建DCM_git文件夹 在/home/user 来存储:

RCW:

git clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
cd rcw
git checkout -b integration origin/github.com.qoriq-os/integration

u-boot:

git clone https://github.com/qoriq-open-source/u-boot

linux:

git clone https://github.com/qoriq-open-source/linux
cd u-boot
git checkout -b LSDK-17.12 LSDK-17.12

PPA:

  git clone https://github.com/NXP/qoriq-ppa-binary/blob/integration/soc-ls1043/ppa.itb

Fsl_fman:

git clone https://github.com/NXP/qoriq-fm-ucode

1.2ubuntu 工具链

下载gcc linaro 工具链:https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/
并保存在DCM_git目录中。

sudo apt install crossbuild-essential-arm64 gcc-aarch64-linux-gnu
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
sudo apt install device-tree-compiler
export PATH=$PATH:/home//DCM_git/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin

1.3 添加补丁

在DCM_git文件夹中,创建三个文件夹:
dcm-linux_patches
dcm-rcw_patches
dcm-uboot_patches
CAF 下载地址:https://www.codeaurora.org/projects/nxp-dual-chip-module-automotive-gateway
MPC- LS中LS1043 内核编译---1 默认版本_第1张图片MPC- LS中LS1043 内核编译---1 默认版本_第2张图片对所有的补丁重复上述操作,
更改补丁名称:
“0001-armv8-ls1043adcm-Enable-USB-support.patch” to “0014-armv8-ls1043adcm-Enable-USB-
support.patch”.
添加补丁:

1.
   cd u-boot
   sudo git am ../dcm-uboot_patches/*
   The patch will be applied to u-boot.
2.
 cd  linux
 sudo git am ../dcm-linux_patches/*
 The patch will be applied to linux.
3.
  cd rcw
  sudo git am ../dcm-rcw_patches/*
  The patch will be applied to rcw.

在DCM_git文件夹中,创建两个文件夹:
dcm-linux_patches_addons
dcm-uboot_patches_addons
从CAF链接下载:
MPC- LS中LS1043 内核编译---1 默认版本_第3张图片添加补丁:

1.
   cd u-boot
   sudo git am ../dcm-uboot_patches_addons/*
   The patch will be applied to u-boot.
2.
 cd  linux
 sudo git am ../dcm-linux_patches_addons/*
 The patch will be applied to linux.

1.4 构造RCW

export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
export PATH=$PATH:/home//DCM_git/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
cd ../rcw/ls1043ardb
make
tclsh ../tools/byte_swap.tcl RR_SPPP_3560/rcw_1600_qspiboot.bin RR_SPPP_3560/rcw_1600_qspiboot_swapped.bin 8

构建成功的rcw_1600_qspiboot_swapped.bin 会生成在…/rcw/ls1043ardb/RR_SPPP_3560。

1.5构造U-boot

U-boot包括了四种形式:ddr、qspi、nand、sd
在DCM_git下创建u-boot_binary目录,在其下创建四个子文件夹: ddr、qspi、nand、sd。

cd u-boot
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
export PATH=$PATH:/home//DCM_git/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin

1.5.1 DDR boot

make distclean && make ls1043adcm_sdcard_defconfig && make -j3
u-boot-dtb.bin  被创建在此文件夹
mv u-boot-dtb.bin ~/DCM_git/u-boot_binary/ddr/u-boot-dtb_ramboot.bin

1.5.2 QSPI NOR boot

make distclean && make ls1043adcm_defconfig && make -j3
mv u-boot-dtb.bin ~/DCM_git/u-boot_binary/qspi/u-boot-dtb_qspi.bin

1.5.3 NAND boot

make distclean && make ls1043adcm_nand_defconfig && make -j3
 mv u-boot-dtb.bin ~/DCM_git/u-boot_binary/nand/u-boot-with-spl-pbl-nand.bin

1.5.4 SD boot

make distclean && make ls1043adcm_sdcard_defconfig && make -j3
 mv u-boot-with-spl-pbl.bin ~/DCM_git/u-boot_binary/qspi/u-boot-dtb_sd.bin

1.6构建linux

下载rootfs (ramdisk版本):https://github.com/qoriq-open-source/ramdiskrfs
下载ramdisk_rootfs_arm64.ext4.gz 。
在/home/user目录下构建ramdisk_fs文件夹,

mv ramdisk_rootfs_arm64.ext4.gz ~/ramdisk_fs

下载tcpdump arm64
link:https://packages.debian.org/stretch/tcpdump
并下载该链接下的libpcap 和libssl arm64版本
在ramdisk_fs目录下创建libpcap 、libssl文件夹,将上述下载内容拷贝到对应的文件夹

cd libpcap
dpkg -x libpcap0.8_1.8.1-3_arm64.deb .
cd ../libssl
dpkg -x libssl1.0.2_1.0.2t-1~deb9u1_arm64.deb .
cd ..
dpkg -x tcpdump_4.9.2-1_deb8u1_arm64.deb .
sudo mkdir TEMP
sudo gunzip ramdisk_rootfs_arm64.ext4.gz
sudo mount ramdisk_rootfs_arm64.ext4 TEMP/
sudo cp usr/sbin/tcpdump TEMP/sbin/
sudo cp libpcap/usr/lib/aarch64-linux-gnu/libpcap.so.0.8 TEMP/usr/lib64
sudo cp libpcap/usr/lib/aarch64-linux-gnu/libpcap.so.1.8.1 TEMP/usr/lib64
sudo cp libssl/usr/lib/aarch64-linux-gnu/libcrypto.so.1.0.2 TEMP/usr/lib64
sudo cp libssl/usr/lib/aarch64-linux-gnu/libssl.so.1.0.2 TEMP/usr/lib64
sudo umount TEMP/
sudo gzip -9 ramdisk_rootfs_arm64.ext4
cp ramdisk_rootfs_arm64.ext4.gz ~/DCM_git/linux
mv ramdisk_rootfs_arm64.ext4.gz fsl-image-core-ls1043ardb.ext2.gz
 export CROSS_COMPILE=aarch64-linux-gnu-
 export ARCH=arm64
 export PATH=$PATH:/home//DCM_git/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
 make defconfig
 make lsdk.config
 make -j6
 ../u-boot/tools/mkimage -f kernel-ls1043a-rdb.its kernel-ls1043a-rdb.itb

kernel-ls1043a-rdb.itb创建成功。
若在上述内核编译过程中遇到权限不足 或缺少头文件等问题:

chmod 777 linux/* -R 

1.7 通过SD卡启动系统

(使用sd boot的前提是开发板上驱动电阻的形式为sd boot形式)
先通过sudo fdisk -l 查看sd卡在主机上所获取的设备号,假设为/dev/sde,则:

export DEVSD=/dev/sde
sudo fdisk ${DEVSD}
Press “d”. (Repeat unitl all the partitions are deleted)
Press “n”. This creates a new partition.
Press “p”. This creates a primary partition.
Press “1”. The first partition.
Press enter. This will create a partition that starts at offset 2048.
Press “t”. To set partition type.
Press “1” to select partition number 1. Note: If “1” is already entered in the command and
displayed, directly go to the next step.
Now type “83” to select Linux file system.
Press “w”. This writes the partition table and fdisk exits
This newly created partition need to be formatted to be usable. Firstly, remove and put SD Card
back into its slot, then run the following commands to format the partition:
sudo mkfs.ext3 -L rootfs ${DEVSD}1

将所有的binary拷贝到sd卡:

1. U-boot: u-boot: u-boot-with-spl-pbl_sd.bin(image build as in section SD Boot)
sudo dd if=u-boot-with-spl-pbl_sd.bin of=/dev/ sde bs=512 seek=8
2. PPA: ppa.itb
sudo dd if=ppa.itb of=/dev/sde bs=512 seek=8192
3. Fman: fsl_fman_ucode_ls1043_r1.1_106_4_18.bin
sudo dd if=fsl_fman_ucode_ls1043_r1.1_106_4_18.bin of=/dev/sde bs=512 seek=18432
4. Linux: kernel-ls1043a-rdb.itb
sudo dd if=kernel-ls1043a-rdb.itb of=/dev/sde bs=512 seek=32768

将sd卡插入开发板即可。

1.8 在ubuntu主机上安装串口驱动

FTDI驱动: https://blog.csdn.net/Davidietop/article/details/86520281
检查是否安装成功:

lsmod | grep usbserial

查找设备列表:

dmesg

串口工具:minicom 、设置端口为USB-serial的名字,设置波特率为115200。

你可能感兴趣的:(MPC- LS中LS1043 内核编译---1 默认版本)