一,设置交叉编译工具链
(否则编译过程会出现莫名其妙的错误)
1.1 在/usr/local/文件夹下建立名为ARM-toolchain的文件夹
mkdir /usr/local/ARM-toolchain
1.2 下载安装包
(注意区分64位和32位的ubuntu系统然后选择对应软件)
https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/
1.3 cp压缩包到ARM-toolchain文件夹
1.4 解压
xz -d gcc-linaro-6.2.1-2016.11-i686_arm-linux-gnueabihf.tar.xz
tar -xvf gcc-linaro-6.2.1-2016.11-i686_arm-linux-gnueabihf.tar
1.5 修改环境变量
在/etc/profile的最后一行添加
export PATH=$HOME:/usr/local/ARM-toolchain/gcc-linaro-6.2.1-2016.11-i686_arm-linux-gnueabihf/bin:$PATH
记住一定是HOME此处为PATH则无效果。
1.6 让profile立即生效
source /etc/profile
1.7 查看环境变量是否添加成功
输入$PATH,则能看到刚才添加的路径。
1.8 查看安装成功否
arm-linux-gnueabihf-gcc -v
显示为gcc version 6.2.1 20161016
注:参考https://www.cnblogs.com/AP0904225/p/6075816.html
二,编译uboot
-
2.1
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
-
2.2
rm -rf ./am335x_evm
-
2.3
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_evm am335x_boneblack_defconfig
-
2.4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_evm
生成的MLO和u-boot.img在arm335x_evm文件中。
注:参考网址
<http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components.html#u-boot>
三,编译kernel,设备树及模块
3.1 Cleaning the Kernel Sources
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
3.2 Configuring the Kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig
3.3 Compiling the Sources
3.3.1 Compiling the Kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage
This will result in a kernel image file being created in the arch/arm/boot/ directory called zImage.
3.3.2 Compiling the Device Tree Binaries
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x-boneblack.dtb
The compiled device tree file with be located in arch/arm/boot/dts.
3.3.3 Compiling the Kernel Modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
3.3.4 Installing the Kernel
make ARCH=arm INSTALL_MOD_PATH=<path to root of file system> modules_install
make ARCH=arm INSTALL_MOD_PATH=/tmp/images/rootfs modules_install
Linux kernel, dtb files and modules都编译完成后,需要copy到同一个目录。
参考< Chinese-BB-Black-Quick-Guide.pdf>
网友评论