手上有个128M的sd卡,所以就只测试uboot
#---------------------------------------------------------------------------------------------------------------------------------#
下载uboot代码https://github.com/linux-sunxi/u-boot-sunxi.git,版本号v2014.04-rc2
#---------------------------------------------------------------------------------------------------------------------------------#
编译uboot
laptop:~$make Cubietruck_config
laptop:~$make CROSS_COMPILE=arm-linux-gnueabi- -j4
注意:
1.Cubietruck首字母大写
2.make CROSS_COMPILE=arm-linux-gnueabi- -j4中-j4表示job4(四核)
#---------------------------------------------------------------------------------------------------------------------------------#
启动代码写入SD卡
uboot父目录创建shell脚本writesdcard
#! /bin/sh
export card=/dev/sdb
export p=""
#To be on safe side erase the first part of your SD Card.
dd if=/dev/zero of=${card} bs=1M count=1
#Bootloader
dd if=u-boot-sunxi/spl/sunxi-spl.bin of=${card} bs=1024 seek=8
dd if=u-boot-sunxi/u-boot.img of=${card} bs=1024 seek=40
保存之后添加权限并(sudo)执行脚本
注意:
1.
export card=/dev/sdb
export p=""
是对应于USB插入的读卡器,详细内容参见http://linux-sunxi.org/Bootable_SD_card
#---------------------------------------------------------------------------------------------------------------------------------#
测试
1
SD卡插入Cubietruck
正确连接usb-ttl数据线——(黑接GND)(绿接RX)(白接TX)
2
打开虚拟窗口
laptop:~screen /dev/ttyUSB0 115200
3
连接Cubietruck电源
U-Boot SPL 2014.04-rc2-10390-g96510e1 (Apr 07 2014 - 21:24:32)
Board: Cubietruck
DRAM: 2048 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600
U-Boot 2014.04-rc2-10390-g96510e1 (Apr 07 2014 - 21:24:32) Allwinner Technology
CPU: Allwinner A20 (SUN7I)
Board: Cubietruck
I2C: ready
DRAM: 2 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: dwmac.1c50000
Warning: failed to set MAC address
Hit any key to stop autoboot: 0
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
** No partition table - mmc 0 **
sun7i#
测试命令led all toggle
sun7i#led all toggle
观察led
成功!
参考:
http://linux-sunxi.org/Bootable_SD_card
http://linux-sunxi.org/Cubieboard/TTL
http://linux-sunxi.org/Toolchain
http://linux-sunxi.org/U-Boot#Compilation