mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2026-12-04 23:13:29 +01:00
Merge pull request #1933 from mkorje/improve
apple/t2: improve firmware extraction
This commit is contained in:
1 file changed
+37
-48
@@ -2,10 +2,7 @@
|
|||||||
lib,
|
lib,
|
||||||
stdenvNoCC,
|
stdenvNoCC,
|
||||||
callPackage,
|
callPackage,
|
||||||
vmTools,
|
_7zz,
|
||||||
util-linux,
|
|
||||||
linux,
|
|
||||||
kmod,
|
|
||||||
version,
|
version,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -38,52 +35,44 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
vmTools.runInLinuxVM (
|
stdenvNoCC.mkDerivation {
|
||||||
stdenvNoCC.mkDerivation {
|
pname = "brcm-firmware";
|
||||||
pname = "brcm-firmware";
|
inherit version;
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetchmacos {
|
src = fetchmacos {
|
||||||
name = version;
|
name = version;
|
||||||
inherit (boards.${version})
|
inherit (boards.${version})
|
||||||
boardId
|
boardId
|
||||||
mlb
|
mlb
|
||||||
osType
|
osType
|
||||||
hash
|
hash
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
util-linux
|
_7zz
|
||||||
get-firmware
|
get-firmware
|
||||||
];
|
];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
ln -s ${linux}/lib /lib
|
7zz x -bd -bso0 -bsp0 $src \
|
||||||
${kmod}/bin/modprobe loop
|
"macOS Base System/usr/share/firmware/bluetooth/*" \
|
||||||
${kmod}/bin/modprobe hfsplus
|
"macOS Base System/usr/share/firmware/wifi/*"
|
||||||
|
|
||||||
imgdir=$(mktemp -d)
|
get-bluetooth "macOS Base System/usr/share/firmware/bluetooth" bluetooth/
|
||||||
loopdev=$(losetup -f | cut -d "/" -f 3)
|
get-wifi "macOS Base System/usr/share/firmware/wifi" wifi/
|
||||||
losetup -P $loopdev $src
|
'';
|
||||||
loopdev_partition=/dev/$(lsblk -o KNAME,TYPE,MOUNTPOINT -n | grep $loopdev | tail -1 | awk '{print $1}')
|
|
||||||
mount $loopdev_partition $imgdir
|
|
||||||
|
|
||||||
get-bluetooth $imgdir/usr/share/firmware/bluetooth bluetooth/
|
installPhase = ''
|
||||||
get-wifi $imgdir/usr/share/firmware/wifi wifi/
|
mkdir -p $out/lib/firmware/brcm
|
||||||
'';
|
cp bluetooth/brcm/* $out/lib/firmware/brcm/
|
||||||
|
cp wifi/brcm/* $out/lib/firmware/brcm/
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
meta = with lib; {
|
||||||
mkdir -p $out/lib/firmware/brcm
|
description = "Wi-Fi and Bluetooth firmware for T2 Macs";
|
||||||
cp bluetooth/brcm/* $out/lib/firmware/brcm/
|
license = licenses.unfree;
|
||||||
cp wifi/brcm/* $out/lib/firmware/brcm/
|
maintainers = with maintainers; [ mkorje ];
|
||||||
'';
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
meta = with lib; {
|
}
|
||||||
description = "Wi-Fi and Bluetooth firmware for T2 Macs";
|
|
||||||
license = licenses.unfree;
|
|
||||||
maintainers = with maintainers; [ mkorje ];
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
Reference in new issue
Block a user