Redboot文件燒寫及配置方法

使用NFS方式啓動系統

爲了能夠方便調試和修改文件,可以使用NFS網絡文件系統方式啓動,需要在RedBoot下配置啓動腳本,如下:

RedBoot> fconfig

Run script at boot: true

Boot script:

.. lo -r -v -b 0xa3000000 zImage(此處改爲可以使用NFS啓動的內核鏡像)

.. go -n 0xa3000000

Enter script, terminate with empty line

>> lo -r -v -b 0xa3000000 zImage

>> go -n 0xa3000000

>>

Boot script timeout (1000ms resolution): 1

Use BOOTP for network configuration: true

Default server IP address: 10.10.68.65

......(後面的使用默認,最後保存)

RedBoot下使用re重新啓動,就可以使用NFS網絡文件系統啓動了。

使用flash方式啓動系統

如何燒寫系統

如果板子中沒有系統,需要對板子進行燒寫。首先,連接電源,進入bootloader的命令行RedBoot。然後按如下步驟進行燒寫。若是板子中已經有系統,要對板子重新進行燒寫,當電源連接或重啓之後,按ctrl+c鍵中斷系統啓動,進入RedBoot命令行之後即可,否則系統會自動啓動而跳過RedBoot

 

分區信息:

0x00000000-0x00040000 : "bootloader"
0x00040000-0x00240000 : "ramdisk"
0x00240000-0x00540000 : "kernel"
0x00540000-0x04b40000 : "system"
0x04b40000-0x07540000 : "userdata"
0x07540000-0x07f40000 : "cache"
0x07f40000-0x08000000 : "boot-cfg"

Nandflash信息:

Manufacturer ID: 0xec, Chip ID: 0xa1 (Samsung NAND 128MiB 1,8V 8-bit)

ChipSize:128MB

BlockSize:128KB

PageSize:2KB

OOBSize:64B

 

燒寫內核

1. lo -r -v -b 0xa3000000 zImage-show (這個是在tftp服務器上的內核鏡像名稱)

2. nand erase -f 0x240000 -l 0x300000 (-l後的是擦除nand flash的大小)

3. nand write -f 0x240000 -b 0xa3000000 -l 0x001d465c (-l 後面的是長度,跟在tftp服務器上內核鏡像的大小一致,此處要根據第一條命令輸入後,內核的大小而定)

燒寫RedBoot

1. lo -r -v -b 0xa3000000 redboot.bin (這個是在tftp服務器上的內核鏡像名稱)

2. nand erase -f 0x0 -l 0x40000 (-l後的是擦除nand flash的大小)

3. nand write -f 0x0 -b 0xa3000000 -l 0x0003b454 (-l 後面的是長度,跟在tftp服務器上redboot鏡像的大小一致,此處要根據第一條命令輸入後,redboot的大小而定)

  1.  

     


燒寫根文件系統

 

1. lo -r -v -b 0xa3000000 root.img (這個是在tftp服務器上的根文件系統鏡像名稱)

2. nand erase -f 0x40000 -l 0x200000

3. nand write -t yaffs2 -f 0x40000 -b 0xa3000000 -l 0x00049380 (-l 後面的是長度,跟在tftp服務器上根文件系統鏡像的大小一致,此處要根據第一條命令輸入後,根文件系統的大小而定)

 

燒寫系統文件鏡像

 

1. lo -r -v -b 0xa3000000 system.img

2. nand erase -f 0x00540000 -l 0x4600000

3. nand write -t yaffs2 -f 0x540000 -b 0xa3000000 -l 0x032f2bc0 (-l 後面的是長度,跟在tftp服務器上系統文件系統鏡像的大小一致,此處要根據第一條命令輸入後,系統文件鏡像的大小而定)

 

燒寫用戶文件鏡像

 

1. lo -r -v -b 0xa3000000 data.img

2. nand erase -f 0x04b40000 -l 0x2A00000

