Install
Write the image to a USB stick and start the box from it. The stick holds everything: the kernel, the tvOS system volume and /private/var. Nothing on the eMMC is written except U-Boot's environment (one variable). With the stick out, the box boots Android as before.
What you need
- A Xiaomi Mi Box S 3rd gen (S905X5M, board
s7d_twilight) with an unlocked bootloader. - A USB stick of 8 GB or more. The box has one USB port; a hub is fine.
- The stick image,
twilight-usb.img. Download the image
To make the image yourself, follow the build instructions.
Write the stick
Write the image to the stick with dd or any imaging tool. Everything on the stick is lost. The stick must not be mounted.
sudo dd if=twilight-usb.img of=/dev/sdX bs=4M conv=fsync status=progressFirst start
U-Boot has to be told once to look at the stick. With the stick in, do one of these:
- From Android with USB debugging on, run
adb reboot update. - Hold the reset button (in the AV socket) while plugging in power.
Either runs aml_autoscript from the stick. It sets U-Boot's bootcmd to "try a USB stick's cfgload, else boot as usual", saves the environment, then starts tvOS. From then on the box starts tvOS whenever the stick is in, and Android when it is not.
Undo
Set bootcmd back to run storeboot in the U-Boot console. Leaving it is harmless: without a stick the extra step finds nothing and Android starts.
setenv bootcmd 'run storeboot'; saveenvUsing it
- The TV's remote works over HDMI-CEC from the start. Pair a Bluetooth remote in Settings.
- Restart in Settings restarts into tvOS, through U-Boot. Pull the stick for Android.
Install IPAs over SSH
Use an unencrypted tvOS IPA compatible with tvOS 16.5. iPhone and iPad apps do not run on tvOS. Your computer and the box must be on the same network.
The image downloaded from this website has SSH enabled by default. It accepts any SSH key for login as root; you do not need to register your public key. Password login is disabled.
1. Connect to the box
Find the box's IP address in Settings, Network. On your computer, replace DEVICE_IP with that address. Your SSH client must offer a key. If you do not have one, run ssh-keygen -t ed25519 on your computer first.
ssh root@DEVICE_IPRun exit to return to your computer before the next step.
2. Extract and copy the app
On your computer, use unzip to extract the IPA, then copy the app bundle to the box. Replace MyApp.ipa with your IPA's filename.
unzip MyApp.ipa -d MyApp
ssh root@DEVICE_IP 'mkdir -p /var/jb/Applications'
scp -r MyApp/Payload/*.app root@DEVICE_IP:/var/jb/Applications/3. Register the app
Replace MyApp.app with the app bundle's actual directory name inside MyApp/Payload/, then run this on your computer:
ssh root@DEVICE_IP '/var/jb/usr/bin/uicache -p "/var/jb/Applications/MyApp.app"'The app should appear on the home screen. If it does not, restart the box from Settings and check again. A connection refused error means SSH is not running; if you see permission denied (publickey), make sure your SSH client is offering a key. Use ssh -i /path/to/private_key root@DEVICE_IP to select one.
On the eMMC
tvOS can also be installed on the box's internal storage. It gets its own partition at the end of the eMMC, next to Android: the system volume first, then /private/var. Android's userdata is made smaller to make room, so Android starts again from its first-time setup.
The steps on this page are for the USB stick, which leaves the eMMC as it is.






