pcduino的linux移植二内核是启动了,但是还存在问题,先分析启动信息,再移植根文件系统
问题一:** Unable to read "uEnv.txt" from mmc 0:1 **
部分启动信息:
reading uEnv.txt
** Unable to read "uEnv.txt" from mmc 0:1 **
Loading file "uEnv.txt" from mmc device 0:1
很明显找不到uEnv.txt,uEnv.txt是设置启动参数的,生成过程boot.cmd——>boot.src——>uEnv.txt
1.创建boot.cmd设置启动参数。boot.cmd:
setenv bootargs console=ttyS0,115200 noinitrd root=/dev/mmcblk0p2 init=/sbin/init rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 boot/script.bin
fatload mmc 0 0x48000000 boot/uImage
bootm 0x48000000
2.根据boot.cmd生成u-boot能够读取的boot.src文件
mkimage -C none -A arm -T script -d boot.cmd boot.scr
3.据说老版本的u-boot能读取boot.scr,新版本的不能直接读取。为了验证这个,我先只用boot.scr,不行再通过uEnv.txt读取boot.scr:
bootenv=boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
mmcboot=echo Running boot.scr script from mmc ...; source ${loadaddr}
4.烧写实验
直接用boot.scr:
change@change:~/Si/A10/pcduino$ vim boot.cmd
setenv bootargs console=ttyS0,115200 noinitrd root=/dev/mmcblk0p2 init=/sbin/init rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 boot/script.bin
fatload mmc 0 0x48000000 boot/uImage
bootm 0x48000000
保存退出
change@change:~/Si/A10/pcduino$ mkimage -C none -A arm -T script -d boot.cmd boot.scr
Image Name:
Created: Sat Apr 20 21:41:43 2013
Image Type: ARM Linux Script (uncompressed)
Data Size: 225 Bytes = 0.22 kB = 0.00 MB
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 217 Bytes = 0.21 kB = 0.00 MB
若干这里mkimage报错或移植二中make uImage报错,需要将编译u-boot是生成的tools目录下的mkimage拷贝到/usr/local/bin,即可解决问题
change@change:~/Si/A10/pcduino$ sudo mount /dev/sdb1 /mnt/
[sudo] password for change:
change@change:~/Si/A10/pcduino$ cp boot.scr /mnt/
放到pcduino tf卡槽,设置串口 115200 8 n 1启动信息还是
U-Boot SPL 2012.10 (Apr 19 2013 - 18:46:44)
DRAM: 1024MB
SUNXI SD/MMC: 0
U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology
CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt
** Unable to read "uEnv.txt" from mmc 0:1 **
Loading file "uEnv.txt" from mmc device 0:1
Failed to mount ext2 filesystem...
** Bad ext2 partition or disk - mmc 0:1 **
ext2load - load binary file from a Ext2 filesystem
看来还是得用uEnv.txt读取boot.scr
change@change:~/Si/A10/pcduino$ vim uEnv.txt
bootenv=boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
mmcboot=echo Running boot.scr script from mmc ...; source ${loadaddr}
保存,退出,tf卡插到UBUNTU变/dev/sdc
change@change:~/Si/A10/pcduino$ sudo mount /dev/sdc1 /mnt/
change@change:~/Si/A10/pcduino$ cp uEnv.txt /mnt/
change@change:~/Si/A10/pcduino$ sudo umount /dev/sdc1 /mnt/
umount: /mnt: not mounted
tf卡插到pcduino卡槽,连接串口设置115200 8 n 1,启动信息如下:
U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology
CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt
144 bytes read
Loaded environment from uEnv.txt
reading boot.scr
289 bytes read
Jumping to boot.scr
## Executing script at 44000000
Wrong image format for "source" command
reading script.bin
44900 bytes read
reading uImage
4693132 bytes read
## Booting kernel from Legacy Image at 48000000 ...
Image Name: Linux-3.0.62
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4693068 Bytes = 4.5 MiB
L