tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
743 stars 73 forks source link

How to update firmware for HDMI support? #121

Open yu-re-ka opened 6 months ago

yu-re-ka commented 6 months ago

The documentation says the firmware can be updated by "re-creating the ESP partition" but it is unclear how to do that.

tpwrules commented 6 months ago

What I meant by that is to delete the macOS stub and ESP, then do a UEFI-only installation using the latest installer, and finally do the repair steps to recreate the ESP contents (see the "extreme circumstances" note here). I had hoped that users would not have to do this as it's annoying and potentially dangerous.

It's unfortunate that HDMI needs new firmware too? What files? Upstream doesn't have any official way to solve this yet? I had some ideas but I was hoping better solutions come along too.

yu-re-ka commented 6 months ago

https://social.treehouse.systems/@AsahiLinux/111515422125309592

This requires 13.5 firmware, so users who installed prior to August will not have the feature enabled. We're working on an upgrade/support solution for those users.

this is as of 9 days ago, and there hasn't been news on a solution for upgrading firmware.

tpwrules commented 6 months ago

Turns out the issue here is outdated DCP firmware stored in the macOS stub partition, NOT the firmware files passed to hardware.asahi.peripheralFirmwareDirectory.

I don't have any sort of solution then, this is a different case to the stuff needed for the webcam. Currently the only possibility is indeed to delete and recreate the macOS stub and ESP.

diegobfernandez commented 6 months ago

What I meant by that is to delete the macOS stub and ESP, then do a UEFI-only installation using the latest installer, and finally do the repair steps to recreate the ESP contents (see the "extreme circumstances" note here). I had hoped that users would not have to do this as it's annoying and potentially dangerous.

I've done this and now HDMI is working.

It was not a difficult procedure but you have to piece together the steps from the link in the mention and how to safely delete the partitions from the Asahi Partitioning cheatsheet.

Read the cheatsheet carefully to not make any mistakes during deletion and make sure you are familiar with NixOS installation process.

n8henrie commented 3 months ago

Giving the "firmware update" a go with slightly more explicit instructions.

Reading https://github.com/AsahiLinux/docs/wiki/Partitioning-cheatsheet, it looks like I want to delete the EFI partition (disk0s4 in my configuration below) and the stub partition -- in the instructions it looks a little difficult to identify the stub; in their documentation it's disk0s5 and is 2.5 GB. In my data below it looks like it should be disk0s3, identified by also being 2.5 GB.

diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk0
   1:             Apple_APFS_ISC Container disk1         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk4         1.9 TB     disk0s2
   3:                 Apple_APFS Container disk3         2.5 GB     disk0s3
   4:                        EFI EFI - ASAHI             500.2 MB   disk0s4
   5:           Linux Filesystem                         92.2 GB    disk0s5
   6:        Apple_APFS_Recovery Container disk2         5.4 GB     disk0s6

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +2.5 GB     disk3
                                 Physical Store disk0s3
   1:                APFS Volume Asahi Linux - Data      4.4 MB     disk3s1
   2:                APFS Volume Asahi Linux             1.2 MB     disk3s2
   3:                APFS Volume Preboot                 126.1 MB   disk3s3
   4:                APFS Volume Recovery                1.8 GB     disk3s4

/dev/disk4 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.9 TB     disk4
                                 Physical Store disk0s2
   1:                APFS Volume NateSSD                 10.1 GB    disk4s1
   2:              APFS Snapshot com.apple.os.update-... 10.1 GB    disk4s1s1
   3:                APFS Volume Preboot                 6.1 GB     disk4s2
   4:                APFS Volume Recovery                922.3 MB   disk4s3
   5:                APFS Volume Data                    1.7 TB     disk4s5
   6:                APFS Volume VM                      24.6 KB    disk4s6
   7:                APFS Volume Nix Store               78.3 GB    disk4s7
$ diskutil mountDisk disk0s4
$ mkdir -p ~/Desktop/tmp/asahi-efi
$ sudo rsync -av /Volumes/EFI\ -\ ASAHI ~/Desktop/tmp/asahi-efi
...
$ diskutil unmountDisk disk0s4
$ diskutil eraseVolume free free disk0s4
$ diskutil eraseVolume free free disk0s4
$ diskutil apfs deleteContainerdisk0s3

Looks like the new EFI is still disk0s4:

$ diskutil mountDisk disk0s4
$ sudo rsync -av /Users/n8henrie/Desktop/tmp/asahi-efi/EFI /Volumes/EFI\ -\ NIXOS/
$ 
$ # edit: don't forget to include the loader directory
$ sudo rsync -av /Users/n8henrie/Desktop/tmp/asahi-efi/loader /Volumes/EFI\ -\ NIXOS/
$
$ diskutil unmountDisk disk0s4

Submitting to not lose my comment, we'll see if it works by just re-copying over the old EFI fileI can still see my old root disk0s5, so hopefully I can figure out how to boot it from UEFI (I'm sure someone that knows UEFI could just boot it directly from the UEFI shell).

EDIT: Posting from NixOS again, with updated firmware, after a little work:

Mistakes from above: