Chinaunix首页 | 论坛 | 博客
  • 博客访问: 315447
  • 博文数量: 22
  • 博客积分: 186
  • 博客等级: 入伍新兵
  • 技术积分: 1091
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-12 19:54
文章存档

2022年(1)

2020年(1)

2018年(1)

2013年(10)

2012年(9)

分类: LINUX

2013-01-15 22:28:47

    N年前一次烧写新打包的rootfs出错,今天偶然看到当时的笔记,顺便整理了下,把uboot下手工更新rootfs的方法记录一下,过程比较简单。硬件平台hi3510/ARM,存储媒介是可以直接启动的norflash,操作系统版本linux-2.6.14,根文件系统rootfs直接采用jffs2类型的日志文件系统(比较适合norflash),bootloader使用u-boot。

 

1.  烧录过程
    先设置好server pc IP地址,是192.168.1.101,目标板IP address 是192.168.1.112。
hiaboloo # tftp 60570000 rootbox.jffs2
hiaboloo # protect off 34300000 34efffff               //地址不对将会报错,如下所示。
hiaboloo # erase 34300000 34efffff 
hiaboloo # cp.b 60570000 34300000 3dc720        //0x3dc720是我制作的rootfs的大小,根据tftp的结果
hiaboloo # protect on 34300000 34efffff

    填写地址不对时报错:

hiaboloo # protect off 34300000 34f00000
Error: end address not on sector boundary            //注意顶部地址减1

    烧写出错时的串口输出:

Empty flash at 0x0000fffc ends at 0x00010000
CLEANMARKER node found at 0x00010000, not first node in block (0x00000000)
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002de94: 0xa2ef instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002de98: 0x4df7 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002de9c: 0xf7a2 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002dea0: 0xbe5f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002dea4: 0xe5ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002dea8: 0x57e9 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002deac: 0x59f6 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002deb0: 0xc87f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002deb4: 0xff77 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002deb8: 0x6bae instead
Further such events for this erase block will not be printed
Empty flash at 0x0002fffc ends at 0x00030000
CLEANMARKER node found at 0x00030000, not first node in block (0x00020000)
Empty flash at 0x0004ff88 ends at 0x00050000
CLEANMARKER node found at 0x00050000, not first node in block (0x00040000)
Empty flash at 0x0006ff5c ends at 0x00070000
CLEANMARKER node found at 0x00070000, not first node in block (0x00060000)

//……中间略去N行

Empty flash at 0x003cfffc ends at 0x003d0000
CLEANMARKER node found at 0x003d0000, not first node in block (0x003c0000)
Eep. Child "index.html" (ino #3870) of dir ino #3843 doesn't exist!
Child dir "modules" (ino #270) of dir ino #8 appears to be a hard link
Child dir "2.6.14-hi3510_v100_p01_dvs_b01" (ino #271) of dir ino #270 appears to be a hard link


 

2.  调试重烧录
    看看与server pc的网络连通情况:
hiaboloo # ping 192.168.1.101
Using Up port.
SFBuf: 0x60580000 - 0x605CBFFF
MAC:   00-00-00-00-00-02
Configuring network: >>>>>>>+++
host 192.168.1.101 is alive

    与server pc的网络连通OK。后来发现自己做的rootbox.jffs2有问题!重新烧录:

HiBoot 1.1.2.1 (Dec 12 2007 - 15:18:04)

HiBoot code: 60500000 -> 60519E94  BSS: -> 60564360
RAM Configuration:
Bank #0: 60000000 32 MB
Flash: 16 MB
LOGO disabled.
In:    serial
Out:   serial
Err:   serial
MAC:   00-00-00-00-00-02
Watchdog disabled by default!
Hit any key to stop autoboot:  0

hiaboloo # erase 34300000 34efffff
Erased 96 sectors

hiaboloo # tftp 60600000 rootbox.jffs2
Using Up port.
SFBuf: 0x60580000 - 0x605CBFFF
MAC:   00-00-00-00-00-02
Configuring network: >>>>>>>+++
TFTP from server 192.168.1.101; our IP address is 192.168.1.112
Download Filename 'rootbox.jffs2'.
Download to address: 0x60600000
Downloading: %#####################################################################################################################################################################################################
         3.875 MB download ok.
Bytes transferred = 4041880 (3dac98 hex)

hiaboloo # cp.b 60600000 34300000 3dac98
Copy to Flash... done  

    烧录ok!
    
hiaboloo # reset                              //重启系统

启动过程中,重要的参考地址信息
HiBoot code: 60500000 -> 60519E94  BSS: -> 60564360    //只能用BSS内可用的内存地址!
RAM Configuration:
Bank #0: 60000000 32 MB
Flash: 16 MB
## Booting image at 34100000 ...           //boot kernel from norflash! 这是flash的起始地址
0x00000000-0x00300000 : "boot"             //kernel 3M
0x00300000-0x00f00000 : "system"          //rootfs 12M,这是fs的相对地址

 

3.  小结一下:
1). uboot命令参数中,地址可不加0x,一般默认是16进制的。
2). 如果出现最上面的错误打印信息,一般是自己做的rootbox.jffs2有问题。
3). tftp , 注意ram_bss_addr只能用BSS内的地址。
4). erase , 注意要用绝对地址! flash_end_addr注意最后一般是fff。
5). cp.b , 因为file_len单位是byte,所以一般用命令cp.b。
6). flash要先擦再写!如果flash受保护,用protect off命令,参数同erase。

 

 

阅读(7581) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~