linux-kernel-4.4 移植 (1)啓動

開發環境: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

 

一、下載、解壓內核

linux-4.4.tar.gz 

二、配置

  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卡都沒有關係html

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的默認配置就已經支持了。linux

4.配置內核支持Tmpfs

$ make menuconfig

File systems --->;
   Pseudo filesystems --->
        [*] Virtual memory file system support (former shm fs)
        [*] Tmpfs POSIX Access Control Lists
這個exynos的默認配置也已經支持了。

5.編譯內核

第一次編譯須要獲取exynos配置git

  make exynos_defconfigshell

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"

編寫腳本。執行,燒寫ubuntu

便可初步啓動kernelbash

---------------------------------------------------------------------------------------------------------------------------------------------------------------app

問題:啓動後若是顯示文件太多會出現工具

dma-pl330 12680000.pdma: Reset Channel-1 CS-20000f FTC-20000
[ 1573.447654] dma-pl330 12680000.pdma: Reset Channel-1 CS-20000f FTC-20000post

參考:https://blog.csdn.net/sinat_20006769/article/details/79060779ui

說是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

相關文章
相關標籤/搜索