clover

1. 制作nandflash镜像

1.1 编译开发板提供的内核
问题1:arm-linux-gnueabi-gcc: error: directory: No such file or directory

参考:

http://elastostester.elastos.org/2015/01/29/allwinner4_2_2_sdk2-1_orig%E7%BC%96%E8%AF%91%E5%A4%B1%E8%B4%A5%E9%97%AE%E9%A2%98%EF%BC%88%E4%B8%8Esvnversion%E6%9C%89%E5%85%B3%EF%BC%89/

https://github.com/cubieboard/cubieboard.org/issues/5

内核和uboot编译成功以后执行build pack打包镜像文件,生成的镜像文件是基于flash的,只能烧写工具烧如flash后从flash启动。

2. 制作基于sun-xi社区的sd卡镜像

参考:https://linux-sunxi.org/Manual_build_howto

2.1 工具链
2.2 uboot

有2个方案可以选择,一个是从sunxi分支编译,一个是从主线编译。

从sunxi分支编译参考:https://linux-sunxi.org/U-Boot#Compile_U-Boot

可以通过boot.scr 文件来设置uboot环境变量,boot.scr 文件是从boot.cmd文件转换来的:

mkimage -C none -A arm -T script -d boot.cmd boot.scr

参数配置参考:https://linux-sunxi.org/U-Boot/Configuration

2.3 内核

同样可以选择从sunxi分支或者主线编译:

https://linux-sunxi.org/Linux_Kernel#Compilation

2.4 script.bin

参考:https://linux-sunxi.org/Script.bin#Build_script.bin

script.bin是sunxi替代设备树dtb用于描述系统设备的文件,是从script.fex文件转换来的。

这里只需要选取A20的某个板子的基础上进行调整即可。

2.5 sd卡启动盘

 参考:https://linux-sunxi.org/Bootable_SD_card

2.5.1 清空sd卡

dd if=/dev/zero of=${card} bs=1M count=1

2.5.2 安装BootLoader

dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8

2.5.3 创建及格式化分区

blockdev --rereadpt ${card}

cat <<EOT | sfdisk ${card}

1M,16M,c

,,L

EOT

格式化:

mkfs.vfat ${card}${p}1

mkfs.ext4 ${card}${p}2

2.5.4 boot分区

mount ${card}${p}1 /mnt/

cp linux-sunxi/arch/arm/boot/uImage /mnt/

cp sunxi-boards/sys_config/a10/script.bin /mnt/

umount /mnt/

如果需要修改uboot环境变量还需要拷贝boot.scr文件

2.5.5 文件系统

这里选择debootstrap方案,创建基于debain的根文件系统

1)准备阶段

debootstrap --arch=armhf --foreign $distro /mnt/

这个操作会花费很长时间

完成之后需要chroot到/mnt继续进行第二阶段的操作

cp /usr/bin/qemu-arm-static /mnt/usr/bin/
chroot /mnt /usr/bin/qemu-arm-static /bin/sh -i
/debootstrap/debootstrap --second-stage

2)更新目标系统apt源 及 fstab

cat <<EOT > etc/apt/sources.list
deb http://http.debian.net/debian $distro main contrib non-free
deb-src http://http.debian.net/debian $distro main contrib non-free
deb http://http.debian.net/debian $distro-updates main contrib non-free
deb-src http://http.debian.net/debian $distro-updates main contrib non-free
deb http://security.debian.org/debian-security $distro/updates main contrib non-free
deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free
EOT
cat <<EOT >> etc/fstab
none	/tmp	tmpfs	defaults,noatime,mode=1777 0 0
# if you have a separate boot partition
${card}${p}1	/boot	vfat defaults 0 0 
EOT

后续

exit
cp /etc/resolv.conf /mnt/etc
chroot /mnt
export LANG=C
apt-get update
# set up 'apt
cat <<END > /etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
END
# set up locales (Debian) - dpkg scripts tend to complain otherwise
apt-get install locales
dpkg-reconfigure locales
# Choose en_US.UTF-8 for both prompts, or whatever you want.
export LANG=en_US.UTF-8
# install your favourite packages here
apt-get install nvi ; apt-get remove nano 
# set root password - otherwise you won't be able to log in
passwd
exit
# cleanup
rm /mnt/usr/bin/qemu-arm-static /mnt/etc/resolv.conf
# ensure hostname has not carried over from your build host
echo something > /mnt/etc/hostname
# enable serial console (Debian/sysvinit way)
echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> etc/inittab
# enable serial console (Ubuntu/upstart way - TBD)
umount /mnt

3. 创建armbian镜像

参考:https://forum.armbian.com/index.php/topic/6-how-to-build-my-own-image-or-kernel/

 

 

转载于:https://my.oschina.net/u/584525/blog/811401

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值