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

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

2、 切换到虚拟机下,在Ubuntu 9.04的环境下,系统能识别出SD卡,其中/dev/sdc即为SD卡存储设备; @linuxidc:/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镜像

@linuxidc:/tftpboot$ ls

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

@linuxidc:/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内核镜像

@linuxidc:/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根文件系统

@linuxidc:/tftpboot$ sudo fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding 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): uChanging display/entry units to sectorsCommand (m for help): pDisk /dev/sdb: 2045 MB, 2045247488 bytes63 heads, 62 sectors/track, 1022 cylinders, total 3994624 sectorsUnits = sectors of 1 * 512 = 512 bytesDisk identifier: 0x390ef65eDevice Boot Start End Blocks Id SystemCommand (m for help): dNo partition is defined yet!Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First sector (62-3994623, default 62): 8192Last sector, +sectors or +size{K,M,G} (8192-3994623, default 3994623):Using default value 3994623Command (m for help): wThe 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. @linuxidc:/tftpboot$

注意重新启动系统。sudo reboot

@linuxidc:~$ 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

@linuxidc:~$ sudo umount /media/disk/ @linuxidc:~$ sudo mkfs.ext3 /dev/sdb1mke2fs 1.41.4 (27-Jan-2009)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)124672 inodes, 498304 blocks24915 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=51170508816 block groups32768 blocks per group, 32768 fragments per group7792 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 33 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.

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

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

@linuxidc:~$ mkdir /home/glose/mountpoint

@linuxidc:~$ sudo mount /dev/sdb1 /home/glose/mountpoint

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

@linuxidc:~$ cd /tools/rootfs/

@linuxidc:/tools/rootfs$ sudo cp -rpa [A-z]* /home/glose/mountpoint

@linuxidc:/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 > resetresetting …BU-Boot 2009.08 (Dec 22 2009 – 07:31:32)CPU: Freescale i.MX51 family 3.0V at 800 MHzmx51 pll1: 800MHzmx51 pll2: 665MHzmx51 pll3: 216MHzipg clock : 66500000Hzipg per clock : 665000000Hzuart clock : 66500000Hzcspi clock : 54000000HzBoard: MX51 BABBAGE 3.0 [WDOG]Boot Device: MMCDRAM: 512 MBMMC: FSL_ESDHC: 0JEDEC ID: 0x1f:0x27:0x01Reading SPI NOR flash 0xc0000 [0x20000 bytes] -> ram 0x975e0800.SUCCESSIn: serialOut: serialErr: serialNet: FEC0 [PRIME]Hit any key to stop autoboot: 0MMC 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-gee1fdaeImage Type: ARM Linux Kernel Image (uncompressed)Data Size: 2267612 Bytes = 2.2 MBLoad Address: 90008000Entry Point: 90008000Verifying Checksum … OKLoading Kernel Image … OKOKStarting 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 2009CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7fCPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cacheMachine: Freescale MX51 Babbage BoardMemory policy: ECC disabled, Data cache writebackBuilt 1 zonelists in Zone order, mobility grouping on. Total pages: 121920Kernel command line: console=ttymxc0,115200 console=tty0 root=/dev/mmcblk0p1 rootwait rwPID 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 totalMemory: 482328KB available (4128K code, 326K data, 132K init, 0K highmem)SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1NR_IRQS:272MXC IRQ initializedConsole: colour dummy device 80x30console [tty0] enabledCalibrating delay loop… 799.53 BogoMIPS (lpj=3997696)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: okregulator: core version 0.5NET: Registered protocol family 16CPU is i.MX51 Revision 3.0MXC GPIO hardwareiomux_config_mux: Warning: iomux pin config changed, reg=fb0a8134, prev=0x1 new=0x3IRAM READYmxc_init_dvfs_per initialisedUsing SDMA I.APIMXC DMA API initializedbio: create slab <bio-0> at 0SCSI subsystem initializedCSPI: mxc_spi-0 probedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbMXC I2C driverMXC I2C driverMXC HS I2C driverIPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)Bluetooth: Core ver 2.15NET: Registered protocol family 31Bluetooth: HCI device and connection manager initializedBluetooth: HCI socket layer initializedmc13892 Rev 2.0 FinVer 2 detectedInitializing regulators for Babbage.regulator: SW1: 600 <–> 1375 mVregulator: SW2: 900 <–> 1850 mVregulator: SW3: 1100 <–> 1850 mVregulator: SW4: 1100 <–> 1850 mVregulator: SWBST: 0 mVregulator: VIOHI: 0 mVregulator: VPLL: 1050 <–> 1800 mVregulator: VDIG: 1650 mVregulator: VSD: 1800 <–> 3150 mVregulator: VUSB2: 2400 <–> 2775 mVregulator: VVIDEO: 2775 mVregulator: VAUDIO: 2300 <–> 3000 mVregulator: VCAM: 2500 <–> 3000 mV fast normalregulator: VGEN1: 1200 mVregulator: VGEN2: 1200 <–> 3150 mVregulator: VGEN3: 1800 <–> 2900 mVregulator: VUSB: 0 mVregulator: GPO1: 0 mVregulator: GPO2: 0 mVregulator: GPO3: 0 mVregulator: GPO4: 0 mVDevice spi1.0 probedNET: Registered protocol family 2IP 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 registeredNET: Registered protocol family 1LPMode driver module loadedStatic Power Management for Freescale i.MX51PM driver module loadedsdram autogating driver module loadedBus freq driver module loadedDVI monitor is primaryusb: Host 1 host (isp1504) registeredusb: DR gadget (utmi) registeredmxc_dvfs_core_probeDVFS driver module loadedi.MXC CPU frequency driverDVFS PER driver module loadedJFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.msgmni has been set to 942io scheduler noop registeredio scheduler anticipatory registeredio scheduler deadline registeredio scheduler cfq registered (default)fbcvt: 1024×768@60: CVT Name – .786M3mxc_ipu mxc_ipu: Channel already disabled 9mxc_ipu mxc_ipu: Channel already uninitialized 9IPU DMFC DP HIGH RESOLUTION: 1(0,1), 5B(2~5), 5F(6,7)Console: switching to colour frame buffer device 128x48fbcvt: 1024×768@60: CVT Name – .786M3regulator: get() with no identifierregulator: get() with no identifierregulator: get() with no identifiermxci2c_wait_writefifo:wait errorSerial: MXC Internal UART drivermxcintuart.0: ttymxc0 at MMIO 0x73fbc000 (irq = 31) is a Freescale i.MXconsole [ttymxc0] enabledmxcintuart.1: ttymxc1 at MMIO 0x73fc0000 (irq = 32) is a Freescale i.MXmxcintuart.2: ttymxc2 at MMIO 0x7000c000 (irq = 33) is a Freescale i.MXloop: module loadedFEC Ethernet Driverfec: PHY @ 0x0, ID 0x0007c0c4 — LAN8700MXC MTD nand Driver 2.5ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driverfsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controllerfsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1fsl-ehci fsl-ehci.0: irq 14, io base 0x73f80200fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00usb usb1: configuration #1 chosen from 1 choicehub 1-0:1.0: USB hub foundhub 1-0:1.0: 1 port detectedInitializing USB Mass Storage driver…usbcore: registered new interface driver usb-storageUSB Mass Storage support registered.ARC USBOTG Device Controller driver (1 August 2005)mice: PS/2 mouse device common for all miceMXC keypad loadedclk: Unable to get requested clock: kpp_clkinput: mxckpd as /devices/virtual/input/input0mc13892 rtc probe startpmic_rtc pmic_rtc.1: rtc core: registered pmic_rtc as rtc0mc13892 rtc probe succeedi2c /dev entries driverLinux video capture interface: v2.00MXC Video Output MXC Video Output.0: Registered device video0usbcore: registered new interface driver uvcvideoUSB Video Class driver (v0.1.0)APM Battery DriverMXC WatchDog Driver 2.0clk: Unable to get requested clock: wdog_clkMXC Watchdog # 0 Timer: initial timeout 60 secBluetooth: Virtual HCI driver ver 1.3Bluetooth: Generic Bluetooth USB driver ver 0.5usbcore: registered new interface driver btusbusb 1-1: new high speed USB device using fsl-ehci and address 2pmic_battery: probe of pmic_battery.1 failed with error -1SCC2: Driver Status is OKVPU initializedmxsdhci: MXC Secure Digital Host Controller Interface drivermxsdhci: MXC SDHCI Controller Driver.mmc0: SDHCI detect irq 128 irq 1 INTERNAL DMAmxsdhci: MXC SDHCI Controller Driver.usb 1-1: configuration #1 chosen from 1 choicehub 1-1:1.0: USB hub foundmmc1: SDHCI detect irq 134 irq 2 INTERNAL DMAhub 1-1:1.0: 7 ports detectedRegistered led device: pmic_ledsrRegistered led device: pmic_ledsgRegistered led device: pmic_ledsbusbcore: registered new interface driver usbhidusbhid: v2.6:USB HID core driverAdvanced Linux Sound Architecture Driver Version 1.0.20.mmc0: new high speed SD card at address b368sgtl5000-i2c 1-000a: SGTL5000 revision 17mmcblk0: mmc0:b368 SD 1.90 GiBmmcblk0: p1No device for DAI imx-ssi-1-0No device for DAI imx-ssi-1-1No device for DAI imx-ssi-2-0No device for DAI imx-ssi-2-1DMA Sound Buffers Allocated:UseIram=1 buf->addr=1ffef000 buf->area=de8b0000 size=24576DMA Sound Buffers Allocated:UseIram=1 buf->addr=ac1f0000 buf->area=fc16a000 size=24576asoc: SGTL5000 <-> imx-ssi-2-0 mapping okALSA device list:#0: imx-3stack (SGTL5000)TCP cubic registeredNET: Registered protocol family 17Bluetooth: L2CAP ver 2.13Bluetooth: L2CAP socket layer initializedBluetooth: SCO (Voice Link) ver 0.6Bluetooth: SCO socket layer initializedBluetooth: RFCOMM TTY layer initializedBluetooth: RFCOMM socket layer initializedBluetooth: RFCOMM ver 1.11Bluetooth: BNEP (Ethernet Emulation) ver 1.3Bluetooth: BNEP filters: protocol multicastBluetooth: HIDP (Human Interface Emulation) ver 1.2RPC: Registered udp transport module.RPC: Registered tcp transport module.VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2regulator_init_complete: incomplete constraints, leaving GPO4 onregulator_init_complete: incomplete constraints, leaving GPO3 onregulator_init_complete: incomplete constraints, leaving GPO2 onregulator_init_complete: incomplete constraints, leaving GPO1 onregulator_init_complete: incomplete constraints, leaving VUSB onregulator_init_complete: incomplete constraints, leaving VGEN3 onregulator_init_complete: incomplete constraints, leaving VGEN2 onregulator_init_complete: incomplete constraints, leaving VGEN1 onregulator_init_complete: incomplete constraints, leaving VCAM onregulator_init_complete: incomplete constraints, leaving VAUDIO onregulator_init_complete: incomplete constraints, leaving VUSB2 onregulator_init_complete: incomplete constraints, leaving VSD onregulator_init_complete: incomplete constraints, leaving VPLL onregulator_init_complete: incomplete constraints, leaving VIOHI onregulator_init_complete: incomplete constraints, leaving SWBST oninput: mxc_ts as /devices/virtual/input/input1mxc input touchscreen loadedpmic_rtc pmic_rtc.1: setting system clock to 1970-01-01 01:41:25 UTC (6085)kjournald starting. Commit interval 5 secondsEXT3 FS on mmcblk0p1, internal journalEXT3-fs: mounted filesystem with writeback data mode.VFS: Mounted root (ext3 filesystem) on device 179:1.Freeing init memory: 132Kusb 1-1.6: new high speed USB device using fsl-ehci and address 3usb 1-1.6: configuration #1 chosen from 1 choicescsi0 : SCSI emulation for USB Mass Storage devicesscsi 0:0:0:0: Direct-Access USB TO I DE/SATA Device 0009 PQ: 0 ANSI: 0sd 0:0:0:0: [sda] Attached SCSI diskarm-none-linux-gnueabi-gcc (GCC) 4.1.2root filesystem built on Thu, 24 Sep 2009 15:23:48 +0800Freescale Semiconductor, Inc.freescale login: freescalePassword:Login incorrectfreescale login:Login timed out after 60 secondsarm-none-linux-gnueabi-gcc (GCC) 4.1.2root filesystem built on Thu, 24 Sep 2009 15:23:48 +0800Freescale 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@ ~$ uname -r

2.6.31-203-gee1fdae

三亚呀——赴一个蓝天碧海。

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

相关文章:

你感兴趣的文章:

标签云: