A small Magisk module: the Action button in the Magisk app, or "su -c mu300-linux" from a terminal, arms the one-shot slot-b trial and reboots into Linux. Until now that needed adb and a computer. It writes the same 32 bytes as the installer - the bootloader_control block at 0x800 of misc - and nothing else, so an unbootable Linux still falls back to Android on its own. The block is not a canned blob: the module reads the live one, sets the slot suffix and the two metadata bytes, and recomputes the CRC32 in awk (no strtonum, no bitwise builtins, so busybox awk is enough). It refuses to run when the magic is not BCAB, when Android is not on slot a, or when boot_b is missing, is not a boot image or is a copy of boot_a. Also: mu300-update now keeps lib/modules on OpenWrt. A release only ships modules for the kernel it was built with, so updating threw away the hand-built 6.18 set and left the mainline system without a modem stack. Checked on hardware (Magisk 30.7, Android 13): status and --dry-run produce exactly the trial block that boot/flash-trial.sh computes on a computer, and the switch rebooted the device into Linux. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Z17MBkdHmZPvNPNSLxcHk
Magisk module: switch to Linux from Android
A one-tap way to start the Linux system from Android, for devices that already have Linux installed
(./install.sh). It replaces having a computer plugged in just to change the boot slot.
android/magisk/build.sh # builds mu300-linux-switch.zip
Install the zip in the Magisk app (Modules → Install from storage), or from a computer:
adb push android/magisk/mu300-linux-switch.zip /data/local/tmp/
adb shell "su -c 'magisk --install-module /data/local/tmp/mu300-linux-switch.zip'"
adb reboot # Magisk applies a new module on the next boot
Using it
- Magisk app → Modules → MU300 Linux switch → Action. The device arms slot b and reboots into Linux.
- From a terminal or adb:
su -c mu300-linux # switch to Linux now
su -c 'mu300-linux status' # what is on each slot; changes nothing
su -c 'mu300-linux --dry-run' # print the block it would write, write nothing
Going back needs nothing: Linux restores the slot-a block during its own boot, so the next reboot returns to
Android. From inside Linux, mu300-next-boot linux arms another Linux boot and mu300-os <name> picks which
system starts.
What it writes
Exactly 32 bytes: the AOSP bootloader_control block at offset 0x800 of misc, with slot b at the highest
priority and tries_remaining = 2 (LK treats 1 as an already failed boot), slot a still bootable and marked
successful. boot_a, boot_b, the GPT, userdata and every other partition are untouched, so the worst case of a
Linux that does not boot is that LK falls back to Android by itself.
The block is not a canned blob: the module reads the live one, changes the slot suffix and the two metadata bytes,
and recomputes the CRC32 (zlib, over the first 28 bytes) in awk, so it stays correct on a device whose block
differs. It refuses to do anything when the magic is not BCAB, when Android is not running from slot a, or when
boot_b is missing, is not a boot image, or is just a copy of boot_a (no Linux installed).
Checked on hardware
ZTE F50 / MU300, Magisk 30.7, Android 13: status and --dry-run produce exactly the trial block that
boot/flash-trial.sh computes on a computer, and the Action/mu300-linux path rebooted the device into Linux.