Closed MrZLeo closed 2 years ago
cargo qemu 就是用 qemu-system 的,musl-gcc 是为了编译 busybox,它必须得有 busybox。还有一些其他非必要的测例也需要 musl-gcc 编译。我们没有 mac,没试过。好像之前用 mac 的人都是直接开 linux 虚拟机的,应该虚拟机里能搞运行。
aarch64 的支持整个都是国防科大的同学提供的,我们理解不深。实际上测例也经常不过。如果你试出来什么可以告诉我们一声,微信上 rcore-os 群里找我们也行。
@YdrMaster 我使用其他架构的时候也是一样,应该是musl-gcc缺失。我不是很了解musl-gcc工具链,但是这里用的是linux-musl-gcc,似乎只能在Linux中运行,是否有对应的mac编译器呢?
@MrZLeo 也许可以,但我没法试……这一块的逻辑是它会层层递归地构造 rootfs,如果你能提供一个 rootfs 他就不会试图编译了。在根目录下新建 rootfs/$arch
目录就行,至少需要 busybox 和 musl-libc 的 ld:
> ~/repos/zCore$ tree rootfs
rootfs
└── riscv64
├── bin
│ ├── busybox
│ ├── cat -> busybox
│ ├── cp -> busybox
│ ├── echo -> busybox
│ ├── false -> busybox
│ ├── grep -> busybox
│ ├── gzip -> busybox
│ ├── kill -> busybox
│ ├── ln -> busybox
│ ├── ls -> busybox
│ ├── mkdir -> busybox
│ ├── mv -> busybox
│ ├── pidof -> busybox
│ ├── ping -> busybox
│ ├── ping6 -> busybox
│ ├── printenv -> busybox
│ ├── ps -> busybox
│ ├── pwd -> busybox
│ ├── rm -> busybox
│ ├── rmdir -> busybox
│ ├── sh -> busybox
│ ├── sleep -> busybox
│ ├── stat -> busybox
│ ├── tar -> busybox
│ ├── touch -> busybox
│ ├── true -> busybox
│ ├── uname -> busybox
│ ├── usleep -> busybox
│ └── watch -> busybox
└── lib
└── ld-musl-riscv64.so.1
3 directories, 30 files
@YdrMaster 我使用其他架构的时候也是一样,应该是musl-gcc缺失。我不是很了解musl-gcc工具链,但是这里用的是linux-musl-gcc,似乎只能在Linux中运行,是否有对应的mac编译器呢?
它说的是 cannot execute binary file
,因为苹果 m1/2 处理器是 arm64,预编译的 gcc 是给 x86 编译的所以没法运行。
@YdrMaster 我使用其他架构的时候也是一样,应该是musl-gcc缺失。我不是很了解musl-gcc工具链,但是这里用的是linux-musl-gcc,似乎只能在Linux中运行,是否有对应的mac编译器呢?
它说的是
cannot execute binary file
,因为苹果 m1/2 处理器是 arm64,预编译的 gcc 是给 x86 编译的所以没法运行。
但是这里换成aarch64也是不行的,因为这里是linux-musl-gcc,不能在Linux之外的OS上运行。我先尝试一下直接下载预编译的rootfs,后续如果成功用上面说的工具链编译的话,再通过这个issue说一声。
非常感谢!!!
@YdrMaster 我使用其他架构的时候也是一样,应该是musl-gcc缺失。我不是很了解musl-gcc工具链,但是这里用的是linux-musl-gcc,似乎只能在Linux中运行,是否有对应的mac编译器呢?
它说的是
cannot execute binary file
,因为苹果 m1/2 处理器是 arm64,预编译的 gcc 是给 x86 编译的所以没法运行。但是这里换成aarch64也是不行的,因为这里是linux-musl-gcc,不能在Linux之外的OS上运行。我先尝试一下直接下载预编译的rootfs,后续如果成功用上面说的工具链编译的话,再通过这个issue说一声。
非常感谢!!!
我理解这个 aarch64 是从 x86 交叉编译到 aarch64,不是自己能在 aarch64 运行。应该大部分 linux 程序都可以直接在 mac 上运行吧,因为都是类 unix……
anyway,祝你成功
可以找个 x86 的电脑或者云服务器什么的编出来拷到你电脑上用
I use command
cargo qemu --arch aarch64 --smp 4
to build the kernel and run it in the qemu, but it failed with error:I don't understand why we need
aarch64-linux-musl-gcc
here. Do we run it in qemu user mode? I can not find detail document about this command. If I want to build the kernel and run it in qemu system mode, what should I do?My environment is as followed: