Linux-2.6.30内核的移植及调试运行

【开发的软件、硬件交代】

内核:linux-2.6.32.tar.gz  下载网址:http://kernel.org/pub/linux/kernel/v2.6/

补丁:2.6.32-at91.patch.gz   下载地址:http://maxim.org.za/at91_26.html

开发硬件平台:AT91RM9200 同为嵌入式开发板

【内核移植过程】

step1:下载内核极其补丁;我的 内核及补丁压缩包 是放在了LINUX操作系统主文件夹flymz/myprog/core文件下;

(郑重声明:下载的内核必须要和补丁是配套的)

step2:解压内核,打补丁;

DZ中输入:tar -zxvf myprog/core/linux-2.6.32.tar.gz进行内核解压

然后进入内核:cd linux-2.6.32

接着,打补丁:zcat ../myprog/core/2.6.32-at91rm.patch.gz | patch -p1

(附:若linux系统没有安装patch命令时,这里就会提示出错。所以要先安装个patch命令包,在ZDsudo apt-get install patch  安装好了就不会报错了)

step3:内核配置;

1)修改makefile文件

linux-2.6.32文件夹下的makefile修改如下:

183ARCH          ?= $(SUBARCH)

184CROSS_COMPILE ?=

修改为

183ARCH          ?= arm

184CROSS_COMPILE ?= /usr/local/arm/gcc-3.4.5/bin/arm-linux-    因为我采用的编译器为gcc-3.4.5,并且放在了 文件系统/usr/local/arm/gcc-3.4.5/bin

2)在ZD(以下都是在linux-2.6.32路径)make clean

3)然后:make at91rm9200dk_defconfig 进行默认配置

(附:若出现一些报错(这里错误就不列举出来了),可能是有些命令包有没有预先装好:在ZD(主文件夹路径)sudo apt-get install libncurse5 -dev  sudo apt-get install ncurses-devel

若出现以下错误:

由于该版本内核不支持dataflash,所以要干掉此项,如(4)所示:

4make menuconfig 进行更进一步的列表配置,主要是修改dataflash

步骤如下(图):

首先进入的界面如下:

 

下面主要就是将dataflash前面的那个 * 去掉——当光标移到 * 处时,按下空格就可以了,然后保存推出!下面的图描述的很清晰了.

 

4)接下来,make uImage 这里可能要耐心的等上几分钟。

(附:要是这里报错的话,可能又是些命令包没有装好,像 mkimage”命令包,在(主文件夹路径)ZD中:sudo apt-get install uboot-mkimage )

若出现如下信息,说明uImage已经成功的生成,并且位于linux-2.6.32/arch/arm/boot

 

【内核调试运行】

Step 1:烧到板子

将上次修改好的u-boot.bin文件和这次成功生成的uImage文件一起烧到板子;

u-boot.bin 地址:0x10000000

uImage 地址:0x10100000

 

step2:调试运行

(1)       打开超级终端,重启板子,会出现如下界面:

提示的bad CRC没有关系,是因为没有保存好环境变量。只要在该界面如下操作即可:

U-Boot>saveenv 

若出现如下提示信息,说明此时的u-boot没有问题了:

重启板子,会将不会再出现bad CRC的警告了,而是:

(2)       将内核复制到SDRAM

在界面中输入:

U-Boot> cp.b 10100000 20080000 200000 回车

(按位复制 待复制数据的起始地址 搬移到SDRAM中的内核地址 空间大小)

然后输入:

U-Boot> bootm 20080000 回车

(运行 内核起动地址)

若会出现一下信息,则说明内核移植成功了:

## Booting image at 20080000 ...                               

   Image Name:   Linux-2.6.32                             

   Image Type:   ARM Linux Kernel Image (uncompressed)                                                     

   Data Size:    1256944 Bytes =  1.2 MB                                       

   Load Address: 20008000                        

   Entry Point:  20008000                        

   Verifying Checksum ... OK                           

OK 

 

Starting kernel ...                  

 

Uncompressing Linux.............................................................                                                                                

.................... done, bootin                              

Linux version 2.6.32 (flymz@flymz-desktop) (gcc version 3.4.5) #1 Sun Jan 9 10:4                                                                                

7:09 CST 2011            

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177                                                       

CPU: VIVT data cache, VIVT instruction cache                                           

Machine: Atmel AT91RM9200-DK                           

Memory policy: ECC disabled, Data cache writeback                                                

