您的当前位置:首页正文

小米平板5(nabu)安装 HyperOS + Arch Linux 双系统

2024-10-17 来源:个人技术集锦

小米平板5(nabu)安装 HyperOS + Arch Linux 双系统

资源准备

资源包:

ArchLinuxArmGnome.lni / UbuntuDesktop_noble.lni / ...

Hyper OS 1.1.5.0.VNXCNXM.BETA 安卓15 : (内容如下)

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 :群文件找到的,来源不明

小米平板5_恢复分区表专用包_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

工具:

HyperOS

系统本体

进入Bootloader

Uotan工具箱中Wired Flash -> More Flash -> Xiaomi Script

选择 Hyper_OS_1.1.5.0.VNXCNXM.BETA_安卓15/nabu_XiaomiPad5_OS1.1.5.0.VNXCNXM.BETA_15.0_By_mytiantian/flash_all.sh ,注意路径不能有空格

flash_all_except_storage.sh 可以不清除数据,也不会影响Linux

ROOT

(由于装Linux会清除userdata分区,Android侧会被还原,因此应该先装完Linux再继续)

adb install Magisk_27.0.apk

然后打开Magisk,它会自动修补并重启。

新内核

(要先完成ROOT才有TWRP)

(似乎装完之后会把UEFI覆盖掉,所以目前决定不做)

先备份boot:

Uotan工具箱 Format&Extract -> Extract -> PartName=boot_a -> Physical Part

然后推送内核包到设备:

adb push xxx.zip /sdcard

然后进入TWRP

Install -> 选择内核zip包 -> 滑动install

Linux

系统本体

进入Bootloader

lon-tool deploy ArchLinuxArmGnome.lni

WiFi问题

(由于未知bug,平板内置无线网卡发送功率被限制,导致网速非常慢,< 10 Mbps)

现象:

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......

查到可能是由于无线监管域未正确配置,相关命令:

iw reg get # 查询无线监管域相关信息sudo iw reg set CN # 设置无线监管域为CNnmcli device wifi # 查询频道和带宽等信息

然而在我这台设备上设置无线监管域和频道都不起作用。

Workaround: 使用c转a转接头+USB无线网卡(见后文网卡驱动)

网卡驱动

(购买了绿联AX900无线网卡,支持Linux 6.x内核,但需要自己编译安装驱动)

依赖包
sudo pacman -S usbutils # for lsusbsudo pacman -S xmlto kmod inetutils bc libelf git cpio perl tar xz # for kmod building
准备内核源码

平板安装的ArchLinux使用的是修改过的内核 ,即 6.1.10-nabu

另:网卡驱动内核模块编译时使用的 version magic 需要与内核保持一致才能被加载,通过置空 LOCALVERSION 来防止版本号自动添加后缀 +

git clone https://github.com/maverickjb/linux-6.1.10.git # fetch kernel sourcecd linux-6.1.10zcat /proc/config.gz > .config # use config of the running kernelmake ARCH=arm64 LOCALVERSION= oldconfig # make sure no new optionsmake ARCH=arm64 LOCALVERSION= modules_prepare -j7 # prepare the kernel for building modulemake ARCH=arm64 LOCALVERSION= kernelrelease # check it, MUST be `6.1.10-nabu` !!!
构建并安装驱动
cd /path/to/aic8800_linux_driversudo bash install_setup.sh # prerequisitecd drivers/aic8800sudo ln -s /path/to/linux-6.1.10 /lib/modules/6.1.10-nabu/build # build with custom sourcemake -j7 # build the driverls aic_load_fw/aic_load_fw.ko && ls aic8800_fdrv/aic8800_fdrv.ko # check completionsudo make install

然后插入无线网卡, ip a 应当显示新设备。

Trouble Shooting

深度修复

(出现HyperOS设置密码卡死的问题,怀疑TEE相关固件异常)

刷入 小米平板5_恢复分区表专用包_A13/flash_all.sh 即可复原纯真MIUI14

安卓无法启动

(在UEFI Boot Menu中选择安卓后,重复进入UEFI的异常现象)

接入充电器,开机,进入UEFI,选择安卓,在黑屏且显示安卓标志之前拔掉充电器,随后成功进入安卓。

(玄学,原理不明)

GNOME无法启动

(Arch滚包后重启无法进入桌面)

发现是由于屏幕键盘模块在GNOME-47会崩溃

sudo -u gdm dbus-run-session gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled falsesudo systemctl restart gdm
显示全文