从零开始之十一、移植linux3.16.57内核(一、linux内核移植)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_16777851/article/details/82050417

本想新开一个题目的,但又想到,内核和文件系统的移植应该只有两篇文章,所以索性就在这里直接续下去。

https://www.kernel.org/

首先下载内核,先看一下比较新4.x的能不能用

我下载了一个4.1.40版本的

打开顶层Makefile,搜索找到 CROSS_COMPILE

按上图所示,注释掉SUBARCH,修改ARCH和CROSS_COMPILE

搜索找到s5pv210_defconfig,然后make 默认配置

修改调试串口

make menuconfig

1.顶层找到,kernel hacking

2.他默认调试串口是0,我们要选择成2

3.选择成2,后make uImage

4.说我们没LOADADDR地址,load地址就是uIamge生成时头部的load地址信息

5.添加LOADADDR编译

 make uImage -j4 LOADADDR=0x30008000

6.拷贝到tftp服务器,使用uboot下载启动

可以启动,出来内核的打印信息,说明我们的bootm命令是正确的,但因为新的kernel的传参只支持设备树方式,所以

这边启动失败。

因为我的设备树还没学习,所以,使用一个3.x版本的支持tag方式传参的内核来启动。

经过测试,3.x后期的也是只支持设备树方式传参,所以我选择一个3.x早期的linux-3.16.57

新的压缩格式非bz2和gz   xz解压使用Jxf,注意这里的J是大写

tar Jxvf linux-3.16.57.tar.xz 

重复上面步骤。

配置值完串口后,增加一步,配置板子

1.选择System Type,进入

2.去掉C110支持的machies

210,我们也只支持SMDKV210

3.修改zImage的解压地址

因为我们s5pv210_defconfig没有打开这个宏,所以我我们要指定解压地址

这个宏的作用是自动设置解压重定位地址。

     .text
 #ifdef CONFIG_AUTO_ZRELADDR
        @ determine final kernel image address
        mov r4, pc
        and r4, r4, #0xf8000000
        add r4, r4, #TEXT_OFFSET
 #else
        ldr r4, =zreladdr
 #endif

我们没是能zh'g这个宏,所以要手动配置zreladdr参数

这个参数在下面文件

arch/arm/mach-s5pv210/Makefile.boot 

可以看到,解压地址是0x20008000,因为我我们的DDR是从0x30000000开始的所以对传参和解压地址都要 更改。

修改后

编译生成uImage

make uImage -j4

这次是一次ok,没有让我们输入LOADADDR,主要原因就是我们在mach文件夹里面的Makefile.boot里面已经制定了。

可以看到,uImage的头信息就是我们指定的。

使用uboot的tftpboot 下载启动尝试启动,这次我们终于看到比较多的打印信息,说明已经差不多了。

