I want to run this on my phone. And I want to port it by myself!
Firstly, follow this useful flowchart before proceeding forward with the porting process.
This flowchart will guide you through and help you decide if you really want to port UEFI or Windows to your device.
Can I port UEFI and Windows to my device?
Can I port UEFI and Windows to my device? Is my processor SoC ARMv8 or higher?
Is my processor SoC ARMv8 or higher? Is my firmware AArch64 (arm64)
Is my firmware AArch64 (arm64) Is the Qualcomm SoC not using Kryo first generation cores (MSM8996)?
Is the... Is the Qualcomm SoC older than SM8350 (888)?
Is the Qualcomm SoC... Yes Yes Yes You can port UEFI to your device but you won't have any drivers currently.
You can port UEFI to your devi... Yes Yes Is your device from Sony, Google, or Samsung (some)?
Is your device from Sony, Google, or... You can port UEFI to your device, boot Windows and it may fully work!
You can port UEFI to your devi... No You can theoretically port UEFI to your device but you will not be able to run official Windows ARM64 builds. Leaked ARM32 builds exist, so does Windows RT. You're on your own and these builds won't be usable.
You can theoretically port UEFI to your... Does the device contain a system call to switch to AArch64 in atleast EL1?
Does the device contain... Yes You can try porting UEFI to your device but your chances are low and nothing will actually work. Don't expect to run Windows on such platform.
You can try porting UEFI to your... Your device will be wiped if you port UEFI and boot Windows on it.
Your device will be wiped if y... No Yes It might be possible to port UEFI to it but it will not be possible to boot Windows on your device.
It might be possible to port U... No No No Is the device a Qualcomm platform?
Is the device a Qualcomm platform? No No No Is the Qualcomm SoC
called SM8250 (865), SM7xxx,
SM6xxx or SDM6xx?
Is the Qualcomm SoC... Yes Text is not SVG - cannot display
Thanks to Gustave Monce (@gus33000) for the original flowchart idea!
Here are some important things you need during porting:
a recent Linux installation, Arch Linux recommended (WSL might work )
Windows 11 installation (optional if you are not going to port Windows )
basic knowledge with Linux, experience on embedded hardware is preferred
a clear mind and the desire to learn (very important)
Make sure you have everything above, then proceed to install some packages (assume you are using Arch Linux):
sudo pacman -Syu
sudo pacman -Sy git base-devel gcc aarch64-linux-gnu-binutils aarch64-linux-gnu-gcc aarch64-linux-gnu-glibc python clang llvm dtc android-tools --needed
¶ Retrieving useful files from Android
Some files found in Android can be useful for porting:
Device tree from Android can be very useful, especially when you don’t have the schematic diagram of your device. It also describes reserved memory regions on your device which can’t be touched by the UEFI.
You can get it from:
/sys/firmware/fdt
on your device. A simple copy will work.
your device’s boot.img
Then decompile it on your computer:
dtc -I dtb -O dts fdt -o output.dts
¶ Android boot image
It has some useful information for generating UEFI image.
You can get it either from:
ROM (boot.img
)
your device (/dev/block/by-name/boot_a
)
Then unpack the image on your computer:
unpack_bootimg --boot_img boot.img --format info
You will see something like:
os version: 9.0.0
os patch level: 2020-09
Simply copy /proc/iomem
to your computer
Clone the repo and build any device to fetch submodules
git clone git@github.com:edk2-porting/edk2-msm.git
cd edk2-msm
./build.sh -d polaris
If everything goes well, you should see something like Build done: /path/to/boot-polaris.img
You should add --skip-rootfs-gen
in subsequent builds. This avoids rebuilding SimpleInit and reduces build time significantly.
Now you can proceed with one of the following:
Windows porting guide TBD