3. nand write -t yaffs2 -f 0x04b40000 -ba 0xa3000000 -l 0x01760580 (-l 後面的是長度,跟在tftp服務器上系統文件系統鏡像的大小一致,此處要根據第一條命令輸入後,用戶文件鏡像的大小而定)

 

配置啓動腳本

以上的步驟完成後,就可以啓動系統了,使用go -n 0xa3000000(0xa3000000爲系統在內存中的起始地址).但是爲了能夠使系統自動加載並啓動,還需要寫入一段flash啓動腳本, 如下:

RedBoot> fconfig

Run script at boot: true

Boot script:

.. lo -r -v -b 0xa3000000 zImage

.. go -n 0xa3000000

Enter script, terminate with empty line

>> nand read -b 0xa3000000 -f 0x240000 -l 0x001d465c

>> go -n 0xa3000000

>>

Boot script timeout (1000ms resolution): 1

Use BOOTP for network configuration: false

Gateway IP address: 10.10.68.254

Local IP address: 10.10.68.70(此處爲板子上的IP)

Local IP address mask: 255.255.255.0

Default server IP address: 10.10.68.65(此處爲服務器的IP)

Board specifics: 0

Console baud rate: 115200

Set eth0 network hardware address [MAC]: false

Set FEC network hardware address [MAC]: true

FEC network hardware address [MAC]: 0x5E:0x00:0x00:0xEA:0x18:0xF0

GDB connection port: 9000

Force console for special debug messages: false

Network debug at boot time: false

Default network device: cs8900a_eth0

Update RedBoot non-volatile configuration - continue (y/n)? yRedBoot下使用re重新啓動,就可以使用NAND方式啓動了。


 

常見的錯誤

  1. 必需先把內核與系統燒寫入flash才能正常啓動系統

  2. 在將內核與系統燒寫入flash之前需要擦除flash,寫入flash的大小要大於等於燒寫鏡像的大小,小於該鏡像所在分區的大小

  3. 腳本的編寫要放在燒寫完系統之後,在RedBoot下鍵入fconfig進行設置


系統燒寫後啓動過程如下(redboot,kernel已經添加了壞塊處理程序,即使有壞塊也可以正常燒寫和運行):

+MX27+
RedBoot
+
After hal_if_diag_init

Found 8 bad blocks

... Read from 0x07ee0000-0x07f00000 at 0xe7ee0000: .
... Read from 0x07ed3000-0x07ed4000 at 0xe7eff000: .
PMIC ID: 0xffffffff [Rev: unknown]
Ethernet FEC MAC address: is not set

