Dual boot Android or Linux?
Dual boot Android or Linux?
I wonder if it's possible to dual boot Android or Linux? I found out that BCDEDIT is no longer locked down in 1903 - though that seems secondary to a primary bootloader that has the Developer menu, etc. I already tried to boot the following using the ARM64 EFI file but it failed:
http://www.rodsbooks.com/refind/
No Android emulators seems to work on WOA through the x86 emulation due to problems accessing graphics acceleration.
How about passing the EFI bootloader to GRUB for Linux or Goldfish kernel for Android?
We might be able to achieve something similar to this:
https://github.com/aarch64-laptops/build
But we don't have any way to boot from USB to start with as there's no GUI for the EFI bootloader.
Currently, I can do everything on Windows except use the HSBC Online banking app - requires Android or IOS.
http://www.rodsbooks.com/refind/
No Android emulators seems to work on WOA through the x86 emulation due to problems accessing graphics acceleration.
How about passing the EFI bootloader to GRUB for Linux or Goldfish kernel for Android?
We might be able to achieve something similar to this:
https://github.com/aarch64-laptops/build
But we don't have any way to boot from USB to start with as there's no GUI for the EFI bootloader.
Currently, I can do everything on Windows except use the HSBC Online banking app - requires Android or IOS.
2 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
I'm interested in dual boot too.
Is there any way to boot an EFI shell?
Just found this: https://www.deskmodder.de/blog/2018/11/ ... -im-video/
Is there any way to boot an EFI shell?
Just found this: https://www.deskmodder.de/blog/2018/11/ ... -im-video/
1 x
Re: Dual boot Android or Linux?
I found a guide on how the EFI bootloader works for the Lumia 950 XL, so I am planning to test EFI GRUB soon - but I think there's few areas I need to brush up on first - because it's quite technical! Will test with the normal 950 as I don't wish to ruin the XL.
https://onedrive.live.com/view.aspx?res ... LV2nY_pncM
https://onedrive.live.com/view.aspx?res ... LV2nY_pncM
2 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
I found out today that non-Windows EFI files cannot be booted from the Windows BCD Boot menu, and that dual booters end up replacing the Windows Boot Manager with the GRUB2 Boot Manager, which I will look into.... However, your idea about booting to the UEFI Shell is good thinking outside the box! I need to check if we can get to Advanced Startup from Windows 10 else we can get to UEFI shell by installing WSL2 - breaks the system! There might also be an official way of booting to the UEFI Shell.
1 x
Re: Dual boot Android or Linux?
I don't see any other choice other than to replace the main .EFI boot manager file with GRUB and then try to add the main .EFI file back as a secondary boot manager after successfully installing a Linux distro:
However, that's providing we can indeed boot to Grub/prompt using the Lumia 950, i.e. it can handle the Grub EFI file I'm about to throw at it now...
Update: I replaced \efi\boot\bootarm.efi with a GRUB EFI file - but it failed to boot.
And I previously tested it on Raspberry Pi to be working, so that method is out of the question.
Update: I read somewhere that bootshim.efi (secondary boot manager when selecting Windows 10 from the primary boot manager menu) is some kind of bootstrapped 64-bit version of UEFI from a 32-bit UEFI that maybe Windows Phone uses (even on the Lumia 950). It seems that bootshim.efi leads to another bootmgfw.efi that we may look to replace with Grub instead.
Update: bootshim.efi leads to Partition41 - another EFI System Partition for Windows 10 specifically - this is looking promising!
https://askubuntu.com/questions/661947/ ... ub-os-listBriefly, edit /etc/grub.d/40_custom and add:
menuentry 'Windows 10' {
search --fs-uuid --no-floppy --set=root CC66-4B02
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
To find the UUID for the --set=root line (CC66-4B02 in the example) you use sudo fdisk -l to identify the EFI partition then sudo blkid /dev/sda1 (or whatever) to find the UUID of the EFI partition. Note it's not the Windows partition but the EFI one you need. Once you've saved the edit, run sudo update-grub to generate the /boot/grub/menu.cfg file and then restart to test.
However, that's providing we can indeed boot to Grub/prompt using the Lumia 950, i.e. it can handle the Grub EFI file I'm about to throw at it now...
Code: Select all
E:\EFIESP\EFI\Microsoft\BOOT>bcdedit /store BCD /enum ALL
Firmware Boot Manager
---------------------
identifier {fwbootmgr}
displayorder {bootmgr}
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=H:
path \efi\boot\bootarm.efi
description Windows Boot Manager
locale en-US
inherit {globalsettings}
booterrorux Simple
default {default}
displayorder {default}
{7619dcca-fafe-11d9-b411-000476eba25f}
{7619dccc-fafe-11d9-b411-000476eba25f}
bootsequence {01de5a27-8705-40db-bad6-96fa5187d4a6}
timeout 30
displaybootmenu Yes
persistbootsequence Yes
custom:54000001 {0ff5f24a-3785-4aeb-b8fe-4226215b88c4}
custom:54000002 {bd8951c4-eabd-4c6f-aafb-4ddb4eb0469b}
Windows Boot Loader
-------------------
identifier {311b88b5-9b30-491d-bad9-167ca3e2d417}
device ramdisk=[E:]\PROGRAMS\UpdateOS\UpdateOS.wim,{ramdiskoptions}
path \windows\system32\boot\winload.efi
description Windows Update OS (Boot from WIM)
inherit {bootloadersettings}
osdevice ramdisk=[E:]\PROGRAMS\UpdateOS\UpdateOS.wim,{ramdiskoptions}
systemroot \windows
nx AlwaysOn
bootmenupolicy Standard
winpe Yes
Windows Boot Loader
-------------------
identifier {default}
device partition=E:
path \windows\system32\boot\winload.efi
description Windows 10 Phone
locale en-US
inherit {bootloadersettings}
nointegritychecks Yes
osdevice partition=E:
systemroot \windows
nx AlwaysOn
bootmenupolicy Standard
bootstatuspolicy IgnoreAllFailures
ems No
Windows Boot Application (1020000a)
-----------------------------------
identifier {01de5a27-8705-40db-bad6-96fa5187d4a6}
device partition=H:
path \windows\system32\boot\mobilestartup.efi
description Mobile Startup App
inherit {bootloadersettings}
recoverysequence {311b88b5-9b30-491d-bad9-167ca3e2d417}
recoveryenabled Yes
nointegritychecks Yes
Windows Boot Application (1020000a)
-----------------------------------
identifier {0ff5f24a-3785-4aeb-b8fe-4226215b88c4}
device partition=H:
path \windows\system32\boot\ffuloader.efi
description FFU Loader (User Invoked)
inherit {bootloadersettings}
custom:26000201 Yes
Windows Boot Application (1020000a)
-----------------------------------
identifier {7619dcca-fafe-11d9-b411-000476eba25f}
device partition=H:
path \EFI\boot\BootShim.efi
description Windows 10
nointegritychecks Yes
Windows Boot Application (1020000a)
-----------------------------------
identifier {7619dccc-fafe-11d9-b411-000476eba25f}
device partition=H:
path \Windows\System32\BOOT\developermenu.efi
description Developer Menu
nointegritychecks Yes
Windows Boot Application (1020000a)
-----------------------------------
identifier {bd8951c4-eabd-4c6f-aafb-4ddb4eb0469b}
device partition=H:
path \windows\system32\boot\resetphone.efi
description Reset My Phone Application
inherit {bootloadersettings}
custom:26000206 Yes
EMS Settings
------------
identifier {emssettings}
bootems No
Debugger Settings
-----------------
identifier {dbgsettings}
description Windows Debugger Settings
Global Settings
---------------
identifier {globalsettings}
inherit {dbgsettings}
{emssettings}
bootuxtransitiontime 5000
booterrorux Simple
extendedinput Yes
nobootuxtext Yes
nobootuxprogress Yes
nobootuxfade No
nokeyboard Yes
mobilegraphics Yes
custom:250000e0 1
chargethreshold 255
custom:25000511 90
bootflow 0x0
offmodecharging No
Boot Loader Settings
--------------------
identifier {bootloadersettings}
inherit {globalsettings}
advancedoptions No
optionsedit No
Setup Ramdisk Options
---------------------
identifier {ramdiskoptions}
description Ramdisk Options
ramdisksdidevice partition=H:
ramdisksdipath \boot\boot.sdi

Update: I read somewhere that bootshim.efi (secondary boot manager when selecting Windows 10 from the primary boot manager menu) is some kind of bootstrapped 64-bit version of UEFI from a 32-bit UEFI that maybe Windows Phone uses (even on the Lumia 950). It seems that bootshim.efi leads to another bootmgfw.efi that we may look to replace with Grub instead.
Update: bootshim.efi leads to Partition41 - another EFI System Partition for Windows 10 specifically - this is looking promising!
2 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Great job! Well, if you're going to replace the bootmgr or main EFI file with a UEFI-Shell(try 64 and 32bit) ... do you think this will work?
1 x
Re: Dual boot Android or Linux?
SUCCESS - I got it to boot the GRand Unified Bootloader!!! That means we can do anything now... (except type
)



2 x
Re: Dual boot Android or Linux?
Good job, gilius! I was wondering too if another ARM64 OS could be booted out of the box on Lumia smartphones. Inside the article, the tweet did imply that touch worked. Wondering if that is really is the case or if we could get in touch with the guy that did it?
0 x
Me on OSDN.net: https://osdn.net/users/quiret/
Re: Dual boot Android or Linux?
Thanks! Yeah, it's obvious now that Ben @ Imbushuo had done all the hard work in chainloading from the Lumia's native UEFI system to a proper one (EFI System Partition 41) where we can run anything we like! And I did drop Ben a line today incidentally, so if he's not too busy he might get back with some additional pointers.
Touch will work for sure inside a main Linux distro - possibly even inside an installer too - but since the disk is GPT we cannot run the Ubuntu installer from the HD; instead, I will look at writing a preinstalled version and trying to get GRUB to point to the rootfs partition, etc.
As long as we only work with Partitions 41 and 42 - and don't delete the Data partition (or anything before it) - I think we should be safe. Just now I deleted them both then extended the Data partition to use the remaining disk space before using WOA Deployer to redeploy WOA and put everything back to how it was prior to messing around with GRUB.
Touch will work for sure inside a main Linux distro - possibly even inside an installer too - but since the disk is GPT we cannot run the Ubuntu installer from the HD; instead, I will look at writing a preinstalled version and trying to get GRUB to point to the rootfs partition, etc.
As long as we only work with Partitions 41 and 42 - and don't delete the Data partition (or anything before it) - I think we should be safe. Just now I deleted them both then extended the Data partition to use the remaining disk space before using WOA Deployer to redeploy WOA and put everything back to how it was prior to messing around with GRUB.
2 x
Re: Dual boot Android or Linux?
Unfortunately, this is not looking as promising as I thought...
I got Ubuntu Server 19.04 to boot up and can navigate the menus, but it crashes shortly after I choose Ubuntu (or Recovery mode); probably related to these ARM64 bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1323239
Edit: GRUB probably needs a new UUID or some workaround:
https://askubuntu.com/questions/171446/ ... er-machine
grub.cfg looks like this:
But the UUID is from a different HD I backed up from.
Edit: I'm not convinced it is a UUID problem. Maybe a bug on the Lumia system or something to do with Microsoft blocking it from booting.
I got Ubuntu Server 19.04 to boot up and can navigate the menus, but it crashes shortly after I choose Ubuntu (or Recovery mode); probably related to these ARM64 bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1323239
Edit: GRUB probably needs a new UUID or some workaround:
https://askubuntu.com/questions/171446/ ... er-machine
grub.cfg looks like this:
Code: Select all
search.fs_uuid a738cc26-615b-4201-9e5c-f90dc5ba8f9a root hd0,gpt42
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Edit: I'm not convinced it is a UUID problem. Maybe a bug on the Lumia system or something to do with Microsoft blocking it from booting.
0 x
Re: Dual boot Android or Linux?
Do you have anything prepared that we can try ourselves to get up-to-speed with how far you have come? Maybe somebody else could quickstart and find workarounds if you posted this "preinstalled version". Other than that, great job for getting this far nonetheless
But you gotta admit that Linux is possible because the tweet does show a GUI environment.

0 x
Me on OSDN.net: https://osdn.net/users/quiret/
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Again great job @gilius!
Is it save to replace the efi files and going back without any chance of bricking the device?
If so then I would try myself to boot debian
Is it save to replace the efi files and going back without any chance of bricking the device?
If so then I would try myself to boot debian

0 x
Re: Dual boot Android or Linux?
OK, I'll write a guide tonight - but I can't promise my methods are the most efficient - and it's harder to setup an ARM version of a distro compared to X64/X86, etc. You guys have access to a Raspberry Pi?
1 x
Re: Dual boot Android or Linux?
I have a Pi 3, a Pi 4 (4Gb), a Pi Zero, a Rock64 (4Gb), and a Banana Pi M3. You write it, I'll try it.
0 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Last I knew WoA wasn't available for the Raspberry Pi 4. It's made for the 3, but not the 4.
0 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Shouldn't make any difference since the SoC is similar 
Maybe the USB3 chip could be a problem, but I don't think so ^^

Maybe the USB3 chip could be a problem, but I don't think so ^^
0 x
Re: Dual boot Android or Linux?
UEFI support for WOA on the RPi4 it not ready yet:
https://github.com/andreiw/RaspberryPiPkg/issues/130
https://github.com/andreiw/RaspberryPiP ... -527246285
But see my guide for using KVM on Raspberry Pi 4:
https://www.raspberrypi.org/forums/view ... p?t=248345
Will help when I finish optimizing Windows 10 Lite for ARM, as it's much quicker to run on lesser devices:
https://discourse.pi64.win/t/windows-10 ... xl-wip/418
For this Linux/Lumia guide you are going to ideally need the Raspberry Pi 3 UEFI - or you could use a VM in software simulation mode on a normal PC running Windows/Linux - but it's very tough to run an ARM64 VM (see above KVM guide as it also applies to ARM64 VMs in general as well as https://www.raspberrypi.org/forums/view ... p?t=224057)
First thing to do then is prepare a memory card with UEFI drivers for the Raspberry Pi so you can boot some Linux installers in UEFI mode:
Micro SD card inside USB adapter (MBR with 64-bit Tiano Core UEFI for the Raspberry Pi 3 & empty partition for Windows paging file if ever you install WOA)
diskpart
list disk
select disk X (micro sd)
clean
convert mbr
create partition primary size=124
format fs=fat32
active
assign letter q
create partition primary
format fs=ntfs quick
assign letter r
exit
copy the EFI files to q:\ from https://github.com/andreiw/RaspberryPiP ... C5/RELEASE
bootcode.bin
fixup.dat
RPI_EFI
start.elf
config.txt
“arm_control=0x200
enable_uart=1
armstub=RPI_EFI.fd
disable_commandline_tags=1
disable_splash=1
disable_overscan=1
max_usb_current=1”
When you boot the micro SD card inside the Pi, always begin by pressing Esc to get to the UEFI menu. Here, you can change to max CPU Clock override (device manager > Raspberry Pi Configuration > Chipset Configuration) and also reduce the resolution (Display settings under the same menu) if you like. When you are ready to boot either a live CD or written OS disk from USB then you can select the device from Boot Manager - but note that hub-powered SSDs can take a while before they show up - so you need to keep exiting and entering the Boot Manager menu till you see the SSD.
This initial Linux experiment is going to require 1 x USB for installing a Linux ISO live CD as well as 1 x SSD (hub-powered) to write the Linux distro.
https://github.com/andreiw/RaspberryPiPkg/issues/130
https://github.com/andreiw/RaspberryPiP ... -527246285
But see my guide for using KVM on Raspberry Pi 4:
https://www.raspberrypi.org/forums/view ... p?t=248345
Will help when I finish optimizing Windows 10 Lite for ARM, as it's much quicker to run on lesser devices:
https://discourse.pi64.win/t/windows-10 ... xl-wip/418
For this Linux/Lumia guide you are going to ideally need the Raspberry Pi 3 UEFI - or you could use a VM in software simulation mode on a normal PC running Windows/Linux - but it's very tough to run an ARM64 VM (see above KVM guide as it also applies to ARM64 VMs in general as well as https://www.raspberrypi.org/forums/view ... p?t=224057)
First thing to do then is prepare a memory card with UEFI drivers for the Raspberry Pi so you can boot some Linux installers in UEFI mode:
Micro SD card inside USB adapter (MBR with 64-bit Tiano Core UEFI for the Raspberry Pi 3 & empty partition for Windows paging file if ever you install WOA)
diskpart
list disk
select disk X (micro sd)
clean
convert mbr
create partition primary size=124
format fs=fat32
active
assign letter q
create partition primary
format fs=ntfs quick
assign letter r
exit
copy the EFI files to q:\ from https://github.com/andreiw/RaspberryPiP ... C5/RELEASE
bootcode.bin
fixup.dat
RPI_EFI
start.elf
config.txt
“arm_control=0x200
enable_uart=1
armstub=RPI_EFI.fd
disable_commandline_tags=1
disable_splash=1
disable_overscan=1
max_usb_current=1”
When you boot the micro SD card inside the Pi, always begin by pressing Esc to get to the UEFI menu. Here, you can change to max CPU Clock override (device manager > Raspberry Pi Configuration > Chipset Configuration) and also reduce the resolution (Display settings under the same menu) if you like. When you are ready to boot either a live CD or written OS disk from USB then you can select the device from Boot Manager - but note that hub-powered SSDs can take a while before they show up - so you need to keep exiting and entering the Boot Manager menu till you see the SSD.
This initial Linux experiment is going to require 1 x USB for installing a Linux ISO live CD as well as 1 x SSD (hub-powered) to write the Linux distro.
2 x
Re: Dual boot Android or Linux?
1) Download the Debian mini.iso and write it to the USB using Rufus on your main Windows PC:
https://d-i.debian.org/daily-images/arm ... y/netboot/

2) Clean your SSD and convert to GPT:

3) Boot up the Debian installer in the Rpi3 and write it to the SSD via Andreiw's UEFI Bios installed to Micro SD - remember to hit ESC and go to Boot Manager to boot USB Device. Near the end of the process you will need to choose a desktop environment - but sadly I missed this part in my attempt so I will not have touch if we ever this thing to properly boot up on the Lumia. Note: most older distros require a USB Ethernet adapter - but not Debian nor Ubuntu 19.10:
4) Once the install completes then take out the SSD from the Pi and connect it to your main Windows PC:
5) You can now boot the thing up in your Pi if you like via Andreiw's UEFI - or just proceed to the next stage.
6) You need to shrink that partition 2 down using either GPARTED on a linux system or Mini Tool Partition wizard on a Windows system:
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 512 MB 1024 KB
Partition 2 Unknown 117 GB 513 MB
Partition 3 Unknown 881 MB 118 GB
Sometimes it might fail first time to shrink and you might need a few GB extra - probably because it discovers a GPT partition table near the end, which I also heard exists and needs to be included in any backup. Also move the swap file to the left - or possibly even delete it:


7) Back on the Windows PC with the shrunken SSD plugged in and your Lumia 950/XL at the mass storage screen via developer menu - having previously deployed WOA - you want to clone the 3 partitions from the SSD to the end of your phone after deleting the last 2 partitions. This is all achieved using Macrium Reflect Free Edition:

