正点原子mp157linux出厂内核源码编译
arm交叉编译工具安装
下载x86_64 Linux hosted cross compilers
下的AArch32 target with hard float (arm-none-linux-gnueabihf)
sudo mkdir /usr/local/arm
sudo cp gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz /usr/local/arm/ -f
sudo tar -vxf gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz
sudo vi /etc/profile
在打开的文件最后添加export PATH=$PATH:/usr/local/arm/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin
安装相关库
sudo apt-get install lsb-core
sudo apt-get install lib32stdc++6
sudo apt-get install lzop
sudo apt-get install libssl-dev
sudo apt-get install u-boot-tools
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev
sudo apt-get install bison
sudo apt-get install flex
解压源码
tar -vxjf linux-5.4.31-gb8d3ec3ac-v1.1.tar.bz2
//解压缩
创建shell脚本stm32mp157d_atk.sh
以下文件需要特别注意空格位置
#!/bin/sh
# 按需清理
# make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- stm32mp1_atk_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- uImage dtbs LOADADDR=0XC2000040 -j16
修改权限运行
编译前建议将终端全屏,终端过小可能无法打开menuconfig
chmod 777 stm32mp157d_atk.sh
//给予可执行权限
./stm32mp157d_atk.sh
//执行编译脚本