Last active
March 15, 2024 20:18
-
-
Save rickmark/9245ed3ef7f36d5a0421557f68c4681b to your computer and use it in GitHub Desktop.
Perform a FOSS restore of an Apple T2 processor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WORKING_DIRECTORY=`pwd` | |
repo_list=(libimobiledevice idevicerestore libplist libusbmuxd usbmuxd libirecovery) | |
for repo in ${repo_list[@]}; do | |
directory="$WORKING_DIRECTORY/$repo" | |
if [ -d "$directory" ]; then | |
rm -rf "$directory" | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONFIG_FILE=/boot/config.txt | |
# Disable WiFi at Device Tree level | |
if ! grep -q "pi3-disable-wifi" "$CONFIG_FILE"; then | |
sed -i '/\/boot\/overlays\/README/a dtoverlay=pi3-disable-wifi' $CONFIG_FILE | |
fi | |
# Disable BlueTooth at Device Tree level | |
if ! grep -q "pi3-disable-bt" "$CONFIG_FILE"; then | |
sed -i '/\/boot\/overlays\/README/a dtoverlay=pi3-disable-bt' $CONFIG_FILE | |
fi | |
# Disable listening services | |
systemctl disable avahi-daemon.socket | |
systemctl disable avahi-daemon.service | |
# Reboot | |
reboot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RECOVERY_DATA_URL="https://mesu.apple.com/assets/bridgeos/com_apple_bridgeOSIPSW/com_apple_bridgeOSIPSW.xml" | |
# TODO: Read XML to find current version | |
# TODO: Verify SHA of downloaded file (Really Apple? SHA1?) | |
wget http://updates-http.cdn-apple.com/2020/macos/061-41296-20200124-14D2074C-3EFF-11EA-9B7E-811124EF36D6/iBridge2,1,iBridge2,10,iBridge2,12,iBridge2,14,iBridge2,3,iBridge2,4,iBridge2,5,iBridge2,6,iBridge2,7,iBridge2,8_4.2_17P3050_Restore.ipsw | |
sudo usbmuxd --foreground --verbose & | |
idevice --debug --erase --no-input iBridge2,1,iBridge2,10,iBridge2,12,iBridge2,14,iBridge2,3,iBridge2,4,iBridge2,5,iBridge2,6,iBridge2,7,iBridge2,8_4.2_17P3050_Restore.ipsw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WORKING_DIRECTORY=`pwd` | |
REPO_LIST=(libplist libusbmuxd libimobiledevice libirecovery usbmuxd idevicerestore) | |
# Perform full update before work | |
if [ -z "$(find /var/cache/apt/pkgcache.bin -mmin -1440)" ]; then | |
sudo pt update -y | |
fi | |
sudo apt upgrade -y | |
# Install pre-requsites | |
sudo apt install -y git autoconf automake libtool pkg-config clang libssl-dev python3-dev python-dev llvm gcc libreadline-dev libusb-1.0-0-dev libzip-dev libcurl4-gnutls-dev | |
# Clone the libimobiledevice world | |
for repo in ${REPO_LIST[@]}; do | |
directory="$WORKING_DIRECTORY/$repo" | |
if [ -d "$directory" ]; then | |
cd "$directory" | |
git pull | |
else | |
cd $WORKING_DIRECTORY | |
git clone "https://github.com/libimobiledevice/$repo.git" | |
fi | |
done | |
# Build and install each repository in order | |
for repo in ${REPO_LIST[@]}; do | |
cd "$WORKING_DIRECTORY/$repo" | |
./autogen.sh | |
make | |
sudo make install | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment