tiny4412学习(二)之移植linux-4.x支持设备树【转】

  • 硬件平台:tiny4412
  • 系统:linux-4.4
  • 文件系统:busybox-1.25
  • 编译器: arm-none-linux-gnueabi-gcc (gcc version 4.8.3 20140320)
  • uboot:友善自带uboot,见上节

实验参考摩斯电码的博客:

http://www.cnblogs.com/pengdonglin137/p/5137941.html

http://www.cnblogs.com/pengdonglin137/p/5143516.html

一、u-boot修改

1、更新交叉工具链

到:http://www.veryarm.com/arm-none-linux-gnueabi-gcc

下载:arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

tar –xjf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

修改环境变量:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/work/gcc/arm-2014.05/bin"

arm-none-linux-gnueabi-gcc -v:

gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29)

2、关闭uboot开启的MMU

(1)修改include/configs/tiny4412.h

#define CONFIG_ENABLE_MMU

修改为

#undef CONFIG_ENABLE_MMU

(2)只关闭MMU还不够,还需要修改u-boot的链接地址

修改文件board/samsung/tiny4412/config.mk

CONFIG_SYS_TEXT_BASE = 0xc3e00000

修改为

CONFIG_SYS_TEXT_BASE = 0x43e00000

因为板子是1G内存,从4000 0000 开始

4000 0000 - 5000 0000 256M

......

7000 0000 - 8000 0000 1G

3、使uboot可以引导uImage

修改uboot源码下:common/cmd_bootm.c

(1)

int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
        ulong           iflag;
        ulong           load_end = 0;
        int             ret;
        boot_os_fn      *boot_fn;
        int             iszImage = 0;

(2)

images.legacy_hdr_valid = 1;            

iszImage = 1;               

goto after_header_check;.

(3)

images.os.os = hdr->;ih_os;     

images.ep = image_get_ep (&;images.legacy_hdr_os_copy);

改为

if (iszImage) {              

images.os.os = hdr->ih_os;              

images.ep = image_get_ep (&images.legacy_hdr_os_copy);      

}

4、修改uboot支持设备树

 

修改include/configs/tiny4412.h

增加如下两个宏

#define CONFIG_OF_LIBFDT
#define CONFIG_SYS_BOOTMAPSZ (20 << 20)

5、编译uboot

(1)修改makefile,增加:

ifeq ($(ARCH),arm)

CROSS_COMPILE ?=/work/gcc/arm-2014.05/bin/arm-none-linux-gnueabi-

endif

(2)make distclean

(3)make tiny4412_config

(4)make

(5)烧写到SD卡

 

cd sd_fuse/tiny4412

./sd_fusing.sh /dev/sdc (fdisk -l查看)

(6)启动uboot

 

 
  1. U-Boot 2010.12 (Jul 02 2017 - 11:26:09) for TINY4412

  2. CPU: S5PC220 [Samsung SOC on SMP Platform Base on ARM CortexA9]

  3. APLL = 1400MHz, MPLL = 800MHz

  4. Board: TINY4412

  5. DRAM: 1023 MiB

  6. vdd_arm: 1.2

  7. vdd_int: 1.0

  8. vdd_mif: 1.1

  9. BL1 version: N/A (TrustZone Enabled BSP)

  10. Checking Boot Mode ... SDMMC

  11. REVISION: 1.1

  12. fwbl1: 0

  13. iram block: 16

  14. u-boot: 48

  15. TrustZone S/W: 704

  16. env: 1024

  17. knl: 1057

  18. rfs: 13345

  19. bl2: 16

  20. MMC Device 0: 14756 MB

  21. lizuobin read idff

  22. lizuobin read idff

  23. lizuobin read idff

  24. lizuobin read idff

  25. fwbl1: 0

  26. iram block: 16

  27. u-boot: 48

  28. TrustZone S/W: 704

  29. env: 1024

  30. knl: 1057

  31. rfs: 13345

  32. bl2: 16

  33. MMC Device 1: 3728 MB

  34. MMC Device 2: N/A

  35. Net: No ethernet found.

  36. Hit any key to stop autoboot: 0

 

