Jump to content

Medion Lifetab S9714 (medion-kai): Difference between revisions

From postmarketOS Wiki
No edit summary
Knuxify (talk | contribs)
m gitlab.com -> gitlab.postmarketos.org (bot edit)
 
(37 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Infobox device
{{Infobox device
| manufacturer = Lenovo
| manufacturer = Medion
| vendor = Medion
| vendor = Medion
| name = Medion Lifetab S9714
| name = Lifetab S9714
| codename = medion-lifetab_s9714
| codename = medion-kai
| image = File:Medion-lifetab_s9714.jpg
| image = File:Medion-kai.jpg
| imagecaption = Medion Lifetab S9714
| imagecaption = Lifetab S9714
| releaseyear = 2012
| releaseyear = 2012
| originalsoftware = Android 4.0 / 4.1
| originalsoftware = Android
| chipset = NVIDIA TEGRA 3
| originalversion = 4.0
| cpu = NVIDIA TEGRA 3 Quad-Core 1.2 GHz
| extendedversion = 4.1
| gpu = NVIDIA TEGRA 3 (Ultra Low Power GeForce)
| chipset = Nvidia Tegra 3 (T30L)
| cpu = Quad-Core 1.2 GHz
| gpu = Ultra Low Power GeForce
| storage = 32 GB internal storage
| storage = 32 GB internal storage
| display = 1280 x 800 touchscreen
| display = 1280 x 800 touchscreen
| memory = 1 GB
| memory = 1 GB
| architecture = armhf
| architecture = armv7
| type = Tablet
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
| status_usbnet = <!-- USB networking does work? then put Y here and delete this comment -->
| status_usbnet = Y
| status_flashing = <!-- Flashing with "pmbootstrap flasher" works? Put Y here. It works the same for everything coming below. -->
| status_flashing = Y
| status_touch = <!-- Touch screen is working? You can also answer these questions with P for partially. -->
| status_touch = Y
| status_screen = <!-- The display is working? -->
| status_screen = Y
| status_wifi = <!-- Wireless network works? -->
| status_wifi = Y
| status_xwayland = <!-- Showing X11 applications in a Wayland compositor (Weston, KWin, ...) works? -->
| status_xwayland = Y
| status_fde = <!-- When installing with full disk encryption, can you type in the password with the on screen keyboard? -->
| status_fde = Y
| status_mainline = <!-- Instead of a Linux kernel fork, it is possible to run mainline. -->
| status_mainline = <!-- Instead of a Linux kernel fork, it is possible to run mainline. -->
| status_battery = <!-- Charging the battery with charging-sdl is possible -->
| status_battery = <!-- Charging the battery with charging-sdl is possible -->
Line 38: Line 41:


<!-- you can also use these lines if you need to:
<!-- you can also use these lines if you need to:
if the device haven't originally ran Android OS, e.g. Nokia N900
| n-android =  ✔
Version of the kernel that pmos is running
Version of the kernel that pmos is running
| pmoskernel = 3.x.x
| pmoskernel = 3.x.x
Line 47: Line 48:
| status_otg = -
| status_otg = -
-->
-->
}}
}}{{Based on SoC|Nvidia_Tegra_3_(tegra30)|Tegra 3}}


== Contributors ==
== How to enter flash mode ==
* [[User:Bonsaiblue|Bonsaiblue]]


== Maintainer(s) ==
To start fastboot mode:
<!-- Only if this device doesn't run on linux-postmarketos yet! -->
When tablet is running Android (with usb debugging enabled in the developer options) or recovery run
<!-- This person needs to be willing to answer questions from users of this device -->


== Users owning this device ==
    adb reboot bootloader
{{Device owners}}
<!-- autogenerated, use {{Owns device|devicepage|notes}} on your profile page -->
<!-- use _ instead of spaces in device page name, e.g. {{Owns device|HTC_Desire_(htc-bravo)|custom notes}}-->
<!-- you may need to purge page cache to see changes (more->purge cache)-->
<!-- you can use {{My devices}} on your profile page to show table with all your devices -->


== How to enter flash mode ==
To unlock bootloader in fastboot mode (CAUTION: this will erase userdata! Backup before doing this!):


To start fastboot mode:
    fastboot oem unlock
# boot into recovery by holding volume-down while starting the device, then
# <code>adb reboot bootloader</code>


To unlock bootloader in fastboot mode (CAUTION: this will erase userdata! Backup before doing this!): <code>fastboot oem unlock</code>
To boot into recovery: hold volume down and power on at the same time to start device.


