Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4611811
  • 博文数量: 385
  • 博客积分: 21208
  • 博客等级: 上将
  • 技术积分: 4393
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-30 13:40
文章分类

全部博文(385)

文章存档

2015年(1)

2014年(3)

2012年(16)

2011年(42)

2010年(1)

2009年(2)

2008年(34)

2007年(188)

2006年(110)

分类: LINUX

2007-01-16 13:40:16

自从移植了uboot,当然不是我写的移植代码, 呵呵,成功引导之后,对uboot爱不释手
参看了luofuchong大侠的贴




成功记录如下:
hujun2410=> printenv
bootdelay=8
baudrate=115200
ethaddr=00:00:C0:FF:EE:08
ipaddr=59.69.75.186
serverip=59.69.74.87
netmask=255.0.0.0
bootfile="zImage"
bootargs=console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/myroot_nfs ip=5fbootcmd=tftp 30008000 zImage;go 30008000
stdin=serial
stdout=serial
stderr=serial
                                                                                  
Environment size: 366/65532 bytes


第一次:
hujun2410=> tftp 31000000 zImage.img
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'zImage.img'.
Load address: 0x31000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
done
Bytes transferred = 1326664 (143e48 hex)
hujun2410=> bootm  31000000
## Booting image at 31000000 ...
   Image Name:   UnCompressed Linux Kernel-2.6.14
   Created:      2007-01-15  21:02:09 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1326600 Bytes =  1.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
hdr->ih_load=30008000,data=31000040
OK
boot linux
                                                                                   
Starting kernel ...
                                                                                  
Uncompressing Linux................................................................Linux version 2.6.14 (root@hujunlinux) (gcc version 3.4.1) #13 Sun Jan 14 15:42:577CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/myrfirq: clearing pending ext status 00000800

NET: Registered protocol family 1
IP-Config: Complete:
      device=eth0, addr=59.69.74.199, mask=255.0.0.0, gw=59.69.74.1,
     host=matrix4, domain=, nis-domain=arm9.net,
     bootserver=59.69.74.87, rootserver=59.69.74.87, rootpath=
Looking up port of RPC 100003/2 on 59.69.74.87
Looking up port of RPC 100005/1 on 59.69.74.87
VFS: Mounted root (nfs filesystem).
Mounted devfs on /dev
Freeing init memory: 112K
                                                                                  