SMDKV210 # bootm 30008000 
## Booting kernel from Legacy Image at 30008000 ...
   Image Name:   Linux-3.16.57
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1382344 Bytes = 1.3 MiB
   Load Address: 30008000
   Entry Point:  30008000
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.16.57 (run@ubuntu) (gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors) ) #1 PREEMPT Sat Aug 25 15:28:17 CST 2018
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: SMDKV210
Memory policy: Data cache writeback
CPU S5PV210/S5PC110 (id 0x43110220)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S5PV210: PLL settings, A=1000000000, M=667000000, E=96000000 V=54000000
S5PV210: ARMCLK=1000000000, HCLKM=200000000, HCLKD=166750000
HCLKP=133400000, PCLKM=100000000, PCLKD=83375000, PCLKP=66700000
sclk_dmc: source is mout_mpll (1), rate is 166750000
sclk_onenand: source is hclk_dsys (1), rate is 166750000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_cam0: source is ext_xtal (0), rate is 24000000
sclk_cam1: source is ext_xtal (0), rate is 24000000
sclk_fimd: source is ext_xtal (0), rate is 24000000
sclk_mfc: source is sclk_a2m (0), rate is 200000000
sclk_g2d: source is sclk_a2m (0), rate is 200000000
sclk_g3d: source is sclk_a2m (0), rate is 200000000
sclk_csis: source is ext_xtal (0), rate is 24000000
sclk_pwi: source is ext_xtal (0), rate is 24000000
sclk_pwm: source is ext_xtal (0), rate is 24000000
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 128000
Kernel command line: root=/dev/nfs nfsroot=192.168.0.107:/home/run/work/rootfs/rootfs ip=192.168.0.20:192.168.0.107:192.168.0.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 508664K/516096K available (1837K kernel code, 163K rwdata, 568K rodata, 107K init, 200K bss, 7432K reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0xa0800000 - 0xff000000   (1512 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x80261738   (2406 kB)
      .init : 0x80262000 - 0x8027ccac   ( 108 kB)
      .data : 0x8027e000 - 0x802a6f20   ( 164 kB)
       .bss : 0x802a6f2c - 0x802d901c   ( 201 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:208
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
VIC @f6020000: id 0x00041192, vendor 0x41
VIC @f6030000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 128784626658ns
Console: colour dummy device 80x30
Calibrating delay loop... 997.78 BogoMIPS (lpj=2494464)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x301c29c8 - 0x301c2a20
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
futex hash table entries: 256 (order: 0, 7168 bytes)
DMA: preallocated 256 KiB pool for atomic coherent allocations
S3C Power Management, Copyright 2004 Simtec Electronics
S5PV210: Initializing architecture
SCSI subsystem initialized
Switched to clocksource samsung_clocksource_timer
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 dma-pl330.0: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.0:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
dma-pl330 dma-pl330.1: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.1:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 74, base_baud = 0) is a S3C6400/10
s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 75, base_baud = 0) is a S3C6400/10
s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 76, base_baud = 0) is a S3C6400/10
console [ttySAC2] enabled
s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 77, base_baud = 0) is a S3C6400/10
brd: module loaded
loop: module loaded
mousedev: PS/2 mouse device common for all mice
VFS: Cannot open root device "nfs" or unknown-block(0,255): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.16.57 #1
[<80012dd0>] (unwind_backtrace) from [<80011080>] (show_stack+0x10/0x14)
[<80011080>] (show_stack) from [<801bd660>] (panic+0xa0/0x20c)
[<801bd660>] (panic) from [<80263220>] (mount_block_root+0x25c/0x2d8)
[<80263220>] (mount_block_root) from [<80263580>] (prepare_namespace+0x19c/0x1d0)
[<80263580>] (prepare_namespace) from [<80262e1c>] (kernel_init_freeable+0x1b4/0x1c0)
[<80262e1c>] (kernel_init_freeable) from [<801bcf50>] (kernel_init+0x8/0xe8)
[<801bcf50>] (kernel_init) from [<8000e4e0>] (ret_from_fork+0x14/0x34)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)

从出错位置看到是VFS死掉,因为我们现在是即没有初始化网卡,也没配置nfs网络文件系统,所以肯定死掉。

一个一个解决。

1.配置网卡驱动。

打开平台相关的数据。

vi arch/arm/mach-s5pv210/mach-smdkv210.c 

因为smdkv210本身就是支持dm9000的,所以我们只要修改一下参数就可以了。

可以看到它使用的SROM的BANK5  数据线是ADDR1,中断引脚是9.这些我们都要改掉。

打开寄存器地址

 vi arch/arm/mach-s5pv210/include/mach/map.h 

可以看到SDRAM地址有问题,

修改后

引脚,SROM寄存器初始化,因为我们在uboot中已经初始化过了,这里可以不用再次初始化(再次初始化也没关系)

这里就不浪费时间一个一个分析了了,具体看uboot中的初始化。

2.支持网络功能

可以看到,之前的默认是不支持任何网络配置的

这里先选中Networking support

先进入 Networking options  --->

默认是什么都没选择的

选择下面的一些基本配置

现在是支持网络了,我们还需要让支持DM9000网卡

返回顶层,进入设备驱动Device Drivers  ---> 

选中网络设备支持

进入Ethernet driver support (NEW)  --->        

选中DM9000 support (NEW),其他网卡我们没有,所以全部去掉

因为我们常用网络文件系统做开发,所以增加网络文件系统配置

回到顶层进入File systems 

选中并进入Network File Systems  --->  

我们选择nfs根文件系统和客户端支持

好了,保存编译,尝试启动。

因为我电脑上已经搭建好nfs服务器和网络文件系统,所以可以直接尝试。

没搭建的小伙伴,我下一节记录制作一个网络文件系统的步骤。

可以看我一节的博客后再继续看这里。

SD checksum Error


U-Boot 2017.01 (Aug 25 2018 - 01:57:42 +0800)

CPU:   S5PC110 @ 1 GHz
Model: Samsung Goni based on S5PC110
Board:  SMDKV210
DRAM:  512 MiB
MMC:   SAMSUNG SDHCI: 0, SAMSUNG SDHCI: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Hit any key to stop autoboot:  0 
SMDKV210 # tftpboot 30008000 uImage
dm9000 i/o: 0x88000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:19:d3:ff:ff:ff
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.0.107; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30008000
Loading: #################################################################
         ##############################
         682.6 KiB/s
done
Bytes transferred = 1382408 (151808 hex)
SMDKV210 # bootm 30008000
## Booting kernel from Legacy Image at 30008000 ...
   Image Name:   Linux-3.16.57
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1382344 Bytes = 1.3 MiB
   Load Address: 30008000
   Entry Point:  30008000
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.16.57 (run@ubuntu) (gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors) ) #1 PREEMPT Sat Aug 25 16:41:35 CST 2018
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: SMDKV210
Memory policy: Data cache writeback
CPU S5PV210/S5PC110 (id 0x43110220)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S5PV210: PLL settings, A=1000000000, M=667000000, E=96000000 V=54000000
S5PV210: ARMCLK=1000000000, HCLKM=200000000, HCLKD=166750000
HCLKP=133400000, PCLKM=100000000, PCLKD=83375000, PCLKP=66700000
sclk_dmc: source is mout_mpll (1), rate is 166750000
sclk_onenand: source is hclk_dsys (1), rate is 166750000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_cam0: source is ext_xtal (0), rate is 24000000
sclk_cam1: source is ext_xtal (0), rate is 24000000
sclk_fimd: source is ext_xtal (0), rate is 24000000
sclk_mfc: source is sclk_a2m (0), rate is 200000000
sclk_g2d: source is sclk_a2m (0), rate is 200000000
sclk_g3d: source is sclk_a2m (0), rate is 200000000
sclk_csis: source is ext_xtal (0), rate is 24000000
sclk_pwi: source is ext_xtal (0), rate is 24000000
sclk_pwm: source is ext_xtal (0), rate is 24000000
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 128000
Kernel command line: root=/dev/nfs nfsroot=192.168.0.107:/home/run/work/rootfs/rootfs ip=192.168.0.20:192.168.0.107:192.168.0.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 508664K/516096K available (1837K kernel code, 163K rwdata, 568K rodata, 107K init, 200K bss, 7432K reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0xa0800000 - 0xff000000   (1512 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x80261738   (2406 kB)
      .init : 0x80262000 - 0x8027ccac   ( 108 kB)
      .data : 0x8027e000 - 0x802a6f20   ( 164 kB)
       .bss : 0x802a6f2c - 0x802d901c   ( 201 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:208
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
VIC @f6020000: id 0x00041192, vendor 0x41
VIC @f6030000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 128784626658ns
Console: colour dummy device 80x30
Calibrating delay loop... 997.78 BogoMIPS (lpj=2494464)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x301c29c8 - 0x301c2a20
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
futex hash table entries: 256 (order: 0, 7168 bytes)
DMA: preallocated 256 KiB pool for atomic coherent allocations
S3C Power Management, Copyright 2004 Simtec Electronics
S5PV210: Initializing architecture
SCSI subsystem initialized
Switched to clocksource samsung_clocksource_timer
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 dma-pl330.0: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.0:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
dma-pl330 dma-pl330.1: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.1:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 74, base_baud = 0) is a S3C6400/10
s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 75, base_baud = 0) is a S3C6400/10
s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 76, base_baud = 0) is a S3C6400/10
console [ttySAC2] enabled
s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 77, base_baud = 0) is a S3C6400/10
brd: module loaded
loop: module loaded
mousedev: PS/2 mouse device common for all mice
VFS: Cannot open root device "nfs" or unknown-block(0,255): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.16.57 #1
[<80012dd0>] (unwind_backtrace) from [<80011080>] (show_stack+0x10/0x14)
[<80011080>] (show_stack) from [<801bd660>] (panic+0xa0/0x20c)
[<801bd660>] (panic) from [<80263220>] (mount_block_root+0x25c/0x2d8)
[<80263220>] (mount_block_root) from [<80263580>] (prepare_namespace+0x19c/0x1d0)
[<80263580>] (prepare_namespace) from [<80262e1c>] (kernel_init_freeable+0x1b4/0x1c0)
[<80262e1c>] (kernel_init_freeable) from [<801bcf50>] (kernel_init+0x8/0xe8)
[<801bcf50>] (kernel_init) from [<8000e4e0>] (ret_from_fork+0x14/0x34)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)