Board Type: EVB [rev A] (external UART doesn't work)
Clock input: 32KHz
Booting from [NAND flash]
[0x08000000 bytes]: 1024 blocks of 64 pages of 2048 bytes each.

chip->mscr is 0x1a
FEC: [ HALF_DUPLEX ] [ connected ] [ 10M bps ]:
Ethernet mxc_fec: MAC address 00:00:45:67:89:ab
IP: 10.10.68.119/255.255.255.0, Gateway: 10.10.68.254
Default server: 10.10.68.74

RedBoot(tm) bootstrap and debug environment [ROMRAM]
Non-certified release, version FSL 200749 - built 16:40:18, Dec 21 2009

Platform: MX27 ADS/EVB (Freescale i.MX27 based) PASS 2.1 [x32 SDR]
Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.

RAM: 0x00000000-0x07f00000, [0x00046300-0x07ed1000] available
FLASH: 0xe0000000 - 0xe7f00000, 1016 blocks of 0x00020000 bytes each.
== Executing boot script in 1.000 seconds - enter ^C to abort
RedBoot> nand read -b 0xa3000000 -f 0x240000 -l 0x001d465c
** WARNING: RAM address: 0xa3000000 may be invalid
   valid range is 0x00000000-0x07f00000
nand_read: skipped to read from a bad block at raw addr= 0x00240000,(block= 18).
nand_read: skipped to read from a bad block at raw addr= 0x00260000,(block= 19).

nand_read 0x00280000: ................................
nand_read 0x00290000: ................................
nand_read 0x002a0000: ................................
nand_read 0x002b0000: ................................
nand_read 0x002c0000: ................................
nand_read 0x002d0000: ................................nand_read: skipped to read from a bad block at raw addr= 0x002e0000,(block= 23).
nand_read: skipped to read from a bad block at raw addr= 0x00300000,(block= 24).

nand_read 0x00320000: ................................
nand_read 0x00330000: ................................
nand_read 0x00340000: ................................
nand_read 0x00350000: ................................
nand_read 0x00360000: ................................
nand_read 0x00370000: ................................
nand_read 0x00380000: ................................
nand_read 0x00390000: ................................
nand_read 0x003a0000: ................................
nand_read 0x003b0000: ................................
nand_read 0x003c0000: ................................
nand_read 0x003d0000: ................................
nand_read 0x003e0000: ................................
nand_read 0x003f0000: ................................
nand_read 0x00400000: ................................
nand_read 0x00410000: ................................
nand_read 0x00420000: ................................
nand_read 0x00430000: ................................
nand_read 0x00440000: ................................
nand_read 0x00450000: ................................
nand_read 0x00460000: ................................
nand_read 0x00470000: ................................
nand_read 0x00480000: ................................
nand_read 0x00490000: .........
RedBoot> go -n 0xa3000000
Uncompressing Linux................................................................................................................................ done, booting the kernel.
Linux version 2.6.25-svn242-dirty20 (feilong@feilong-desktop) (gcc version 4.1.1) #95 PREEMPT Thu Dec 24 17:35:14 CST 2009
CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177
Machine: Freescale i.MX27ADS
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 28448
Kernel command line: noinitrd console=ttymxc0,115200 root=/dev/mtdblock1 rw init=/init mem=112M
MXC IRQ initialized
PID hash table entries: 512 (order: 9, 2048 bytes)
------------[ cut here ]------------
WARNING: at arch/arm/mach-mx27/time.c:245 mxc_init_time+0x64/0x1a0()
Modules linked in:
[<c003e190>] (dump_stack+0x0/0x14) from [<c005bfa8>] (warn_on_slowpath+0x4c/0x60)
[<c005bf5c>] (warn_on_slowpath+0x0/0x60) from [<c000df00>] (mxc_init_time+0x64/0x1a0)
 r6:00000003 r5:02a4791e r4:00e17db1
[<c000de9c>] (mxc_init_time+0x0/0x1a0) from [<c000ca88>] (time_init+0x1c/0x24)
[<c000ca6c>] (time_init+0x0/0x24) from [<c0008b14>] (start_kernel+0x19c/0x2a0)
[<c0008978>] (start_kernel+0x0/0x2a0) from [<a0008034>] (0xa0008034)
 r6:c00221e8 r5:c03eb20c r4:00053175
---[ end trace ca143223eefdc828 ]---
MXC GPT timer initialized, rate = 14777780
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 112MB = 112MB total
Memory: 108944KB available (3580K code, 933K data, 196K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
AIPI VA base: 0xd4000000
CPU is i.MX27 Revision 2.0
Clock input source is 26000000
MXC GPIO hardware
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
MXC I2C driver
MXC I2C driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
usb: Host 2 host (isp1504) registered
usb: OTG host (isp1504) registered
usb: OTG gadget (isp1504) registered
usb: OTG OTG registered
MX27: Power management module initialized
NetWinder Floating Point Emulator V0.97 (extended precision)
ashmem: initialized
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
yaffs Dec 21 2009 15:13:40 Installing. 
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 100x30
mxc_sdc_fb mxc_sdc_fb.0: fb0: DISP0 BG fb device registered successfully.
mxc_sdc_fb mxc_sdc_fb.0: fb1: DISP0 FG fb device registered successfully.
Init dsp...
HwReset: Vp140Ackn is 1 
reset dsp ok
After reset,i=0xaa55
in function CodeDowload cur_word= 0xaa55
CodeDowload: Download finished
Dsp reseted
--- DSP API v1_26
--- DSP CODE REV 341:f36
--- DSP SUPPORTS 1 CHANNELS
--- DSP BONDING OPTIONS 0 
--- DSP MAX JITTER 250 
[0] 0x0 [1] 0x0
CAPABILITIES: CHANNELS:1 G729:Y, G.723:Y, G.728:N, G729E:N T.38:Y
vpDspChannelClose: ch0
vpDspChannelClose: ch1
vpDspChannelClose: ch2
vpDspChannelClose: ch3
dsp_init: vpInit success.!!!
Init dsp ok
dsp_i2c_client_attach: MXC I2C2 Adapter
-----dsp_OutSwitch(): TELCHAN_PHONE_SOUNDOUT_HANDSET!-----
-----dsp_OutSwitch(): TELCHAN_PHONE_SOUNDOUT_HANDSET!-----
-------------dsp_OutByDsp  flag is 0---------------
Serial: MXC Internal UART driver
mxcintuart.0: ttymxc0 at MMIO 0x1000a000 (irq = 20) is a Freescale MXC
console [ttymxc0] enabled
mxcintuart.1: ttymxc1 at MMIO 0x1000b000 (irq = 19) is a Freescale MXC
mxcintuart.2: ttymxc2 at MMIO 0x1000c000 (irq = 18) is a Freescale MXC
mxcintuart.4: ttymxc4 at MMIO 0x1001b000 (irq = 49) is a Freescale MXC
mxcintuart.5: ttymxc5 at MMIO 0x1001c000 (irq = 48) is a Freescale MXC
brd: module loaded
loop: module loaded
pmem: 0 init
FEC ENET Version 0.2
fec: PHY @ 0x7, ID 0x0007c0c4 -- unknown PHY!
eth0: ethernet 00:00:45:67:89:ab
Linux video capture interface: v2.00
ov7725_attach: MXC I2C1 Adapter
ov7725_attach: MXC I2C2 Adapter success!
ov7725: id=0x32,0x21.
ov7725: register on 163
Driver 'sd' needs updating - please use bus_type methods
MXC MTD nand Driver 2.0
NAND device: Manufacturer ID: 0xec, Chip ID: 0xa1 (Samsung NAND 128MiB 1,8V 8-bit)
Scanning device for bad blocks
Bad eraseblock 2 at 0x00040000
Bad eraseblock 3 at 0x00060000
Bad eraseblock 4 at 0x00080000
Bad eraseblock 7 at 0x000e0000
Bad eraseblock 18 at 0x00240000
Bad eraseblock 19 at 0x00260000
Bad eraseblock 23 at 0x002e0000
Bad eraseblock 24 at 0x00300000
Searching for RedBoot partition table in NAND 128MiB 1,8V 8-bit at offset 0x7fe0000
No RedBoot partition table detected in NAND 128MiB 1,8V 8-bit
Creating 7 MTD partitions on "NAND 128MiB 1,8V 8-bit":
0x00000000-0x00040000 : "bootloader"
0x00040000-0x00240000 : "ramdisk"
0x00240000-0x00540000 : "kernel"
0x00540000-0x04b40000 : "system"
0x04b40000-0x07540000 : "userdata"
0x07540000-0x07f40000 : "cache"
0x07f40000-0x08000000 : "boot-cfg"
usbmon: debugfs is not available
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: could not register psaux device, error: -16
mice: PS/2 mouse device common for all mice
MXC keypad loaded
input: mxckpd as /class/input/input0
input: imx27-keypad as /class/input/input1
ds1307 0-0068: rtc core: registered ds1307 as rtc0
i2c /dev entries driver
SSI module loaded successfully
SSI-1 enable the ac97 mode
SSI-ac97 conf & ops
SEC: mxc_sec_mod_init() called 
Sahara HW Version is 0x00000003
VPU initialized
set vpu clock
setclock: pcdr0: 0x13c401c3 
MXC MMC/SD driver
mxcmci-1 found
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
Advanced Linux Sound Architecture Driver Version 1.0.16rc2 (Thu Jan 31 16:40:16 2008 UTC).
codec's id is (0x574d,0x4c12)
Wolfson wm9712/9715.
mx27_codec_ac97_init entry
ALSA device list:
  #0: MX27 with wm9712
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation <[email protected]>
ds1307 0-0068: setting system clock to 2000-01-01 00:09:25 UTC (946685365)
yaffs: dev is 32505857 name is "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.1, "mtdblock1"
yaffs: auto selecting yaffs2
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 196K
Warning: unable to open an initial console.
init: /init.freescale.rc: 19: invalid option 'setprop'
init: cannot open '/initlogo.rle'
yaffs: dev is 32505859 name is "mtdblock3"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.3, "mtdblock3"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
yaffs: dev is 32505860 name is "mtdblock4"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.4, "mtdblock4"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
yaffs: dev is 32505861 name is "mtdblock5"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.5, "mtdblock5"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
/system/bin/busybox/bin/sh: _PATH_TTY = /dev/tty
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: cannot find '/system/bin/hcid', disabling 'hcid'
gpio_free_mux(0xb2000000)
gpio_request_mux(0xb2000000, 0x00000002)
mxc_set_gpio_dataout(0x93000000,0x00000001)
mxc_set_gpio_dataout(0x92000000,0x00000000)
------------adc_init IN-----------------
the vendor id wm9712(0x574d,0x4c12)
input: TOUCHSCREEN WM9712 as /class/input/input2
 adc_init: Touchscreen driver has been registered successfully! 
@ snd_pcm_common_ioctl1, 2605 cmd = c25c4111
@ snd_pcm_hw_params_user, 481
@ snd_pcm_hw_params, 379
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
$$$$$$$$$$$$$$ mx27_codec_hw_params 1000
$$$$$$$$$$$$$$ mx27_codec_hw_params 1007
$$$$$$$$$$$$$$ mx27_codec_hw_params 1015
@ snd_pcm_common_ioctl1, 2610 cmd = c0684113
@ snd_pcm_sw_params_user, 584
@ snd_pcm_sw_params, 535
@ snd_pcm_common_ioctl1, 2610 cmd = c0684113
@ snd_pcm_sw_params_user, 584
@ snd_pcm_sw_params, 535
@ snd_pcm_common_ioctl1, 2605 cmd = c25c4111
@ snd_pcm_hw_params_user, 481
@ snd_pcm_hw_params, 379
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1214===================
snd_pcm_hw_param_value, 1219===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
snd_pcm_hw_param_value, 1211===================
snd_pcm_hw_param_value, 1222===================
snd_pcm_hw_param_value, 1225===================
$$$$$$$$$$$$$$ mx27_codec_hw_params 1000
$$$$$$$$$$$$$$ mx27_codec_hw_params 1007
$$$$$$$$$$$$$$ mx27_codec_hw_params 1015
@ snd_pcm_common_ioctl1, 2610 cmd = c0684113
@ snd_pcm_sw_params_user, 584
@ snd_pcm_sw_params, 535
@ snd_pcm_common_ioctl1, 2610 cmd = c0684113
@ snd_pcm_sw_params_user, 584
@ snd_pcm_sw_params, 535
android_power: wakeup (0->0) at 63372364099 (2000-01-01 00:10:24.798135514 UTC)
input open the wm9712!
# ls
cache                 init.goldfish.rc      sbin
data                  init.rc               sdcard
default.prop          init.rc-nfs           sqlite_stmt_journals
dev                   issvoip.conf          sys
etc                   lib                   system
init                  lost+found
init.freescale.rc     proc
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章