emitrax
emitrax

Reputation: 394

Build AOSP on MacOS M1

I wanted to get my feet wet with AOSP on my MacOS M1 (ARM64) with Big Sur, but it looks like there is no configuration build for this host.

When I look under build/soong/cc/config I only see one Darwin related file, namely x86_darwin_host.go.

With the latest aosp release, namely android-11.0.0_r35 I'm able to build a generic arm64 target, but the resulting emulator does not boot. Configuration shows that the HOST is detected as x86_64, in fact binaries generated are in x86_64 format.

total 0
drwxr-xr-x  3 salvatorebenedetto  staff  102 Apr 10 15:21 common
drwxr-xr-x  9 salvatorebenedetto  staff  374 Apr 10 15:21 darwin-x86
➜  aosp file out/host/darwin-x86/lib64/libc++.dylib 
out/host/darwin-x86/lib64/libc++.dylib: Mach-O 64-bit dynamically linked shared library x86_64
➜  aosp 

This is what I get when booting the emulator from the kernel

RAMDISK: lz4 image found at block 0
RAMDISK: lz4 decompressor not configured!
Invalid ramdisk decompression routine.  Select appropriate config option.
Kernel panic - not syncing: Could not decompress initial ramdisk image.
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.94+ #1
Hardware name: ranchu (DT)
Call trace:
[<ffffffc00008a590>] dump_backtrace+0x0/0x128
[<ffffffc00008a6cc>] show_stack+0x14/0x1c
[<ffffffc0005ca064>] dump_stack+0x80/0xa4
[<ffffffc0005c95a0>] panic+0xe8/0x228
[<ffffffc00074ba34>] rd_load_image+0x2fc/0x5e0
[<ffffffc00074be30>] initrd_load+0x50/0x2cc
[<ffffffc00074b47c>] prepare_namespace+0xd8/0x1ac
[<ffffffc00074ad04>] kernel_init_freeable+0x1bc/0x1dc
[<ffffffc0005c8150>] kernel_init+0x10/0xf4
Rebooting in 5 seconds..Reboot failed -- System halted

Any idea how I can debug what is wrong with the initrd image?

Upvotes: 2

Views: 5381

Answers (1)

Kaue Fontes
Kaue Fontes

Reputation: 21

I think this should help, it has a peace specific for setup the missing sdk 10.15.

Good luck, let us know if it works to you!

Upvotes: 2

Related Questions