SD checksum Error


U-Boot 2017.01 (Aug 25 2018 - 01:57:42 +0800)

CPU:   S5PC110 @ 1 GHz
Model: Samsung Goni based on S5PC110
Board:  SMDKV210
DRAM:  512 MiB
MMC:   SAMSUNG SDHCI: 0, SAMSUNG SDHCI: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Hit any key to stop autoboot:  0 
SMDKV210 # tftpboot 30008000 uImage
dm9000 i/o: 0x88000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:19:d3:ff:ff:ff
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.0.107; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30008000
Loading: #################################################################
         #################################################################
         ########
         615.2 KiB/s
done
Bytes transferred = 2022584 (1edcb8 hex)
SMDKV210 # b
  base bdinfo boot bootd bootm bootp
SMDKV210 # bootm 30008000
## Booting kernel from Legacy Image at 30008000 ...
   Image Name:   Linux-3.16.57
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2022520 Bytes = 1.9 MiB
   Load Address: 30008000
   Entry Point:  30008000
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.16.57 (run@ubuntu) (gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors) ) #2 PREEMPT Sat Aug 25 16:52:51 CST 2018
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: SMDKV210
Memory policy: Data cache writeback
CPU S5PV210/S5PC110 (id 0x43110220)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S5PV210: PLL settings, A=1000000000, M=667000000, E=96000000 V=54000000
S5PV210: ARMCLK=1000000000, HCLKM=200000000, HCLKD=166750000
HCLKP=133400000, PCLKM=100000000, PCLKD=83375000, PCLKP=66700000
sclk_dmc: source is mout_mpll (1), rate is 166750000
sclk_onenand: source is hclk_dsys (1), rate is 166750000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_fimc: source is ext_xtal (0), rate is 24000000
sclk_cam0: source is ext_xtal (0), rate is 24000000
sclk_cam1: source is ext_xtal (0), rate is 24000000
sclk_fimd: source is ext_xtal (0), rate is 24000000
sclk_mfc: source is sclk_a2m (0), rate is 200000000
sclk_g2d: source is sclk_a2m (0), rate is 200000000
sclk_g3d: source is sclk_a2m (0), rate is 200000000
sclk_csis: source is ext_xtal (0), rate is 24000000
sclk_pwi: source is ext_xtal (0), rate is 24000000
sclk_pwm: source is ext_xtal (0), rate is 24000000
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 128000
Kernel command line: root=/dev/nfs nfsroot=192.168.0.107:/home/run/work/rootfs/rootfs ip=192.168.0.20:192.168.0.107:192.168.0.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 507416K/516096K available (2753K kernel code, 197K rwdata, 804K rodata, 129K init, 240K bss, 8680K reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0xa0800000 - 0xff000000   (1512 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x803818dc   (3559 kB)
      .init : 0x80382000 - 0x803a246c   ( 130 kB)
      .data : 0x803a4000 - 0x803d5400   ( 197 kB)
       .bss : 0x803d540c - 0x80411700   ( 241 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:208
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
VIC @f6020000: id 0x00041192, vendor 0x41
VIC @f6030000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 128784626658ns
Console: colour dummy device 80x30
Calibrating delay loop... 997.78 BogoMIPS (lpj=2494464)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x302a1670 - 0x302a16c8
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
futex hash table entries: 256 (order: 0, 7168 bytes)
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
S3C Power Management, Copyright 2004 Simtec Electronics
S5PV210: Initializing architecture
SCSI subsystem initialized
Switched to clocksource samsung_clocksource_timer
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 4, 81920 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 12288 bytes)
UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 dma-pl330.0: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.0:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
dma-pl330 dma-pl330.1: Loaded driver for PL330 DMAC-267056
dma-pl330 dma-pl330.1:  DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 74, base_baud = 0) is a S3C6400/10
s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 75, base_baud = 0) is a S3C6400/10
s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 76, base_baud = 0) is a S3C6400/10
console [ttySAC2] enabled
s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 77, base_baud = 0) is a S3C6400/10
brd: module loaded
loop: module loaded
eth0: dm9000b at a085a000,a085c004 IRQ 42 MAC: 00:09:c0:ff:ec:48 (platform data)
mousedev: PS/2 mouse device common for all mice
TCP: cubic registered
NET: Registered protocol family 17
dm9000 dm9000 eth0: link down
dm9000 dm9000 eth0: link down
IP-Config: Complete:
     device=eth0, hwaddr=00:09:c0:ff:ec:48, ipaddr=192.168.0.20, mask=255.255.255.0, gw=192.168.0.1