== Installation ==
== Installation ==
Line 79: Line 71:
# Backup Android installation on SD card
# Backup Android installation on SD card
# [[Installation_guide|Follow installation guide]] (note that flashing rootfs can take a few minutes without feedback, just wait)
# [[Installation_guide|Follow installation guide]] (note that flashing rootfs can take a few minutes without feedback, just wait)
# After flashing has finished, the screen should show the Medion logo and a notice saying "Cold booting linux"; after that, the postmarkedOS logo and then the demo should come up.


== Notes ==
== Notes ==
Apparently, the device was manufactured by Lenovo for vendor Medion and is similar to Lenovo's A2110 / A2109 boards. Some information about the [https://thinkwiki.de/IdeaTab_A2109 IdeaTab A2109].


<!-- add more sections below as necessary, e.g. WiFi, photos, ... -->
<!-- add more sections below as necessary, e.g. WiFi, photos, ... -->


== See also ==
== How bonsaiblue made wifi work ==
 
How bonsaiblue made wifi work (minus the confusing detours). [[Samsung_Galaxy_S_Advance_(samsung-i9070)#How_drebrez_made_wifi_work|Inspired by the very helpful How_drebrez_made_wifi_work]].
 
* Find information online about the wifi chip of the device: it uses Broadcom BCM4330 for wifi 11b/g/n and Bluetooth 3.0
* Read the [[WiFi]] page, in particular [[WiFi#Broadcom_WiFi|the part about Broadcom WiFi]].
* Since that page mentions kernel config parameters, grep for "BCM" in the devices kernel config:
 
    grep -i "BCM" pmaports/device/linux-medion-kai/config-medion-kai.armv7
    ...
    CONFIG_BCMDHD_FXN_FW_PATH="/system/vendor/firmware/bcm4330/fw_bcmdhd.bin"
    CONFIG_BCMDHD_FXN_NVRAM_PATH="/system/etc/nvram_4330.txt"
    CONFIG_BCMDHD_FXN_195_89=m
    ...
 
* So the wifi chip needs a kernel module (<code>CONFIG_BCMDHD_FXN_195_89=m</code>) and firmware and config files (<code>fw_bcmdhd.bin</code>, <code>nvram_4330.txt</code>).
* Download and unpack the vendor's OTA ROM zip (link in the [[Medion_Lifetab_S9714_(medion-kai)#See_also]] section). (Other ideas on how to find firmware files are on the [[How_to_find_device-specific_information#Firmware_files]] page.)
* In the unpacked ROM folder, look for <code>system/vendor/firmware/bcm4330/fw_bcmdhd.bin</code> and <code>system/etc/nvram_4330.txt</code>.
* First step is to try to get wifi to work with the vendor firmware. Later on we might be able to use existing postmarket firmware packages instead.
* Copy <code>nvram_4330.txt</code> to <code>aports/device/device-medion-kai</code>.
* Edit <code>device/linux-medion-kai/APKBUILD</code> to get kernel modules built and installed:
** Increase <code>pkgrel</code> by one.
** At the end of the <code>build()</code> section, add this to build the modules:
    # the 'no-pic' flag is necessary to avoid the
    # error 'Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)' when loading the module
    make ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \
        KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" modules
** At the end of the <code>package()</code> section, add this to install the modules:
    # Modules
    cd "$builddir"
    unset LDFLAGS
    make ARCH="$_carch" CC="${CC:-gcc}" \
        KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \
        INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \
        modules_install
 
* Edit <code>device/linux-medion-kai/config-medion-kai.armv7</code> and set the path where the wifi firmware is expected to a subfolder of <code>/lib/firmware/postmarketos</code>:
 
 
    CONFIG_BCMDHD_FXN_FW_PATH="/lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin"
    CONFIG_BCMDHD_FXN_NVRAM_PATH="/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt"
 
* Rebuild <code>linux-medion-kai</code> and create an image file:
 
    pmbootstrap checksum linux-medion-kai && \
    pmbootstrap kconfig check -f && \
    pmbootstrap build linux-medion-kai --force && \
    pmbootstrap install
 
* Chroot into the image file and check if modules have been built:
 
    pmbootstrap chroot -r
   
    find /lib/modules/
   
* In particular there should be <code>/lib/modules/3.1.10/kernel/drivers/net/wireless/bcmdhd_fxn_195_89/bcmdhd.ko</code>. Leave chroot again (with <code>exit</code>).
 
* In <code>device/device-medion-kai</code>, add a new file <code>modules-load.conf</code> and have the module found in the previous step loaded at boot time:
 
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    # wifi module
    bcmdhd
 
* Edit <code>device/device-medion-kai/APKBUILD</code>
** Increase <code>pkgrel</code> by one.
** Add to source files and declare a new subpackage:
 
    subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
    source="deviceinfo
        nvram_4330.txt
        modules-load.conf"
 
** At the end of the <code>package()</code> section, add this to put <code>modules-load.conf</code> in the right place on the device:
 
    install -Dm644 "$srcdir"/modules-load.conf \
        "$pkgdir"/etc/modules-load.d/00-$pkgname.conf
 
** Below the <code>package()</code> section, add a new <code>nonfree_firmware()</code> section that installs the <code>nvram_4330.txt</code> file from the vendor ROM.
 
    nonfree_firmware() {
        pkgdesc="Wifi firmware"
        mkdir "$subpkgdir"
        install -D -m644 "$srcdir"/nvram_4330.txt \
            "$subpkgdir"/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt
    }
   
* Rebuild <code>device-medion-kai</code> and recreate the image file:
 
    pmbootstrap checksum device-medion-kai && \
    pmbootstrap build device-medion-kai --force && \
    pmbootstrap install
 
* Flash image to device   
 
    pmbootstrap flasher flash_rootfs && pmbootstrap flasher flash_kernel   
 
* ssh into the device via [[USB_Network]]
* Use scp to copy the firmware bin <code>fw_bcmdhd.bin</code> onto the device (e.g. into the /tmp directory) and move it to the path given in <code>CONFIG_BCMDHD_FXN_FW_PATH</code>: <code>/lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin</code>, next to <code>nvram_4330.txt</code>, which should already be in that directory.
* Restart the device
* Log in with ssh over USB again and run lsmod to see if the kernel module has been loaded correctly:
 
    lsmod
    Module                  Size  Used by
    bcmdhd                387306  0
    cfg80211              157302  1 bcmdhd
 
* If the module isn't listed, check that it's on the device (<code>find /lib/modules/ -iname "*bcm*ko"</code>) and what happens if you try to insert it manually (<code>modprobe bcmdhd || dmesg | tail -n 20</code>). If modprobe doesn't find the module you can also try <code>insmod /lib/modules/3.1.10/kernel/drivers/net/wireless/bcmdhd_fxn_195_89/bcmdhd.ko || dmesg | tail -n 20</code>.<br/>If dmesg gives <code>Unknown symbol _GLOBAL_OFFSET_TABLE_</code> you may be missing the <code>-fno-pic</code> flag when building the kernel modules.
 
* Once the module is loaded correctly, continue with the [[WiFi#Debugging|steps on the Wifi page]]:
** Check if the interface is available
 
    ip link
    ...
    7: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
** Turn on wifi
 
    nmcli radio wifi on
 
** Scan for available wifis:
 
    nmcli device wifi list ifname wlan0
 
** Connect to your wifi:
 
    nmcli device wifi connect "$SSID" password "$PASSWORD" ifname wlan0
 
* If wifi works, try replacing the vendor's firmware bin with bins from existing postmarket firmware packages. Information about the Broadcom firmware version is added in ASCII at the end of the blobs and can be seen with <code>less</code>:
   
    less fw_bcmdhd.bin
    ... 4330b2-roml/sdio-g-pool-pno-pktfilter-keepalive-wapi-wme-p2p-apsta-aoe Version: 5.90.195.89 CRC: 2303bcd6 Date: Sun 2012-07-22 19:27:22 PDT ...
 
* Candidate postmarket packages can be identified with <code>grep -ril "bcm" pmaports/firmware</code>. Package <code>firmware-aosp-broadcom-wlan</code> sounds promising.
 
* The blobs for <code>firmware-aosp-broadcom-wlan</code> are taken from this [https://github.com/zhuowei/android_hardware_broadcom_wlan/tree/6c8ef5b600cec5d36a54a0276fe8c97b9ab8d6bb/bcmdhd/firmware GitHub repository].
* Checking blob <code>bcm4330/fw_bcm4330_bg.bin</code> from that repository with less shows that it's a newer version:
 
    less fw_bcm4330_bg.bin
    ... 4330b2-roml/sdio-g-p2p-idsup-idauth-pno Version: 5.90.195.114 CRC: 24b8f965 Date: Wed 2013-01-23 17:48:37 PST ...
 
* Copying <code>fw_bcm4330_bg.bin</code> onto the device at <code>/lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin</code> and rebooting shows, that this firmware also works (with the vendor <code>nvram_4330.txt</code> file unchanged).
 
* This means we can add <code>firmware-aosp-broadcom-wlan</code> as a dependency in the firmware part of  <code>device/device-medion-kai/APKBUILD</code>:
 
    nonfree_firmware() {
        pkgdesc="Wifi firmware"
        depends="firmware-aosp-broadcom-wlan"
        mkdir "$subpkgdir"
        install -D -m644 "$srcdir"/nvram_4330.txt \
            "$subpkgdir"/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt
    }
 
Result: [https://gitlab.postmarketos.org/postmarketOS/pmaports/merge_requests/904 Merge request for wifi on medion kai]
 
== Contributors ==
* [[User:Bonsaiblue|Bonsaiblue]]
 
== Maintainer(s) ==
<!-- Only if this device doesn't run on linux-postmarketos yet! -->
<!-- This person needs to be willing to answer questions from users of this device -->


[https://forums.lenovo.com/t5/Lenovo-Android-based-Tablets-and/A2109-Updated-ClockworkMod-Recovery-for-Jelly-Bean/td-p/949575 CWM recovery is available here]
== Users owning this device ==
{{Device owners}}


[https://docs.google.com/open?id=0B1jde5rC0oQGOVRfVzNrY19SZWc Direct link for CWM for Jelly Bean / Android 4.1]
=== Related links ===


[https://docs.google.com/open?id=0B1jde5rC0oQGWmJsYi1tLWViUWc Direct link for CWM for Ice Cream Sandwich / Android 4.0]
* [https://www.cypress.com/file/298686/download nvram text file reference]
* [https://android.googlesource.com/platform/hardware/broadcom/wlan/+/bcd905af9e0c40e7c4bf2e6390fc3374a7a261f7/bcmdhd/firmware/bcm4330/ more recent version of broadcom firmware that also works on kai]


[https://gitlab.com/red-black-bonsai/pmaports/tree/medion-lifetab_s9714 Postmarket device files in GitLab]
== See also ==


[https://github.com/red-black-bonsai/android_kernel_medion_lifetab_s9714 Vendor Android kernel sources in a GitHub repository]
* [[Google Nexus 7 2012 (asus-grouper)]]
* {{Device package|medion-kai}}
* {{Kernel package|medion-kai}}
* [https://github.com/red-black-bonsai/android_kernel_medion_lifetab_s9714 Vendor Android kernel sources in a GitHub repository]
* [https://forums.lenovo.com/t5/Lenovo-Android-based-Tablets-and/A2109-Updated-ClockworkMod-Recovery-for-Jelly-Bean/td-p/949575 CWM recovery is available here]
* [https://docs.google.com/open?id=0B1jde5rC0oQGOVRfVzNrY19SZWc Direct link for CWM for Jelly Bean / Android 4.1]
* [https://docs.google.com/open?id=0B1jde5rC0oQGWmJsYi1tLWViUWc Direct link for CWM for Ice Cream Sandwich / Android 4.0]
* [https://download.chainfire.eu/696/SuperSU/UPDATE-SuperSU-v2.46.zip SuperSU-v2.46]
* [https://github.com/Kahlo007/cm_kernel_lenovo_kai kernel sources for Lenovo Kai?]


<!--
<!--
Line 102: Line 267:
You can also add normal web links:
You can also add normal web links:
* [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS2I9100 Replicant wiki page]
* [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS2I9100 Replicant wiki page]
-->
<!--
If you manage to get your device packages merged, uncomment links below and change DEVICE_CODENAME with the actual one.
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/device-DEVICE_CODENAME Device package]
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/linux-DEVICE_CODENAME Kernel package]
-->
-->

Latest revision as of 13:49, 4 November 2024

Medion Lifetab S9714
Lifetab S9714
Lifetab S9714
Manufacturer Medion
Name Lifetab S9714
Codename medion-kai
Released 2012
Type tablet
Hardware
Chipset Nvidia Tegra 3 (T30L)
CPU Quad-Core 1.2 GHz
GPU Ultra Low Power GeForce
Display 1280 x 800 touchscreen
Storage 32 GB internal storage
Memory 1 GB
Architecture armv7
Software
Original software Android
Original version 4.0
Extended version 4.1
postmarketOS
Category testing
Pre-built images no
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
No data
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
No data
Audio
No data
Camera
No data
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
No data
GPS
No data
NFC
No data
Modem
Calls
No data
SMS
No data
Mobile data
No data
Miscellaneous
FDE
Works
USB OTG
No data
HDMI/DP
No data
Sensors
Accelerometer
No data
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data

How to enter flash mode

To start fastboot mode: When tablet is running Android (with usb debugging enabled in the developer options) or recovery run

   adb reboot bootloader

To unlock bootloader in fastboot mode (CAUTION: this will erase userdata! Backup before doing this!):

   fastboot oem unlock

To boot into recovery: hold volume down and power on at the same time to start device.

Installation

My procedure was:

  1. Backup all important user data
  2. Unlock bootloader (see above)
  3. Install CWM recovery by going into fastboot mode and then running fastboot flash recovery A2109_CWMrecovery-6.0.1.9d.img
  4. Backup Android installation on SD card
  5. Follow installation guide (note that flashing rootfs can take a few minutes without feedback, just wait)
  6. After flashing has finished, the screen should show the Medion logo and a notice saying "Cold booting linux"; after that, the postmarkedOS logo and then the demo should come up.

Notes

Apparently, the device was manufactured by Lenovo for vendor Medion and is similar to Lenovo's A2110 / A2109 boards. Some information about the IdeaTab A2109.


How bonsaiblue made wifi work

How bonsaiblue made wifi work (minus the confusing detours). Inspired by the very helpful How_drebrez_made_wifi_work.

  • Find information online about the wifi chip of the device: it uses Broadcom BCM4330 for wifi 11b/g/n and Bluetooth 3.0
  • Read the WiFi page, in particular the part about Broadcom WiFi.
  • Since that page mentions kernel config parameters, grep for "BCM" in the devices kernel config:
   grep -i "BCM" pmaports/device/linux-medion-kai/config-medion-kai.armv7
   ...
   CONFIG_BCMDHD_FXN_FW_PATH="/system/vendor/firmware/bcm4330/fw_bcmdhd.bin"
   CONFIG_BCMDHD_FXN_NVRAM_PATH="/system/etc/nvram_4330.txt"
   CONFIG_BCMDHD_FXN_195_89=m
   ...
  • So the wifi chip needs a kernel module (CONFIG_BCMDHD_FXN_195_89=m) and firmware and config files (fw_bcmdhd.bin, nvram_4330.txt).
  • Download and unpack the vendor's OTA ROM zip (link in the Medion_Lifetab_S9714_(medion-kai)#See_also section). (Other ideas on how to find firmware files are on the How_to_find_device-specific_information#Firmware_files page.)
  • In the unpacked ROM folder, look for system/vendor/firmware/bcm4330/fw_bcmdhd.bin and system/etc/nvram_4330.txt.
  • First step is to try to get wifi to work with the vendor firmware. Later on we might be able to use existing postmarket firmware packages instead.
  • Copy nvram_4330.txt to aports/device/device-medion-kai.
  • Edit device/linux-medion-kai/APKBUILD to get kernel modules built and installed:
    • Increase pkgrel by one.
    • At the end of the build() section, add this to build the modules:
   # the 'no-pic' flag is necessary to avoid the
   # error 'Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)' when loading the module
   make ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \
       KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" modules
    • At the end of the package() section, add this to install the modules:
   # Modules
   cd "$builddir"
   unset LDFLAGS
   make ARCH="$_carch" CC="${CC:-gcc}" \
       KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \
       INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \
       modules_install
  • Edit device/linux-medion-kai/config-medion-kai.armv7 and set the path where the wifi firmware is expected to a subfolder of /lib/firmware/postmarketos:


   CONFIG_BCMDHD_FXN_FW_PATH="/lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin"
   CONFIG_BCMDHD_FXN_NVRAM_PATH="/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt"
  • Rebuild linux-medion-kai and create an image file:
   pmbootstrap checksum linux-medion-kai && \
   pmbootstrap kconfig check -f && \
   pmbootstrap build linux-medion-kai --force && \
   pmbootstrap install
  • Chroot into the image file and check if modules have been built:
   pmbootstrap chroot -r
   
   find /lib/modules/
   
  • In particular there should be /lib/modules/3.1.10/kernel/drivers/net/wireless/bcmdhd_fxn_195_89/bcmdhd.ko. Leave chroot again (with exit).
  • In device/device-medion-kai, add a new file modules-load.conf and have the module found in the previous step loaded at boot time:
   # This file contains the names of kernel modules that should be loaded
   # at boot time, one per line. Lines beginning with "#" are ignored.
   # wifi module
   bcmdhd
  • Edit device/device-medion-kai/APKBUILD
    • Increase pkgrel by one.
    • Add to source files and declare a new subpackage:
   subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
   source="deviceinfo
       nvram_4330.txt
       modules-load.conf"
    • At the end of the package() section, add this to put modules-load.conf in the right place on the device:
   install -Dm644 "$srcdir"/modules-load.conf \
       "$pkgdir"/etc/modules-load.d/00-$pkgname.conf
    • Below the package() section, add a new nonfree_firmware() section that installs the nvram_4330.txt file from the vendor ROM.
   nonfree_firmware() {
       pkgdesc="Wifi firmware"
       mkdir "$subpkgdir"
       install -D -m644 "$srcdir"/nvram_4330.txt \
           "$subpkgdir"/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt
   }
   
  • Rebuild device-medion-kai and recreate the image file:
   pmbootstrap checksum device-medion-kai && \
   pmbootstrap build device-medion-kai --force && \
   pmbootstrap install
  • Flash image to device
   pmbootstrap flasher flash_rootfs && pmbootstrap flasher flash_kernel    
  • ssh into the device via USB_Network
  • Use scp to copy the firmware bin fw_bcmdhd.bin onto the device (e.g. into the /tmp directory) and move it to the path given in CONFIG_BCMDHD_FXN_FW_PATH: /lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin, next to nvram_4330.txt, which should already be in that directory.
  • Restart the device
  • Log in with ssh over USB again and run lsmod to see if the kernel module has been loaded correctly:
   lsmod
   Module                  Size  Used by
   bcmdhd                387306  0
   cfg80211              157302  1 bcmdhd
  • If the module isn't listed, check that it's on the device (find /lib/modules/ -iname "*bcm*ko") and what happens if you try to insert it manually (modprobe bcmdhd || dmesg | tail -n 20). If modprobe doesn't find the module you can also try insmod /lib/modules/3.1.10/kernel/drivers/net/wireless/bcmdhd_fxn_195_89/bcmdhd.ko || dmesg | tail -n 20.
    If dmesg gives Unknown symbol _GLOBAL_OFFSET_TABLE_ you may be missing the -fno-pic flag when building the kernel modules.
  • Once the module is loaded correctly, continue with the steps on the Wifi page:
    • Check if the interface is available
   ip link
   ...
   7: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
       link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
    • Turn on wifi
   nmcli radio wifi on
    • Scan for available wifis:
   nmcli device wifi list ifname wlan0
    • Connect to your wifi:
   nmcli device wifi connect "$SSID" password "$PASSWORD" ifname wlan0
  • If wifi works, try replacing the vendor's firmware bin with bins from existing postmarket firmware packages. Information about the Broadcom firmware version is added in ASCII at the end of the blobs and can be seen with less:
   less fw_bcmdhd.bin
   ... 4330b2-roml/sdio-g-pool-pno-pktfilter-keepalive-wapi-wme-p2p-apsta-aoe Version: 5.90.195.89 CRC: 2303bcd6 Date: Sun 2012-07-22 19:27:22 PDT ...
  • Candidate postmarket packages can be identified with grep -ril "bcm" pmaports/firmware. Package firmware-aosp-broadcom-wlan sounds promising.
  • The blobs for firmware-aosp-broadcom-wlan are taken from this GitHub repository.
  • Checking blob bcm4330/fw_bcm4330_bg.bin from that repository with less shows that it's a newer version:
   less fw_bcm4330_bg.bin
   ... 4330b2-roml/sdio-g-p2p-idsup-idauth-pno Version: 5.90.195.114 CRC: 24b8f965 Date: Wed 2013-01-23 17:48:37 PST ...
  • Copying fw_bcm4330_bg.bin onto the device at /lib/firmware/postmarketos/bcmdhd/bcm4330/fw_bcm4330_bg.bin and rebooting shows, that this firmware also works (with the vendor nvram_4330.txt file unchanged).
  • This means we can add firmware-aosp-broadcom-wlan as a dependency in the firmware part of device/device-medion-kai/APKBUILD:
   nonfree_firmware() {
       pkgdesc="Wifi firmware"
       depends="firmware-aosp-broadcom-wlan"
       mkdir "$subpkgdir"
       install -D -m644 "$srcdir"/nvram_4330.txt \
           "$subpkgdir"/lib/firmware/postmarketos/bcmdhd/bcm4330/nvram_4330.txt
   }

Result: Merge request for wifi on medion kai

Contributors

Maintainer(s)

Users owning this device


Related links

See also