LG K40 AT&T (lg-mmh4x)

From postmarketOS Wiki
LG K40 (AT&T)
LG K40 running postmarketOS with Xfce4
LG K40 running postmarketOS with Xfce4
Manufacturer LG
Name K40 (AT&T)
Codename lg-mmh4x
Released 2019
Type handset
Hardware
Chipset MediaTek MT6765
CPU 4x 2.0 GHz & 4x 1.5 GHz
GPU PowerVR Rogue GE8320
Display 720x1440 IPS
Storage 32 GB
Memory 2 GB
Architecture armv7
Software
Original software Android
Original version 9
FOSS bootloader no
postmarketOS
Category testing
Pre-built images no
postmarketOS kernel 4.9.190
Unixbench Whet/Dhry score 3140.0
Features
Flashing
Works
USB Networking
Works
Internal storage
SD card
Battery
Broken
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Broken
Audio
Camera
Broken
Camera Flash
Connectivity
WiFi
Bluetooth
Broken
GPS
NFC
Modem
Calls
SMS
Mobile data
Miscellaneous
FDE
Broken
USB OTG
Works
Sensors
Accelerometer
Broken
Magnetometer
Broken
Ambient Light
Proximity
Haptics
Barometer
Power Sensor


Contributors

  • BenTheTechGuy

Users owning this device


How to enter flash mode

The LG K40 doesn't have a useful recovery mode (it's just a factory reset button), and fastboot doesn't exist at all on the device; the only useful mode is Download Mode, but that requires a signed image to flash.

Luckily, the mtkclient tool can make use of vulnerabilities in the MediaTek SoC itself in order to unlock the bootloader and flash images. In the below examples, the command mtk is used, but if you installed from source, you'll need to run python mtk inside the repo.

To enter into a mode that mtkclient can be used in, follow these steps:

  1. Power off the device.
  2. Run an mtkclient command, like mtk printgpt.
  3. While mtkclient waits for the device, hold Volume Up and plug it into the computer.
  4. mtkclient should output a lot of text at this point. The button can be released.
  5. As long as mtkclient did its job properly, the command will succeed. Now, other commands can be run with mtkclient.

Unlocking the bootloader

  1. Enable developer options, and OEM Unlocking from there.
  2. Follow the steps in #How to enter flash mode.
  3. Erase the userdata partition:
    mtk e metadata,userdata,md_udc
  4. Unlock the bootloader:
    mtk da seccfg unlock
  5. Reset mtkclient:
    mtk reset
  6. The bootloader should now be unlocked. From here, the device can be unplugged and powered on to go through setup.

Installation

  1. Run pmbootstrap init. DRM is not supported yet, so Xfce4 is the best graphical option for now.
  2. Run pmbootstrap install.
  3. Follow the steps in #How to enter flash mode.
  4. Run pmbootstrap flasher flash_kernel.
  5. Run pmbootstrap flasher flash_rootfs.

Status

What doesn't work:

  • WiFi: Haven't attempted to figure out how MTK's proprietary WiFi setup works on MT6765. Hoping the mainline effort gets there first.
  • Modem: Same
  • FDE: osk-sdl crashes with the following message and the device reboots:
    ERROR: Mode 720 x 1440 not available: f
    (!!!) *** UNIMPLEMENTED [fusion_get_fusionee_pid] *** [fusion.c:4147]
    (*) FBDev/Mode: Setting 720x1440 RGB32

    When set to use a 16 bit pixel format, osk-sdl hangs before it can reach this point, and the screen shows a corrupted version of its previous contents. The device reboots shortly after.
  • Battery: Always reports 0; the device will reboot after a short time if not plugged in, even if the battery is full.
  • Sensors: Not detected and don't know where to start getting it working.

See also