dm9000 dm9000 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
     host=192.168.0.20, domain=, nis-domain=(none)
     bootserver=192.168.0.107, rootserver=192.168.0.107, rootpath=
VFS: Mounted root (nfs filesystem) on device 0:10.
Freeing unused kernel memory: 128K (80382000 - 803a2000)

Please press Enter to activate this console. 

可以看到已经可以正常使用了

这里补充一个点:

上一节我们分析的bootm中国,如果我们直接加载到内存的地址就是zImage将要运行的地址就是XIP,即不再搬移。

而如果我们下载的地址不是zImage的load加载地址,则uboot要负责搬移。

这里我们做一个小实验来验证一下。

通过上一节课我们知道了,uImage是zImage前面加64字节的hdr.

所以下载uImage到0x30007fc0,zImage起始就在0x30008000地址就是XIP地址了。

既然uboot会搬移zImage,是不是下载到ddr的任何位置都可以啊(前提是不能覆盖掉uboot本身)

我们做两个实验,分贝下载到0x30000000和0x40000000启动  

可见uboot根据uImage的头信息做的事情还是比较有作用的。

为了每次uboot开机后都让我们不用手动敲下载命令,我就直接把启动命令bootcmd命令写到代码中。

注释掉goni开发板原有的,增加我们的

#define CONFIG_BOOTCOMMAND  "tftpboot 0x30007fc0 uImage;bootm 0x30007fc0"

这里使用0x30007fc0的原因前面也看到来,这个位置可以uboot中不用再次搬移zImage,即可以提高启动时间

可以看到是自动开机就下载,没输入任何命令。

后面有时间我再修改别的命令,如MTD分区等。

所有的命令都属用到了,查看它的help说明,然后根据自己需要群殴需要修改。

猜你喜欢

转载自blog.csdn.net/qq_16777851/article/details/82050417