"); //-->
前言 Samsung EXYNOS ---> SAMSUNG EXYNOS4
ITOP-4412开发板被Linux官方支持,所以我们在4412上学习新的内核是非常方便的,本文作者是4412精英群8群一位技术高手,接下来,我们一起来欣赏下他的表演。
环境说明
OS版本
Ubuntu 20 LTS
交叉编译环境配置
~$ sudo apt install gcc-arm-linux-gnueabihf
~$ sudo apt install flex
~$ sudo apt install bison
~$ sudo apt install u-boot-tools
目标开发板
CPU (Exynos4412,四核Cortex-A9,主频为1.4GHz-1.6GHz)
RAM (1GB 双通道 DDR3)
ROM (8GB EMMC)
其他请见官网链接
1. 下载源码
~$ git clone https://github.com/jason416/linux.gi
Note:移植好的源码见博主github仓库的iTop4412分支。
2. 配置内核
2.1 进入内核源码目录
~/linux-5.4$ ls
arch COPYING Documentation include Kbuild lib Makefile README security usr
block CREDITS drivers init Kconfig LICENSES mm samples sound virt
certs crypto fs ipc kernel MAINTAINERS net scripts tools
jason@jason-vm2:~/arm-develop/linux$
2.2 修改内核配置
说明:
Note: 官方提供了所有三星系列的默认配置,需要先生成一个exynos的配置为基础,再上面再修改成跟板子一致的配置选项即可。
为了避免每次都需要指定ARCH和CROSS_COMPILE变量,可以直接在顶层Makefile直接指定好,如下所示:
选择系统类型
System Type --->
--- Samsung EXYNOS
[] SAMSUNG EXYNOS3
[] SAMSUNG EXYNOS5
*** EXYNOS SoCs ***
-*- SAMSUNG EXYNOS4210
SAMSUNG EXYNOS4412
配置调试串口 - 设置为UART2
Kernel hacking --->
Kernel low-level debugging functions (read help!)
Kernel low-level debugging port (Use Samsung S3C UART 2 for low-level debug) --->
开启串口调试驱动
Device Drivers --->
Character devices --->
Serial drivers --->
<*> Samsung SoC serial support
Samsung SoC serial debug
Support for console on Samsung SoC serial port
开启DM96XX网卡驱动
Device Drivers --->
Network device support --->
<*> USB Network Adapters --->
<*> Davicom DM96xx based USB 10/100 ethernet devices
设置内核压缩模式为LZMA(非必须,可减小文件大小)
General setup --->
() Build ID Salt
Kernel compression mode (LZMA) --->
编译内核
~/linux-5.4$ make uImage LOADADDR=0x40008000 -j$(nproc)
...
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
UIMAGE arch/arm/boot/uImage
Image Name: Linux-5.4.47
Created: Sun Jun 21 22:41:40 2020
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 5337464 Bytes = 5212.37 KiB = 5.09 MiB
Load Address: 40008000
Entry Point: 40008000
Kernel: arch/arm/boot/uImage is ready
这里需要指定LOADADDR变量,才能生成正确的uImage文件。因为在uboot启动内核时,会先解析uImage中的前64B头信息,定义如下:
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。