使用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服务器上内核镜像的大小一致,此处要根据第一条命令输入后,内核的大小而定)
烧写RedBoot1. 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. 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)? y在RedBoot下使用re重新启动,就可以使用NAND方式启动了。
常见的错误必需先把内核与系统烧写入flash才能正常启动系统
在将内核与系统烧写入flash之前需要擦除flash,写入flash的大小要大于等于烧写镜像的大小,小于该镜像所在分区的大小
脚本的编写要放在烧写完系统之后,在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:
[] (dump_stack+0x0/0x14) from [] (warn_on_slowpath+0x4c/0x60)
[] (warn_on_slowpath+0x0/0x60) from [] (mxc_init_time+0x64/0x1a0)
r6:00000003 r5:02a4791e r4:00e17db1
[] (mxc_init_time+0x0/0x1a0) from [] (time_init+0x1c/0x24)
[] (time_init+0x0/0x24) from [] (start_kernel+0x19c/0x2a0)
[] (start_kernel+0x0/0x2a0) from [] (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
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
#