Install Asahi Linux

❯ curlie https://alx.sh | sudo sh                                                                                (base)
HTTP/2 200
server: nginx/1.21.1
date: Sat, 19 Mar 2022 15:19:56 GMT
content-type: text/plain; charset=utf-8
content-length: 967
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
etag: "af389cf3253fe3f924350c99c293434d1c78883b3c51676bf954211c7bb0872b"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 821E:6DAB:83C117:8E8F7F:623518DF
accept-ranges: bytes
via: 1.1 varnish
x-served-by: cache-fra19151-FRA
x-cache: HIT
x-cache-hits: 1
x-timer: S1647703197.985480,VS0,VE1
vary: Authorization,Accept-Encoding,Origin
access-control-allow-origin: *
x-fastly-request-id: 7ac18bfda3e671762cc598d7521b9663e583d871
expires: Sat, 19 Mar 2022 15:24:56 GMT
source-age: 195
strict-transport-security: max-age=31536000;


Bootstrapping installer:
  Checking version...
  Version: v0.3.5
  Downloading...
  Extracting...
  Initializing...


Welcome to the Asahi Linux installer!

This installer is in an alpha state, and may not work for everyone.
It is intended for developers and early adopters who are comfortable
debugging issues or providing detailed bug reports.

Please make sure you are familiar with our documentation at:
  https://alx.sh/w

Press enter to continue.


By default, this installer will hide certain advanced options that
are only useful for developers. You can enable expert mode to show them.
» Enable expert mode? (y/N): y

Collecting system information...
  Product name: MacBook Pro (16-inch, 2021)
  SoC: Apple M1 Max
  Device class: j316cap
  Product type: MacBookPro18,2
  Board ID: 0xa
  Chip ID: 0x6001
  System firmware: iBoot-7459.101.2
  Boot UUID: 57F7E9CF-77CE-4D0F-83A4-15967BA49F69
  Boot VGID: 57F7E9CF-77CE-4D0F-83A4-15967BA49F69
  Default boot VGID: 57F7E9CF-77CE-4D0F-83A4-15967BA49F69
  Boot mode: macOS
  OS version: 12.3 (21E230)
  System rOS version: 12.3 (21E230)
  No Fallback rOS
  Login user: yiweiyang

Collecting partition information...
  System disk: disk0

Collecting OS information...

Partitions in system disk (disk0):
  1: APFS [Macintosh HD] (850.00 GB, 6 volumes)
    OS: [B*] [Macintosh HD] macOS v12.3 [disk3s1, 57F7E9CF-77CE-4D0F-83A4-15967BA49F69]
  2: (free space: 144.66 GB)
  3: APFS (System Recovery) (5.37 GB, 2 volumes)
    OS: [  ] recoveryOS v12.3 [Primary recoveryOS]

  [B ] = Booted OS, [R ] = Booted recovery, [? ] = Unknown
  [ *] = Default boot volume

Using OS 'Macintosh HD' (disk3s1) for machine authentication.

Choose what to do:
  f: Install an OS into free space
  r: Resize an existing partition to make space for a new OS
  q: Quit without doing anything
» Action (f): f

Choose an OS to install:
  1: Asahi Linux Desktop
  2: Asahi Linux Minimal (Arch Linux ARM)
  3: UEFI environment only (m1n1 + U-Boot + ESP)
  4: Tethered boot (m1n1, for development)
» OS: 1

Downloading OS package info...
.

Minimum required space for this OS: 15.00 GB

Available free space: 144.66 GB

How much space should be allocated to the new OS?
  You can enter a size such as '1GB', a fraction such as '50%',
  the word 'min' for the smallest allowable size, or
  the word 'max' to use all available space.
» New OS size (max): max

The new OS will be allocated 144.66 GB of space,
leaving 167.94 KB of free space.

Enter a name for your OS
» OS name (Asahi Linux):

Choose the macOS version to use for boot firmware:
(If unsure, just press enter)
  1: 12.3
