前提说明
操作系统:ubuntu 20.04
硬件环境:野火IMX6ULL NAND
注意有些路径为我自己的本地路径,以$开头为linux指令。其余的为配置信息。请不要直接复制指令,建议根据实际情况填写指令。后期我会完善一些过程。
交叉编译器
Linaro - 下载最新版本,并解压
$ wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
$ tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
配置环境变量
$ vim ~/.bashrc
export PATH=$PATH:/home/bohao/Nand/tool/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
$ source ~/.bashrc
查看版本信息
$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Linaro GCC 7.5-2019.12) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU Toolchain | GNU-A Downloads – Arm Developer
None - 下载最新版本,并解压
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz
$ tar xvf gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz
配置环境变量
$ vim ~/.bashrc
export PATH=$PATH:/home/bohao/Nand/tool//home/bohao/Nand/tool/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabihf-
$ source ~/.bashrc
查看版本信息
arm-none-linux-gnueabihf-gcc --version
arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
安装相关工具
$ sudo apt install bc build-essential git libncurses5-dev lzop perl libssl-dev bison flex
Kernel
https://source.codeaurora.org/external/imx/linux-imx
5.4.70 - 下载最新版本
$ git clone https://source.codeaurora.org/external/imx/linux-imx -b imx_5.4.70_2.3.0
IMX6ULL - NAND - KSZ8081 5.4.70
复制配置文件
$ cp arch/arm/configs/imx_v7_defconfig arch/arm/configs/2022zzu_defconfig
# 末尾添加一行
CONFIG_LOCALVERSION_AUTO=n
复制设备树
$ cp arch/arm/boot/dts/imx6ull-14x14-evk-gpmi-weim.dts arch/arm/boot/dts/2022zzu.dts
# 在arch/arm/boot/dts/Makefile中添加
dtb-$(CONFIG_SOC_IMX6UL) += \
2022zzu.dtb \
编译并烧录,网络可用
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.70+ (bohao@ubuntu) (gcc version 7.5.0 (Linaro GCC 7.5-2019.12)) #1 SMP Fri Oct 22 23:13:02 PDT 2021
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Freescale i.MX6 ULL 14x14 EVK Board
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] efi: Getting EFI parameters from FDT:
/ # ifconfig eth1 192.168.0.121 netmask 255.255.255.0
/ # route add default gw 192.168.0.1
/ # ping www.baidu.com
PING www.baidu.com (104.193.88.77): 56 data bytes
64 bytes from 104.193.88.77: seq=0 ttl=49 time=165.796 ms
64 bytes from 104.193.88.77: seq=1 ttl=49 time=165.259 ms
64 bytes from 104.193.88.77: seq=2 ttl=49 time=165.165 ms