Halium 9 tasting -- transplantation on Millet plate 4

Well, it seems a long time since the last study of Halium. Although I haven't had time to do this, I haven't been fully driven. I'm not convinced. Recently, I took the time to do it well (OK, but not completely). Xiaomi tablet 4 finally has a chance to get rid of the title of "big mobile phone" and do something about productivity. Although there are still many pits, it can be competent as a small computer to watch videos and write codes. I don't know much about the adaptation of lineage OS & Halium. Many commit s are copied from the great gods. I hope that the great gods will have time to help me improve this project in the future.

Droidian project

I feel that the graphical interface scheme of mir+lomiri adopted by Ubuntu touch is too far from my needs. Although Ubuntu touch can use containers to run some xorg and wayland applications, it can not use 3d acceleration and strange compatibility, which may make android + chroot more practical and convenient. The bottom layer has been stuck in Ubuntu 16.04, which is one of the reasons why I decided to choose other Halium distributions.
Fortunately, I found droidian, a branch of the mobian project. It is based on Debian 11. The use of phosh and wayland in the graphical interface makes most linux programs run without pressure. It also packs the hybrids driver of xorg. linux on halium can finally switch the desktop as freely as linux on pc. However, droidian is still in the early development stage and may not be very stable.

Confused Treble

Project Treble is a technology launched by Google on android 8. It separates the set of drivers connected to hal in the user layer by adding a vendor partition to the original partition table. Only a common system.img is needed to make the same system run on different devices.
For the convenience of project development, Droidian also released their brush package in the form of treble package (gsi). Many mobile phones that support treble only need to modify the kernel to run, but they are only limited to devices with Android 9 vendor s at the factory (I don't know whether the description is accurate or not. Anyway, my device will be stuck in the keymaster verification with gsi halium). Xiaomi tablet 4 is in this awkward position. It happens to be the vendor partition of 8.1 when it leaves the factory. Moreover, the official refuses to update Android 9 or above, and can only adapt to the Droidian by compiling halium's system.img.

Run wifi

The wifi part of Qualcomm's Android kernel is very complex. Compared with the driver in the main line, it only needs the kernel driver and firmware in place to run. It also needs the private library and Daemon in the user space to work normally to run wifi. If the startup time of some modules is incorrect, wifi cannot be started. For example, Android in halium is started as an lxc container, which is slower than that of ordinary Android. If the wifi kernel module is loaded a long time ago, it is likely that CNSs daemon will not get the mac address, Therefore, halium's wifi driver must be loaded in the form of ko kernel module at an appropriate time before it can run through wifi. A modified example is as follows. The loading of ko module needs to be handled by itself (module-load.d). Halium will not help you load the kernel module of Android vendor partition.

--- a/arch/arm64/configs/clover_halium_defconfig
+++ b/arch/arm64/configs/clover_halium_defconfig
@@ -1780,7 +1780,7 @@ CONFIG_ATH_CARDS=y
 # CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS is not set
 # CONFIG_ATH5K_PCI is not set
 # CONFIG_ATH6KL is not set
-CONFIG_WIL6210=y
+CONFIG_WIL6210=m
 CONFIG_WIL6210_ISR_COR=y
 CONFIG_WIL6210_TRACING=y
 CONFIG_WIL6210_WRITE_IOCTL=y
@@ -4103,7 +4103,7 @@ CONFIG_ION_MSM=y
 #
 # Qualcomm Atheros CLD WLAN module
 #
-CONFIG_QCA_CLD_WLAN=y
+CONFIG_QCA_CLD_WLAN=m
 CONFIG_QCACLD_WLAN_LFR3=y
 CONFIG_PRIMA_WLAN_OKC=y
 CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y
@@ -4155,7 +4155,7 @@ CONFIG_RMNET_IPA3=y
 # CONFIG_IPA_UT is not set
 CONFIG_GPIO_USB_DETECT=y
 # CONFIG_MSM_MHI is not set
-CONFIG_MSM_11AD=y
+CONFIG_MSM_11AD=m
 CONFIG_SEEMP_CORE=y
 CONFIG_USB_BAM=y
 CONFIG_MSM_EXT_DISPLAY=y

Let's begin the debug ging of wifi in the user space. In the device warehouse, there is such a commit for the ubuntu touch transplantation of Hongmi note7.

diff --git a/BoardConfig.mk b/BoardConfig.mk
index 991cea0..be799da 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -246,11 +246,11 @@ BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
 # WiFi
 BOARD_HAS_QCOM_WLAN := true
 BOARD_HAS_QCOM_WLAN_SDK := true
-BOARD_WLAN_DEVICE := qcwcn
+#BOARD_WLAN_DEVICE := qcwcn
 BOARD_HOSTAPD_DRIVER := NL80211
-BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
+#BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
 BOARD_WPA_SUPPLICANT_DRIVER := NL80211
-BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
+#BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
 WIFI_DRIVER_FW_PATH_AP := "ap"
 WIFI_DRIVER_FW_PATH_STA := "sta"
 WIFI_DRIVER_FW_PATH_P2P := "p2p"

At first, I thought that the modifications of the same chip should be the same, so I directly moved the commit to my warehouse. The result is that CNSs daemon can't find some dynamic link libraries and can't work all the time. After careful analysis, it is found that the vendor of Hongmi note7 already contains the product of the things commented out by the commit, while Xiaomi tablet 4 does not, so the following modifications should be made to CNSs daemon to start wifi.

@@ -239,7 +240,7 @@ VENDOR_SECURITY_PATCH := 2019-04-01
 # Wifi
 BOARD_HAS_QCOM_WLAN := true
 BOARD_HAS_QCOM_WLAN_SDK := true
-#BOARD_WLAN_DEVICE := qcwcn
+BOARD_WLAN_DEVICE := qcwcn
 BOARD_HOSTAPD_DRIVER := NL80211
 #BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
 BOARD_WPA_SUPPLICANT_DRIVER := NL80211

touch screen

It was tuned in the ubuntu touch, but there was no response in the droidian. There was no error report about the touch screen in the kernel log and Android log. Direct the cat /dev/input/event * device, and then operate the touch screen to find that there is data. Finally, locking is the problem of udev. Just add a new statement to udev.

# Goodix Touchscreen
ACTION=="add", KERNEL=="input[0-9]*", SUBSYSTEM=="input", ATTRS{name}=="goodix-ts", ENV{ID_INPUT}=="1", ENV{ID_INPUT_TOUCHSCREEN}="1"

Adaptation of special package for Droidian equipment

As mentioned earlier, Droidian does not provide a tutorial on how to generate a device specific package. Only one gsi brush package can be used.
After research, it is found that the way droidian and Ubuntu touch mount Android system partitions is not exactly the same. Droidian directly puts Android rootfs as a system package under / var/lib/lxc/android, while Ubuntu touch puts Android rootfs and Ubuntu touch rootfs under / data through the halium install script, Note that Android rootfs and GNU/Linux rootfs here are formats in which linux mount instructions can be directly mounted.
So, directly convert the system.img generated by Halium into ext4 img, and then directly replace Android rootfs in rootfs. The conversion instructions are as follows.

$ simg2img system.img android-rootfs.img
# Resize mirror to fit
$ resize2fs -M android-rootfs.img

In twrp, you can enter the Droidian system by successively brushing the modified brush package, vendor.img and halium-boot.img!

Improvement of GitHub Action construction system

In the previous article, I mentioned a scheme of compiling Halium with Github Action, but recently, it seems that Github's container has added something (about 1-2G). The action that was able to create system.img just before the hard disk is full has failed.
from easimon/maximize-build-space The project learned that github actually has a swap disk in addition to the default 60G data disk of the container, which seems to have more than 10 G, so it only needs to get rid of the useless software in the container, reduce the swap space, and then get a hard disk pool to include these two disks. Generally, it can get about 80G of space. Compiling and uploading images should be more than enough.

    $ df -h
    Filesystem                   Size  Used Avail Use% Mounted on
    /dev/mapper/buildvg-buildlv   78G   57M   78G   1% /home/runner/work/halium

The Action script is here. If you need it, you can get it directly into your Action

 - name: Cleanup Disk
   uses: HandsomeYingyan/cleanup-disk-action@v3.0

 - name: Maximize build space
   uses: easimon/maximize-build-space@master
   with:
      root-reserve-mb: 512
      swap-size-mb: 1024
      build-mount-path: '$ANDROID_ROOT'

Multi start?

In theory, multi boot (Android and halium coexist) is feasible. Halium only occupies part of the boot partition and data partition in design. This is easy to do on the platform of double boot partition. It only needs one partition to install Android boot.img and the other to install halium-boot.img, which can be done by selecting the boot partition to be started. However, Xiaomi tablet 4 has only one boot.img partition. You may need to sacrifice the recovery partition to achieve dual boot. You can use the recovery method to enter another system, but you don't have time to get it, and you don't need Android. This scheme will be tried again when you have time.

effect

Run vscade

neofetch

Run Gnome40

system resource

Photo Desktop

Related links

github project home page
github action and Halium image download of Xiaomi tablet 4
droidian project
droidian image download (GSI API 28)

Unfinished to be continued

At present, the whole system is in a relatively usable state, but there are Bluetooth, sensors, cameras and traffic Internet access that have not been completed. In addition, there are many small details that are not perfect. I hope I can get all these things out one day...

Tags: Android

Posted on Wed, 13 Oct 2021 12:20:50 -0400 by zdzislaw