Delete the last 2 partitions one at a time - but don't touch data or any partitions before 41

Drag over the 3 partitions to the end of the phone disk and then write the changes:

Unfortunately, that debian clone has the same problem as the ubuntu clone - both boot to the main menus but crash at the "EFI stub" part - so require tinkering in terms of GRUB whilst booted on the Pi - probably something simple to do with UUIDs or creating a different kind of GRUB menuentry.
8) To restore the phone go back to Mass Storage Mode. In Disk Management delete the last 2 partitions, but then the EFI one (Partition 41) will need to be deleted in Diskpart:

9) Extend the Data partition - you can then reinstall Windows 10 on ARM using WOA Deployer:


Let me know if you guys manage to find the EFI/Grub fix causing the kernel panic on both Debian and Ubuntu (haven't tried any others so far)!
EDIT: I'm starting to think it's not a GRUB problem at all - but a limitation to do with the EFI Firmware - only Ben can confirm for sure.
https://d-i.debian.org/daily-images/arm ... y/netboot/

2) Clean your SSD and convert to GPT:

3) Boot up the Debian installer in the Rpi3 and write it to the SSD via Andreiw's UEFI Bios installed to Micro SD - remember to hit ESC and go to Boot Manager to boot USB Device. Near the end of the process you will need to choose a desktop environment - but sadly I missed this part in my attempt so I will not have touch if we ever this thing to properly boot up on the Lumia. Note: most older distros require a USB Ethernet adapter - but not Debian nor Ubuntu 19.10:
4) Once the install completes then take out the SSD from the Pi and connect it to your main Windows PC:
Code: Select all
C:\Windows\System32>diskpart
Microsoft DiskPart version 10.0.18362.1
Copyright (C) Microsoft Corporation.
On computer: GILIUS-W10
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 1907 GB 1024 KB *
Disk 1 Online 5589 GB 1024 KB *
Disk 2 Online 5589 GB 0 B *
Disk 3 Online 119 GB 0 B *
DISKPART> select disk 3
Disk 3 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 512 MB 1024 KB
Partition 2 Unknown 117 GB 513 MB
Partition 3 Unknown 881 MB 118 GB
DISKPART> select partition 1
Partition 1 is now the selected partition.
DISKPART> assign letter p
DiskPart successfully assigned the drive letter or mount point.
DISKPART> exit
Leaving DiskPart...
C:\Windows\System32>p:
P:\>cd efi
P:\EFI>dir
Volume in drive P has no label.
Volume Serial Number is A9CC-56BF
Directory of P:\EFI
25/11/2019 19:47 <DIR> .
25/11/2019 19:47 <DIR> ..
25/11/2019 19:47 <DIR> debian
0 File(s) 0 bytes
3 Dir(s) 532,193,280 bytes free
P:\EFI>mkdir boot
P:\EFI>copy debian\*.* boot\
debian\shimaa64.efi
debian\grubaa64.efi
debian\mmaa64.efi
debian\fbaa64.efi
debian\BOOTAA64.CSV
debian\grub.cfg
6 file(s) copied.
P:\EFI>cd boot
P:\EFI\boot>dir
Volume in drive P has no label.
Volume Serial Number is A9CC-56BF
Directory of P:\EFI\boot
25/11/2019 20:17 <DIR> .
25/11/2019 20:17 <DIR> ..
25/11/2019 19:47 918,872 shimaa64.efi
25/11/2019 19:47 1,693,040 grubaa64.efi
25/11/2019 19:47 884,952 mmaa64.efi
25/11/2019 19:47 819,152 fbaa64.efi
25/11/2019 19:47 110 BOOTAA64.CSV
25/11/2019 19:47 126 grub.cfg
6 File(s) 4,316,252 bytes
2 Dir(s) 527,835,136 bytes free
P:\EFI\boot>rename grubaa64.efi bootaa64.efi
6) You need to shrink that partition 2 down using either GPARTED on a linux system or Mini Tool Partition wizard on a Windows system:
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 512 MB 1024 KB
Partition 2 Unknown 117 GB 513 MB
Partition 3 Unknown 881 MB 118 GB
Sometimes it might fail first time to shrink and you might need a few GB extra - probably because it discovers a GPT partition table near the end, which I also heard exists and needs to be included in any backup. Also move the swap file to the left - or possibly even delete it:


7) Back on the Windows PC with the shrunken SSD plugged in and your Lumia 950/XL at the mass storage screen via developer menu - having previously deployed WOA - you want to clone the 3 partitions from the SSD to the end of your phone after deleting the last 2 partitions. This is all achieved using Macrium Reflect Free Edition:

Delete the last 2 partitions one at a time - but don't touch data or any partitions before 41

Drag over the 3 partitions to the end of the phone disk and then write the changes:

Unfortunately, that debian clone has the same problem as the ubuntu clone - both boot to the main menus but crash at the "EFI stub" part - so require tinkering in terms of GRUB whilst booted on the Pi - probably something simple to do with UUIDs or creating a different kind of GRUB menuentry.
8) To restore the phone go back to Mass Storage Mode. In Disk Management delete the last 2 partitions, but then the EFI one (Partition 41) will need to be deleted in Diskpart:


Code: Select all
C:\Windows\System32>diskpart
Microsoft DiskPart version 10.0.18362.1
Copyright (C) Microsoft Corporation.
On computer: GILIUS-W10
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 1907 GB 1024 KB *
Disk 1 Online 5589 GB 1024 KB *
Disk 2 Online 5589 GB 0 B *
Disk 3 Online 119 GB 112 GB *
Disk 4 Online 29 GB 17 GB *
DISKPART> select disk 4
Disk 4 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Unknown 512 B 32 KB
Partition 2 Primary 8 MB 2048 KB
Partition 3 Unknown 1536 KB 10 MB
Partition 4 Unknown 1536 KB 12 MB
Partition 5 Unknown 1536 KB 14 MB
Partition 6 Unknown 16 KB 16 MB
Partition 7 Unknown 1024 KB 18 MB
Partition 8 Unknown 128 KB 20 MB
Partition 9 Unknown 256 KB 22 MB
Partition 10 Unknown 256 KB 24 MB
Partition 11 Unknown 16 KB 26 MB
Partition 12 Unknown 16 MB 28 MB
Partition 13 Unknown 16 KB 44 MB
Partition 14 Unknown 256 KB 46 MB
Partition 15 Unknown 256 KB 46 MB
Partition 16 Unknown 256 KB 48 MB
Partition 17 Unknown 16 KB 50 MB
Partition 18 Unknown 1024 KB 52 MB
Partition 19 Unknown 512 KB 54 MB
Partition 20 Unknown 48 KB 56 MB
Partition 21 Unknown 2048 KB 58 MB
Partition 22 Unknown 500 KB 60 MB
Partition 23 Unknown 1024 KB 62 MB
Partition 24 Unknown 500 KB 64 MB
Partition 25 Unknown 512 KB 66 MB
Partition 26 Unknown 16 MB 68 MB
Partition 27 Unknown 1024 KB 84 MB
Partition 28 Unknown 512 KB 86 MB
Partition 29 Unknown 48 KB 88 MB
Partition 30 Unknown 2048 KB 90 MB
Partition 31 Unknown 500 KB 92 MB
Partition 32 Unknown 1024 KB 94 MB
Partition 33 Unknown 500 KB 96 MB
Partition 34 Unknown 512 KB 98 MB
Partition 35 Unknown 16 MB 100 MB
Partition 36 Unknown 8 MB 116 MB
Partition 37 Primary 32 MB 124 MB
Partition 38 Primary 6144 KB 156 MB
Partition 39 Primary 2933 MB 168 MB
Partition 40 Primary 8 GB 3104 MB
Partition 41 System 512 MB 11 GB
DISKPART> select partition 41
Partition 41 is now the selected partition.
DISKPART> delete partition override
DiskPart successfully deleted the selected partition.