» Version (1): 1

Using macOS 12.3 for OS firmware

Downloading macOS OS package info...
.

Creating new stub macOS named Asahi Linux
Installing stub macOS into disk0s5 (Asahi Linux)
Preparing target volumes...
Checking volumes...
Beginning stub OS install...
++
Setting up System volume...
Setting up Data volume...
Setting up Preboot volume...
++++++++++
Setting up Recovery volume...
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Wrapping up...

Stub OS installation complete.

Adding partition EFI (500.17 MB)...
  Formatting as FAT...
Adding partition Root (144.16 GB)...
Collecting firmware...
Installing OS...
  Copying from esp into disk0s4 partition...
+
  Copying firmware into disk0s4 partition...
  Extracting root.img into disk0s7 partition...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Error downloading data (IncompleteRead(10240000 bytes read, 1294336 more expected)), retrying... (1/5)
+Error downloading data (IncompleteRead(1130496 bytes read, 10403840 more expected)), retrying... (2/5)
+++++++++++++++++++++++++++++++++++++Error downloading data (IncompleteRead(5979282 bytes read, 5555054 more expected)), retrying... (1/5)
+++++++
Preparing to finish installation...
Collecting installer data...

To continue the installation, you will need to enter your macOS
admin credentials.

Password for yiweiyang:

Setting the new OS as the default boot volume...

Installation successful!

Install information:
  APFS VGID: 052A3A5A-E253-4B46-AF6A-F9615F39844B
  EFI PARTUUID: 487bfda1-77ae-4a4c-8462-3cba91f073a7

To be able to boot your new OS, you will need to complete one more step.
Please read the following instructions carefully. Failure to do so
will leave your new installation in an unbootable state.

Press enter to continue.




When the system shuts down, follow these steps:

1. Wait 15 seconds for the system to fully shut down.
2. Press and hold down the power button to power on the system.
   * It is important that the system be fully powered off before this step,
     and that you press and hold down the button once, not multiple times.
     This is required to put the machine into the right mode.
3. Release it once 'Entering startup options' is displayed,
   or you see a spinner.
4. Wait for the volume list to appear.
5. Choose 'Asahi Linux'.
6. You will briefly see a 'macOS Recovery' dialog.
   * If you are asked to 'Select a volume to recover',
     then choose your normal macOS volume and click Next.
     You may need to authenticate yourself with your macOS credentials.
7. Once the 'Asahi Linux installer' screen appears, follow the prompts.

Press enter to shut down the system.

MacVM Hypervisor performance

Mac has launched its API for virtulization and KhaosT has wrapped this api into a fully automated tool to install MacOS on Apple Sillicon just like opening sandbox.

The virtulization API is universal in swift.

let vm = VZVirtualMachine(configuration: configuration, queue: .main)
vm.delegate = self
            
vm.start { [weak self] result in
    switch result {
    case .success:
       self?.document?.isRunning = true
       NSLog("Success")
    case .failure(let error):
       NSLog("Error: \(error)")
     }
}

vm lifecycle

Performance test between M1 and 9700k

