由于我们生成了nopading的uboot,我们直接执行前者语句即可,烧写uboot后上电测试.
进入uboot目录
linuxidc.com@lnuxidc-laptop:~$ cd workdir/freescale/Android/bootable/bootloader/uboot-imx/
生成nopading的uboot
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android/bootable/bootloader/uboot-imx$ sudo dd if=./u-boot.bin of=./u-boot-no-padding.bin bs=1024 skip=1
148+1 records in
148+1 records out
151952 bytes (152 kB) copied,0.000897465 秒,169 MB/秒
该命令参数的含义
skip = blocks 跳过读入缓冲区开头的ibs*blocks块。
bs=bytes同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。
烧写uboot
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android/bootable/bootloader/uboot-imx$ sudo dd if=u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1
148+1 records in
148+1 records out
151952 bytes (152 kB) copied,0.202129 秒,752 kB/秒
seek=blocks 从输出文件开头跳过 blocks 个块后再开始复制。(通常只有当输出文件是磁盘或磁带时才有效)
设置为uboot启动模式,并上电测试:
Setup the correct boot DIP configuration.
i.MX51 BBG3, load bootloader from SD:
* 7/8 ON; all others off
view plaincopy to clipboardprint?
U-Boot
2009.08-00099-gc1a8812 ( 6月 22 2010 - 15:55:43)
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
*** Warning - bad CRC or MMC, using default environment
In: serial
Out: serial
Err: serial
Press home + power to enter recovery mode ...
Net: FEC0 [PRIME]
Hit any key to stop autoboot: 0
Unknown command 'mmcinit' - try 'help'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
BBG U-Boot >
U-Boot
2009.08-00099-gc1a8812 ( 6月 22 2010 - 15:55:43)
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
*** Warning - bad CRC or MMC, using default environment
In: serial
Out: serial
Err: serial
Press home + power to enter recovery mode ...
Net: FEC0 [PRIME]
Hit any key to stop autoboot: 0
Unknown command 'mmcinit' - try 'help'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
BBG U-Boot >
分别写入内核与文件系统到SD卡中,用dd或tftp均可.
Use dd on Linux PC to program kernel and ramdisk rootfs into SD:
# dd if=your_kernel_uImage of=/dev/sdb bs =1M seek=1
# dd if=your_uramdisk of=/dev/sdb bs =4M seek=1
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android/kernel_imx$ sudo dd if=arch/arm/boot/uImage of=/dev/sdb bs=1M seek=1
2+1 records in
2+1 records out
2352920 bytes (2.4 MB) copied,0.504715 秒,4.7 MB/秒
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android$ sudo dd if=out/target/product/imx51_BBG/uramdisk.img of=/dev/sdb bs=4M seek=1
0+1 records in
0+1 records out
207807 bytes (208 kB) copied,0.0672214 秒,3.1 MB/秒
Next, program the Android file system image into each partition.
If you are using the prebuilt image, pick up the correct Android file system image (see "Prebuilt image for using uboot ")
If you are building your own image, the images (system.img , userdata.img , recovery.img ) are generated under out/target/product/imx51_BBG
# dd if=your_system.img of=/dev/sdb2 (Program system.img into SYSTEM partition which will be mounted as "/system")
# dd if=your_recovery.img of=/dev/sdb4 (Program recovery.img into RECOVERY partition which will mounted as "/" in recovery mode)
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android$ sudo dd if=out/target/product/imx51_BBG/system.img of=/dev/sdb2
187536+0 records in
187536+0 records out
96018432 bytes (96 MB) copied,51.4244 秒,1.9 MB/秒
linuxidc.com@lnuxidc-laptop:~/workdir/freescale/android$ sudo dd if=out/target/product/imx51_BBG/recovery.img of=/dev/sdb4
9184+0 records in
9184+0 records out
4702208 bytes (4.7 MB) copied,4.43228 秒,1.1 MB/秒
Note: You can dd userdata.img if there are files to be added. Make sure data partition size is set correctly in session TARGET_USERIMAGES_BLOCKS : = 204800 of file vendor/fsl/imx51_BBG/BoardConfig.mk.
插入SD卡,启动设备,进入uboot命令行,执行:
BBG U-Boot > setenv bootcmd 'run bootcmd_SD1 bootcmd_SD2'
BBG U-Boot > setenv bootcmd_SD1 'run bootargs_base bootargs_android bootargs_SD '
BBG U-Boot > setenv bootcmd_SD2 'mmc read 0 ${loadaddr } 0x800 0x1280;mmc read 0 ${rd_loadaddr } 0x2000 0x258;bootm ${loadaddr } ${rd_loadaddr }'
BBG U-Boot > setenv bootargs_base 'setenv bootargs console=ttymxc0,115200'
BBG U-Boot > setenv bootargs_SD 'setenv bootargs ${bootargs }'
BBG U-Boot > setenv bootargs_android 'setenv bootargs ${bootargs } init=/init androidboot.console =ttymxc0 wvga calibration'
BBG U-Boot > setenv loadaddr 0x90800000
BBG U-Boot > setenv rd_loadaddr 0x90B00000
BBG U-Boot > saveenv
第一次启动需要校准触摸屏,请认真设置,如果设置不准确用起来就麻烦了.
对于在windows上使用adb工具,安装好对应驱动即可.
在Ubuntu linux上使用adb工具或adt工具连接物理设备,google的文档中有描述:
If you're developing on Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. Each device manufacturer uses a different vendor ID. The example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID). In order to support more devices, you will need additional lines of the same format that provide a different value for the SYSFS{idVendor} property. For other IDs, see the table of USB Vendor IDs below.
Log in as root and create this file: /etc/udev/rules.d/51-android.rules .
For Gusty/Hardy, edit the file to read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For Dapper, edit the file to read:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
但是实际上的USB Vendor ID的表并不正确
在这里我使用下面的方法解决
1.插拔连接设备的USB线,并分别用lsusb打印 usb信息.
我们可以看到我们的vendor信息, High Tech Computer Corp.为我们的设备.
linuxidc.com@lnuxidc-laptop:/$ lsusb
Bus 002 Device 093: ID 0bb4:0c02 High Tech Computer Corp.
Bus 002 Device 082: ID 14cd:8123 Super Top
Bus 002 Device 075: ID 046d:c01f Logitech, Inc.
Bus 002 Device 028: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 002 Device 004: ID 0c45:6450 Microdia
Bus 002 Device 002: ID 8087:0020
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hup.
将 /etc/udev/rules.d/51- android.rules中vendor值修改为 0bb4使用eclipse的adt工具连接,正常.
可以加载hello world测试.正常.
加载歌曲到sd卡媒体分区中,播放歌曲,无声音,原因是 codec没有编译进去,现在把codec加载并编译.