Skip to content

Commit

Permalink
Use tar to copy firmware and avoid breaking symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaGarg8 authored May 30, 2024
1 parent e151b08 commit b575ea6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/tools/firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,13 @@ case "$os" in
sudo umount ${verbose} ${loopdevice}
sudo rm -r ${verbose} ${imgdir}
sudo losetup -d /dev/loop50
sudo rm -r ${verbose} ${fwdir}
}

echo -e "\nDownloading macOS Recovery Image"
workdir=$(mktemp -d)
imgdir=$(mktemp -d)
fwdir=$(mktemp -d)
cd ${workdir}
if [[ ${verbose} = -v ]]
then
Expand All @@ -562,7 +564,9 @@ case "$os" in
sudo mount ${verbose} ${loopdevice} ${imgdir}
echo "Getting firmware"
cd - >/dev/null
python3 "$0" ${imgdir}/usr/share/firmware ${workdir}/firmware-renamed.tar ${verbose} || (echo -e "\nCouldn't extract firmware. Try choosing some other macOS version (should be Monterey or later). If error still persists, try restarting your Mac and then run the script again." && cleanup_dmg && exit 1)
tar ${verbose} -cf ${workdir}/firmware.tar -C ${imgdir}/usr/share/firmware .
tar --warning=no-unknown-keyword ${verbose} -xC ${fwdir} -f ${workdir}/firmware.tar
python3 "$0" ${fwdir} ${workdir}/firmware-renamed.tar ${verbose} || (echo -e "\nCouldn't extract firmware. Try choosing some other macOS version (should be Monterey or later). If error still persists, try restarting your Mac and then run the script again." && cleanup_dmg && exit 1)
sudo tar ${verbose} -xC /lib/firmware/brcm -f ${workdir}/firmware-renamed.tar
echo "Reloading Wi-Fi and Bluetooth drivers"
sudo modprobe -r brcmfmac_wcc || true
Expand Down Expand Up @@ -768,8 +772,6 @@ class WiFiFWCollection(object):
for dim in self.DIMS:
if dim in props:
ident.append(props.pop(dim))
if props:
log.warning(f"Ignoring unexpected properties in {idpath}: {props}")
assert not props
node = self.root
Expand Down

0 comments on commit b575ea6

Please sign in to comment.