Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware: Add support for retrieving firmware from macOS Recovery Image #540

Merged
merged 25 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
aababd0
Firmware: Add support for retrieving firmware from macOS Recovery Image
AdityaGarg8 May 25, 2024
facdf86
Add files via upload
AdityaGarg8 May 25, 2024
72aeda7
Improvements for Arch
AdityaGarg8 May 26, 2024
5b3a26f
Use dmg2img instead of 7z + Arch fixes
AdityaGarg8 May 26, 2024
cfed261
More Arch fixes
AdityaGarg8 May 26, 2024
2237320
Better wording
AdityaGarg8 May 26, 2024
12da70f
cleanup if script fails
AdityaGarg8 May 26, 2024
7ed5b23
Add files via upload
AdityaGarg8 May 26, 2024
7c1165d
Exit when it fails
AdityaGarg8 May 27, 2024
c0fe0c7
Force mount to use hfsplus
AdityaGarg8 May 27, 2024
9950efb
Final version
AdityaGarg8 May 27, 2024
fd17ded
Pause for 5 sec after mounting
AdityaGarg8 May 27, 2024
8a15727
Retry if fails
AdityaGarg8 May 27, 2024
0c5e8a5
Copy firmware to workdir before renaming
AdityaGarg8 May 28, 2024
f5019a6
cp should be verbose
AdityaGarg8 May 28, 2024
130c96b
This is the strangest bug :(
AdityaGarg8 May 28, 2024
e151b08
Add debug info for Bug
AdityaGarg8 May 29, 2024
942795c
Add initial support for older macOS Recovery Images
AdityaGarg8 May 30, 2024
8f1e8bc
check for /lib/firmware/brcm instead of /lib/firmware
AdityaGarg8 May 31, 2024
9bd05d2
Support older macOS versions
AdityaGarg8 May 31, 2024
d7a4295
Bluetooth missing is warning not error
AdityaGarg8 May 31, 2024
82a08f7
Wiki updates (#544)
AdityaGarg8 Jun 1, 2024
4a2697d
Update wifi-bluetooth.md
AdityaGarg8 Jun 1, 2024
1f7307b
Remove wifi bit from pre install guide
AdityaGarg8 Jun 2, 2024
ad512e7
Update wifi-bluetooth.md
AdityaGarg8 Jun 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions docs/guides/preinstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,6 @@ Or you can use `dd` in macOS Terminal:

While the installation image is being written to the USB, you can skip to [Copy Wi-Fi firmware](#copy-wi-fi-firmware); but don't follow the steps after it, wait until the ISO has been written to disk.

## Copy Wi-Fi firmware

!!! Warning "Arch/EndeavourOS"
If you're going to install Arch or EndeavourOS, you do not need to follow this step.

Linux's Wi-Fi driver uses the same Wi-Fi firmware files as macOS, so we need to copy these files from macOS to Linux.

[Follow here](https://wiki.t2linux.org/guides/wifi-bluetooth/#on-macos) the **first part in macOS** and come back to this page.

The second part must be followed **on Linux** after you have completed the installation.

## Disable Secure Boot

Now that you have completed the first part of the Wi-Fi firmware in macOS, you can proceed with the disabling of the secure boot.
Expand Down
48 changes: 36 additions & 12 deletions docs/guides/wifi-bluetooth.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ Refer to the "Updating Kernel" section on your distro's FAQ for instructions if

## Setting up

We now use a script which can help you set up Wi-Fi and Bluetooth. Follow the instructions below to use this script :-
We now use a script which can help you set up Wi-Fi and Bluetooth. Click [here](../tools/firmware.sh) to download the script.

### On macOS
There are 4 methods supported by this script to get firmware for Linux, named as **Method 1-4** in this guide. Details of each method are given in the [On macOS](#on-macos) and [On Linux](#on-linux) section.

**Method 1-3** require macOS installed on your Mac. The initial steps of these methods are to be followed on macOS, and later steps have to be followed on Linux. Thus, if you choose one of these methods, you first need to follow the [On macOS](#on-macos) section and then proceed to the [On Linux](#on-linux) section.

**Method 4** does not require macOS, so you can directly follow the [On Linux](#on-linux) section if you choose it.

!!! Tip "macOS Removed after installing Linux"
In case you have removed macOS after installing Linux, and need the firmware, **Method 4** is the only option for you.

1. Click [here](../tools/firmware.sh) to download the script.
2. Boot into macOS.
3. Run this script there.
### On macOS

When you run the script in macOS, it will ask you to choose between 3 methods to move firmware to Linux:
Run the script on the macOS terminal. After you run the script, it will ask you to choose between 3 methods to move firmware to Linux:

=== "Method 1"
**Method 1: Run the same script on Linux**
Expand All @@ -46,7 +51,7 @@ When you run the script in macOS, it will ask you to choose between 3 methods to

1. **python3** - Renames the firmware and creates the tarball.

The script shall automatically detect if any dependency is missing, and if required, will give you the option of installing it. So you need not worry about not having any dependency installed.
The script shall automatically detect if any dependency is missing, and if required, will give you the option of installing it. So you need not worry about having missing dependencies.

Once the script confirms that you have the necessary dependencies installed, it shall create a tarball of the firmware by the name of `firmware.tar` in your **Downloads** folder.

Expand All @@ -63,7 +68,7 @@ When you run the script in macOS, it will ask you to choose between 3 methods to
4. **makepkg** - Creates a package that can be installed on Linux using `pacman`.
5. **coreutils** - Additional requirement of **makepkg**.

The script shall automatically detect if any dependency is missing, and if required, will give you the option of installing it. So you need not worry about not having any dependency installed.
The script shall automatically detect if any dependency is missing, and if required, will give you the option of installing it. So you need not worry about having missing dependencies.

Once the script confirms that you have the necessary dependencies installed, it shall create a package of the firmware which can be installed by `apt`, `dnf` or `pacman`, depending on the option you chose while running the script. The package shall be saved in your **Downloads** folder.

Expand All @@ -73,22 +78,21 @@ When you run the script in macOS, it will ask you to choose between 3 methods to

Once you have run the script on macOS, depending on the method you chose, the steps to be followed on Linux are described below:

!!! Warning "Running script directly on Linux"
We have noticed a lot of users directly running the script on Linux and without running it first on macOS. Please ensure that you have run the script on macOS first. If you have removed macOS, this script won't be very helpful.

=== "Method 1"
**Method 1: Run the same script on Linux**

Now we need to retrieve the firmware from the **EFI** partition. You further have 2 options to do so:

=== "Option 1"

In this option, you simply have to copy the same script to Linux, and run it with:
In this option, you have to run the firmware script on Linux. You run it with:

```bash
bash /path/to/firmware.sh
```

After you run the script, you have to choose the **"Retrieve the firmware from EFI"** option. After choosing that option, the script will install the firmware on Linux.

!!! note

Replace `/path/to/firmware.sh` with the actual path of the script. For example, if the script is in the Downloads folder in Linux, command to be run would be `bash $HOME/Downloads/firmware.sh`
Expand All @@ -104,6 +108,8 @@ Once you have run the script on macOS, depending on the method you chose, the st
sudo umount /tmp/apple-wifi-efi
```

After you run the above commands, you have to choose the **"Retrieve the firmware from EFI"** option. After choosing that option, the script will install the firmware on Linux.

This option shall be useful if you are unable to copy the script to Linux.

=== "Method 2"
Expand Down Expand Up @@ -176,6 +182,24 @@ Once you have run the script on macOS, depending on the method you chose, the st

Replace `/path/to/firmware_package.pkg.tar.zst` with the actual path of the package. For example, if `apple-firmware-14.5-1-any.pkg.tar.zst` was created in macOS and has been copied to the Downloads folder in Linux, command to be run would be `sudo pacman -U $HOME/Downloads/apple-firmware-14.5-1-any.pkg.tar.zst`

=== "Method 4"
**Method 4: Download a macOS Recovery Image from Apple and extract the firmware from there**

!!! warning "Internet connection is required for **Method 4**"

**Method 4** downloads a macOS Recovery image from Apple. So you need to have an active internet connection on Linux. You can use Ethernet, USB tethering or an external Wi-Fi adapter to get internet.

This method does not have any steps to be followed on macOS. So, you have to run the script directly on Linux. After you run the script on Linux, you have to choose the **"Download a macOS Recovery Image from Apple and extract the firmware from there**" option.

If you choose this method, the script will install the following dependencies, if missing, on Linux:

1. **curl** - Downloads a [python script](https://github.com/kholia/OSX-KVM/blob/master/fetch-macOS-v2.py) which is used to download the macOS Recovery image from Apple.
2. **dmg2img** - Converts the downloaded macOS Recovery Image to a Linux readable format.

The script shall automatically detect if any dependency is missing, and if required, will give you the option of installing it. So you need not worry about having missing dependencies.

Once the script confirms that you have the necessary dependencies installed, it shall give you the option to choose which macOS version you wish to download. You must choose **macOS Monterey or later** in order to get complete firmware files. After you choose the desired macOS version, the script should do the rest of the work itself.

## Testing Firmware

You can check the logs to confirm correct loading of the firmware using `sudo journalctl -k --grep=brcmfmac`, the output should look similar to this:
Expand Down
Loading