Medion Lifetab S9714 (medion-kai)

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

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

# 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 # 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
 * So the wifi chip needs a kernel module and firmware and config files.
 * Download and unpack the vendor's OTA ROM zip (link in the Medion_Lifetab_S9714_(medion-kai) section). (Other ideas on how to find firmware files are on the How_to_find_device-specific_information page.)
 * In the unpacked ROM folder, look for  and.
 * 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  to.
 * Edit  to get kernel modules built and installed:
 * Increase  by one.
 * At the end of the  section, add this to build the modules:
 * At the end of the  section, add this to install the modules:


 * Edit  and set the path where the wifi firmware is expected to a subfolder of  :

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  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 . Leave chroot again (with  ).


 * In, add a new file   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
 * Increase  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  section, add this to put   in the right place on the device:

install -Dm644 "$srcdir"/modules-load.conf \ "$pkgdir"/etc/modules-load.d/00-$pkgname.conf


 * Below the  section, add a new   section that installs the   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  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  onto the device (e.g. into the /tmp directory) and move it to the path given in  : , next to  , 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 and what happens if you try to insert it manually . If modprobe doesn't find the module you can also try  . If dmesg gives   you may be missing the   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:  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

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


 * Candidate postmarket packages can be identified with . Package   sounds promising.


 * The blobs for  are taken from this GitHub repository.
 * Checking blob  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  onto the device at   and rebooting shows, that this firmware also works (with the vendor   file unchanged).


 * This means we can add  as a dependency in the firmware part of   :

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

 * Bonsaiblue

Related links

 * nvram text file reference
 * more recent version of broadcom firmware that also works on kai