Jump to content

Microsoft Lumia 640 XL (microsoft-makepeace)

From postmarketOS Wiki
Microsoft Lumia 640 XL
Manufacturer Microsoft
Name Lumia 640 XL
Codename microsoft-makepeace
Released 2015
Type handset
Hardware
Chipset Qualcomm Snapdragon 400 (MSM8926)
CPU Quad-core 1.2 GHz Cortex-A7
GPU Adreno 305
Display 720 x 1280 IPS LCD
Storage 8 GB
Memory 1 GB
Architecture armv7
Software
Original software
The software and version the device was shipped with.
Windows Phone 8.1
Extended version
The most recent supported version from the manufacturer.
Windows Phone
Mainline
Instead of a Linux kernel fork, it is possible to run (Close to) Mainline.
no
Features
Flashing
Whether it is possible to flash the device with pmbootstrap flasher.
Broken
USB Networking
After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system).
Works
SD card
Also includes other external storage cards.
Works
Battery
Whether charging and battery level reporting work.
Broken
Screen
Whether the display works; ideally with sleep mode and brightness control.
Partial
Touchscreen
Broken
Multimedia
3D Acceleration
Broken
Audio
Audio playback, microphone, headset and buttons.
Broken
Camera
Broken
Connectivity
WiFi
Broken
Bluetooth
Broken
GPS
Broken
NFC
Near Field Communication
Broken
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
Full disk encryption and unlocking with unl0kr.
Broken
Sensors
Accelerometer
Handles automatic screen rotation in many interfaces.
Untested

Contributors

Users owning this device

  • Jacko (Notes: Current project. After procrastinating for 1 year, linux is booting now! gonna keep working on it in my spare time.)


Installation

Unlocking bootloader

See the general guide Unlocking the Bootloader for instructions.

Install developer menu and bootshim

After you have unlocked the bootloader of your phone, you will have to install the developer menu and bootshim onto your phone. This is made easy by the LumiaQuickStart script - intended to run on a windows machine.

  • Clone the LumiaQuickStart repo [1]
  • Use WPInternals to reboot your phone into mass storage mode.
  • Run install.ps1 as administrator. Provide the path to EFIESP (Windows might also have mounted it inside MainOS).

After the script finishes, you should see a boot menu upon restart, which means we're ready to.

Install lk2nd

  • Download emmc_appsboot.mbn [2]. This version of the LK2nd bootloader was compiled for another lumia phone by the mainline4lumia team, however it appears to work fine on the 640xl.
  • Copy emmc_appsboot.mbn to your phone's EFIESP folder
  • Unmount mass storage and restart your phone by holding the power button for 10 seconds.

If all went well, you should enter lk2nd by pressing volume up on the bootmenu.

Install postmarketOS to an SD card

  1. Run pmbootstrap init and set up your device config. I am still currently working on the postmarketOS device package for this phone. For now, the existing package device-microsoft-dempsey will boot successfully. Possibly the device-nokia-tesla package might work better but I have not tested that personally. Choose the console UI.
  2. Plug an SD card into your PC and verify which device name it has under /dev . For me it was /dev/mmcblk0. Then install postmarketOS directly to the SD card: pmbootstrap install --sdcard /dev/{your-sdcard}
  3. Unmount the SD card and plug it in to the phone. To access the SD card slot you need to remove the back cover and battery.
  4. Next boot, press volume up on boot to enter lk2nd. lk2nd should then immediately boot into linux. You should see the standard postmarketOS USB network device after ~30-60sec.

NOTE: To interrupt lk2nd and access the fastboot interface, quickly hold down the Volume Down button after pressing Volume Up to enter lk2nd.

UART

In case of any booting issues, UART is one of the most reliable ways to get info from any embedded device. Here are the UART pins on the main board. To access them, pull off the back plastic cover, then unscrew the midframe. Logic level is 1.8V, and baudrate is 115200. By default you should see some UART logs from the windows bootloader and lk2nd.

To boot Linux with logs sent to UART console, add the cmdline param console=ttyMSM0,115200

Screen Progress

The screen is working now! I needed to modify the device tree to configure the framebuffer as 24-bit pixels.

Instability Problem

In my testing of the device, I have found severe instability which causes the device to crash or corrupt the SD card. It will work fine for light commands, but installing apk packages has crashed the system for me. It might be a power regulator issue? No idea.

Misc Dev Notes

  • If you can get lk2nd working, you can boot any kernel image using the fastboot interface. This might help if you want to quickly iterate on kernels without worrying about updating the rootfs. Example command: fastboot boot vmlinuz initramfs --cmdline "console=tty0" . For this command to work, the vmlinuz file must have the dtb appended to the end of it. If you don't have an initramfs, you won't see any logs right now. For my early testing I took the initramfs from the rootfs of the Lumia 640, already packaged in postmarketOS.
  • If you don't have an initramfs, your kernel will probably panic really early. I don't think it will output anything to the display. I finally discovered this fact when I setup UART on the board and could finally read early kernel logs.
  • lk2nd will automatically detect a boot partition on an attached sd card and boot from it. I believe it requires an android-style boot.img containing the kernel and initramfs.

See also

Internal links

External links

  • [3] Close to mainline linux kernel w/ support for dempsey and a few other msm8x26 lumias on msm8x26 branch. Use msm8x26-touchscreen branch for touchscreen, until it gets committed into msm8x26. [NOTE: Current working kernel is the pmOS package postmarketos-linux-qcom-msm8226]
  • [4] EDK2 for dempsey, tesla, makepeace and superman. This does boot Linux!
  • [5] LittleKernel for tesla and some other lumias. This does not boot Linux!! Useful for chain loading lk2nd to dump regulators when porting a lumia to linux.
  • [6] Boot shim used to boot EDK2 and lk2nd.
  • [7] Here's a nice guide written by WolfLink115 which explains how to compile/install EDK2 and boot Linux
  • [8] If you manage to brick the Lumia 640 XL into Qualcomm EDL mode, then this guide can help you unbrick it.