栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

debootstrap定制arm平台linux

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

debootstrap定制arm平台linux

debootstrap制作arm平台linux

参考资料

Debootstrap - Debian Wiki

一、自动安装
1、组件安装

sudo apt install qemu-user-static
sudo apt install ubuntu-dev-tools
sudo apt install debootstrap

2、命令说明
sudo debootstrap --arch |平台|  |发行版本代号|  |目录| |安装源|
3、安装debian

sudo mkdir /mnt/debian 
sudo debootstrap --arch armhf buster /mnt/debian  https://mirrors.tuna.tsinghua.edu.cn/debian/

4、复制qemu

sudo cp /usr/bin/qemu-arm-static /mnt/debian/usr/bin/

5、进入目录更新组件

sudo chroot /mnt/debian

echo "debian-arm" >/etc/hostname
echo "127.0.0.1 localhost" >/etc/hosts
echo "127.0.1.1 debian-arm" >/etc/hosts
echo "nameserver 8.8.8.8" >/etc/resolv.conf
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

apt install net-tools vim sudo bash-completion
apt install pciutils usbutils
apt install systemd systemd-coredump makedev locales openssh-server
passwd root
adduser test
exit

6、制作文件

sudo dd if=/dev/zero of=debian.img bs=1 count=0 seek=1024M
sudo mkfs.ext4  debian.img
sudo mount debian.img /mnt/temp
sudo cp -ar /mnt/debian/* /mnt/temp/
sudo umount /mnt/temp

7、模拟启动

sudo qemu-system-arm -M virt -cpu cortex-a7 -nographic -smp 4 -m 1024 
-kernel zImage  
-append "console=ttyAMA0,115200 init=/sbin/init root=/dev/vda rw  ip=dhcp" 
-drive format=raw,if=none,file=debian.img,id=ha,index=0 -device virtio-blk-device,drive=ha  
-netdev bridge,br=virbr0,id=net0  -device virtio-net-device,netdev=net0,mac=12:22:33:44:55:66
启动界面
[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttyAMA0.
[  OK  ] Reached target Login prompts.
Debian GNU/Linux 10 test-linnux ttyAMA0
test-linnux login: root

 二、手工制作

wget https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cdimage/ubuntu-base/releases/21.04/release/ubuntu-base-21.04-base-armhf.tar.gz
sudo rm -rf /mnt/ubuntu
sudo mkdir /mnt/ubuntu
sudo tar -xvf ubuntu-base-21.04-base-armhf.tar.gz -C /mnt/ubuntu
sudo cp /usr/bin/qemu-arm-static /mnt/ubuntu/usr/bin
sudo mount -t proc /proc /mnt/ubuntu/proc
sudo mount -t sysfs /sys /mnt/ubuntu/sys
sudo mount -o bind /dev /mnt/ubuntu/dev
sudo mount -o bind /dev/pts /mnt/ubuntu/dev/pts
#sudo cp /etc/apt/sources.list /mnt/ubuntu/etc/apt/
sudo cp /etc/resolv.conf /mnt/ubuntu/etc/
sudo chroot /mnt/ubuntu
echo "nameserver 8.8.8.8" >/etc/resolv.conf
echo "ubuntu-arm" >/etc/hostname
echo "127.0.0.1 localhost" >/etc/hosts
echo "127.0.1.1 ubuntu-arm" >/etc/hosts
#passwd root
#adduser test
apt update
apt install -y  wget net-tools systemd  makedev locales vim openssh-server sudo bash-completion rsyslog 
apt install -y systemd-coredump
apt install -y iproute2 udhcpc iputils-ping
exit
#Geographic area: 6 Time zone: 70
#下面运行一次
sudo umount /mnt/ubuntu/proc
sudo umount /mnt/ubuntu/sys
sudo umount /mnt/ubuntu/dev/pts
sudo umount /mnt/ubuntu/dev

#可能要重启一次
sudo rm ubuntu.img
sudo dd if=/dev/zero of=ubuntu.img bs=1 count=0 seek=2048M
sudo mkfs.ext3  ubuntu.img
sudo mount ubuntu.img /mnt/temp
sudo cp -ar /mnt/ubuntu/* /mnt/temp/
sudo umount /mnt/temp
#安装shell
#apt install -y gnome-core gnome-shell gnome-session
apt install xfce4
systemctl set-default multi-user.target
systemctl set-default graphical.target
#ttyAMA0 system 启动
sudo cp /lib/systemd/system/serial-getty@.service /lib/systemd/system/serial-getty@ttyAMA0.service
sudo ln -s /lib/systemd/system/serial-getty@ttyAMA0.service /etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service
#"%i.device”这个好像不用改
#sudo cp /mnt/temp/etc/init/tty1.conf /mnt/temp/etc/init/ttyS0.conf
#exec /sbin/getty -L 115200 ttyS0 vt102

测试结果

systemd[1]: Detected virtualization qemu.
Welcome to Ubuntu 21.04!
[  OK  ] Started Serial Getty on ttyAMA0.
[  OK  ] Reached target Login prompts.
         Starting Hostname Service...
Ubuntu 21.04 ubuntu-arm ttyAMA0
ubuntu-arm login:
#只有shell,但桌面vcn没起来,估计是固件fd原因,暂不处理

三、机顶盒安装

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/361734.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号