Linuximx6ull Kernel 源码下载和编译环境配置

Posted ZHONGCAI0901

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linuximx6ull Kernel 源码下载和编译环境配置相关的知识,希望对你有一定的参考价值。

1. 获取 ARM 官方交叉编译工具链

在ubuntu linux环境下编译imx6ull Kernel源码时,需要安装对应版本的交叉编译工具链。IMX6ULL的CPU是 32bit ARM v7架构并支持硬件浮点,所以下载 AArch32版本工具链后缀为gnueabihf,地址如下:

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
在这里插入图片描述
解压之后将工具路径添加到环境变量:$ vim ~/.bashrc

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabihf-
export PATH=$PATH:/opt/ToolChain/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin

验证是否配置成功,输入命令:$ arm-none-linux-gnueabihf-gcc -v。配置成功结果如下:
在这里插入图片描述

2. 在IMX官网下载IMX6ULL相关资料

IMX6ULL官网地址如下:
https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i-mx-6ull-and-6ulz-applications-processor:MCIMX6ULL-EVK

下载比较新的imx6ull linux开发相关文档:
在这里插入图片描述
硬件参考设计:
在这里插入图片描述

3. 下载源码和编译kernel

在下载的资料中,我们可以找到《i.MX_Linux_Users_Guide.pdf》文件,它有介绍如何下载code和编译如下:
在这里插入图片描述
imx6ull的uboot源码下载和编译:

Download source by cloning with git clone https://source.codeaurora.org/external/imx/uboot-imx -b imx_v2020.04_5.4.70_2.3.0
cd uboot-imx
make clean
make mx6ull_14x14_evk_defconfig
make

imx6ull的kernel源码下载和编译:

Download source by cloning with git clone https://source.codeaurora.org/external/imx/linux-imx -b imx_5.4.70_2.3.0
cd linux-imx
make imx_v7_defconfig
make

4. 编译验证kernel

成功生成内核镜像zImage,如下:
在这里插入图片描述
下载后开机log如下:

U-Boot 2020.04 (Jul 05 2021 - 12:25:58 +0800)

CPU:   i.MX6ULL rev1.1 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 45C
Reset cause: POR
Model: i.MX6 ULL 14x14 EVK Board
Board: MX6ULL 14x14 EVK
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

[*]-Video Link 0 (1024 x 600)
[0] lcdif@21c8000, video
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc0 is current device
flash target is MMC:0
Net:   eth1: ethernet@20b4000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  3  2  1  0 
switch to partitions #0, OK
mmc0 is current device
switch to partitions #0, OK
mmc0 is current device
8189384 bytes read in 369 ms (21.2 MiB/s)
Booting from mmc ...
35442 bytes read in 17 ms (2 MiB/s)
Kernel image @ 0x80800000 [ 0x000000 - 0x7cf5c8 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300ba71
Modify /soc/aips-bus@2200000/epdc@228c000:status disabled
ft_system_setup for mx6

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.70 (benjamin@ubuntu) (gcc version 9.3.0 (Buildroot -g658cfb3-dirty)) #1 SMP PREEMPT Sun Jul 4 18:28:07 CST 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] Reserved memory: created CMA memory pool at 0x96000000, size 160 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] percpu: Embedded 15 pages/cpu s32076 r8192 d21172 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129920
[    0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rw
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 335464K/524288K available (12288K kernel code, 578K rwdata, 4288K rodata, 1024K init, 435K bss, 24984K reserved, 163840K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
[    0.000000] Tasks RCU enabled.

5. 相关文章

《【uboot】imx6ull uboot 2020.04源码下载和编译环境配置》

以上是关于Linuximx6ull Kernel 源码下载和编译环境配置的主要内容,如果未能解决你的问题,请参考以下文章

kernel源码浅析

第一次作业:深入源码分析进程模型(Linux kernel 2.6.32)

在虚拟机上运行 HelloX Kernel

buildroot管理uboot+kernel+rootfs

petalinux如何保留u-boot和kernel源码

22-Openwrt 使用外部kernel和kernel_config