编译环境:Ubuntu 16.04.5
第一步:
apt-get install binfmt-support qemu qemu-user-static debootstrap
cd /home/;mkdir debian
debootstrap --verbose --arch=armhf --foreign stretch debian http://mirrors.ustc.edu.cn/debian/
cd debian
cp /usr/bin/qemu-arm-static usr/bin/
LC_ALL=C LANGUAGE=C LANG=C chroot . /debootstrap/debootstrap --second-stage
LC_ALL=C LANGUAGE=C LANG=C chroot . dpkg --configure -a
第二步:
chroot .
passwd root
echo "Ntablet" > etc/hostname
echo T0:2345:respawn:/sbin/getty -L ttyS2 115200 vt100 >> etc/inittab
echo deb http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free > etc/apt/sources.list
echo deb http://security.debian.org/ stretch/updates main contrib non-free >> etc/apt/sources.list
apt-get update
apt-get dist-upgrade
apt-get install openssh-server
apt-get install locales
echo "en_US.UTF-8 UTF-8" > etc/locale.gen
echo "zh_CN.UTF-8 UTF-8" >> etc/locale.gen
locale-gen
apt-get install wireless-tools wpasupplicant rfkill screen nano wget tar zip bluetooth blueman bluez bluez-tools libbluetooth-dev v4l-utils i2c-tools
exit
第三步(2G为例创建img文件并且分区):
#dd if=/dev/zero of=./disk.img bs=1024 count=2000000
#fdisk ./disk.img
输入:
n
(回车)
(回车)
w
格式化:
mkfs.ext4 -F -L home disk.img
挂载:
mkdir /tmp/rootfs
mount ./disk.img /tmp/rootfs
目录同步:
tar --exclude=qemu-arm-static -cf - . | tar -C /tmp/rootfs -xvf -
sync
复制 dtb,zImage 到 /tmp/rootfs/boot/
创建uEnv.txt
cd /tmp/rootfs/boot/
vi uEnv.txt
贴入下面代码:
bootmenu_0=Linux=run boot0;run usbboot;
boot0=load ${devtype} ${devnum}:${partnum} ${kernel_addr_r} /boot/zImage; \
load ${devtype} ${devnum}:${partnum} ${fdt_addr_r} /boot/rk3288-ntablet-870a-5648.dtb; \
env set bootargs console=ttyS2,${baudrate} rw rootwait rootfstype=ext4 root=/dev/mmcblk1p${partnum} init=/sbin/init earlyprintk noinitrd selinux=0; \
bootz ${kernel_addr_r} - ${fdt_addr_r};
Umount:
sync
umount /tmp/rootfs/boot/
此时,你将得到:
disk.img
详情请访问我们的 github