Skip to content

Instantly share code, notes, and snippets.

@semenko
Created June 12, 2022 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semenko/3de2c6135687a40bd55fb3dec1411706 to your computer and use it in GitHub Desktop.
Save semenko/3de2c6135687a40bd55fb3dec1411706 to your computer and use it in GitHub Desktop.
Generate NTFS image for Xbox OSU updater
#!/bin/bash
set -x
# By Nick Semenkovich https://nick.semenkovich.com
#
# Largely derived from:
# https://gist.github.com/kumbasar/49906cb704ce9213c972a3e008c74c0c
# I found myself needing to update an Xbox S via USB (with the Offline System Update OSU1 patch)
# See: https://support.xbox.com/en-US/help/hardware-network/console/system-update-solution/offline-system-update
#
# Unfortunately, making an NTFS filesystem on OS X is hard without disabling System Integrity Protection (SIP)
# and installing third party / semi-sketch software & extensions.
#
# Instead, you can use a remote linux machine (I bet Google Cloud Shell would work for free for this),
# and generate an image, then write that image to a flash drive on OS X.
# Download OSU
wget -O osu1.zip https://www.xbox.com/xboxone/osu1
image="osu1.img"
label="osu"
mntdir=`mktemp -d`
# This will be roughly 7GB -- it must be larger than the osu1.zip contents
sudo dd status=progress if=/dev/zero of=$image bs=4M count=1750 && sync
echo 'type=7' | sudo sfdisk $image
LOOPMOUNT=`sudo losetup --partscan --show --find ${image}`
echo $LOOPMOUNT
sudo mkfs.ntfs -Q -v -F -L ${label} ${LOOPMOUNT}p1
sudo mount ${LOOPMOUNT}p1 ${mntdir}
# Extract OSU1 into the tmpdir
unzip osu1.zip -d ${mntdir}
# Unmount everything
sudo umount ${mntdir}
sudo losetup -d ${LOOPMOUNT}
# NOTE:
# Now you need to write this on OS X to the flash drive
# Roughly:
# 0. Copy the file to your local mac ($ scp -C remote-machine:osu1.img .)
# 1. Plug in a flash drive
# 2. Find its path ($ mount )
# 3. Ensure it's unmounted ($ sudo diskutil unmount /Volumes/FLASHNAME/)
# 4. Write the image ($ sudo dd if=osu1.img of=/dev/diskNN bs=4M && sync)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment