You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/alt/boot-process-guide.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ The PARTUUID of the EFI system partition assigned to the currently booted OS is
42
42
Here's where it gets a bit hairy. m1n1, u-boot, Linux, and the device trees have somewhat complex and subtle version interdependencies.
43
43
44
44
* m1n1 stage 2 is in charge of some hardware init, and patching in dynamic values into the device trees. This means that newer kernel hardware support often depends on a m1n1 update, either to initialize things or to add more device tree data, or both.
45
-
* In general, we prefer to keep Linux drivers simple and put "magic" init (e.g. random magic sets of register writes, which Apple loves to describe in their variant of a DT) in m1n1. Same with things related to the memory controller, clock configurations that we can reasonably leave static, etc. The exception is when Linux has no choice but to do this dynamically at runtime. Apple likes to leave way too much to the XNU kernel (which m1n1 replaces), including ridiculous things like turning on the system-level L3 cache, and we don't want Linux to have to deal with that. This also highly increases our chances of existing kernels working (at least partially) on newer SoCs/platforms with only DT changes, which is good for e.g. forward-compatibility of distro install images. For example, PCIe on M2 required no driver-level changes, only changes to the m1n1 initialization.
45
+
* In general, we prefer to keep Linux drivers simple and put "magic" init (e.g. random magic sets of register writes, which Apple loves to describe in their variant of a DT) in m1n1. Same with things related to the memory controller, clock configurations that we can reasonably leave static, etc. The exception is when Linux has no choice but to do this dynamically at runtime. Apple likes to leave way too much to the XNU kernel (which m1n1 replaces), including ridiculous things like turning on the system-level L3 cache, and we don't want Linux to have to deal with that. This also highly increases our chances of existing kernels working (at least partially) on newer SoCs/platforms with only DT changes, which is good for e.g. forward-compatibility of distro install images. For example, PCIe on M2 required no driver-level changes, only changes to the m1n1 initialization.
46
46
* U-Boot generally doesn't change much once properly brought up on any given SoC, and only cares about a subset of DT info.
47
47
* Linux needs DT data to bring up hardware, so new hardware needs DT updates. Our canonical DT repository is part of our Linux tree itself, but remember changes here often need m1n1 (stage 2) updates to make things actually work.
Copy file name to clipboardExpand all lines: docs/hw/soc/agx.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,9 +68,9 @@ Data structures: see [channels.py](https://github.com/AsahiLinux/m1n1/blob/main/
68
68
#### CPU->GPU channels
69
69
70
70
* Work Channels: four groups (0-3), each with three channels, one per GPU work type
71
-
* TA (Tile Accelerator; vertex processing)
72
-
* 3D (3D; pixel processing)
73
-
* CP (Compute)
71
+
* TA (Tile Accelerator; vertex processing)
72
+
* 3D (3D; pixel processing)
73
+
* CP (Compute)
74
74
75
75
TODO: there is probably some priority scheme for work submitted to different channels.
76
76
@@ -79,14 +79,14 @@ Data structures: see [channels.py](https://github.com/AsahiLinux/m1n1/blob/main/
79
79
#### GPU->CPU channels
80
80
81
81
* Event: work-related event notifications
82
-
* Work completion flag events
82
+
* Work completion flag events
83
83
* These have a 128-bit array indicating which event indices are firing
84
-
* Fault notifications
84
+
* Fault notifications
85
85
* GPU faults seem to be quite poorly handled as a stop-the-world process; macOS actually goes off dumping GPU MMIO registers directly, and the firmware seems to be quite clueless as to what to do.
86
86
* Statistics messages
87
-
* We ignore these. The firmware will complain once if the buffer overflows, but it's harmless.
87
+
* We ignore these. The firmware will complain once if the buffer overflows, but it's harmless.
88
88
* Firmware syslogs
89
-
* This one is weird in that there are multiple sub-channels for some reason, with control structures laid out contiguously.
89
+
* This one is weird in that there are multiple sub-channels for some reason, with control structures laid out contiguously.
90
90
* An unknown channel (tracing?)
91
91
92
92
### GPU contexts
@@ -181,14 +181,14 @@ Note: this is all summarized and glosses over tons of unknown/fixed/magic number
181
181
* Timestamp 3 ptr
182
182
* Unknown buffer 2 (empty)
183
183
* Embedded structures:
184
-
* Tiler parameters (tile counts/etc)
185
-
* TA work struct 2
184
+
* Tiler parameters (tile counts/etc)
185
+
* TA work struct 2
186
186
* TVB tilemap ptr
187
187
* TVB list ptr
188
188
* Three small buffers passed from userspace (alyssa calls these "deflake")
189
189
* Command encoder ptr (i.e. actual gfx pipeline to run, from userspace)
190
190
* Pipeline window base (4GiB window into VAs used for 32-bit shader pointers)
191
-
* TA work struct 3
191
+
* TA work struct 3
192
192
* One of the deflake ptrs
193
193
* Encoder ID (unique ID, GPU likely does not care)
194
194
* "Unknown buffer" (the one with incrementing numbers, from userspace)
@@ -270,7 +270,7 @@ This blocks 3D until TA is done. Unclear what black magic makes partial renders
* iBoot2, firmware, XNU kernel, RecoveryOS (all required by the platform)
21
-
* m1n1 as fuOS kernel, with chainloading config pointing to the EFI partition
22
-
*~empty root/data filesystem subvolumes
20
+
* iBoot2, firmware, XNU kernel, RecoveryOS (all required by the platform)
21
+
* m1n1 as fuOS kernel, with chainloading config pointing to the EFI partition
22
+
*~empty root/data filesystem subvolumes
23
23
2. EFI system partition (FAT32) (~512MB) with:
24
-
* m1n1 stage 2 + device trees + U-Boot
25
-
* GRUB or another UEFI OS loader boot the target kernel
24
+
* m1n1 stage 2 + device trees + U-Boot
25
+
* GRUB or another UEFI OS loader boot the target kernel
26
26
3. root/boot/etc. partitions (OS-specific)
27
27
28
28
Rationale: this arrangement pairs together a third-party OS with an APFS-resident OS as seen by Apple's tooling, and allows users to use the native boot picker (with a11y support). It avoids potential trouble down the road which could come from having multiple OSes attempt to manage the SEP under a shared OS context. It also lets us have independent secure-boot chains for OSes (once that is implemented), with the fuOS image containing the root of trust for subsequent boot stages, bridged to the machine chain of trust by the user with their machine owner credentials during installation.
@@ -41,39 +41,39 @@ A typical boot of a reference Linux system will go as follows, continuing on fro
41
41
42
42
* iBoot2 loads the custom kernel, which is a build of m1n1
43
43
* m1n1 stage 1 runs and
44
-
* Parses the Apple Device Tree (ADT) to obtain machine-specific information
* E.g. memory controller details, USB-C charging, HDMI display (on Mac Mini)
47
-
* Displays its logo on the screen (replacing the Apple logo)
48
-
* Loads its embedded configuration, which directs it to chainload from a FAT32 partition
49
-
* Initializes the NVMe controller
50
-
* Searches the GPT for the partition configured for chainloading, by PARTUUID.
51
-
* Mounts the partition as FAT32
52
-
* Searches for the filename configured for chainloading and loads it
53
-
* Shuts down the NVMe controller
54
-
* Chainloads to the loaded instance of m1n1 (as a raw binary blob), including forwarding any /chosen property configurations found in its embedded config.
47
+
* Displays its logo on the screen (replacing the Apple logo)
48
+
* Loads its embedded configuration, which directs it to chainload from a FAT32 partition
49
+
* Initializes the NVMe controller
50
+
* Searches the GPT for the partition configured for chainloading, by PARTUUID.
51
+
* Mounts the partition as FAT32
52
+
* Searches for the filename configured for chainloading and loads it
53
+
* Shuts down the NVMe controller
54
+
* Chainloads to the loaded instance of m1n1 (as a raw binary blob), including forwarding any /chosen property configurations found in its embedded config.
55
55
* m1n1 stage 2 runs and
56
-
* Parses the Apple Device Tree (ADT) to obtain machine-specific information
57
-
* Re-initializes hardware, including anything stage 1 did not do (e.g. due to it being older)
58
-
* Searches its embedded payloads to find Device Trees and an embedded U-Boot image
59
-
* Selects an embedded Device Tree (FDT) appropriate for the current platform
60
-
* Personalizes the FDT with dynamic information transplanted from the ADT
61
-
* Performs any other hardware initialization to prepare the machine environment for Linux
62
-
* Loads the embedded U-Boot image and jumps to it
56
+
* Parses the Apple Device Tree (ADT) to obtain machine-specific information
57
+
* Re-initializes hardware, including anything stage 1 did not do (e.g. due to it being older)
58
+
* Searches its embedded payloads to find Device Trees and an embedded U-Boot image
59
+
* Selects an embedded Device Tree (FDT) appropriate for the current platform
60
+
* Personalizes the FDT with dynamic information transplanted from the ADT
61
+
* Performs any other hardware initialization to prepare the machine environment for Linux
62
+
* Loads the embedded U-Boot image and jumps to it
63
63
* U-Boot runs and
64
-
* Parses the FDT
65
-
* Initializes the keyboard for input
66
-
* Initializes NVMe
67
-
* Prompts the user to break into a shell if requested
68
-
* Mounts the appropriate EFI System Partition
69
-
* Brings up basic EFI services
70
-
* Locates the default EFI bootloader in the ESP, e.g. GRUB, and boots it
64
+
* Parses the FDT
65
+
* Initializes the keyboard for input
66
+
* Initializes NVMe
67
+
* Prompts the user to break into a shell if requested
68
+
* Mounts the appropriate EFI System Partition
69
+
* Brings up basic EFI services
70
+
* Locates the default EFI bootloader in the ESP, e.g. GRUB, and boots it
71
71
* GRUB runs and
72
-
* Uses EFI disk access services to mount the /boot filesystem (could be the ESP itself, could be something else)
73
-
* Locates its configuration file and additional components
74
-
* Presents the user with a boot menu, using EFI console/input services
75
-
* Loads the kernel and initramfs from /boot
76
-
* Jumps to the kernel
72
+
* Uses EFI disk access services to mount the /boot filesystem (could be the ESP itself, could be something else)
73
+
* Locates its configuration file and additional components
74
+
* Presents the user with a boot menu, using EFI console/input services
75
+
* Loads the kernel and initramfs from /boot
76
+
* Jumps to the kernel
77
77
* The Linux kernel boots as it would on any other UEFI+FDT platform
78
78
79
79
This boot chain is designed to progressively bring the system closer to a "typical" ARM64 machine, so that subsequent layers have to worry less about the particulars of Apple Silicon machines.
@@ -122,11 +122,11 @@ Future installation options could include:
122
122
123
123
* USB netinstall images/bundles, setting up the installer as "bootable install media". This can be set up by just unpacking some files to a FAT32 partition on a USB drive, so it is easy for users to use, and will allow them to select the installer from the boot picker ([more info](introduction.md#boot-picker) on how this magic works). It would still fetch the OS to be installed from the internet.
124
124
* USB local install images/bundles, which can also serve as UEFI install media for later or for other platforms. This will install the target OS from USB, but will still hit Apple's CDN for the Apple components, making the install not truly offline.
125
-
* An option for end users to add the Apple components, e.g. by running a script from the USB drive, making it fully offline
126
-
* An option for end users to add the Apple components when creating the USB installer, e.g. by running a script that downloads them and provisions the installer in one go, instead of a pre-baked image.
125
+
* An option for end users to add the Apple components, e.g. by running a script from the USB drive, making it fully offline
126
+
* An option for end users to add the Apple components when creating the USB installer, e.g. by running a script that downloads them and provisions the installer in one go, instead of a pre-baked image.
127
127
* We want to add this as a feature to the online installer, e.g. "create a bootable USB installer" instead of actually doing the install.
128
128
* Packaging as a macOS app (this would already be part of USB install modes anyway)
129
-
* Though this runs into GateKeeper issues with unsigned downloads if downloaded "normally" by users from a browser...
129
+
* Though this runs into GateKeeper issues with unsigned downloads if downloaded "normally" by users from a browser...
130
130
131
131
## Firmware provisioning
132
132
@@ -150,8 +150,8 @@ The stub OS installer collects available platform firmware from the IPSW, and pa
150
150
151
151
* firmware.tar: Tarball containing the firmware, in a structure compatible with the `/lib/firmware` hierarchy (e.g. `brcm/foo.bin`).
152
152
* manifest.txt: A text file containing lines of the following two forms:
153
-
*`LINK <src> <tgt>` : hard link
154
-
*`FILE <name> SHA256 <hash>`: file
153
+
*`LINK <src> <tgt>` : hard link
154
+
*`FILE <name> SHA256 <hash>`: file
155
155
156
156
These files are then placed in the EFI system partition under the `vendorfw` directory.
0 commit comments