[p=26, null, left][color=#333333][font=Arial]最近pcduino官方公布了kernel源码,很是兴奋,决定开始在pcduino上移植linux系统,有兴趣的一起万博manbext登录网址哈[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]目标:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]1.移植u-boot 2012.10[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]2.移植linux内核[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]3.移植最小文件系统[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]开发环境:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]系统:ubuntu 10.04.4[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]单板:pcDuino[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]编译器:arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]下面移植pcDuino官方最新公布的u-boot[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]1.获取源码[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]pcDuino提供的u-boot-sunxi [url=https://github.com/pcduino/kernel]https://github.com/pcduino/kernel[/url] 下载u-boot-sunxi源码[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]获取交叉编译链 [url=http://code.google.com/p/smp-on-qemu/downloads/list]http://code.google.com/p/smp-on-qemu/downloads/list[/url] [/font][/color][/p][p=26, null, left][color=#333333][font=Arial]选择arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2并下载。然后在ubuntu下直接解压即可,还要配置环境变量[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]sudo gedit /etc/environment[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]修改PATH,在最后再加“:/.../arm-2009q3/bin”,其中“...”是上面arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2解压的路径。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]接着Log Out ubuntu系统,就可以直接使用交叉编译链。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]2.编译u-boot[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]解压上面下载的u-boot-sunxi-sunxi.zip到工作目录,接着配置单板并编译[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]make pcduino CROSS_COMPILE=arm-none-linux-gnueabi-[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]最后输出如下,编译成功[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]arm-none-linux-gnueabi-ld -g -Ttext 0x50000000 \
-o hello_world -e hello_world hello_world.o libstubs.o \
-L/home/change/tools/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1 -lgcc
arm-none-linux-gnueabi-objcopy -O srec hello_world hello_world.srec 2>/dev/null
arm-none-linux-gnueabi-objcopy -O binary hello_world hello_world.bin 2>/dev/null
make[2]: Leaving directory `/home/change/Si/A10/pcduino/u-boot-sunxi-sunxi/examples/standalone'
make -C examples/api all
make[2]: Entering directory `/home/change/Si/A10/pcduino/u-boot-sunxi-sunxi/examples/api'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/change/Si/A10/pcduino/u-boot-sunxi-sunxi/examples/api'
make[1]: Leaving directory `/home/change/Si/A10/pcduino/u-boot-sunxi-sunxi'[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]3.烧写、测试[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]上述生成的第一阶段/spl/sunxi-spl.bin 、第二阶段 /u-boot.bin,是支持sd卡启动的,准备tf卡读卡器,连接到PC,下面是烧写命令[/font][/color][/p][p=26, null, left][color=#333333][font=Arial][url=mailto:change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$[/url] sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.511973 s, 2.0 MB/s
[url=mailto:change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$[/url] sudo dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8
20+0 records in
20+0 records out
20480 bytes (20 kB) copied, 0.0134902 s, 1.5 MB/s
[url=mailto:change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$[/url] sudo dd if=u-boot.bin of=/dev/sd
sda sda1 sda2 sda3 sda4 sda5 sda6 sdb
[url=mailto:change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$[/url] sudo dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32
171+1 records in
171+1 records out
175272 bytes (175 kB) copied, 0.0930407 s, 1.9 MB/s
[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]取下tf卡,插到pcDuino的tf卡槽,接上串口线,pcDuino默认是从sd卡启动的,上电串口输出如下:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]U-Boot SPL 2012.10 (Apr 19 2013 - 18:46:44)
DRAM: 1024MB
SUNXI SD/MMC: 0[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]
U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
sun4i#[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]u-boot基本移植成功,下阶段实现目标二linux内核移植。[/font][/color][/p]
转自:[url]http://blog.csdn.net/u010216127/article/details/8825788[/url]