Clocks: CPU 179 MHz, master 59 MHz, main 18.432 MHz                                                  

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128                                                                        

Kernel command line: mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root                                                                                

=/dev/ram0 rw            

PID hash table entries: 128 (order: -3, 512 bytes) instruction                    

pc : [<20008010>

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)p : 20eddb04  ip : 00000001  fp : 00000002                  

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)20eddfdc                                          

r7 : 00

Memory: 32MB = 32MB total: 00000000  r4 : 00000000

Memory: 26800KB available (2272K code, 190K data, 108K init, 0K highmem) r2 : 20000100  r1 : 000000fb  r0 : 20eddce8                           

SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1            

Resetting CPU ...                

 

 

 

U-Boot 1.1.6 (Jan 

Hierarchical RCU implementation.                     

 

DRAM:  1

NR_IRQS:192   

SST: S

AT91: 128 gpio irqs in 4 banks              

Flash:  8 MB 

Console: colour dummy device 80x30 

Out:   serial            

Err:

console [ttyS0] enabled cp.b 10100000 20080000

Calibrating delay loop... 89.53 BogoMIP   

U-Boot> bootm 200              

DRAM:  16 MB           

SST: SST3

TCP reno registered                  

NET: Registered protocol family 1Warning - bad CRC, using default

Trying to unpack rootfs image as initramfs...            

 

In:    serial            

Out

rootfs image is not initramfs (junk in compressed archive); looks like an initrd

Saving Environment to Flash...                             

Un-Protected 2 sec

 

Freeing initrd memory: 3072Ksing Flash...Erasing       

NetWinder Floating Point Emulator V0.97 (double precision)      

Erased 2 sectors               

Writing to Flash.

msgmni has been set to 58    

Protected 2 sectors

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252):33)                                     

 

DRAM:  16 MB           

 

io scheduler noop registered                      

Flas

io scheduler anticipatory registered (default)

Out:   serial            

Err:   serial    

at91_spi: Baud rate                   

at91_ohci at91_ohci: irq 23, io mem 0x00300000                                  

Clocks: CP

usb usb1: New USB device found, idVendor=1d6b, idProduct=0001                 

Built 1 zonelists in Zone order, mobilit 

usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 console=ttyS0,115200 initrd=0x20410000,3145728 root             

usb usb1: Product: AT91 OHCI                           

usb usb1: Manufacturer: Linux 2.6.32 ohci_hcd92          

AT91: 128 gpio irqs in 4 banks

usb usb1: SerialNumber: at91

PID hash table entries: 64

usb usb1: configuration #1 chosen from 1 choice                    

Console: colour dummy dev

hub 1-0:1.0: USB hub found               

console [

console [

NET: Registered protocol family 17

at91_rtc at91_rtc: setting system clock to 1998-01-01 00:12:45 UTC (883613565)

RAMDISK: Couldn't find valid RAM disk image starting at 0.

List of all partitions:

No filesystem could mount root, tried:  ext2 cramfs

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

Backtrace:

[] (dump_backtrace+0x0/0x104) from [] (dump_stack+0x18/0x1c)

 

 r7:c1c12000 r6:c02748ac r5:ffffffea r4:c1c23f60

[] (dump_stack+0x0/0x1c) from [] (panic+0x40/0x11c)

[] (panic+0x0/0x11c) from [] (mount_block_root+0x260/0x2b4)

 r3:00000000 r2:80000000 r1:c1c23f60 r0:c022a410

[] (mount_block_root+0x0/0x2b4) from [] (mount_root+0x54/0x6

c)

[] (mount_root+0x0/0x6c) from [] (prepare_namespace+0x170/0x

1d0)

 r5:c002180c r4:c02745f4

[] (prepare_namespace+0x0/0x1d0) from [] (kernel_init+0xd8/0

x10c)

 r5:c0020b0c r4:c02743d8

[] (kernel_init+0x0/0x10c) from [] (do_exit+0x0/0x59c)

 r5:00000000 r4:00000000

接下来将进行文件系统的学习了,加油!

 

                                                                             By :flymz  09/01/2011  

                                                                             请注明出处,珍惜他人劳动成果!谢谢合作!

说明:实在是悲剧,图片全部没有上的了,感兴趣的可以进我的新浪博客,有图有真相!

http://blog.sina.com.cn/u/1588992452

你可能感兴趣的:(Linux-2.6.30内核的移植及调试运行)