Git Product home page Git Product logo

lumia950xlpkg's Introduction

EDK2 UEFI Implementation for Lumia 950 and Lumia 950 XL

For users

You can download the latest UEFI build by clicking the Azure Pipelines icon below. Click Artifacts button in Azure Pipelines, then download UEFI.elf in ELF directory.

Build Status (Visual Studio Team Services)

What's this?

This package demonstrates an AArch64 UEFI implementation for hacked Lumia 950 and Lumia 950 XL. Currently it is able to boot Windows 10 ARM64 as well as various Linux distros. See notes below for more details. Please be aware that MSM8992 devices have limited support.

Hapanero support has been dropped as of 2020/11. Hapanero users are expected to completely understand all hardware, firmware and software implementation details, thus there's no point to keep an untested target floating in this project. For existing Hapanero owners, please build and fix this firmware by yourself (use 950 XL configuration as the blueprint), but no PR regarding Hapanero will be accepted.

Support Status

Applicable to all supported targets unless noted.

  • Low-speed I/O: I2C, SPI, GPIO, SPMI and Pinmux (TLMM).
  • Power Management: PMIC and Resource Power Manager (RPM).
  • High-speed I/O for firmware and HLOS: eMMC (SDR50 in firmware, HS200/HS400 in OS) and microSD (be aware that a few cards are unsupported), PCI Express (Firmware-configured, HLOS Only, x2 Lane)
  • Peripherals: Touchscreen (QUP I2C), side-band buttons (TLMM GPIO and PMIC GPIO) and Lattice UC120 (iCE5LP2K) FPGA configuration
  • Display FrameBuffer depends on stock Qualcomm UEFI for boostrapping, MDP is not fully implemented.

What can you do?

I am too busy to write an average-user tutorial. So, if you are interested in, you are welcome to contribute to an easy instruction for all Lumia 950 (XL) users.

Or you can buy me a coffee: PayPal.

Build

If you are familiar with EDK2, you don't need to use my build script.

  • Checkout a copy of EDK2. We are currently tracking the master branch. At least commit 1b6b4a83e1d85e48837068dfe409f5557b50d71d works without further modification.
  • Checkout this repository under EDK2's worktree.
  • Install ACPI tools from your package manager or ACPICA website.
  • Install uuid-dev and python (or equivalent package on your distribution).
  • Install Linaro AArch64 GCC toolchains, my build script uses gcc-linaro-7.5.0-2019.12. Then untar them. I place everything under /opt directory, so I have directories like /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin. If you placed it somewhere else, modify build scripts. If you are macOS user, bootstrap the toolchain using ct-ng.
  • Run EDK2 BaseTools setup (make -C BaseTools).
  • Copy rundbbuild.sh in Tools directory to your EDK2 worktree root directory.
  • By default only MSM8994 target is built. To build all, set environment variable BUILDALL.
  • Start build: . rundbbuild.sh --950xl --development

WSL Build Notes

If you checked out the EDK2 repository under Windows and build it using WSL, you will have trouble locating BaseTools Python classes due to file case sensitive behavior changes in WSL. Run the following PowerShell script under EDK2 directory prior to build:

Get-ChildItem .\BaseTools\ -Directory -Recurse | Foreach-Object { fsutil.exe file setCaseSensitiveInfo $_.FullName }

You only need to run it once.

Run

Per UEFI specification, ARM32 UEFI cannot boot ARM64 binaries directly. A recent engineering change removed the dependency of Little Kernel. LK can still boot it, but the path is untested.

To run this UEFI build on Lumia 950 XL, the following procedure is required:

  • Check out Boot Shim. This Boot Manager Application implements a simple ELF loader for the kickstarter (LK) with Secure Monitor Call for EL1 transition. You will need branch msm8994-aa64.
  • Place UEFI.elf in the WP EFIESP root directory, copy Boot Shim EFI application to the EFIESP partition, create a new BCD entry for it.
  • Select this boot entry to enter UEFI.

To re-flash UEFI, simply place new UEFI.elf in WP EFIESP root directory.

TZ Implementation Notes

