xz -d en.SOURCES-tf-a-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17_tar.xz
mv en.SOURCES-tf-a-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17_tar en.SOURCES-tf-a-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17.tar
tar -xvf en.SOURCES-tf-a-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17.tar
里面分为源码和patch文件:
tf-a-stm32mp-v2.4-stm32mp-r2-r0 TF-A installation directory
├──
[*].patch ST patches to apply during the TF-A preparation (see next chapter)
├── tf-a-stm32mp-v2.4-stm32mp-r2 TF-A source code directory
├── Makefile.sdk Makefile for the TF-A compilation
├── README.HOW_TO.txt Helper file for TF-A management: reference for TF-A build
├── series List of all ST patches to apply
└── tf-a-stm32mp-v2.4-stm32mp-r2-r0.tar.gz Tarball file of the TF-A source code
mv en.SOURCES-u-boot-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17_tar.xz en.SOURCES-u-boot-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17.tar.xz
tar -xvf en.SOURCES-u-boot-stm32mp1-openstlinux-5-10-dunfell-mp1-21-11-17.tar.xz
里面分为源码和patch文件:
u-boot-stm32mp-v2020.10-stm32mp-r2-r0 U-Boot installation directory
├──
[*].patch ST patches to apply during the U-Boot preparation (see next chapter)
├── u-boot-stm32mp-v2020.10-stm32mp-r2 U-Boot source code directory
├── Makefile.sdk Makefile for the U-Boot compilation
├── README.HOW_TO.txt Helper file for U-Boot management: reference for U-Boot build
├── series List of all ST patches to apply
└── u-boot-stm32mp-v2020.10-stm32mp-r2-r0.tar.gz Tarball file of the U-Boot source code
解压源码:
tar -zxvf u-boot-stm32mp-v2020.10-stm32mp-r2-r0.tar.gz
除了uboot源码之外,在上一级目录下,还有 FIP_artifacts 目录如下:
FIP_artifacts
├── arm-trusted-firmware
│ ├── bl32
│ └── fwconfig
├── optee
├── u-boot
│ ├── u-boot-nodtb-stm32mp15.bin
│ ├── u-boot-stm32mp157a-dk1-trusted.dtb Device tree for U-Boot → STM32MP15 Discovery kits
│ ├── u-boot-stm32mp157a-ev1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
│ ├── u-boot-stm32mp157c-dk2-trusted.dtb Device tree for U-Boot → STM32MP15 Discovery kits
│ ├── u-boot-stm32mp157c-ed1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
│ ├── u-boot-stm32mp157c-ev1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
│ ├── u-boot-stm32mp157d-dk1-trusted.dtb Device tree for U-Boot → STM32MP15 Discovery kits
│ ├── u-boot-stm32mp157d-ev1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
│ ├── u-boot-stm32mp157f-dk2-trusted.dtb Device tree for U-Boot → STM32MP15 Discovery kits
│ ├── u-boot-stm32mp157f-ed1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
│ └── u-boot-stm32mp157f-ev1-trusted.dtb Device tree for U-Boot → STM32MP15 Evaluation boards
2. 编译uboot 2. 1. uboot源码打patch
cd u-boot-stm32mp-v2020.10-stm32mp-r2/
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
tar xvf en.SOURCES-kernel-stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17.tar.xz
里面分为源码和patch文件:
linux-stm32mp-5.10.61-r2 Linux kernel installation directory
├──
[*].patch ST patches to apply during the Linux kernel preparation (see next chapter)
├── fragment-
[*].config ST configuration fragments to apply during the Linux kernel configuration (see next chapter)
├── linux-5.10.61 Linux kernel source code directory
├── linux-5.10.61.tar.xz Tarball file of the Linux kernel source code
├── README.HOW_TO.txt Helper file for Linux kernel management: reference for Linux kernel build
└── series List of all ST patches to apply
解压源码:
xz -d xvf linux-5.10.61.tar.xz
tar xvf linux-5.10.61.tar
for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r -O $PWD/../build $PWD/../build/.config $f; done
yes '' | make ARCH=arm oldconfig
2.4. 编译源码
编译内核:
make ARCH=arm uImage vmlinux dtbs LOADADDR=0xC2000040 O="$PWD/../build"
编译完成:
编译完成之后,在上一级目录的build/arch/arm/boot目录下可以看到编译出的镜像:
在dts目录下可以看到编译出的设备树:
2.5. 编译模块
make ARCH=arm modules O="$PWD/../build"
3. 烧写
sdb4分区是ext4文件系统,所以将之前使用的SD卡插入后,需要将该文件系统挂载:
sudo mkdir -p /mnt/bootfs
sudo mount /dev/sdb4 /mnt/bootfs/