User:Ignapk

From postmarketOS
Jump to navigation Jump to search

♻

This user has ported 1 devices to postmarketOS.

đŸ“±

This user's main device is a Google_Pixel_3a_(google-sargo).

GitLab logo This user has a GitLab profile.

Ignacy KuchciƄski

Contacts:

Matrix: @ignapk-matrix:matrix.org

IRC: ignapk

E-mail: ignacykuchcinski at gmail

Owns devices

Device Notes
Google Pixel 3a (google-sargo) Daily driver
Huawei P10 Lite (huawei-warsaw) Ported, stuck fixing audio
Samsung Galaxy S4 Mini LTE (samsung-serranolte) Current test subject



How ignapk made wifi work

How ignapk made wifi work. Inspired by the very helpful How_drebrez_made_wifi_work and How bonsaiblue made wifi work.

  • Find information online about the wifi chip of the device: in my case it uses HiSilicon HI1102 for wifi 802.11 b/g/n/ac and Bluetooth v4.1. If you have trouble finding it online, you can search kernel config for wifi drivers too, in my case `grep -i wifi config-huawei-warsaw.aarch64` gave me among others `CONFIG_HI1102_WIFI=y`.
  • Reading the WiFi page, in particular the part about Mediatek WiFi, it mentions that the best way to get to know how to make your specific SoC work is to look at the init.rc scripts from an Android ROM available for your phone.
  • I had previously installed stock EMUI8 before postmarketOS, so I mounted all partitions that were mountable from the overall /dev/mmcblk0p{1..56} in respective /mnt/{1..56} folders, and grepped them for 'hisi' string:
   # for i in $(seq 1 56); do mkdir /mnt/$i; mount /dev/mmcblk0p$i /mnt/$i; done
   find /mnt/{1..56} -name "*.rc"
   ...
   /mnt/54/etc/init/connectivity/init.connectivity.hi1102.rc
   ...

https://github.com/testandroidtests/hi6250_hi6250_dump/blob/883fb2ca0c890d7b0caea7a622a05d2da1451e02/vendor/etc/init/connectivity/init.connectivity.hi1102.rc In this init script there's a mention of /vendor/bin/start_connectivity_hisi, which luckily turns out to be a text file (in our case vendor partition is mounted in /mnt/54 instead of /vendor like in android roms), which is located in /mnt/54/bin/start_connectivity_hisi https://github.com/testandroidtests/hi6250_hi6250_dump/blob/883fb2ca0c890d7b0caea7a622a05d2da1451e02/vendor/bin/start_connectivity_hisi

  • After reading it we learn that the wifi chip drivers can be either builtin or compiled as modules, in my case they were built-in, so all I needed to do to enable them was:


echo init > /sys/hisys/boot/plat

echo init > /sys/hisys/boot/wifi

  • After this ip link shows a wlan0 interface that can be turned on with ip link.

ip link set wlan0 up

  • Now just repeat previous step and fix errors that show up in dmesg:
    • About missing config files in /vendor directory, for now I simply copied the entire vendor partition to /vendor directory to resolve these issues, in a long run I'll try to find out exactly which files are needed, and a way to change the hardcoded path. EDIT: following firmware files are needed:
      • /vendor/etc/cfg_warsaw_lx1_hisi.ini - seems to be optional
      • /vendor/firmware/bfgx_and_wifi_cfg
      • /vendor/firmware/wifi_cfg
      • /vendor/firmware/bfgx_cfg
      • /vendor/firmware/cr4_asic.bin
      • /vendor/firmware/CPU_RAM_SCHED.bin
      • /vendor/firmware/CPU_RAM_WBS.bin
    • About missing config files in the root directory: copy/link some config files from the /vendor/firmware directory to the root directory, specifically wifi_cfg, ram_reg_test_cfg, bfgx_cfg, bfgx_and_wifi_cfg. Again, I learned this by reading the dmesg output of previous step and additionally after trying to enable the interface with `ip link set wlan0 up`. EDIT: These errors don't seem to come up anymore?

However, after following above steps there would be kernel level cpu stalls on wpa_supplicant, caused by problems with p2p, which can be workarounded by disabling it in etc/wpa_supplicant/wpa_supplicant.conf by adding `p2p_disabled=1` at the beginning.