Qualcomm Snapdragon MSM8992/MSM8994 implements a subset of PSCI interface for multi-processor startup. However, required commands like PSCI_SYSTEM_OFF and PSCI_SYSTEM_RESET are not implemented. Hence we use PMIC to shutdown platform (there's a bug in RT that will be fixed) instead of PSCI. Additionally, 8992/8994 uses HVC call for PSCI commands instead of SMC call.

Linux Notes

The ACPI tables are copied from stock Windows Phone FFU, hence these device IDs are likely not be recognized by Linux.

To get started, starts with the device tree of Qualcomm MSM8994 MTP. The repository devicetree-rebasing with DT content from Android Linux Kernel is sufficient for DT development. To boot with device tree, add it in your GRUB configuration:

devicetree /lumia-950-xl.dtb
linux /vmlinuz ..... acpi=no

PSCI partially works in EL1. If you want to use PSCI for multi-processor startup, add the following code to your DT:

psci {
	compatible	= "arm,psci-0.2";
	method		= "hvc";
};

And use psci for core-enable method. If you are using EL2 startup, use spin-table with per_cpu_mailbox_addr + 0x8 as the release address.

For MSM8994, PCI Express Root Port 1 is firmware-initialized. Similarly, MSM8992 have PCI Express Root Port 0 initialized. Hence it is not necessary to supply qcom,pcie in device tree. Instead, supply a firmware-initialized PCI bus device pci-host-ecam-generic. ACPI MCFG table is supplied for your reference.

Note: interrupt is not configured in the example below (therefore ath10k will crash the system if loaded.)

pci@f8800000 {
	compatible = "pci-host-ecam-generic";
	device_type = "pci";
	#address-cells = <0x3>;
	#size-cells = <0x2>;
	bus-range = <0x0 0x1>;
	#interrupt-cells = <0x1>;

	reg = <0xf8800000 0x200000>;
	ranges = <0x02000000 0x0 0xf8a00000 0xf8a00000 0x0 0x600000>;

	status = "okay";
};

Acknowledgements

License

All code except drivers in GPLDriver directory are licensed under BSD 2-Clause. GPL Drivers are licensed under GPLv2 license.

lumia950xlpkg's People

Contributors

adeltax avatar cewbdex avatar googulator avatar gus33000 avatar imbushuo avatar kazker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lumia950xlpkg's Issues

Write-protect critical eMMC regions

Recent Windows arm64 builds brick the device. The symptom is observed on at least Lumia 950, 950XL, NovaGo and Envy x2. While the ongoing investigation continues, it is a good idea to write-protect certain regions on the eMMC.

Protected regions

  • GPT header
  • SBL1 to TZAPPS, as well as PLAT

Trouble building uefi

When I was building uefi from the latest source code, I was troubled. The error message says "/mnt/e/zengxianxi/uefi/lumia/edk2/Lumia950XLPkg/Lumia950XL.dsc(79): error F001: Pcd (gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['AARCH64']". How can I solve it?

Quick Rundown

Apologies if this isn't the right place to enquire.

I'd just like to know how you have managed to run a custom boot-oader on these devices, assuming that Qualcom's boot process is the same as that on their android counterparts.

I've been looking for a way to unlock the bootloader on my Galaxy S5, and have come up short (there is a way to change the CID on the internal storage so that the phone thinks it's a 'developer edition' device, but mine is incompatible.

MSM8996 support?

With gus' Secure Boot unlock flaw making it possible to exploit MSM8996 devices like the HP Elite X3, would it be possible to port this UEFI firmware to MSM8996? Does the MSM8994 used in the 950s share a significant amount of code with the MSM8996?

Boot from SDCard

This AArch64 uefi can't detect external sdcard.However the original arm32 one can.Will it possible to add sd driver and boot from sdcard?

Imbushuo, can you help?

Hello! I know what you can boot windows 10 ARM on old Lumia.
I have a question: can i boot it on my phone(2 core qualcomm armv7, 1 GB RAM). I port on my phone efidroid(edk2 uefi, but with GUI). Can i use it to install windows on sd card and boot?
Please, write answer! Thanks.

Configure UC120 on non-Hapanero devices

The Lumia 950 and XL have a Lattice UC120 chip for USB-C negotiation and USB-PD.
Right now, it appears that this chip loses its configuration at some point during boot (likely when the SoC is switched to 64-bit mode), requiring a reupload of the bitstream.

The bitstream upload protocol for the UC120 uses a modified SPI bus that the MSM SPI controllers don't support, thus requiring GPIO bitbanging. Unfortunately Windows' GPIO stack isn't fast enough to upload the whole 72KB bitstream over bitbanged SPI (~1KHz is the maximum achievable), so this needs to be done in the UEFI instead.

Do we have wifi driver?

In another word, which drivers we don't have yet?
If i want to contribute to this project, what knowledge should I have? thx

Move everything back to master branch

The branch of msm8994 is kept for historical reasons. From the engineering perspective, we might want to move everything back to the master branch.

  • Create master branch
  • Reconfigure CI trigger rules and build validation workflow

Can't boot into Windows (INACCESSIBLE_BOOT_DEVICE)

After deploying the latest version of Windows, it brings up a BSOD that has the error "INACCESSIBLE_BOOT_DEVICE"... any suggestions?
Image

Edit: I just remembered I can use older versions of windows, so I'm trying 1803
Edit 2: 1803 doesn't work either, but I get a different error: SDBUS_INTERNAL_ERROR
Edit 3: After rebooting that error seemed to fix itself. It's now at "Getting Devices Ready". I guess I'll just update it to 1903 when it gets fully set up.
Edit 4 ugh: I keep getting SDBUS_INTERNAL_ERROR
Edit 5: I guess it only wants to start when it wants to. Works now, I guess I just have to restart it about 5 or 6 times if my device decides it has better things to do than, yn, work

HP Elite X3

Would it be very difficult to do this on an HP Elite X3?

Can't bootstrap win10 build 17763 on RM-1116

Win10 Build 17763 cannot bootstrap on my Lumia 950 XL (RM-1116) through your latest UEFI and bootshim, but Build 17134 can. What's the problem with it?
BTW, can WLAN, USB and Camera driver work through your latest UEFI?

Use memory module information from QCOM SRAM area

Since we are targeting multiple devices, it is not feasible to set a fixed 3GB assumption for memory configuration. Apart from fixed subsystem regions, we should retrieve other usable memory regions from the memory module information in SRAM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.