Let me know if you guys manage to find the EFI/Grub fix causing the kernel panic on both Debian and Ubuntu (haven't tried any others so far)!
EDIT: I'm starting to think it's not a GRUB problem at all - but a limitation to do with the EFI Firmware - only Ben can confirm for sure.
1 x
Re: Dual boot Android or Linux?
Explosive news: rEFInd boot manager actually works on partition 41 and apparently has touch support! About to test Ubuntu from there... 
Update: same type of crash happens - even when booting Ubuntu using Refind boot manager.

Update: same type of crash happens - even when booting Ubuntu using Refind boot manager.

0 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Nice!!!! I'll take a look as soon as I can! Thank you for this great guide gilius!!!
1 x
Re: Dual boot Android or Linux?
NP - it's always a good IT exercise to learn more about the Lumias, bootloaders and different approaches to handling partitions - even though Linux isn't properly bootable yet. For example, I'm now more confident to try a manual install of WOA next.
BTW, Ben (Bingxing Wang) got back to me this morning:
BTW, Ben (Bingxing Wang) got back to me this morning:
Anyone know how to compile those?For booting Linux, you have two options:
- Use Little Kernel (LK) similar to some Android phones: retrieve the required BootShim from https://dev.azure.com/imbushuo-personal ... t/BootShim and https://dev.azure.com/imbushuo-personal ... ootShimPkg. (BootShim chainloads BootShimPkg, then chainloads LK)
Also for booting Linux on 950XL on the 64bit UEFI, you need to disable acpi "acpi=off". Then you need to load a proper device tree.
- If you are using Lumia 930, consider https://github.com/rickliu2000/Lumia930Pkg. You might want to contact the author for further details.
1 x
- blackdiamont
- Posts: 12
- Joined: Wed Nov 20, 2019 10:15 am
- Location: localhost
- x 15
- x 3
- Contact:
Re: Dual boot Android or Linux?
Compiling a kernel isn't a big deal but crosscompiling is a bit .... ugh ...
I never compiled android, because it looks to freaking time consuming and weird =D

I never compiled android, because it looks to freaking time consuming and weird =D
Looks interestingIf you are using Lumia 930, consider https://github.com/rickliu2000/Lumia930Pkg. You might want to contact the author for further details.

0 x
Re: Dual boot Android or Linux?
BootShim:
BootShimPkg:
My head hurts...
Compiling those things is the least I will do for you guys.
Both are compiled for 32bit ARM. Are these all that you need? And what about this LittleKernel? Can you do that yourself?

Both are compiled for 32bit ARM. Are these all that you need? And what about this LittleKernel? Can you do that yourself?
- Attachments
-
- BootShimPkg.zip
- (22.04 KiB) Downloaded 641 times
2 x
Me on OSDN.net: https://osdn.net/users/quiret/
Re: Dual boot Android or Linux?
Good stuff, GTA! That's the hardest part out of the way, as I haven't compiled a program in 20 years except for Linux makefiles! I wouldn't even know what compiler to use for Ben's handywork or how to setup the right environment, etc.
I found this info about LittleKernel - perhaps BootShim is a port of that:
https://forum.xda-developers.com/window ... l-t3782093
So that just leaves "acpi=off" (anything for that in the source code?) and "loading a proper device tree"? Could Ben be referring to a DTB file made especially for the Lumia 950 XL that must be present somewhere...? How about those ELF files - could they be DTBs?
I found this info about LittleKernel - perhaps BootShim is a port of that:
https://forum.xda-developers.com/window ... l-t3782093
So that just leaves "acpi=off" (anything for that in the source code?) and "loading a proper device tree"? Could Ben be referring to a DTB file made especially for the Lumia 950 XL that must be present somewhere...? How about those ELF files - could they be DTBs?
2 x
Re: Dual boot Android or Linux?
I feel like an ancient shaman cooking up some ridiculous EFI things.
Turns out I managed to create EFI binaries with less dependencies on Linux stuff (at least some Ubuntu nerd wrote it down this way). So I recompiled BootShimPkg with arm-none-eabi-gcc and for the heck of it compiled LK aswell.
Hoping that you get some interesting stuff done with these
Since those are both 32bit this acpi=off stuff does not matter for us, right? Unless you want to do all this procedure for ARM64 aswell...
Turns out I managed to create EFI binaries with less dependencies on Linux stuff (at least some Ubuntu nerd wrote it down this way). So I recompiled BootShimPkg with arm-none-eabi-gcc and for the heck of it compiled LK aswell.
Hoping that you get some interesting stuff done with these

Since those are both 32bit this acpi=off stuff does not matter for us, right? Unless you want to do all this procedure for ARM64 aswell...
2 x
Me on OSDN.net: https://osdn.net/users/quiret/
Re: Dual boot Android or Linux?
Much appreciated for all your efforts so far on this; cheers to GTA in the name of progress, for this thread is certainly edging in the right direction!
I'm still confused as to which components in the Lumia 950 XL - coupled with additional ones by the WOA Deployer project (Ben's EFI dependencies being at the core of that) - are ARM32 vs. ARM64? Presumably since we are primarily running Windows 10 on ARM via BootShim chainloaded to the secondary Windows Boot Manager @ Partition 41 then that (BootShim) would be compiled in ARM64? And maybe Windows Phone and the Developer menu are ARM32 via the primary Windows Boot Manager? So if you compiled them in ARM32 - and definitely not x86, right(?) - then we might be able to run a 32-bit ARMv7 Linux distro - equivalent to Windows RT or Windows S? Purely speculation of course.* The WOA team @ Microsoft tried to encourage developers to use Visual Studio and to simply switch the architecture to ARM64 when compiling:
*Or it might be that everything about these packages are ARM32, but they happen to be capable of running ARM64 operating systems?
I'll try to deep dive the Lumia components to see if we can deduce more on the bigger picture of how everything fits together in this tremendous gift that is the Lumia 950 XL!
I'm still confused as to which components in the Lumia 950 XL - coupled with additional ones by the WOA Deployer project (Ben's EFI dependencies being at the core of that) - are ARM32 vs. ARM64? Presumably since we are primarily running Windows 10 on ARM via BootShim chainloaded to the secondary Windows Boot Manager @ Partition 41 then that (BootShim) would be compiled in ARM64? And maybe Windows Phone and the Developer menu are ARM32 via the primary Windows Boot Manager? So if you compiled them in ARM32 - and definitely not x86, right(?) - then we might be able to run a 32-bit ARMv7 Linux distro - equivalent to Windows RT or Windows S? Purely speculation of course.* The WOA team @ Microsoft tried to encourage developers to use Visual Studio and to simply switch the architecture to ARM64 when compiling:
*Or it might be that everything about these packages are ARM32, but they happen to be capable of running ARM64 operating systems?
I'll try to deep dive the Lumia components to see if we can deduce more on the bigger picture of how everything fits together in this tremendous gift that is the Lumia 950 XL!
0 x
Re: Dual boot Android or Linux?
Good idea. Not sure about the Lumia 950 boot architecture. My assumption was that WoA did boot from a 32bit UEFI but because it was kernel-mode code it could just switch into 64bit mode. But I am in no shape or form experienced in ARM32/ARM64 assembly. On a related side-node, imbushuo's BootShim project did come with only a ARM 32bit compilation mode, so I assume that ARM 32bit is the way it was meant to be compiled.
Just hit me up if you need the ARM64 versions. Will see what I can do.
EDIT: to answer the question about loading a "device tree" I found this interesting guide on Github. While it is not complete anymore (imbushuo has long since removed files that were linked in the guide) it does claim to have complete steps for Linux booting. Maybe we can build on these steps to even allow Ubuntu?
Just hit me up if you need the ARM64 versions. Will see what I can do.
EDIT: to answer the question about loading a "device tree" I found this interesting guide on Github. While it is not complete anymore (imbushuo has long since removed files that were linked in the guide) it does claim to have complete steps for Linux booting. Maybe we can build on these steps to even allow Ubuntu?
Last edited by The_GTA on Thu Nov 28, 2019 4:46 pm, edited 1 time in total.
1 x
Me on OSDN.net: https://osdn.net/users/quiret/
Re: Dual boot Android or Linux?
OK cool - will hopefully be in a position this weekend to have a tinker and see where it leads - thanks for everything!
0 x