参考1: 精华帖 Debian 9.9 文件系统制作
参考2: 在 x86 下 chroot 到 ARM 平台的 rootfs
1. 准备工作:
sudo apt install qemu-user-static -y
2. 编译buildroot, 或单独编译 busybox 等。
3. 找到buidlroot的target目录, 复制qemu-user-static到target目录
$ cp /usr/bin/qemu-arm-static /buildroot-2018.08.2/output/target/usr/bin/
4. chroot:
sudo chroot /buildroot-2018.08.2/output/target/ /bin/sh
好了, 现在你可以为所欲为, 就像在嵌入式系统一样,执行任何busybox 命令了:
whycan@ubuntu$ sudo chroot /buildroot-2018.08.2/output/target/ /bin/sh
/ $ ls
THIS_IS_NOT_YOUR_ROOT_FILESYSTEM linuxrc run
bin media sbin
dev mnt sys
etc opt tmp
lib proc usr
lib32 root var
/ $
/ $
/ $ ping
BusyBox v1.27.2 (2017-11-10 15:34:58 CST) multi-call binary.
Usage: ping [OPTIONS] HOST
Send ICMP ECHO_REQUEST packets to network hosts
-c CNT Send only CNT pings
-s SIZE Send SIZE data bytes in packets (default 56)
-t TTL Set TTL
-I IFACE/IP Source interface or IP address
-W SEC Seconds to wait for the first response (default 10)
(after all -c CNT packets are sent)
-w SEC Seconds until ping exits (default:infinite)
(can exit earlier with -c CNT)
-q Quiet, only display output at start
and when finished
-p Pattern to use for payload
/ $
离线