rust-embedded/rust-raspberrypi-OS-tutorials

Makefile Aarch64 Issues

WittsEnd2 opened this issue · 5 comments

When trying to run make qemu, it seems to error out on line 129 (at least in part 03_hacky_hello_world)

    @$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN) 

Is there a way to fix this so that it works with Aarch64 (especially useful for those that have M1 chips).

I am working on figuring this out myself too, but would appreciate any help I can get.

Hmm yeah, currently everything assumes an x86 host machine. The docker image is definitely x86 only at the moment.
I don’t know if docker on M1 is already supported/working?

This might be something I can try to address during this year’s holiday season.

For now, you can try to modify the Makefile so that it doesn’t try to launch stuff through docker, and then get a native version of qemu-system-aarch64 installed on your Mac.

Not sure what the best way to do this is. Manual compilation should always work. Maybe there’s a shortcut through Homebrew as well?

My suggestion is to create an archlinux arm on m1 via qemu to run this project, just pass the serial device to qemu and replace the x86_64 gcc in docker with aarch64 gcc and he will work perfectly, that's what I'm doing now.

Example:

截屏2021-11-20 12 16 16

I think what I will be aiming for, once I get around to doing it, is to provide an Ubuntu-based ARM64 container for everything except Make targets that require the USB serial, like chainboot.

These should run natively on Macs with little effort, since Ruby is preinstalled on macOS anyways. So it should just be a matter of installing the required gems.

I also learned that there is something in Docker called BuildX which allows for building cross-compiled containers. Not sure how it works though

Fixed by 89472ab

QEMU targets should work now on M1 Macs.