Please press Enter to activate this console.
                                                                                  
                                                                                  
BusyBox v1.2.1 (2007.01.13-23:04+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
                                                                                  
[root@hjembed /]#

hujun2410=> imi 31000000
                                                                                  
## Checking Image at 31000000 ...
   Image Name:   UnCompressed Linux Kernel-2.6.14
   Created:      2007-01-15  21:02:09 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1326600 Bytes =  1.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum .. OK
  
  
   第二次:
  
[root@hujunlinux tftpboot]# ./mkimage -n "uboot ramdisk filesystem" \
> -A arm  -O linux -T ramdisk  -C gzip  -d today.ramfs.gz  today.uboot.ramfs.gz
Image Name:   uboot ramdisk filesystem
Created:      Tue Jan 16 12:59:49 2007
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    2836874 Bytes = 2770.38 kB = 2.71 MB
Load Address: 0x00000000
Entry Point:  0x00000000
[root@hujunlinux tftpboot]# ./mkimage -l today.uboot.ramfs.gz
Image Name:   uboot ramdisk filesystem
Created:      Tue Jan 16 12:59:49 2007
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    2836874 Bytes = 2770.38 kB = 2.71 MB
Load Address: 0x00000000
Entry Point:  0x00000000
[root@hujunlinux tftpboot]#

  
  
   hujun2410=> tftp 31000000  zImage.img
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'zImage.img'.
Load address: 0x31000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
done
Bytes transferred = 1326664 (143e48 hex)
hujun2410=> tftp 30800000 today.uboot.ramfs.gz
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'today.uboot.ramfs.gz'.
Load address: 0x30800000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###################################
done
Bytes transferred = 2836938 (2b49ca hex)
hujun2410=> bootm 31000000  30800000
## Booting image at 31000000 ...
   Image Name:   UnCompressed Linux Kernel-2.6.14
   Created:      2007-01-15  21:02:09 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1326600 Bytes =  1.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
hdr->ih_load=30008000,data=31000040
OK
boot linux
## Loading Ramdisk Image at 30800000 ...
   Image Name:   uboot ramdisk filesystem
   Created:      2007-01-16  17:59:49 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2836874 Bytes =  2.7 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
                                                                                  
Starting kernel ...
                                                                                  
Uncompressing Linux................................................................Linux version 2.6.14 (root@hujunlinux) (gcc version 3.4.1) #13 Sun Jan 14 15:42:577CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/myrfirq: clearing pending ext status 00000800
irq: clearing subpending status 00000002
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
.....

IP-Config: Complete:
      device=eth0, addr=59.69.74.199, mask=255.0.0.0, gw=59.69.74.1,
     host=matrix4, domain=, nis-domain=arm9.net,
     bootserver=59.69.74.87, rootserver=59.69.74.87, rootpath=
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
Mounted devfs on /dev
                                                                                  
Please press Enter to activate this console.


第三次:

 hujun2410=> tftp 31000000 zImage.img
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'zImage.img'.
Load address: 0x31000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
done
Bytes transferred = 1326664 (143e48 hex)
hujun2410=> tftp 33000000 today.uboot.ramfs.gz
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'today.uboot.ramfs.gz'.
Load address: 0x33000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###################################
done
Bytes transferred = 2836938 (2b49ca hex)
hujun2410=> bootm 31000000 33000000
## Booting image at 31000000 ...
   Image Name:   UnCompressed Linux Kernel-2.6.14
   Created:      2007-01-15  21:02:09 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1326600 Bytes =  1.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
hdr->ih_load=30008000,data=31000040
OK
boot linux
## Loading Ramdisk Image at 33000000 ...
   Image Name:   uboot ramdisk filesystem
   Created:      2007-01-16  17:59:49 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2836874 Bytes =  2.7 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
                                                                                  
Starting kernel ...
                                                                                  
Uncompressing Linux................................................................Linux version 2.6.14 (root@hujunlinux) (gcc version 3.4.1) #13 Sun Jan 14 15:42:577CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/myrfirq: clearing pending ext status 00000800

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

NET: Registered protocol family 1
IP-Config: Complete:
      device=eth0, addr=59.69.74.199, mask=255.0.0.0, gw=59.69.74.1,
     host=matrix4, domain=, nis-domain=arm9.net,
     bootserver=59.69.74.87, rootserver=59.69.74.87, rootpath=
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
Mounted devfs on /dev
                                                                                  
Please press Enter to activate this console.

总结:
1. bootm的作用是可以加载用uboot工具制作的kernel 和ramdisk ,这个工具就是uboot/tools/mkimage
利用他,可以 gz, bzip2, none等压缩方式压缩kernel 和ramdisk.,mkimage 在压缩时在起头部加入了0x40
字节的校验码。 所以在bootm源码中, 先从头部取出64个字节来校验, 如通过校验,再将其后面的内容
搬到内存a处,再从a处读取,启动内核。

这里要说一下,ramdisk,也可以说是我的一个发现, 刚开始用bootm成功启动是很偶然的,碰巧我
设置的参数是用nfs启动,后来试了几次,老是不行,加载ramdisk时,说Bad Magic Number
幸好我勤于记录, 才发现刚才成功了是因为用nfs启动的,猜想出现这个情况很可能与kernel类似,
因为之前我看uboot/readme有点印象。

果然 ,看了一下readme,才发现ramdisk也要用mkimage  才行。

如果你不用ramdisk作为根文件系统, 那就不用这个了。


2.kernel加载的地址是30008000, 是不能改的, 这个在include/configs/smdk2410.h中作了定义,
#define    CFG_LOAD_ADDR        0x30008000    /* default load address    */

你可以修改试试。

 将ramdisk映像下载到内存的位置,可以不是0x30800000  ,可以自己指定。


3:uboot 可以自我更新 ,这是我以前所没有发现的,现在想来vivi中应该也可以的,是一个道理嘛
改天试试,先记录如下:

U-Boot 1.1.4 (Jan 16 2007 - 10:48:42)
                                                                                
U-Boot code: 33F80000 -> 33F9DAF4  BSS: -> 33FA2164
RAM Configuration:
Bank #0: 30000000 64 MB
Nor Flash:  0 kB
Nand Flash:    64 MB
                                                                                
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
hujun2410=> tftp 30005000  u-boot.bin.debug
TFTP from server 59.69.74.87; our IP address is 59.69.75.186
Filename 'u-boot.bin.debug'.
Load address: 0x30005000
Loading: ########################
done
Bytes transferred = 121840 (1dbf0 hex)
hujun2410=> nand erase 0  20000
                                                                                
NAND erase: device 0 offset 0, size 131072 ... OK
hujun2410=> nand write 30005000  0  20000
                                                                                
NAND write: device 0 offset 0, size 131072 ...  131072 bytes written: OK
hujun2410=> reset
                                                                                
U-Boot 1.1.4 (Jan 16 2007 - 11:05:02)
                                                                                
U-Boot code: 33F80000 -> 33F9DBF0  BSS: -> 33FA2260
RAM Configuration:
Bank #0: 30000000 64 MB
                                                                                
-------------------todaygood debug ----------------
Nor Flash:  0 kB
Nand Flash:    64 MB
                                                                                
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
hujun2410=>


这样一来,可比用并口烧写bootloader 快多了。







  
  
  

 
阅读(6936) | 评论(0) | 转发(1) |
0

上一篇:2.6 下的ramdisk

下一篇:了解s3c2410系列 MMU

给主人留下些什么吧!~~