1.环境准备
sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
2.获取debian根文件系统
2.1.cd /opt
2.2.sudo debootstrap --foreign --arch armel wheezy wheezy_fs http://ftp.debian.org/debian/
3.为chroot做准备
3.1.cp /usr/bin/qemu-arm-static /opt/wheezy_fs/usr/bin/
3.2.sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot wheezy_fs debootstrap/debootstrap --second-stage
3.3.cd wheezy_fs
sudo echo "proc /proc proc defaults 0 0" >> etc/fstab
sudo mknod dev/console c 5 1
cd ../
3.4.sudo chroot wheezy_fs,此时会进入以下状态:
[email protected]:/opt$ sudo chroot wheezy_fs
[email protected]:/# ls
bin dev home media opt root sbin srv tmp var
boot etc lib mnt proc run selinux sys usr
4.在etc/apt/source.list文件中添加以下内容:
deb http://cdn.debian.net/debian wheezy main contrib non-free
deb-src http://cdn.debian.net/debian wheezy main contrib non-free
5.更新软件源
apt-get update
6.为root设置密码:
passwd root (会要求输入密码)
7.添加一个新用户jello:
adduser jello (会要求输入密码)
8.cp /usr/share/sysvinit/inittab /etc/
9.vi /etc/inittab,修改波特率:
修改前:
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
修改后:
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
10.退出chroot环境
exit