SD卡启动制作

完成SD卡分区操作后,你可以看到你现在已经有两个分区了假设为sdb1 sdb2。分别格式化成fat ext3 的方式,然后把kernel rootfs 放入相应的分区。

下面要详细介绍的是如何把 uboot 放入前面一直提到的保留区域内。利用Linux 系统的dd 命令,就可以达到这个目的。具体命令如下所示,注意这个操作需要sudo 超级权限。

dd if=./uboot of=/dev/sdb bs=1 count=442

dd if=./uboot of=/dev/sdb bs=512 skip=1 seek=1

其中 if 标识输入文件的名字,也就是说你要烧入的uboot 的名字。 of代表输出设备的命名,也就是说将要被烧入的设备名。

经过上述步骤以后,一张带 ubootkernel rootfs 的卡片就制作完成了。你只要在uboot 动以后设置对应的bootargandroid 的机器人界面应该马上可以看到了。

 

//kernelrootfs移入相应分区

root@ubuntu:~# mount /dev/sdb1 /mnt/fat32    //1分区挂载到/mnt/fat32

root@ubuntu:~# cp ./uImage /mnt/fat32     //kernel拷贝到1

root@ubuntu:~# umount /dev/sdb1         //卸载

root@ubuntu:~# mount /dev/sdb2 /mnt/ext3    //2分区挂载到/mnt/ext3

root@ubuntu:~# cp –r ./root /mnt/ext3      //root拷贝放入2

root@ubuntu:~# umount /dev/sdb2         //卸载

root@ubuntu:~#

root@ubuntu:~#

 

//442-512SD卡信息等保存区域,不能擦除,否则kernelrootfs等都找不到。所以烧入//uboot时需要跳过这段区域。

//具体是哪段区域,可以看uboot根目录的mksdcard中指明:

//sudo dd if=${BUILD_DIR}/${BINFILE} of=$1 bs=1 count=442

//sudo dd if=${BUILD_DIR}/${BINFILE} of=$1 bs=512 skip=1 seek=1

root@ubuntu:~# dd if=./u-boot-aml.bin of=/dev/sdb bs=1 count=442

root@ubuntu:~# dd if=./u-boot-aml.bin of=/dev/sdb bs=512 skip=1 seek=1

root@ubuntu:~#

root@ubuntu:~#

 

//设置uboot相应启动参数

8726M_MID # printenv

bootcmd=nand read 84100000 ${p0start} ${p0size};nand read ${loadaddr} ${normalst

art} ${normalsize};bootm

bootdelay=1

baudrate=115200

bootfile=uImage

loadaddr=0x82000000

testaddr=0x82400000

usbtty=cdc_acm

console=ttyS2,115200n8

mmcargs=setenv bootargs console=${console} boardname=m1_mid

chipname=8726m

machid=2956

bootargs=init=/init console=ttyS0,115200 mem=512M board_ver=v2 decopt=0 hdmitx=v

dacoff,powermode1,unplug_powerdown rootwait logo=osd1,0x84100000,lcd,full

…….

stdin=serial

stdout=serial

stderr=serial

 

Environment size: 971/8188 bytes

 

8726M_MID # setenv bootcmd  ‘mmcinfo 0; fatload mmc 0 82000000 uImage;bootm’

8726M_MID# setenv bootargs  root=/dev/cardblksd2 rw rootfstype=ext3 init=/init console=ttyS0,115200

8726M_MID #

8726M_MID # boot

Partition Map for UNKNOWN device 0  --   Partition Type: DOS

 

Partition     Start Sector     Num Sectors     Type

    1                316008       2875992    b

    2               3192000        647976    83

Device: SDIO Port A

Manufacturer ID: 0

OEM: 0

Name: [1]Tran Speed: 40000000

Rd Block Len: 512

SD version 2.0

High Capacity: No

Capacity: 1967128576

Bus Width: 4-bit

 

Partition Map for UNKNOWN device 0  --   Partition Type: DOS

 

Partition     Start Sector     Num Sectors     Type

    1                316008       2875992    b

    2               3192000        647976    83

reading uImage

 

2782077 bytes read

## Booting kernel from Legacy Image at 82000000 ...

   Image Name:   Linux-2.6.34

   Image Type:   ARM Linux Kernel Image (lzma compressed)

   Data Size:    2782013 Bytes = 2.7 MiB

   Load Address: 80008000

   Entry Point:  80008000

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Using machid 0xb8c from environment

 

Starting kernel ...

[    0.000000] Linux version 2.6.34 (root@ubuntu) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #17 Sun Apr 3 00:32:57 PDT 2011

[    0.000000] CPU: ARMv7 Processor [411fc091] revision 1 (ARMv7), cr=10c53c7f

[    0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

[    0.000000] Machine: AMLOGIC MESON-M1 8726M SZ

……..

#

#

启动成功。

 

uboot中修改相应启动参数重新编译,烧入SD卡相应区域,设置Amlogic Meson M1 8726M板从SD卡启动,启动信息如下:

U-Boot 2010.06-svn1550 (Jan 28 2011 - 11:35:57)

 

DRAM:  512 MiB

NAND:   ID read  ad,d7 hy27ubg8t2a page 8192 oob 448 erase size 2097152  BCH16 device

 ID read  ad,d7 hy27ubg8t2a page 8192 oob 448 erase size 2097152       BCH16 device

4096 MiB

In:    serial

Out:   serial

Err:   serial

KGDB:  ready

MMC:   SDIO Port A: 0

LCD screen clear!

LCD:       800x480 24bbp

Dcache status 1

Icache status 1

tag = 3    !!!!!!!!!!!!!!!!!!

kernel_args = 0xeaac6099

NORMAL_BOOT...

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

powerkey: 1

Power Up!

 

NAND read: device 0 offset 0x1800000, size 0x800000

 8388608 bytes read: OK

LCD backlight on!

get_adc_sample(4): 0x3ff

get_adc_sample(4): 0x3ff

get_adc_sample(4): 0x3ff

get_key(): 0

Normal Start...

Hit any key to stop autoboot:  1

 

Partition Map for UNKNOWN device 0  --   Partition Type: DOS

 

Partition     Start Sector     Num Sectors     Type

    1                316008       2875992    b

    2               3192000        647976    83

Device: SDIO Port A

Manufacturer ID: 0

OEM: 0

Name: [1]Tran Speed: 40000000

Rd Block Len: 512

SD version 2.0

High Capacity: No

Capacity: 1967128576

Bus Width: 4-bit

 

Partition Map for UNKNOWN device 0  --   Partition Type: DOS

 

Partition     Start Sector     Num Sectors     Type

    1                316008       2875992           b

    2               3192000        647976           83

reading uImage

 

2782077 bytes read

## Booting kernel from Legacy Image at 82000000 ...

   Image Name:   Linux-2.6.34

   Image Type:   ARM Linux Kernel Image (lzma compressed)

   Data Size:    2782013 Bytes = 2.7 MiB

   Load Address: 80008000

   Entry Point:  80008000

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Using machid 0xb8c from environment

 

Starting kernel ...

…….

#

#

SD卡成功启动。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值