# M1 Direct
❯ openssl speed -evp aes-128-cbc aes-256-cbc des-ede3 rsa2048 sha256                                             (base)
Doing sha256 for 3s on 16 size blocks: 13547385 sha256's in 2.98s
Doing sha256 for 3s on 64 size blocks: 6595521 sha256's in 2.91s
Doing sha256 for 3s on 256 size blocks: 2811715 sha256's in 2.98s
Doing sha256 for 3s on 1024 size blocks: 811209 sha256's in 2.90s
Doing sha256 for 3s on 8192 size blocks: 109612 sha256's in 2.96s
Doing sha256 for 3s on 16384 size blocks: 55935 sha256's in 2.94s
Doing des ede3 for 3s on 16 size blocks: 4252004 des ede3's in 2.99s
Doing des ede3 for 3s on 64 size blocks: 1017455 des ede3's in 2.91s
Doing des ede3 for 3s on 256 size blocks: 272326 des ede3's in 2.99s
Doing des ede3 for 3s on 1024 size blocks: 66040 des ede3's in 2.97s
Doing des ede3 for 3s on 8192 size blocks: 8196 des ede3's in 2.94s
Doing des ede3 for 3s on 16384 size blocks: 4052 des ede3's in 2.93s
Doing aes-256 cbc for 3s on 16 size blocks: 28033078 aes-256 cbc's in 2.95s
Doing aes-256 cbc for 3s on 64 size blocks: 7296104 aes-256 cbc's in 2.97s
Doing aes-256 cbc for 3s on 256 size blocks: 1724393 aes-256 cbc's in 2.88s
Doing aes-256 cbc for 3s on 1024 size blocks: 438037 aes-256 cbc's in 2.84s
Doing aes-256 cbc for 3s on 8192 size blocks: 57285 aes-256 cbc's in 2.93s
Doing aes-256 cbc for 3s on 16384 size blocks: 27726 aes-256 cbc's in 2.92s
Doing aes-128-cbc for 3s on 16 size blocks: 91712957 aes-128-cbc's in 2.89s
Doing aes-128-cbc for 3s on 64 size blocks: 24402793 aes-128-cbc's in 2.90s
Doing aes-128-cbc for 3s on 256 size blocks: 8617690 aes-128-cbc's in 2.97s
Doing aes-128-cbc for 3s on 1024 size blocks: 2327697 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 8192 size blocks: 246604 aes-128-cbc's in 2.60s
Doing aes-128-cbc for 3s on 16384 size blocks: 157122 aes-128-cbc's in 2.95s
Doing 2048 bits private rsa's for 10s: 8364 2048 bits private RSA's in 9.92s
Doing 2048 bits public rsa's for 10s: 229578 2048 bits public RSA's in 7.99s
OpenSSL 1.1.1l  24 Aug 2021
built on: Tue Nov 23 07:53:43 2021 UTC
options:bn(64,64) rc4(16x,int) des(int) aes(partial) idea(int) blowfish(ptr)
compiler: /Users/yiweiyang/project/spack/lib/spack/env/clang/clang -fPIC  -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -D_REENTRANT -DZLIB -DNDEBUG -I/Users/yiweiyang/project/spack/opt/spack/darwin-monterey-x86_64/apple-clang-13.0.0/zlib-1.2.11-fj3aancm72hxjybw6445d5uuftok6jvr/include
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
des ede3         22753.20k    22377.02k    23316.21k    22769.35k    22837.29k    22658.01k
aes-256 cbc     152043.81k   157222.44k   153279.38k   157940.10k   160163.39k   155569.45k
aes-128-cbc     507753.40k   538544.40k   742804.26k   799852.93k   776992.30k   872639.61k
sha256           72737.64k   145056.13k   241543.30k   286440.70k   303358.62k   311713.96k
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.001186s 0.000035s    843.1  28733.2

# M1 hypervisor
test-vm@test-vms-Mac ~ % openssl speed -evp aes-128-cbc des-ede3 rsa2048 sha256
Doing sha256 for 3s on 16 size blocks: 12417802 sha256's in 2.91s
Doing sha256 for 3s on 64 size blocks: 8605571 sha256's in 2.73s
Doing sha256 for 3s on 256 size blocks: 7519183 sha256's in 2.97s
Doing sha256 for 3s on 1024 size blocks: 3766735 sha256's in 2.99s
Doing sha256 for 3s on 8192 size blocks: 675151 sha256's in 2.98s
Doing des ede3 for 3s on 16 size blocks: 4212079 des ede3's in 3.00s
Doing des ede3 for 3s on 64 size blocks: 1079073 des ede3's in 2.99s
Doing des ede3 for 3s on 256 size blocks: 274746 des ede3's in 2.98s
Doing des ede3 for 3s on 1024 size blocks: 71968 des ede3's in 2.99s
Doing des ede3 for 3s on 8192 size blocks: 8420 des ede3's in 2.98s
Doing aes-128-cbc for 3s on 16 size blocks: 43091935 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 64 size blocks: 11225248 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 256 size blocks: 2726199 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 1024 size blocks: 673152 aes-128-cbc's in 2.96s
Doing aes-128-cbc for 3s on 8192 size blocks: 82678 aes-128-cbc's in 2.98s
Doing 2048 bit private rsa's for 10s: 4518 2048 bit private RSA's in 9.94s
Doing 2048 bit public rsa's for 10s: 103797 2048 bit public RSA's in 9.94s
LibreSSL 3.3.5
built on: date not available
options:bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
des ede3         22500.93k    23073.39k    23597.93k    24660.00k    23143.85k
aes-128-cbc     231587.58k   239916.76k   234029.06k   233230.99k   227646.27k
sha256           68226.66k   201824.46k   648416.14k  1288982.79k  1855047.46k
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.002201s 0.000096s    454.4  10441.9

# 9700K Direct
❯ openssl speed -evp aes-128-cbc aes-256-cbc des-ede3 rsa2048 sha256
Doing sha256 for 3s on 16 size blocks: 21369624 sha256's in 2.86s
Doing sha256 for 3s on 64 size blocks: 11887732 sha256's in 2.92s
Doing sha256 for 3s on 256 size blocks: 5599953 sha256's in 2.97s
Doing sha256 for 3s on 1024 size blocks: 1737136 sha256's in 2.98s
Doing sha256 for 3s on 8192 size blocks: 229175 sha256's in 2.92s
Doing sha256 for 3s on 16384 size blocks: 117287 sha256's in 2.97s
Doing des ede3 for 3s on 16 size blocks: 8288297 des ede3's in 2.99s
Doing des ede3 for 3s on 64 size blocks: 2095278 des ede3's in 2.98s
Doing des ede3 for 3s on 256 size blocks: 525764 des ede3's in 2.98s
Doing des ede3 for 3s on 1024 size blocks: 130040 des ede3's in 2.95s
Doing des ede3 for 3s on 8192 size blocks: 16445 des ede3's in 2.99s
Doing des ede3 for 3s on 16384 size blocks: 8217 des ede3's in 2.98s
Doing aes-256 cbc for 3s on 16 size blocks: 49239507 aes-256 cbc's in 2.98s
Doing aes-256 cbc for 3s on 64 size blocks: 12584820 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 256 size blocks: 3150137 aes-256 cbc's in 2.98s
Doing aes-256 cbc for 3s on 1024 size blocks: 792478 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 8192 size blocks: 99018 aes-256 cbc's in 2.98s
Doing aes-256 cbc for 3s on 16384 size blocks: 49599 aes-256 cbc's in 2.99s
Doing aes-128-cbc for 3s on 16 size blocks: 205033256 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 64 size blocks: 84091603 aes-128-cbc's in 2.92s
Doing aes-128-cbc for 3s on 256 size blocks: 21937430 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 1024 size blocks: 5512203 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 8192 size blocks: 689395 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 16384 size blocks: 344040 aes-128-cbc's in 2.99s
Doing 2048 bits private rsa's for 10s: 24679 2048 bits private RSA's in 9.94s
Doing 2048 bits public rsa's for 10s: 800018 2048 bits public RSA's in 9.94s
OpenSSL 1.1.1m  14 Dec 2021
built on: Thu Feb 10 23:52:55 2022 UTC
options:bn(64,64) rc4(16x,int) des(int) aes(partial) idea(int) blowfish(ptr)
compiler: /Volumes/DataCorrupted/spack/lib/spack/env/clang/clang -fPIC  -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -D_REENTRANT -DZLIB -DNDEBUG -I/Volumes/DataCorrupted/spack/opt/spack/darwin-monterey-skylake/apple-clang-13.0.0/zlib-1.2.11-7yfdtza4upfsjhx6nyigqab6ctnbiqxg/include
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
des ede3         44352.09k    44999.26k    45166.30k    45139.31k    45056.00k    45176.96k
aes-256 cbc     264373.19k   269374.07k   270615.80k   271403.84k   272199.82k   271782.61k
aes-128-cbc    1100849.70k  1843103.63k  1878254.88k  1894126.13k  1895142.23k  1885201.12k
sha256          119550.34k   260553.03k   482689.55k   596921.90k   642945.75k   647013.54k
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.000403s 0.000012s   2482.8  80484.7

