Xiaomi Mi Box 3 (xiaomi-once)

From postmarketOS Wiki
Note pmOS can't run on its internal storage.However, it's possible to boot pmOS from Usb Stick .
Note This device is supported as part of a generic port. Refer to Amlogic Generic TV Box (amlogic-tvbox) for installation instructions and more information.
Xiaomi Mi Box 3
Running XFCE4
Running XFCE4
Manufacturer Xiaomi
Name Mi Box 3
Codename xiaomi-once
Released 20XX
Type set-top box
Hardware
Chipset Amlogic S905X-H
CPU Quad-core 1.5 GHz Cortex-A53
GPU Mali-450 MP3
Display HDMI
Storage 4/8 GB
Memory 1/2 GB
Architecture aarch64
Software
Original software Android (TV)
Original version 6.0.1
Extended version 9
Optional software MIUI TV
FOSS bootloader yes
postmarketOS
Category testing
Pre-built images no
Mainline yes
Generic port Amlogic Generic TV Box (amlogic-tvbox)
Features
Flashing
Broken
USB Networking
Internal storage
Screen
Works
Multimedia
3D Acceleration
Works
Audio
Partial
Camera Flash
IR TX
IR RX
Connectivity
WiFi
Works
Bluetooth
Works
Ethernet
Miscellaneous
FDE
USB OTG
HDMI/DP
Sensors
Haptics
Power Sensor
Note This port is only tested on the mda-16-ab variant. If you get it working on the mda-16-aa variant then please let us know. Thanks!

There are 2 variants:

  • Mi Box 3/mda-16-ab, running Android TV and sold everywhere else.
  • Mi Box 3C/mda-16-aa, running MIUI TV and sold in China. Seems to only have 4GB of storage and 1GB of RAM.

Some people succeeded at flashing the mda-16-ab firmware to an mda-16-aa set-top box though.

Note that these instructions are only expected to work on the mda-16-ab variant.

Note about the stock u-boot

If running Android 8/7/6

It can be intercepted when it is booting.

It will load either aml_autoscript (more info) or recovery.img (android recovery mode image), both at the root of a USB stick, the latter being booted when Android TV and the recovery mode aren't bootable.

If running Android 9

You're out of luck! You need to downgrade to Android 8.

Installation

Icon WARNING: DO NOT PLUG multiple USB devices to the TV box when it boots. DO NOT PLUG USB drives that had pmOS installed to the TV box when it boots into Android because Android will destroy file permissions!

Before doing everything here, please follow the instructions in #Downgrading from Android 9 to Android 8.

Only installing to a USB drive works currently.

Use pmbootstrap to build your own image, like so:

$ pmbootstrap init
$ pmbootstrap install --sdcard=/dev/sdX # change 'sdX' with the path of your USB drive

After you created the image, connect the UART to your Mi Box.

Next, intercept U-Boot when it's booting. You should get a shell.

Note U-Boot will run commands that are saved in the bootcmd environment variable. By default bootcmd contains commands to load Android TV.

Run these commands to modify the default boot behavior for making pmOS automatically boot when it powered on and a pm os usb stick is pluged in:

once# setenv bootandroid "${bootcmd}"
once# setenv bootcmd "usb start;ext4load usb 0:1 ${loadaddr} aml_autoscript;autoscr ${loadaddr};run bootandroid"
once# saveenv

Run those command to reboot after you have modified the default boot behavior

once# reset

You can still boot into android by unplugging the pmOS usb stick after you have modify the default boot behavior.


You can manually boot pmOS if you dont want to modify the default boot behavior.

Run these commands to boot pmOS:

once# usb start
once# ext4load usb 0:1 ${loadaddr} aml_autoscript
once# autoscr ${loadaddr}

Downgrading from Android 9 to Android 8

Icon WARNING: THIS WILL ERASE ALL DATA ON YOUR MI BOX. CONSIDER YOURSELF WARNED.
Icon WARNING: DO NOT PLUG USB DRIVE BEFORE RECOVERY MODE IS ON IN STEP 3

There's a guide for downgrading from Android 9 to 8: https://forum.xda-developers.com/t/mi-box-3-mdz-16-ab-downgrade-android-9-pie-to-android-8-oreo.4194075/

If that guide doesn't work, try this:

Icon WARNING: There are a report of this method bricking the device.Although it is has been tested to work on multiple Xiaomi Mi Box 3.
  1. Plug a USB drive into your computer and format it as FAT32
  2. Download via BitTorrent or MEGA
  3. Extract update.zip and xiaomi_update from the zip file, as well as recovery.img from update.zip and put them at the root of your USB drive
  4. Power your Mi Box on and boot it into the recovery mode
  5. Plug your USB drive to it
  6. 'Apply update from EXT' > 'From Udisk' > update.zip (note: "Udisk" is a translation error in the recovery)
  7. Flash and reboot! Your Mi Box should reboot a few times. You should see a progress bar after that. (It only flashed U-Boot, and Android 9 isn't bootable from it, and thus it loads recovery.img from the USB drive, which runs xiaomi_update)
  8. After that, it's going to boot into Android 8, which will fail. It's then going to boot into recovery mode and you should see the following error message: "Cannot load Android system. Your data may be corrupt. If you continue to get this message, you may need to perform a factory data reset and erase all user data stored on this device."
  9. 'Factory data reset' > 'Yes'
  10. Then it should reboot automatically by itself
  11. Done!

Recover back to the default booting behavior

Run these commands:

once# setenv bootcmd ${bootandroid}
once# setenv bootandroid 
once# saveenv

Unlock the bootlocker

This device has a locked bootloader (It seem only mda-16-ab have this kind of bl) that can only signed boot image supposedly.

However exkc find out it can chainboot a unlocked bootloader from the locked bootloader via "multiboot" mode.There are some work on unlocking the android 6 bootloader which allow you to boot unsigned boot image directly from the stock bootloader.

Recovery

The following instructions would show a wobble circle with a progress bar.

Icon WARNING: This might cause your device to be in a state of endless bootloop

Boot into recovery mode

  1. Unplug power from Mi Box 3
  2. Remove batteries from remote control
  3. Press and hold middle select button + back button on the remote
  4. While holding select+back, put batteries back in remote
  5. Reconnect power to the Mi Box 3
  6. Hold the remote close to the Mi Box 3 and wait for recovery screen

Source: https://l.opnxng.com/r/AndroidTV/comments/g3mw3s/xiaomi_mi_box_3_reboot_into_recovery_mode

Maintainer

Users owning this device

See also