simple web maker
Mobirise

Install Debian on 950XL 

THOSE WHO ARE FIRST TIMERS GO AND CHECK OUT WOA PROJECT FIRST, LEARN ABOUT RISKS (Several partitions need to be left alone or you will damage your device so back up with win32diskimager! You have been warned I'm serious!)


This will mainly be a text-based guide, I may add screens next time I reinstall Linux but I feel not need right now..

Notes please read:

From the start I will presume readers have already Unlocked their Bootloader and Installed WoA Lumia already/before.
This isn't really useful yet because nothing can be done really, it's more for fun or developing more on getting Linux supported.


This wouldn't be possible if it wasn't for the people behind the original 4.18.6 Kernel and the 950XL's Device Tree
(Find links to Kernel source and DT source on the XL's PostmarketOS Page)
I upgraded the kernel to the mainline 5.7 Kernel, and added Bluetooth Networking (bnap module) support to the kernel. To use this there are extra steps.. I recommend using Imbushuo's 4.18.6 Kernel for guarenteed boot up, mine is still testing stage (this is my first proper Kernel compile so there may be issues I haven't found any yet it seems to work just fine, but so far it performs the same just with added BT networking.)

Downloads

Here you can find links to the Kernels and Boot files.

#

Kernel Version 4.18.6 and Boot files

This is the original mainline kernel based on 4.18.6  

#

Kernel Version 5.7 and Boot Files

This was compiled using the config from 4.18.6, added Bluetooth Networking support (Kernel Modules) 

Requirements:


⦁ Unlocked Bootloader and Uefi, Bootshim, Developer Menu and BDC Config - It's expected you have already unlocked with WPInternals and used WoA Deployer to get the other requirements.

⦁ A FULL backup of your device - I'm serious when I say backup.. use Win32DiskImager to create a raw backup of your device.. There is always a chance of something going wrong.

⦁ Debian installed - I used Debian Stretch, this in theory can be done with WSL or Virtual Machine but I have not tried those methods, it can also be done with Ubuntu to install an Ubuntu flavour

Step 1 - Prepairing


⦁ We need to install the required tools: 

  sudo apt install qemu-user-static debootstrap binfmt gparted


⦁ Plug in the device in Mass Storage Mode, open Gparted and change to the device (usually /dev/sdb if no other drives are inserted)

⦁ Find the partition Labled Windows (the partition holding Windows 10 ARM) and reformat it to ext4, once it is formatted successfully close gparted.
(Take note of what device the ext4 partition is along with what partition is the EFI for Windows ARM, for me ext4 (is named Windows) = /dev/sdb41 and EFI (is named SYSTEM) = /dev/sdb39)


To mount the new partition we will need folders. Open Terminal and as root and type: 

⦁ mkdir /mnt/root
⦁ mkdir /mnt/boot
⦁ mount /dev/sdb41 /mnt/root
Keep Terminal open.

Step 2 - Debootstrap Debian onto device:


Now we need to install to the mounted partition. As root type:
⦁ qemu-debootstrap --arch=arm64 stretch /mnt/root
This will take a while.. Let it do it's thing, if you encounter an internet issue, delete everything inside /mnt/root and try again.


(I'm using 4.18.6 as the example, if you're using 5.7 then this is the same just change the file names)
Copy the downloaded kernel *.deb files to /mnt/root
For example if they are in your Downloads folder type (as root, %Username% replace with your username) :

⦁ cp /home/%Username%/Downloads/linux-headers-4.18.6-lumia-950xl-uefi-arm64.deb /mnt/root/
⦁ cp /home/%Username%/Downloads/linux-image-4.18.6-lumia-950xl-uefi-arm64.deb /mnt/root/
⦁ cp /home/%Username%/Downloads/linux-libc-dev-4.18.6-lumia-950xl-uefi-arm64.deb /mnt/root/

Copy the msm8994-lumia..dtb to /mnt/root/boot
⦁ cp /home/%Username%/Downloads/msm8994-microsoft-lumia-950xl.dtb /mnt/root/boot

Step 3 - Finishing installation


Now we need to finish up and make it usable, type:

⦁  chroot /mnt/root

⦁ apt update && apt install initramfs-tools sudo nano onboard locales
(Onboard will let you have an onscreen keyboard, and if you modify the settings, will act like a phone keyboard for ease)

Now time to install the Kernel files: 
⦁dpkg -i /*.deb
⦁update-initramfs -c -k 4.18.6-lumia-950xl-uefi


⦁Now this next bit WILL fail several times, not sure why but it does.. takes me between 4 and 6 tries so patience and non't panic , type:

⦁ apt install tasksel && apt update
⦁ tasksel (This will load a menu:)
⦁ Choose a Desktop Environment
⦁Repeat until it finishes with without the error "tasksel: apt-get failed"

( I chose MATE because I'm used to it and it's lightweight , but you can choose any)


Now add a user and add them to Sudoers Group (From here %Username& is the name you want eg. I would replace %Username% with empy as thats the user I created)

⦁  adduser %Username%
 ⦁ usermod -aG sudo %Username%


 This is if you selected MATE(lightdm based) as the Desktop Environment, if you chose a different one google how to enable AutoLogin.. We will enable autologin for lightdm, type:
 
⦁ nano /etc/lightdm/lightdm.conf
⦁ Add this under [Seat:*] 

[Seat:*]
pam-service=lightdm
pam-autologin-service=lightdm-autologin
autologin-user=%Username%
autologin-user-timeout=0
session-wrapper=/etc/X11/Xsession
Greeter-session=lightdm-greeter
(To save press CTRL and X then type Y, then Enter)

(If you are trying my 5.7 Kernel stay in the chroot and continue to next step. )
⦁ Exit chroot by typing Exit and move to Booting Debian

Extra Steps For Kernel 5.7


Now we need to install the things for Bluetooth Networking, still in the chroot type:

⦁ apt install bluetooth bluemon bluez rfkill network-manager-gnome

(Bluez and Network-Manager-Gnome are not really needed I think, but I installed them for tools like hciconfig and hcitool and the Gnome Network Manager)


Now we need to add our user created earlier to the netdev group and Blacklist the Wifi
(See info on why here at the section Linux Notes):
⦁ adduser %Username% netdev
 ⦁ nano /etc/modprobe.d/blacklist.conf
(type)
 blacklist ath10k_pci
 (Save and exit, then exit chroot)


⦁ Copy the downloaded rampatch and tvl file to device, this may be different for some variants of the 950XL (Don't quote me) if you are unsure then: boot the phone into Debian (See Below) and run dmesg, look for where it says it failed to load files. Type as root

 cp /home/%UsernameOnPC%/Downloads/rampatch_00440302.bin /mnt/root/lib/firmware/qca
 cp /home/%UsernameOnPC%/Downloads/nvm_00440302.bin /mnt/root/lib/firmware/qca

Booting Debian


In the files downloaded there will be a GRUB-EFI folder..
⦁ Open the Grub.cfg file in the downloaded GRUB-EFI folder, it will show similar to this:


just make sure mmcblk0p41 matches the end number for the ext4 partition e.g /dev/sdb41 = /dev/mmcblk0p41
(everything should be set up like this, if you are using 5.7 Kernel the grub.cfg will be amended for 5.7 on my github) 


Mount EFI partition and copy the boot files (as root) to the device:

⦁ mount /dev/sda39 /mnt/boot
⦁ cp /home/%UsernameOnPC%/Downloads/GRUB-EFI/EFI/Boot/grub.cfg /mnt/boot/EFI/boot/
⦁ cp /home/%UsernameOnPC%/Downloads/GRUB-EFI/EFI/Boot/bootaa64.efi /mnt/boot/EFI/boot/
⦁ umount /mnt/boot
⦁ umount /mnt/root

DONE! Safely remove and restart Phone, If all gone well it should boot up to the Menu, Camera button on "Windows 10", it will load grub and boot Debian!

Final Thoughts


Things to keep in mind: Wifi will not work yet, I haven't got the knowledge to make it if you are curious go have a look at the notes on the Lumia950XLPkg page, there are also notes on ACPI and other issues present.

I take no credit for all of this work (apart from my 5.7 Kernel work). There's a long list of people who made this possible, I will list who I'm aware worked on it I am sorry if i missed someone!!:
-WoA Project-Heathcliff74 for WPInternals-Imbushuo-gus33000-Android4Lumia-Members from the GNU/Lumia Telegram group-Users from PostmarketOS-
Many More!!


Add Me on these platforms!!!!

I AM NOT AFFILIATED WITH WOA-PROJECT, POSTMARKETOS, MICROSOFT OR ANY RESPECTIVE COMPANIES, PROJECTS OR PEOPLE.
© Copyright 2019 Mobirise for the website builder