您尚未登录。

楼主 #1 2019-11-19 11:08:33

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

参考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
/ $ 




离线

楼主 #4 2019-11-19 14:02:05

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

Re: 在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

你可能没有执行第3步





离线

楼主 #6 2019-11-19 14:13:06

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

Re: 在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

那可能如前面那个网友说的, 你可能缺 lib 了.

因为我换了几台电脑, 甚至搬瓦工上的虚拟机都是OK的。





离线

楼主 #8 2019-11-19 17:37:47

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

Re: 在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

你在 buildroot 配置成了大端?





离线

楼主 #10 2019-11-19 17:45:48

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

Re: 在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

哈哈,这样自嘲不好吧,不过现在基本见不到大端的系统。





离线

楼主 #16 2019-11-22 08:18:10

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,246
积分: 9197

Re: 在 ubuntu@x86 用 chroot 到 ARM 平台的 rootfs

既然大家都验证通过了, 我加入本站精华帖汇总应该没有不同意见吧:


210. 在 ubuntu@x86 用 chroot 到 ARM 平台的





离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn