body
{
font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif;
font-size: 10.5pt;
line-height: 1.5;
}
html, body
{
}
h1 {
font-size:1.5em;
font-weight:bold;
}
h2 {
font-size:1.4em;
font-weight:bold;
}
h3 {
font-size:1.3em;
font-weight:bold;
}
h4 {
font-size:1.2em;
font-weight:bold;
}
h5 {
font-size:1.1em;
font-weight:bold;
}
h6 {
font-size:1.0em;
font-weight:bold;
}
img {
border:0;
max-width: 100%;
height: auto !important;
}
blockquote {
margin-top:0px;
margin-bottom:0px;
}
table {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
td {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
Steps:
准备工作:
下载openwrt源码: git clone git://git.openwrt.org/openwrt.git
Step1:编译openwrt源码
先执行make menuconfig命令,然后有下列几个地方要更改:
- 选择Target System为llwinner A1x/A20/A3x
- 选择Target Profile为Cubietruck
- 选择Target Images,设置Boot大小与Root大小(我用的是4G卡,Boot设置为100M,Root设置为3600M)
然后保存生成.config文件
接下来执行make -j8 (我的机子是双核四线程的,总共8个线程,so..j8)
Step2:为SD卡分区
使用命令:fdisk /dev/sdb (注:sdb为我机子SD卡的盘符,其他因机子而异)
创建两个分区 /dev/sdb1 与 /dev/sdb2,分别为boot分区与root分区,具体大小看你Step1所编译的大小
将第一个分区格式化为vfat格式: mkfs.vfat /dev/sdb1
Step3:写卡系统
以下操作都是基于下面表完成的.
SD layout
SD layout with 512 byte blocks:
NAME | start block | size |
MBR | 0 | 1 block |
u-boot-with-spl.bin | 16 (8 KB) | ~250 KB |
FAT | 2048 (1 MB) | 15 MB |
EXT4 | 32768 (16 MB) | rest |
1.将spl写到CD卡第8k内存处:
dd if=bin/sunxi/uboot-sunxi-Cubietruck/openwrt-sunxi-Cubietruck-u-boot-with-spl.bin of=/dev/sdb bs=1024 seek=8
2.挂载/dev/sdb1到/mnt
mount -t vfat /dev/sdb1 /mnt
3.复制boot相关文件到/mnt
cp bin/sunxi/uboot-sunxi-Cubietruck/openwrt-sunxi-Cubietruck-uEnv.txt /mnt/uEnv.txt
cp bin/sunxi/sun7i-a20-cubietruck.dtb /mnt/dtb
cp bin/sunxi/openwrt-sunxi-uImage /mnt/uImage
4.重定义root系统文件的大小(刚才在make menuconfig那定义了,现在可以不用执行)
resize2fs bin/sunxi/openwrt-sunxi-root.ext4 3600M
5.将root根文件系统写道/dev/sdb2
dd if=bin/sunxi/openwrt-sunxi-root.ext4 of=/dev/sdb2 bs=128k
6.将缓存内容写到SD卡,并卸载/mnt
sync
umount /mnt
END
以上方法如果失败,Step3直接换成以下命令:
dd if=bin/sunxi/openwrt-sunxi-Cubietruck-sdcard-vfat-ext4.img of=/dev/sdb
?
参考资料:
- http://wiki.openwrt.org/doc/hardware/soc/soc.allwinner.sunxi
- http://www.geek-workshop.com/thread-10755-1-1.html