Jump to content

Apple Macbook Air M1 (apple-tonga)

From postmarketOS Wiki
Apple MacBook Air
MacBook Air M1 2020 running postmarketOS.
MacBook Air M1 2020 running postmarketOS.
Manufacturer Apple
Name MacBook Air
Codename apple-tonga
Released 2020
Type laptop
Hardware
Chipset Apple M1
CPU 3.2 GHz 8cores (4× Apple Firestorm high-performance
4× Apple Icestorm high-efficiency)
GPU Apple G13G (either 7 or 8 cores dependent on base spec)
Display 13.3", native 2560 x 1600 pixels (16:10, 227 ppi) IPS
Storage 128GB (education only), 256GB, 512GB, 1TB, 2TB
Memory 8/16 GB LPDDR4 @ 4266 MT/s
Architecture aarch64
Software
Original software macOS
Original version
The version the device was shipped with.
11.0
FOSS bootloader yes
postmarketOS
Category testing
Pre-built images
Whether pre-built images are available here.
no
Mainline
Instead of a Linux kernel fork, it is possible to run (Close to) Mainline.
yes
Features
USB Networking
After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system).
Works
Battery
Charging and battery level reporting works
Works
Screen
Display works. Ideally with sleep mode and brightness control.
Works
Keyboard
Build in physical keyboard
Works
Touchpad
Build in Touchpad
Works
Multimedia
3D Acceleration
Partial
Audio
Audio playback, microphone, headset and buttons.
Partial
Camera
Works
Connectivity
WiFi
Untested
Bluetooth
Works
Miscellaneous
FDE
Full disk encryption and unlocking with unl0kr.
Partial
USB OTG
USB On-The-Go or USB-C Role switching
Works
U-Boot
Secondary Bootloader
It is possible to chainload U-Boot from stock bootloader.
Works
Mainline
Latest versions of U-Boot are not broken and it is possible to use them.
Works
Internal Storage
It is possible to boot from internal storage (e.g. eMMC or UFS).
Works
USB Host
It is possible to boot from a USB storage or connect a keyboard.
Works
USB Peripheral
It is possible to use device as a peripheral in U-Boot, e.g. for fastboot mode.
Works
Display
Works
Keyboard
Works
Note Note: for active development see https://asahilinux.org/ .

Contributors

  1. Asahi Linux Project

Users owning this device

How to enter flash mode

for DFU mode: https://support.apple.com/en-gb/guide/apple-configurator-2/apdd5f3c75ad/mac

Bootloader

According to Asahi Linux's Wiki, m1n1 is the bootloader for Linux kernel booting.
m1n1 is the bootloader developed by the Asahi Linux project to bridge the Apple (XNU) boot ecosystem to the Linux boot ecosystem.

What it does(from their wiki)

  • Initializes hardware
  • Puts up a pretty logo
  • Loads embedded (appended) payloads, which can be:
  • Device Trees (FDTs), with automatic selection based on the platform
  • Initramfs images (compressed CPIO archives)
  • Kernel images in Linux ARM64 boot format (optionally compressed)
  • Configuration statements
  • Chainloads another version of itself from a FAT32 partition (if configured to do so)

Proxy mode enables a huge toolset of developer features, from reducing your Linux kernel test cycle to 7 seconds, to live hardware probing and experimentation, to a hypervisor capable of running macOS or Linux and tracing hardware accesses in real time while providing a virtual UART over USB.
m1n1 can load U-Boot as a payload.

U-Boot

Note Note: You can look up their wiki for further informations.

U-Boot is the default payload for m1n1 stage 2, and is used to provide a standard preboot environment familiar to AArch64 developers. External boot is not supported with the native Apple Silicon boot tooling, making U-Boot a hard necessity for providing a PC-like boot environment.
It is able to boot from any external media (USB drive, network, etc.) and users an execute any EFI binaries.

U-Boot Status

Feature Status
USB-A Ports Not working due to their controller requiring firmware which we cannot redistribute.
USB devices Certain USB devices which expose multiple functions (hubs with NICs, fancy gaming keyboards, etc.) do not work.
USB Hubs Hubs with SD Card slots may cause U-Boot crash.

Installation

This device now have a WIP port in postmarketOS,like any other Linux port for Apple M1, you'll need to set up a simple UEFI environment to continue installation. Asahi Linux website and their script can help you to do this.
Use pmbootstrap to generate a postmarketOS image, then follow this guide to deploy it to an USB stick.
After you finished deploying postmarketOS on your USB stick, you need to do some extra work to boot your system:

  1. Download rEFInd and install it to your MacBook's EFI partition( just copy refind_aa64.efi to the root of the EFI partition, rename it to BOOTAA64.efi );
  2. Power off your Mac when you finished setting up UEFI environment, then plug in your USB drive and turn on your Mac again;
  3. When you see rEFInd boot menu, select "boot vmlinux-asahi from 486 MiB Volume" and hit enter.

UART Debug Port

This device has UART port on the USB-C port closest to the edge. To activate this, you need to send various of commands via USB-PD.
If you enabled UART successfully, here is a command reference :

103: PD reset

This needs a 0x8000 argument (taken from the get action info reply).

105: Reboot

This needs a 0x8000 argument (taken from the get action info reply).

about reboot command

the command "5AC8012,0105,80000000" is sent through the Serial Monitor of Arduino IDE. if you want to reboot Mac more conveniently.

106: DFU / hold mode

This needs a 0x8001 argument (taken from the get action info reply). It only works properly in DFP mode (Mac acting as UFP).
This mode is special. On the Mac Mini, a hard shutdown normally disables PD communications and UFP mode (Rd open). However, a hard shutdown from this mode (e.g. holding down the power button) will power down the machine while PD communications remain active. The machine can also be rebooted via 105 into normal mode, and again PD is not reset and existing modes remain active. This can be used to maintain debug connectivity through a machine reset.

306: Debug UART

Pin order: TX, RX
This can be mapped to pin sets 0-2 (D+/D- B, D+/D- A, or SBU1/2). The UART uses 1.2V voltage levels.

pin 1 is TX and pin 2 is RX, orientation-aware (for CC=CC2 they are flipped). In other words, the SBU pin on the same side of the connector (A or B) as your CC pin is TX.

606: DFU USB

Pin order: D+, D- (of course)
This is automatically mapped to pin set 1 (D+/D- primary) in DFU mode, but can be moved.

4606: Debug USB(What we need)

Interesting. This is not main-CPU-driven, it enumerates even when the system is off (in persistent mode). It re-enumerates on power transitions.

0803: An I²C bus (3.3V)

Pin order: SCL, SDA

Device addresses seen (unshifted): 0x38, 0x3f
It doesn't do anything interesting during normal boot, but does in macOS.
Also, sometimes it just sends START 00 STOP (no ACK cycle) at slower speed (?)

0809: Another I²C bus (3.3V)

Pin order: SCL, SDA

Device addresses seen (unshifted): 0x6b, 0x38, 0x3f,

TBD

0206 weak (30kΩ) pull to 1.2V, no reaction to gnd, no transitions. Good chance this is SWD.
0301 1.2V, one pin drives high, the other no drive. Another UART? high-z in DFU mode, no activity except high pin tracking power/boots.
0303 Only maps to pinsets 1-2? Seems to be GND? No transitions seen. Unused UART mode?

See also

This device does currently boot and works to a degree, it has a actively developed Linux port (https://asahilinux.org/).
Initial merge request: MR5913

Notes

Note Note: An available GPU driver is ready for daily usage.

Now you can install other Linux like Debian from this website:[Other].
To use Asahi's graphics driver, Update your kernel to their develop branch.