HyperOS + Arch Linux dual boot on Xiaomi Pad 5 (nabu)

HyperOS + Arch Linux dual boot on Xiaomi Pad 5 (nabu)

Resource Preparation

Resource packages:

ArchLinuxArmGnome.lni / UbuntuDesktop_noble.lni / ...: Linux Rootfs Image Packages @timoxa0/Guide-Linux-Nabu

Hyper OS 1.1.5.0.VNXCNXM.BETA 安卓15: HyperOS System Package @Uotan Community (contents as follows)

Hyper_OS_1.1.5.0.VNXCNXM.BETA_安卓15
├── Magisk_27.0.apk
├── nabu_XiaomiPad5_OS1.1.5.0.VNXCNXM.BETA_15.0_By_mytiantian
│   ├── flash_all.bat
│   ├── flash_all_except_storage.bat
│   ├── flash_all_except_storage.sh
│   ├── flash_all.sh
│   └── images
├── nabu_XiaomiPad5_OS1.1.5.0.VNXCNXM.BETA_15.0_By_mytiantian.zip
├── 开启SELinux_1.zip
└── 新内核
    ├── files
    ├── Horizon Kernel Flasher-1.3.apk
    ├── Kernel Flasher_1.0.0-alpha19.apk
    └── new_nabu_release_20241003_source.zip

小米平板5_恢复分区表专用包_A13.7z: Found in group files, source unknown @Uotan Community

Xiaomi Pad 5_Partition Table Recovery Package_A13
├── flash_all.bat
├── flash_all_except_storage.bat
├── flash_all_except_storage.sh
├── flash_all_lock.bat
├── flash_all_lock.sh
├── flash_all.sh
├── flash_gen_crc_list.py
├── flash_gen_md5_list.py
├── flash_gen_resparsecount
├── images
└── misc.txt

Tools:

UotanToolboxNT

lon-tool

HyperOS

System Installation

Enter Bootloader.

In Uotan Toolbox, go to Wired Flash -> More Flash -> Xiaomi Script.

Select Hyper_OS_1.1.5.0.VNXCNXM.BETA_安卓15/nabu_XiaomiPad5_OS1.1.5.0.VNXCNXM.BETA_15.0_By_mytiantian/flash_all.sh; note that the path should not contain spaces.

Using flash_all_except_storage.sh can avoid data wipe and won't affect Linux.

ROOT

(Since installing Linux will wipe the userdata partition and restore the Android side, you should finish installing Linux before proceeding.)

Run:

adb install Magisk_27.0.apk

Then open Magisk; it will automatically patch and reboot.

New Kernel

(ROOT is required to have TWRP.)

(It seems that after installation, UEFI will be overwritten, so currently we decide not to proceed.)

First, back up the boot partition:

In Uotan Toolbox, go to Format & Extract -> Extract -> PartName=boot_a -> Physical Part.

Then push the kernel package to the device:

adb push xxx.zip /sdcard

Then enter TWRP.

Go to Install -> Select the kernel zip package -> Swipe to install.

Linux

System Installation

Follow Guide-Linux-Nabu.

Enter Bootloader.

Run:

lon-tool deploy ArchLinuxArmGnome.lni

Wi-Fi Issue

(Due to an unknown bug, the tablet's built-in wireless card has limited transmission power, resulting in very slow network speeds, less than 10 Mbps.)

Symptoms:

sudo dmesg
......
[  403.870295] wlan0: authenticate with XX:XX:XX:XX:XX:XX
[  403.870351] wlan0: capabilities/regulatory prevented using AP HT/VHT configuration, downgraded
[  403.887663] wlan0: send auth to XX:XX:XX:XX:XX:XX (try 1/3)
[  403.893183] wlan0: authenticate with XX:XX:XX:XX:XX:XX
[  403.893214] wlan0: send auth to XX:XX:XX:XX:XX:XX (try 1/3)
[  403.922796] wlan0: authenticated
[  403.924309] wlan0: associate with XX:XX:XX:XX:XX:XX (try 1/3)
[  403.931876] wlan0: RX AssocResp from XX:XX:XX:XX:XX:XX (capab=0x1511 status=0 aid=2)
[  404.004361] wlan0: associated
[  404.095151] wlan0: Limiting TX power to 27 (30 - 3) dBm as advertised by XX:XX:XX:XX:XX:XX
[  404.141740] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
......

It was found that this might be due to incorrect wireless regulatory domain configuration. Related commands:

iw reg get # Check wireless regulatory domain information
sudo iw reg set CN # Set wireless regulatory domain to CN
nmcli device wifi # Check channel and bandwidth information

However, on my device, setting the wireless regulatory domain and channels does not work.

Workaround: Use a USB wireless network card with a USB-C to USB-A adapter (see network card driver below).

Network Card Driver

(Purchased a Ugreen AX900 wireless network card, which supports Linux 6.x kernels but requires manual compilation and installation of the driver.)

Dependencies
sudo pacman -S usbutils # for lsusb
sudo pacman -S xmlto kmod inetutils bc libelf git cpio perl tar xz # for kmod building
Prepare Kernel Source

The ArchLinux installed on the tablet uses a modified kernel maverickjb/linux-6.1.10, i.e., 6.1.10-nabu.

Note: The version magic used when compiling the network card driver module needs to match the kernel exactly to be loaded. By setting LOCALVERSION to empty, we prevent the version number from automatically adding a + suffix.

git clone https://github.com/maverickjb/linux-6.1.10.git # Fetch kernel source
cd linux-6.1.10
zcat /proc/config.gz > .config # Use the config of the running kernel
make ARCH=arm64 LOCALVERSION= oldconfig # Ensure no new options
make ARCH=arm64 LOCALVERSION= modules_prepare -j7 # Prepare the kernel for building modules
make ARCH=arm64 LOCALVERSION= kernelrelease # Check it, MUST be `6.1.10-nabu` !!!
Build and Install Driver
cd /path/to/aic8800_linux_driver
sudo bash install_setup.sh # Prerequisites

cd drivers/aic8800
sudo ln -s /path/to/linux-6.1.10 /lib/modules/6.1.10-nabu/build # Build with custom source
make -j7 # Build the driver
ls aic_load_fw/aic_load_fw.ko && ls aic8800_fdrv/aic8800_fdrv.ko # Check completion
sudo make install

Then plug in the wireless network card; ip a should display the new device.

Trouble Shooting

Deep Repair

(Encountered an issue where setting a password in HyperOS causes a freeze, suspected TEE firmware anomaly.)

Flashing 小米平板5_恢复分区表专用包_A13/flash_all.sh can restore the pure MIUI14.

Android Cannot Boot

(In the UEFI Boot Menu, selecting Android results in repeatedly returning to UEFI.)

Connect the charger, power on, enter UEFI, select Android, and after the black screen displaying the Android logo, unplug the charger. Then it successfully enters Android.

(Mysterious, principle unknown.)

GNOME Cannot Start

(After Arch rolling updates, rebooting cannot enter the desktop.)

Found that it's due to the on-screen keyboard module crashing in GNOME 47 Reference.

sudo -u gdm dbus-run-session gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false
sudo systemctl restart gdm
posted @ 2024-10-14 18:24  Terrasse  阅读(80)  评论(0编辑  收藏  举报