开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位
工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabi
要移植的kernel版本:linux-4.4
Tiny4412开发板硬件版本为:
底板: Tiny4412SDK 1312B
核心板:Tiny4412 - 1306
1、下载、解压内核
linux-4.4.tar.gz
2、配置
1)配置开发板类型及指定交叉编译链
diff --git a/arch/arm/boot/dts/exynos4412-tiny4412.dts b/arch/arm/boot/dts/exyno index 4840bbd..048ae67 100644 --- a/arch/arm/boot/dts/exynos4412-tiny4412.dts +++ b/arch/arm/boot/dts/exynos4412-tiny4412.dts @@ -21,6 +21,7 @@ ESCOD index 70dea02..42b0d63 100644 --- a/Makefile +++ b/Makefile @@ -248,8 +248,11 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_6 # "make" in the configured kernel build directory always uses that. # Default value for CROSS_COMPILE is not to prefix executables # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile -ARCH ?= $(SUBARCH) -CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) +#ARCH ?= $(SUBARCH) +#CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) + +ARCH ?= arm +CROSS_COMPILE ?= /usr/local/ARM-toolchian/gcc-linaro-6.1.1-2016.08-i686_arm-linux-gnueabi/bin/arm-linux-gnueabi- # Architecture as present in compile.h UTS_MACHINE := $(ARCH)
2)修改设备树
diff --git a/arch/arm/boot/dts/exynos4412-tiny4412.dts b/arch/arm/boot/dts/exyno index 4840bbd..048ae67 100644 --- a/arch/arm/boot/dts/exynos4412-tiny4412.dts +++ b/arch/arm/boot/dts/exynos4412-tiny4412.dts @@ -21,6 +21,7 @@ chosen { stdout-path = &serial_0; + bootargs="root=/dev/ram0 rw rootfstype=ext4 console=ttySAC0,115200 init=/linuxrc earlyprintk";
}; memory { @@ -78,7 +79,8 @@ bus-width = <4>; pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; pinctrl-names = "default"; - status = "okay"; + /* status = "okay";*/ + status = "disabled"; }; &serial_0 {
这里关键的一点是在chosen中增加了bootargs的设置,上面设置bootargs表示的意思是:根文件系统是ramdisk,可读写,文件系统类型是ext4格式,串口终端使用ttySAC0,波特率是115200,earlyprintk用于打印内核启动早期的一些log,它会把printk的信息打印到一个叫做bootconsole的终端上,在真正的console注册后,bootconsole会被disable掉,要想使用earlyprintk,需要在内核中做相关的配置,这个下面再说。bootargs的设置很灵活,既可以在内核的设备树中设置,也可以在u-boot中设置,需要注意的是:如果在u-boot中设置了bootargs的话,在bootm的时候u-boot会用自己的bootargs来覆盖设备树里的bootargs( do_bootm_linux -> bootm_linux_fdt -> fdt_chosen)。还有一点是把SD卡控制器2给禁掉了,目前SD控制器的初始化还有些问题,会导致内核挂掉,这个以后再解决,因为我们将来先用ramdisk做根文件系统,跟eMMC和SD卡都没有关系
3,配置内核支持Ramdisk
make menuconfig
File systems --->;
<*> Second extended fs support
Device Drivers
SCSI device support --->;
<*> SCSI disk support
Block devices --->;
<*>RAM block device support
(16)Default number of RAM disks
(8192) Default RAM disk size (kbytes) (修改为8M)
General setup --->;
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
这个exynos的默认配置就已经支持了。
4.配置内核支持Tmpfs
$ make menuconfig
File systems --->;
Pseudo filesystems --->
[*] Virtual memory file system support (former shm fs)
[*] Tmpfs POSIX Access Control Lists
这个exynos的默认配置也已经支持了。
5.编译内核
第一次编译需要获取exynos配置
make exynos_defconfig
root@ubuntu:/home/arm/linux-4.4# cat build.sh #!/bin/bash echo "---------------" echo "rm ./ uImage and dtb" rm uImage exynos4412-tiny4412.dtb echo "make" make uImage LOADADDR=0x40007000 -j4 echo "make dtb" make dtbs echo "backup config" cp .config tiny4412_defconfig echo "copy uImage" cp arch/arm/boot/uImage ./ echo "copy dtb" cp arch/arm/boot/dts/exynos4412-tiny4412.dtb ./ echo "over"
编写脚本。执行,烧写
即可初步启动kernel
---------------------------------------------------------------------------------------------------------------------------------------------------------------
问题:启动后如果显示文件太多会出现
dma-pl330 12680000.pdma: Reset Channel-1 CS-20000f FTC-20000
[ 1573.447654] dma-pl330 12680000.pdma: Reset Channel-1 CS-20000f FTC-20000
参考:https://blog.csdn.net/sinat_20006769/article/details/79060779
说是DMA驱动的问题,按照介绍取消dma-pl330后,kernel无法启动
参考:https://blog.csdn.net/hyyoxhk/article/details/83305367
修改arch/arm/boot/dts/exynos4412-tiny4412.dts中,serial_0的dmas导致卡死,serial_2的dmas无效果
参考:https://blog.csdn.net/qq_25370227/article/details/84891632
是uboot中TrustZone造成,目前未尝试
--------------------------------------------------------------------------------------------------------------------------------------------------------------
已解决:就是TrustZone造成,具体查看:linux-kernel-4.4 移植 (2)解决上部遗留DMA-PL330的问题
————————————————————————————————————————————————
整体参考:
https://www.cnblogs.com/pengdonglin137/p/5143516.html
https://blog.csdn.net/sinat_20006769/column/info/19139