MX51开发板利用Linux主机和BSP包重新制作SD卡启动


1、  在WINDOWS下FAT32格式化整个SD卡;

2、  切换到虚拟机下,在Ubuntu 9.04的环境下,系统能识别出SD卡,其中/dev/sdc即为SD卡存储设备;www.bkjia.com @bkjia:/media$ cat /proc/partitions

major minor  #blocks  name

8        0   20971520 sda

8        1   20049088 sda1

8        2          1 sda2

8        5     915673 sda5

8       32    1997312 sdb

使用df  -h,可以看出其挂载点为/media/disk;

/dev/sdb              2.0G  4.0K  2.0G   1% /media/disk

3、copy bootloader镜像

www.bkjia.com @bkjia:/tftpboot$ ls

u-boot-bbg.bin  u-boot-bbg-no-padding.bin  uImage

www.bkjia.com @bkjia:/tftpboot$ sudo dd if=./u-boot-bbg.bin of=/dev/sdb bs=512 && sync && sync

记录了 274+1 的读入

记录了 274+1 的写出

140660字节(141 kB)已复制,0.000910636 秒,154 MB/秒

4、copy内核镜像

www.bkjia.com @bkjia:/tftpboot$ sudo dd if=./uImage of=/dev/sdb bs=512 seek=2048 && sync && sync

记录了 4429+1 的读入

记录了 4429+1 的写出

2267676字节(2.3 MB)已复制,0.0549108 秒,41.3 MB/秒

5、copy根文件系统

www.bkjia.com @bkjia:/tftpboot$ sudo fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x390ef65e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/sdb: 2045 MB, 2045247488 bytes
63 heads, 62 sectors/track, 1022 cylinders, total 3994624 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x390ef65e
Device Boot      Start         End      Blocks   Id  System
Command (m for help): d
No partition is defined yet!
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (62-3994623, default 62): 8192
Last sector, +sectors or +size{K,M,G} (8192-3994623, default 3994623):
Using default value 3994623
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
www.bkjia.com @bkjia:/tftpboot$

注意重新启动系统。sudo reboot

www.bkjia.com @bkjia:~$ sudo mkfs.ext3 /dev/sdb1

[sudo] password for glose:

mke2fs 1.41.4 (27-Jan-2009)

/dev/sdb1 is mounted; will not make a filesystem here!

得先把其umonut

www.bkjia.com @bkjia:~$ sudo umount /media/disk/
www.bkjia.com @bkjia:~$ sudo mkfs.ext3 /dev/sdb1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
124672 inodes, 498304 blocks
24915 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=511705088
16 block groups
32768 blocks per group, 32768 fragments per group
7792 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

接着是把根文件系统复制到刚才的分区

首先建立一个文件挂载点目录,然后把设备挂载上去

www.bkjia.com @bkjia:~$  mkdir /home/glose/mountpoint

www.bkjia.com @bkjia:~$ sudo mount /dev/sdb1 /home/glose/mountpoint

在这里我的要文件系统在/tools/rootfs里面

www.bkjia.com @bkjia:~$ cd /tools/rootfs/

www.bkjia.com @bkjia:/tools/rootfs$ sudo cp -rpa [A-z]* /home/glose/mountpoint

www.bkjia.com @bkjia:/tools/rootfs$ sudo umount /home/glose/mountpoint

把SD卡插入到板子上,启动开发板

U-Boot 2009.08 (Dec 22 2009 - 07:31:32)

CPU:   Freescale i.MX51 family 3.0V at 800 MHz

mx51 pll1: 800MHz

mx51 pll2: 665MHz

mx51 pll3: 216MHz

ipg clock     : 66500000Hz

ipg per clock : 665000000Hz

uart clock    : 66500000Hz

cspi clock    : 54000000Hz

Board: MX51 BABBAGE 3.0 [POR]

Boot Device: MMC

DRAM:  512 MB

