fc66046d76
The AOP uses an 'EPIC' protocol similar to the one other coprocessor firmware is using but not in the exact same version. Add code for tracing the AOP calls and extend the aop.py experiment with the client side of it. Include description of audio calls and some other calls related to sensor discovery. Furthermore, in experiments/aop.py, do some AOP audio setup. Once that is done we can start streaming samples from the internal microphones by making what AOP considers power state adjustment calls. That is, we adjust the power state of a 'hpai' device, first to a 'pw1 ' stage, then to 'pwrd' stage. So, to see microphone samples, enter the AOP experiment shell first: $ M1N1DEVICE=/dev/ttyACM0 experiments/aop.py Within the shell, adjust the power state of 'hpai': >>> aop_set_audio_pstate('hpai', 'pw1 ') At that point /arm-io/admac-aop-audio powers up. In parallel to the AOP shell, we can start tools/admac_stream.py on the just powered-up ADMAC instance: $ M1N1HEAP=0x10010000000 M1N1DEVICE=/dev/ttyACM1 tools/admac_stream.py \ --node admac-aop-audio --channel 1 -v | xxd -g 4 -c 12 -e Returning back to the AOP shell, we can then set 'hpai' to 'pwrd' state to kick off the streaming: >>> aop_set_audio_pstate('hpai', 'pwrd') By that point, we should see samples coming out on the ADMAC end. The samples are 32-bit floats packed in groups of three in a frame, e.g. 00000000: ba7ac6a7 ba32d3c3 baa17ae2 ..z...2..z.. 0000000c: 38ccea5f b99c1a37 ba0c4bb1 _..87....K.. 00000018: 39d2354f 3964b5ff 39b209fb O5.9..d9...9 00000024: b96a1d1f 39c8503f 3958fc4f ..j.?P.9O.X9 00000030: b6b1f5ff 39c72b8f 39bbe017 .....+.9...9 0000003c: 3a912de5 36dd4f7f 37f1147f .-.:.O.6...7 This has been tested and will to some degree be specific to 2021 Macbook Pro (t6000). Differences on other models TBD (at the very least the number of microphones can be presumed different). Signed-off-by: Martin Povišer <povik@protonmail.com> |
||
---|---|---|
.github/workflows | ||
3rdparty_licenses | ||
artwork@35626c31f5 | ||
data | ||
font | ||
proxyclient | ||
rust | ||
src | ||
sysinc | ||
tools | ||
udev | ||
.clang-format | ||
.editorconfig | ||
.gitignore | ||
.gitmodules | ||
config.h | ||
docker-compose.yml | ||
Dockerfile | ||
LICENSE | ||
m1n1-raw.ld | ||
m1n1.ld | ||
Makefile | ||
README.md |
m1n1: an experimentation playground for Apple Silicon
(And to some extent a Linux bootloader)
Building
You need an aarch64-linux-gnu-gcc
cross-compiler toolchain (or a native one, if running on ARM64).
$ git clone --recursive https://github.com/AsahiLinux/m1n1.git
$ cd m1n1
$ make
The output will be in build/m1n1.macho.
To build on a native arm64 machine, use make ARCH=
.
Building on ARM64 macOS is supported with clang and LLVM; you need to use Homebrew to install the required dependencies:
$ brew install llvm
After that, just type make
.
Building using the container setup
If you have a container runtime installed, like Podman or Docker, you can make use of the compose setup, which contains all build dependencies.
$ git clone --recursive https://github.com/AsahiLinux/m1n1.git
$ cd m1n1
$ podman-compose run m1n1 make
$ # or
$ docker-compose run m1n1 make
Usage
Our wiki has more information on how to use m1n1.
To install on an OS container based on macOS <12.1, use m1n1.macho
:
kmutil configure-boot -c m1n1.macho -v <path to your OS volume>
To install on an OS container based on macOS >=12.1, use m1n1.bin
:
kmutil configure-boot -c m1n1.bin --raw --entry-point 2048 --lowest-virtual-address 0 -v <path to your OS volume>
Payloads
m1n1 supports running payloads by simple concatenation:
$ cat build/m1n1.macho Image.gz build/dtb/apple-j274.dtb initramfs.cpio.gz > m1n1-payload.macho
$ cat build/m1n1.bin Image.gz build/dtb/apple-j274.dtb initramfs.cpio.gz > m1n1-payload.bin
Supported payload file formats:
- Kernel images (or compatible). Must be compressed or last payload.
- Devicetree blobs (FDT). May be uncompressed or compressed.
- Initramfs cpio images. Must be compressed.
Supported compression formats:
- gzip
- xz
License
m1n1 is licensed under the MIT license, as included in the LICENSE file.
- Copyright The Asahi Linux Contributors
Please see the Git history for authorship information.
Portions of m1n1 are based on mini:
- Copyright (C) 2008-2010 Hector Martin "marcan" marcan@marcan.st
- Copyright (C) 2008-2010 Sven Peter sven@svenpeter.dev
- Copyright (C) 2008-2010 Andre Heider a.heider@gmail.com
m1n1 embeds libfdt, which is dual BSD and GPL-2 licensed and copyright:
- Copyright (C) 2014 David Gibson david@gibson.dropbear.id.au
- Copyright (C) 2018 embedded brains GmbH
- Copyright (C) 2006-2012 David Gibson, IBM Corporation.
- Copyright (C) 2012 David Gibson, IBM Corporation.
- Copyright 2012 Kim Phillips, Freescale Semiconductor.
- Copyright (C) 2016 Free Electrons
- Copyright (C) 2016 NextThing Co.
The ADT code in mini is also based on libfdt and subject to the same license.
m1n1 embeds minlzma, which is MIT licensed and copyright:
- Copyright (c) 2020 Alex Ionescu
m1n1 embeds a slightly modified version of tinf, which is ZLIB licensed and copyright:
- Copyright (c) 2003-2019 Joergen Ibsen
m1n1 embeds portions taken from arm-trusted-firmware, which is BSD licensed and copyright:
- Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
m1n1 embeds Doug Lea's malloc (dlmalloc), which is in the public domain (CC0).
m1n1 embeds portions of PDCLib, which is in the public domain (CC0).
m1n1 embeds the Source Code Pro font, which is licensed under the OFL-1.1 license and copyright:
- Copyright 2010-2019 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
m1n1 embeds portions of the dwc3 usb linux driver, which was BSD-or-GPLv2 dual-licensed and copyright
- Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
m1n1 embeds some rust crates. Licenses can be found in the vendor directory for every crate.