二、内核及文件系统系统制作

1、内核移植(支持设备树)

(1)下载源码:https://www.kernel.org/pub/linux/kernel/v4.x/  下载  linux-4.4.tar.gz  

(2)解压:tar –xzf  linux-4.4.tar.gz 

(3)cd linux-4.4

(4)修改makefile,增加

 

+ARCH           ?= arm
+CROSS_COMPILE  ?= /work/gcc/arm-2014.05/bin/arm-none-linux-gnueabi-

 

(5)配置:linux-4.4 已经很好的支持了tiny4412,所以移植的工作并不多。

 

make exynos_defconfig

(6)修改arch/arm/boot/dts/exynos4412-tiny4412.dts

      chosen {                

stdout-path = &;serial_0;               

bootargs = "root=/dev/ram0 rw rootfstype=ext4 console=ttySAC0,115200 init=/linuxrc earlyprintk";     };

 

        pinctrl-names = "default";

        #status = "okay";       

status = "disabled"; 

}&serial_0 

(7)配置内核,支持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

(8)配置内核,使其支持tmpfs

$ make menuconfig
File systems --->;
    Pseudo filesystems --->
        [*] Virtual memory file system support (former shm fs)
        [*] Tmpfs POSIX Access Control Lists

exynos的默认配置也已经支持了。

(9)编译产生uImage

make uImage LOADADDR=0x40008000 -j2

生成的uImage在arch/arm/boot下。 

(10)编译设备树

make dtbs

arch/arm/boot/dts/会生成tiny4412上用的设备树镜像文件exynos4412-tiny4412.dtb。

(11)文件系统制作

下载busybox的代码,制作ramdisk镜像。

三、下载测试

下载内核、文件系统、设备树文件

#u-boot:dnw 0x40600000

dnw arch/arm/boot/uImage

#u-boot:dnw 0x41000000 

dnw ramdisk.img

#u-boot:dnw 0x42000000

dnw arch/arm/boot/dts/exynos4412-tiny4412.dtb

启动内核使用bootm启动内核:

bootm 0x40600000 0x41000000 0x42000000

启动日志:

 
  1. TINY4412 # bootm 0x40600000 0x41000000 0x42000000

  2. ## Booting kernel from Legacy Image at 40600000 ...

  3. Image Name: Linux-4.4.0

  4. Image Type: ARM Linux Kernel Image (uncompressed)

  5. Data Size: 4193128 Bytes = 4094 KiB

  6. Load Address: 40008000

  7. Entry Point: 40008000

  8. Verifying Checksum ... OK

  9. ## Loading init Ramdisk from Legacy Image at 41000000 ...

  10. Image Name: ramdisk

  11. Image Type: ARM Linux RAMDisk Image (gzip compressed)

  12. Data Size: 2585838 Bytes = 2525 KiB

  13. Load Address: 00000000

  14. Entry Point: 00000000

  15. Verifying Checksum ... OK

  16. ## Flattened Device Tree blob at 42000000

  17. Booting using the fdt blob at 0x42000000

  18. Loading Kernel Image ... OK

  19. OK

  20. ## Loading init Ramdisk from Legacy Image at 41000000 ...

  21. Image Name: ramdisk

  22. Image Type: ARM Linux RAMDisk Image (gzip compressed)

  23. Data Size: 2585838 Bytes = 2525 KiB

  24. Load Address: 00000000

  25. Entry Point: 00000000

  26. Verifying Checksum ... OK

  27. Loading Ramdisk to 43a84000, end 43cfb4ee ... OK

  28. Loading Device Tree to 413f2000, end 413ff555 ... OK

  29.  
  30. Starting kernel ...

  31.  
  32. [ 0.000000] Booting Linux on physical CPU 0xa00

  33. [ 0.000000] Linux version 4.4.0 (root@book-virtual-machine) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #1 SMP PREEMPT Sun Jul 2 11:55:00 CST 2017

  34. [ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d

  35. [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache

  36. [ 0.000000] Machine model: FriendlyARM TINY4412 board based on Exynos4412

  37. [ 0.000000] cma: Reserved 64 MiB at 0x7bc00000

  38. [ 0.000000] Memory policy: Data cache writealloc

  39. [ 0.000000] Samsung CPU ID: 0xe4412011

  40. [ 0.000000] PERCPU: Embedded 12 pages/cpu @ef79c000 s18816 r8192 d22144 u49152

  41. [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260352

  42. [ 0.000000] Kernel command line: root=/dev/mmcblk0p1 rootfstype=ext4 console=ttySAC0,115200 init=/linuxrc ctp=2 skipcali=y loglevel=7

  43. [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)

  44. [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)

  45. [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)

  46. [ 0.000000] Memory: 961316K/1047552K available (5715K kernel code, 239K rwdata, 2020K rodata, 432K init, 315K bss, 20700K reserved, 65536K cma-reserved, 195584K highmem)

  47. [ 0.000000] Virtual kernel memory layout:

  48. [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)

  49. [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)

  50. [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)

  51. [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)

  52. [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)

  53. [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)

  54. [ 0.000000] .text : 0xc0008000 - 0xc0795eac (7736 kB)

  55. [ 0.000000] .init : 0xc0796000 - 0xc0802000 ( 432 kB)

  56. [ 0.000000] .data : 0xc0802000 - 0xc083de00 ( 240 kB)

  57. [ 0.000000] .bss : 0xc0840000 - 0xc088ec28 ( 316 kB)

  58. [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1

  59. [ 0.000000] Preemptible hierarchical RCU implementation.

  60. [ 0.000000] Build-time adjustment of leaf fanout to 32.

  61. [ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.

  62. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=4

  63. [ 0.000000] NR_IRQS:16 nr_irqs:16 16

  64. [ 0.000000] GIC physical location is 0x10490000

  65. [ 0.000000] L2C: platform modifies aux control register: 0x02070000 -> 0x3e470001

  66. [ 0.000000] L2C: platform provided aux values permit register corruption.

  67. [ 0.000000] L2C: DT/platform modifies aux control register: 0x02070000 -> 0x3e470001

  68. [ 0.000000] L2C-310 enabling early BRESP for Cortex-A9

  69. [ 0.000000] L2C-310: enabling full line of zeros but not enabled in Cortex-A9

  70. [ 0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled

  71. [ 0.000000] L2C-310 cache controller enabled, 16 ways, 1024 kB

  72. [ 0.000000] L2C-310: CACHE_ID 0x4100c4c8, AUX_CTRL 0x4e470001

  73. [ 0.000000] Exynos4x12 clocks: sclk_apll = 466666667, sclk_mpll = 800000000

  74. [ 0.000000] sclk_epll = 96000000, sclk_vpll = 108000000, arm_clk = 1400000000

  75. [ 0.000000] Switching to timer-based delay loop, resolution 41ns

  76. [ 0.000000] clocksource: mct-frc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns

  77. [ 0.000003] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns

  78. [ 0.000125] Console: colour dummy device 80x30

  79. [ 0.000138] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=120000)

  80. [ 0.000148] pid_max: default: 32768 minimum: 301

  81. [ 0.000215] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)

  82. [ 0.000222] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)

  83. [ 0.000596] CPU: Testing write buffer coherency: ok

  84. [ 0.000793] CPU0: thread -1, cpu 0, socket 10, mpidr 80000a00

  85. [ 0.001024] Setting up static identity map for 0x40008280 - 0x400082d8

  86. [ 0.045045] CPU1: thread -1, cpu 1, socket 10, mpidr 80000a01

  87. [ 0.060040] CPU2: thread -1, cpu 2, socket 10, mpidr 80000a02

  88. [ 0.075041] CPU3: thread -1, cpu 3, socket 10, mpidr 80000a03

  89. [ 0.075081] Brought up 4 CPUs

  90. [ 0.075093] SMP: Total of 4 processors activated (192.00 BogoMIPS).

  91. [ 0.075098] CPU: All CPU(s) started in SVC mode.

  92. [ 0.075616] devtmpfs: initialized

  93. [ 0.084885] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4

  94. [ 0.085179] lcd0-power-domain@10023C80 has as child subdomain: tv-power-domain@10023C20.

  95. [ 0.085542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns

  96. [ 0.087530] pinctrl core: initialized pinctrl subsystem

  97. [ 0.088329] NET: Registered protocol family 16

  98. [ 0.089749] DMA: preallocated 256 KiB pool for atomic coherent allocations

  99. [ 0.105005] cpuidle: using governor ladder

  100. [ 0.120000] cpuidle: using governor menu

  101. [ 0.120758] exynos-audss-clk 3810000.clock-controller: setup completed

  102. [ 0.157186] SCSI subsystem initialized

  103. [ 0.157551] usbcore: registered new interface driver usbfs

  104. [ 0.157627] usbcore: registered new interface driver hub

  105. [ 0.157707] usbcore: registered new device driver usb

  106. [ 0.158855] Advanced Linux Sound Architecture Driver Initialized.

  107. [ 0.159956] clocksource: Switched to clocksource mct-frc

  108. [ 0.169326] missing cooling_device property

  109. [ 0.169336] failed to build thermal zone cpu-thermal: -2

  110. [ 0.169438] NET: Registered protocol family 2

  111. [ 0.169823] TCP established hash table entries: 8192 (order: 3, 32768 bytes)

  112. [ 0.169883] TCP bind hash table entries: 8192 (order: 5, 163840 bytes)

  113. [ 0.170058] TCP: Hash tables configured (established 8192 bind 8192)

  114. [ 0.170135] UDP hash table entries: 512 (order: 2, 24576 bytes)

  115. [ 0.170163] UDP-Lite hash table entries: 512 (order: 2, 24576 bytes)

  116. [ 0.170308] NET: Registered protocol family 1

  117. [ 0.170515] RPC: Registered named UNIX socket transport module.

  118. [ 0.170522] RPC: Registered udp transport module.

  119. [ 0.170526] RPC: Registered tcp transport module.

  120. [ 0.170531] RPC: Registered tcp NFSv4.1 backchannel transport module.

  121. [ 0.170682] Trying to unpack rootfs image as initramfs...

  122. [ 0.171066] rootfs image is not initramfs (no cpio magic); looks like an initrd

  123. [ 0.178611] Freeing initrd memory: 2528K (c3a84000 - c3cfc000)

  124. [ 0.180220] futex hash table entries: 1024 (order: 4, 65536 bytes)

  125. [ 0.189910] romfs: ROMFS MTD (C) 2007 Red Hat, Inc.

  126. [ 0.190627] bounce: pool size: 64 pages

  127. [ 0.190639] io scheduler noop registered

  128. [ 0.190648] io scheduler deadline registered

  129. [ 0.190827] io scheduler cfq registered (default)

  130. [ 0.195804] dma-pl330 12680000.pdma: Loaded driver for PL330 DMAC-141330

  131. [ 0.195815] dma-pl330 12680000.pdma: DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32

  132. [ 0.198955] dma-pl330 12690000.pdma: Loaded driver for PL330 DMAC-141330

  133. [ 0.198966] dma-pl330 12690000.pdma: DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32

  134. [ 0.199872] dma-pl330 12850000.mdma: Loaded driver for PL330 DMAC-141330

  135. [ 0.199882] dma-pl330 12850000.mdma: DBUFF-64x8bytes Num_Chans-8 Num_Peri-1 Num_Events-32

  136. [ 0.258208] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled

  137. [ 0.259497] 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 44, base_baud = 0) is a S3C6400/10

  138. [ 0.893042] console [ttySAC0] enabled

  139. [ 0.897038] 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 45, base_baud = 0) is a S3C6400/10

  140. [ 0.905817] 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 46, base_baud = 0) is a S3C6400/10

  141. [ 0.914662] 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 47, base_baud = 0) is a S3C6400/10

  142. [ 0.924239] [drm] Initialized drm 1.1.0 20060810

  143. [ 0.938118] brd: module loaded

  144. [ 0.943226] loop: module loaded

  145. [ 0.944056] usbcore: registered new interface driver r8152

  146. [ 0.944186] usbcore: registered new interface driver asix

  147. [ 0.944901] usbcore: registered new interface driver ax88179_178a

  148. [ 0.950999] usbcore: registered new interface driver cdc_ether

  149. [ 0.956814] usbcore: registered new interface driver smsc75xx

  150. [ 0.962551] usbcore: registered new interface driver smsc95xx

  151. [ 0.968259] usbcore: registered new interface driver net1080

  152. [ 0.973900] usbcore: registered new interface driver cdc_subset

  153. [ 0.979802] usbcore: registered new interface driver zaurus

  154. [ 0.985391] usbcore: registered new interface driver cdc_ncm

  155. [ 0.991341] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

  156. [ 0.997448] ehci-exynos: EHCI EXYNOS driver

  157. [ 1.001740] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

  158. [ 1.007792] ohci-exynos: OHCI EXYNOS driver

  159. [ 1.012303] usbcore: registered new interface driver usb-storage

  160. [ 1.018477] mousedev: PS/2 mouse device common for all mice

  161. [ 1.024259] s3c-rtc 10070000.rtc: failed to find rtc source clock

  162. [ 1.029582] s3c-rtc: probe of 10070000.rtc failed with error -2

  163. [ 1.035678] i2c /dev entries driver

  164. [ 1.041008] device-mapper: ioctl: 4.34.0-ioctl (2015-10-28) initialised: dm-devel@redhat.com

  165. [ 1.048188] sdhci: Secure Digital Host Controller Interface driver

  166. [ 1.053518] sdhci: Copyright(c) Pierre Ossman

  167. [ 1.057990] Synopsys Designware Multimedia Card Interface Driver

  168. [ 1.065815] usbcore: registered new interface driver usbhid

  169. [ 1.069388] usbhid: USB HID core driver

  170. [ 1.076210] NET: Registered protocol family 10

  171. [ 1.078177] sit: IPv6 over IPv4 tunneling driver

  172. [ 1.082805] NET: Registered protocol family 17

  173. [ 1.086696] NET: Registered protocol family 15

  174. [ 1.091276] Registering SWP/SWPB emulation handler

  175. [ 1.097130] hctosys: unable to open rtc device (rtc0)

  176. [ 1.112737] ALSA device list:

  177. [ 1.112775] No soundcards found.

  178. [ 1.113484] RAMDISK: gzip image found at block 0

  179. [ 1.257012] EXT4-fs (ram0): mounted filesystem with o鋎ered data mode. Opts: (null)

  180. [ 1.257106] VFS: Mounted root (ext4 filesystem) on device 1:0.

  181.  
  182. Please press Enter to activate this console.

  183. [root@tiny4412 ]#

  184. [root@tiny4412 ]#

  185. [root@tiny4412 ]# ls

  186. bin etc linuxrc mnt root sys usr

  187. dev lib lost+found proc sbin tmp var



 

 

内核、uboot、文件系统文件下载:

http://download.csdn.net/detail/fengyuwuzu0519/9886548

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值