MMC:   FSL_ESDHC: 0

JEDEC ID: 0x1f:0x27:0x01

Reading SPI NOR flash 0xc0000 [0x20000 bytes] -> ram 0x975e0800

.SUCCESS

In:    serial

Out:   serial

Err:   serial

Net:   FEC0 [PRIME]

Hit any key to stop autoboot:  0

*** ERROR: `ipaddr' not set

Wrong Image Format for bootm command

ERROR: can't get kernel image!

出现如上错误,得设置相应的环境

BBG U-Boot > setenv bootargs_mmc 'setenv bootargs ${bootargs} console=tty0 root=/dev/mmcblk0p1 rootwait rw'

BBG U-Boot > setenv bootcmd_mmc 'run bootargs_base bootargs_mmc;mmc read 0 ${loadaddr} 0x800 0x1800;bootm'

BBG U-Boot > setenv bootcmd 'run bootcmd_mmc'

保存环境

BBG U-Boot > saveenv

Saving Environment to SPI Flash...

Erasing SPI flash...Erase is built in program.

Writing to SPI flash...Writing SPI NOR flash 0xc0000 [0x20000 bytes] <- ram 0x975e0800

.....SUCCESS

Done

重启

BBG U-Boot > reset
resetting ...
B
U-Boot 2009.08 (Dec 22 2009 - 07:31:32)
CPU:   Freescale i.MX51 family 3.0V at 800 MHz
mx51 pll1: 800MHz
mx51 pll2: 665MHz
mx51 pll3: 216MHz
ipg clock     : 66500000Hz
ipg per clock : 665000000Hz
uart clock    : 66500000Hz
cspi clock    : 54000000Hz
Board: MX51 BABBAGE 3.0 [WDOG]
Boot Device: MMC
DRAM:  512 MB
MMC:   FSL_ESDHC: 0
JEDEC ID: 0x1f:0x27:0x01
Reading SPI NOR flash 0xc0000 [0x20000 bytes] -> ram 0x975e0800
.SUCCESS
In:    serial
Out:   serial
Err:   serial
Net:   FEC0 [PRIME]
Hit any key to stop autoboot:  0
MMC read: dev # 0, block # 2048, count 6144 ... 6144 blocks read: OK
## Booting kernel from Legacy Image at 90800000 ...
Image Name:   Linux-2.6.31-203-gee1fdae
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2267612 Bytes =  2.2 MB
Load Address: 90008000
Entry Point:  90008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.................................................................................................................................................. done, booting the kernel.
Linux version 2.6.31-203-gee1fdae (r65388@szx32-17) (gcc version 4.1.2) #1 PREEMPT Tue Dec 22 06:48:06 CST 2009
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: Freescale MX51 Babbage Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 121920
Kernel command line: console=ttymxc0,115200 console=tty0 root=/dev/mmcblk0p1 rootwait rw
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 480MB = 480MB total
Memory: 482328KB available (4128K code, 326K data, 132K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:272
MXC IRQ initialized
Console: colour dummy device 80x30
console [tty0] enabled
Calibrating delay loop... 799.53 BogoMIPS (lpj=3997696)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
NET: Registered protocol family 16
CPU is i.MX51 Revision 3.0
MXC GPIO hardware
iomux_config_mux: Warning: iomux pin config changed, reg=fb0a8134,  prev=0x1 new=0x3
IRAM READY
mxc_init_dvfs_per initialised
Using SDMA I.API
MXC DMA API initialized
bio: create slab <bio-0> at 0
SCSI subsystem initialized
CSPI: mxc_spi-0 probed
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
MXC I2C driver
MXC I2C driver
MXC HS I2C driver
IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
Bluetooth: Core ver 2.15
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
mc13892 Rev 2.0 FinVer 2 detected
Initializing regulators for Babbage.
regulator: SW1: 600 <--> 1375 mV
regulator: SW2: 900 <--> 1850 mV
regulator: SW3: 1100 <--> 1850 mV
regulator: SW4: 1100 <--> 1850 mV
regulator: SWBST: 0 mV
regulator: VIOHI: 0 mV
regulator: VPLL: 1050 <--> 1800 mV
regulator: VDIG: 1650 mV
regulator: VSD: 1800 <--> 3150 mV
regulator: VUSB2: 2400 <--> 2775 mV
regulator: VVIDEO: 2775 mV
regulator: VAUDIO: 2300 <--> 3000 mV
regulator: VCAM: 2500 <--> 3000 mV fast normal
regulator: VGEN1: 1200 mV
regulator: VGEN2: 1200 <--> 3150 mV
regulator: VGEN3: 1800 <--> 2900 mV
regulator: VUSB: 0 mV
regulator: GPO1: 0 mV
regulator: GPO2: 0 mV
regulator: GPO3: 0 mV
regulator: GPO4: 0 mV
Device spi1.0 probed
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
NET: Registered protocol family 1
LPMode driver module loaded
Static Power Management for Freescale i.MX51
PM driver module loaded
sdram autogating driver module loaded
Bus freq driver module loaded
DVI monitor is primary
usb: Host 1 host (isp1504) registered
usb: DR gadget (utmi) registered
mxc_dvfs_core_probe
DVFS driver module loaded
i.MXC CPU frequency driver
DVFS PER driver module loaded
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
msgmni has been set to 942
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
fbcvt: 1024x768@60: CVT Name - .786M3
mxc_ipu mxc_ipu: Channel already disabled 9
mxc_ipu mxc_ipu: Channel already uninitialized 9
IPU DMFC DP HIGH RESOLUTION: 1(0,1), 5B(2~5), 5F(6,7)
Console: switching to colour frame buffer device 128x48
fbcvt: 1024x768@60: CVT Name - .786M3
regulator: get() with no identifier
regulator: get() with no identifier
regulator: get() with no identifier
mxci2c_wait_writefifo:wait error
Serial: MXC Internal UART driver
mxcintuart.0: ttymxc0 at MMIO 0x73fbc000 (irq = 31) is a Freescale i.MX
console [ttymxc0] enabled
mxcintuart.1: ttymxc1 at MMIO 0x73fc0000 (irq = 32) is a Freescale i.MX
mxcintuart.2: ttymxc2 at MMIO 0x7000c000 (irq = 33) is a Freescale i.MX
loop: module loaded
FEC Ethernet Driver
fec: PHY @ 0x0, ID 0x0007c0c4 -- LAN8700
MXC MTD nand Driver 2.5
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 14, io base 0x73f80200
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ARC USBOTG Device Controller driver (1 August 2005)
mice: PS/2 mouse device common for all mice
MXC keypad loaded
clk: Unable to get requested clock: kpp_clk
input: mxckpd as /devices/virtual/input/input0
mc13892 rtc probe start
pmic_rtc pmic_rtc.1: rtc core: registered pmic_rtc as rtc0
mc13892 rtc probe succeed
i2c /dev entries driver
Linux video capture interface: v2.00
MXC Video Output MXC Video Output.0: Registered device video0
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)
APM Battery Driver
MXC WatchDog Driver 2.0
clk: Unable to get requested clock: wdog_clk
MXC Watchdog # 0 Timer: initial timeout 60 sec
Bluetooth: Virtual HCI driver ver 1.3
Bluetooth: Generic Bluetooth USB driver ver 0.5
usbcore: registered new interface driver btusb
usb 1-1: new high speed USB device using fsl-ehci and address 2
pmic_battery: probe of pmic_battery.1 failed with error -1
SCC2: Driver Status is OK
VPU initialized
mxsdhci: MXC Secure Digital Host Controller Interface driver
mxsdhci: MXC SDHCI Controller Driver.
mmc0: SDHCI detect irq 128 irq 1 INTERNAL DMA
mxsdhci: MXC SDHCI Controller Driver.
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
mmc1: SDHCI detect irq 134 irq 2 INTERNAL DMA
hub 1-1:1.0: 7 ports detected
Registered led device: pmic_ledsr
Registered led device: pmic_ledsg
Registered led device: pmic_ledsb
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.20.
mmc0: new high speed SD card at address b368
sgtl5000-i2c 1-000a: SGTL5000 revision 17
mmcblk0: mmc0:b368 SD    1.90 GiB
mmcblk0: p1
No device for DAI imx-ssi-1-0
No device for DAI imx-ssi-1-1
No device for DAI imx-ssi-2-0
No device for DAI imx-ssi-2-1
DMA Sound Buffers Allocated:UseIram=1 buf->addr=1ffef000 buf->area=de8b0000 size=24576
DMA Sound Buffers Allocated:UseIram=1 buf->addr=ac1f0000 buf->area=fc16a000 size=24576
asoc: SGTL5000 <-> imx-ssi-2-0 mapping ok
ALSA device list:
#0: imx-3stack (SGTL5000)
TCP cubic registered
NET: Registered protocol family 17
Bluetooth: L2CAP ver 2.13
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO (Voice Link) ver 0.6
Bluetooth: SCO socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
regulator_init_complete: incomplete constraints, leaving GPO4 on
regulator_init_complete: incomplete constraints, leaving GPO3 on
regulator_init_complete: incomplete constraints, leaving GPO2 on
regulator_init_complete: incomplete constraints, leaving GPO1 on
regulator_init_complete: incomplete constraints, leaving VUSB on
regulator_init_complete: incomplete constraints, leaving VGEN3 on
regulator_init_complete: incomplete constraints, leaving VGEN2 on
regulator_init_complete: incomplete constraints, leaving VGEN1 on
regulator_init_complete: incomplete constraints, leaving VCAM on
regulator_init_complete: incomplete constraints, leaving VAUDIO on
regulator_init_complete: incomplete constraints, leaving VUSB2 on
regulator_init_complete: incomplete constraints, leaving VSD on
regulator_init_complete: incomplete constraints, leaving VPLL on
regulator_init_complete: incomplete constraints, leaving VIOHI on
regulator_init_complete: incomplete constraints, leaving SWBST on
input: mxc_ts as /devices/virtual/input/input1
mxc input touchscreen loaded
pmic_rtc pmic_rtc.1: setting system clock to 1970-01-01 01:41:25 UTC (6085)
kjournald starting.  Commit interval 5 seconds
EXT3 FS on mmcblk0p1, internal journal
EXT3-fs: mounted filesystem with writeback data mode.
VFS: Mounted root (ext3 filesystem) on device 179:1.
Freeing init memory: 132K
usb 1-1.6: new high speed USB device using fsl-ehci and address 3
usb 1-1.6: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access     USB TO I DE/SATA Device   0009 PQ: 0 ANSI: 0
sd 0:0:0:0: [sda] Attached SCSI disk
arm-none-linux-gnueabi-gcc (GCC) 4.1.2
root filesystem built on Thu, 24 Sep 2009 15:23:48 +0800
Freescale Semiconductor, Inc.
freescale login: freescale
Password:
Login incorrect
freescale login:
Login timed out after 60 seconds
arm-none-linux-gnueabi-gcc (GCC) 4.1.2
root filesystem built on Thu, 24 Sep 2009 15:23:48 +0800
Freescale Semiconductor, Inc.
freescale login:

有时候启动的时候无法挂载根文件系统,相关的UBOOT和内核都已经启动了,主要原来是找到相关的SD卡设备。

不知道是不是要使用mmc init命令才行。这个有待查证。

freescale login: root

BusyBox v1.11.2 () built-in shell (ash)

Enter 'help' for a list of built-in commands.

root@ www.bkjia.com ~$ uname -r

2.6.31-203-gee1fdae

相关内容