# 9700K hypervisor
test-vm@macos-12 ~ %  openssl speed -evp aes-128-cbc aes-256-cbc des-ede3 rsa2048 sha256
Doing sha256 for 3s on 16 size blocks: 6998286 sha256's in 1.76s
Doing sha256 for 3s on 64 size blocks: 5937478 sha256's in 2.40s
Doing sha256 for 3s on 256 size blocks: 3640021 sha256's in 2.89s
Doing sha256 for 3s on 1024 size blocks: 1276928 sha256's in 2.99s
Doing sha256 for 3s on 8192 size blocks: 172371 sha256's in 2.98s
Doing des ede3 for 3s on 16 size blocks: 6392897 des ede3's in 2.97s
Doing des ede3 for 3s on 64 size blocks: 1840224 des ede3's in 2.97s
Doing des ede3 for 3s on 256 size blocks: 486441 des ede3's in 2.99s
Doing des ede3 for 3s on 1024 size blocks: 122497 des ede3's in 2.99s
Doing des ede3 for 3s on 8192 size blocks: 15081 des ede3's in 2.98s
Doing aes-256 cbc for 3s on 16 size blocks: 24622581 aes-256 cbc's in 2.96s
Doing aes-256 cbc for 3s on 64 size blocks: 6913334 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 256 size blocks: 1779287 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 1024 size blocks: 993353 aes-256 cbc's in 2.98s
Doing aes-256 cbc for 3s on 8192 size blocks: 130072 aes-256 cbc's in 2.99s
Doing aes-128-cbc for 3s on 16 size blocks: 248465144 aes-128-cbc's in 2.96s
Doing aes-128-cbc for 3s on 64 size blocks: 80633266 aes-128-cbc's in 2.98s
Doing aes-128-cbc for 3s on 256 size blocks: 20577300 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 1024 size blocks: 5140306 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 8192 size blocks: 631903 aes-128-cbc's in 2.99s
Doing 2048 bit private rsa's for 10s: 13162 2048 bit private RSA's in 9.97s
Doing 2048 bit public rsa's for 10s: 246512 2048 bit public RSA's in 9.96s
LibreSSL 2.8.3
built on: date not available
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
des ede3         34426.72k    39593.28k    41604.84k    41932.50k    41488.42k
aes-256 cbc     133310.22k   148026.58k   152125.43k   341155.78k   356036.10k
aes-128-cbc    1341209.76k  1730061.34k  1759369.75k  1758876.41k  1729626.63k
sha256           63774.17k   158049.71k   322534.94k   437365.11k   473238.50k
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.000758s 0.000040s   1320.1  24743.0

The measurement of TSO on M1 Max

We've seen that there's already a TSO Enabler for M1 and worked perfectly fine on M1 Max using kernel injection kmutil trigger-panic-medic --volume-root /Volumes/Data/Library/Extensions/TSOEnabler.kext just like Hackintosh.

So, I just want to check the famous OOTA problem on both TSO on and off.

Line 24 will be stuck without TSO and will work fine with TSO.

M1 Max 提货体验

花了半个月,11月23号早上就到货了,本来是一个月才到货,这也是一个小惊喜吧。买这个本的初步想法就是学习arm汇编,同时尝试反编译一下metal api到苹果的asic的过程。总之就是想花钱买开心。

21637743555_.pic_hd

LLVM all 14分钟就编译完了。几乎是我9700k的2倍。我终于实现了rust电量自由。