Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.
C
The SoC, device and UEFI repositories are their own: hakios-sc7280-common, hakios-redwood, hakios-uefi
shimokue81c2049a3cb
diff --git a/.gitignore b/.gitignoreindex de348c3..b51646e 100644--- a/.gitignore+++ b/.gitignore@@ -21,7 +21,6 @@!/THIRD_PARTY_LICENSES.md!/devices/!/socs/-!/uefi/!/drivers/!/docs/!/xl@@ -108,3 +107,11 @@ __pycache__//devices/*/uefi/files/Binaries/*/*!/devices/*/uefi/files/Binaries/*/README.md/devices/*/prebuilt/SILICIUM_UEFI.fd++# The SoC, device and UEFI repositories that tools/hakios-device.py sync clones into place (devices/manifest.conf) are their own:+/socs/*+!/socs/README.md+/devices/*+!/devices/manifest.conf+!/devices/README.md+!/devices/qemu/diff --git a/devices/README.md b/devices/README.mdnew file mode 100644index 0000000..8093917--- /dev/null+++ b/devices/README.md@@ -0,0 +1,5 @@+# Device repositories++`devices/manifest.conf` names every device; `tools/hakios-device.py sync` clones each into `devices/<name>/`. `devices/qemu/` is+kept here: QEMU's machine, with none of a phone's drivers, the device every checkout of the common repository can build and run.+A device of your own: `tools/hakios-device.py new` ([Port a device](../docs/porting/index.md)).diff --git a/devices/manifest.conf b/devices/manifest.confindex b0d6887..5134d3d 100644--- a/devices/manifest.conf+++ b/devices/manifest.conf@@ -9,13 +9,16 @@# is the guide. A device of yours: open a pull request that adds its block here, with its repository and revision.soc sc7280- path socs/sc7280+ repository https://github.com/shimoku74/hakios-sc7280-common.git+ revision 977fc7181fc1eb984c4ebd4bb64c65a4d65f549adevice redwood- path devices/redwood+ repository https://github.com/shimoku74/hakios-redwood.git+ revision f0050c4fd1e0d23b09bb02a9f34d96f26a08ceaddevice qemupath devices/qemuuefi hakios-uefi- path uefi+ repository https://github.com/shimoku74/hakios-uefi.git+ revision ffafb6df955b297d2a1fdd2b9339457618a416d7diff --git a/devices/redwood/README.md b/devices/redwood/README.mddeleted file mode 100644index 410ef66..0000000--- a/devices/redwood/README.md+++ /dev/null@@ -1,80 +0,0 @@-# Device: POCO X5 Pro 5G (redwood)--Everything in HakiOS that belongs to one phone is here. The kernel, loader and user space above-know nothing about the phone: addresses, interrupts, power rails and firmware come from its device-tree and its Android. A port to another Qualcomm phone is another directory like this one.--| What | Where |-|---|---|-| SoC | Qualcomm Snapdragon 778G (SM7325, "yupik" in the device tree) |-| UEFI for the phone | `uefi/`: a port of Mu-Silicium (a patch and files; `apply.sh` clones and applies, `export.sh` saves) |-| Prebuilt UEFI images | `prebuilt/`: `SILICIUM_UEFI.fd`, `BootShim.bin`, the device tree `device-tree.dtb` (the phone's Android kernel's), `ramdisk`, `mkbootimg.py` |-| The phone's firmware | **not in the repository**: `pull-firmware.sh` pulls it off your phone over `adb` into `fw-*/` at the top |-| Tools | `tools/modem_firmware.py` (the modem image by the device tree), `tools/cellular_probe.py` (the modem's nodes in the device tree) |--What the kernel does for this phone in particular is the drivers `drivers/*/hakios.*`-(display, Goodix touch, UFS, Adreno 642L, WCN6750 Wi-Fi, the audio DSP, the modem, the Awinic-haptics, the cameras); the head of each file says where its numbers come from. That is the map of-what to rewrite for another phone.--## Firmware--```sh-devices/redwood/pull-firmware.sh # the phone in Android, on adb-```--Pulls the GPU (`fw-gpu/`), Wi-Fi (`fw-wifi/`), the audio DSP (`fw-audio/`, battery and charging-come through it), the vibration motor (`fw-haptic/`), the modem (`fw-modem/`, with `image/` for its-TFTP) and the cameras (`fw-camera/`). All of it is the vendor's and stays out of git.--## Running--From the top of the repository, see the main README: `./xl enter`, `./xl ramdisk`, `./xl run`,-or everything in one command: `tools/modem-cycle.sh "ARGS" SECS`, or `make phone`.--## Porting to another Qualcomm phone: the SoC addresses--The kernel's modem and IPA drivers carry this phone's register and memory addresses as defaults and-take any that differ from boot-args `soc_*` (`hakios.mpss.c`, `soc_override()`, and `hakios.ipa.c`).-To bring up another phone, pull its own device tree and turn it into those arguments:--```sh-devices/<name>/pull-soc.sh # adb pull /sys/firmware/fdt, then tools/soc-args.py -> devices/<name>/soc.args-```--`tools/soc-args.py DEVICE-TREE.dtb` reads the `qcom,ipa`, `qcom,ipcc`, the AOSS mailbox, the RPMh-controller and `apps-smmu` nodes and prints `soc_ipa_base`, `soc_gsi_base`, `soc_ipcc`, `soc_aoss`,-`soc_rsc`, `soc_apps_smmu`. The run scripts append `devices/<name>/soc.args` to the kernel command-line automatically (`SOC_ARGS=` to point elsewhere). The memory addresses (`soc_smem`, `soc_cmd_db`,-`soc_mpss_mem`, `soc_imem`) come from the phone's reserved-memory nodes; add them by hand for now.-For this phone every generated value equals the built-in default, so `soc.args` changes nothing here-and is kept only as the worked example.--### Every soc_* argument--What `tools/soc-args.py` reads from a phone's device tree, and where each comes from. The POCO-X5 Pro's values (the kernel defaults) are shown; another phone's are generated into its `soc.args`.--| Argument | Device-tree source | POCO value |-|---|---|---|-| `soc_ipa_base` | `qcom,ipa` reg `ipa-base` + 0x40000 (the registers) | `0x1e40000` |-| `soc_gsi_base` | `qcom,ipa` reg `gsi-base` | `0x1e04000` |-| `soc_ipcc` | `qcom,ipcc` reg | `0x408000` |-| `soc_aoss` | the AOSS QMP mailbox reg | `0xc300000` |-| `soc_rsc` | `qcom,rpmh-rsc` reg drv-2 (the apps DRV) | `0x18220000` |-| `soc_apps_smmu` | `apps-smmu` reg | `0x15000000` |-| `soc_smem` | the reserved-memory `qcom,smem` points at | `0x80900000` |-| `soc_cmd_db` | reserved-memory `cmd_db` | `0x80860000` |-| `soc_mpss_mem` | reserved-memory `mpss` (the modem's image) | `0x8b800000` |-| `modem_ipa_fw_at` | reserved-memory `ipa_gsi` (where the IPA firmware loads) | `0x8b710000` |-| `soc_imem` | `qcom,msm-imem`, rounded down to its 2 MB block | `0x14600000` |-| `soc_ipa_stream` | `ipa_smmu_ap` iommus stream | `0x480` |-| `soc_ipa_stream_uc` | `ipa_smmu_uc` iommus stream | `0x482` |-| `soc_pas_mpss` | `qcom,mss` `qcom,pas-id` | `0x4` |-| `soc_pas_ipa` | `qcom,ipa_fws` `qcom,pas-id` | `0xf` |-| `soc_ipa_fw` | `qcom,ipa_fws` `qcom,firmware-name` | `yupik_ipa_fws` |--Still hardcoded (IPA-version specific, not per-phone within one IPA version): the SRAM region-layout and the SMEM filter-table item (`ipa_4_11_mem_part`), and the Qtime/resource-group values-the IPA is programmed with. A phone on the same IPA (4.11) needs none of these changed; a different-IPA version is a larger port.diff --git a/devices/redwood/configs/redwood.config b/devices/redwood/configs/redwood.configdeleted file mode 100644index a3a9aa5..0000000--- a/devices/redwood/configs/redwood.config+++ /dev/null@@ -1,6 +0,0 @@-# HakiOS fragment: the POCO X5 Pro 5G (redwood, devices/redwood) -- what is true of this phone and of no other with the same SoC.-# The vibration motor's variant (5), and where the modem's remote-file-system buffer is in its memory map (a number taken from the-# phone's own device tree; tools/soc-args.py makes it for a phone that has another).-CONFIG_DEVICE="redwood"-CONFIG_HAPTIC=5-CONFIG_MODEM_BUFFER=0xa8000000diff --git a/devices/redwood/configs/redwood_defconfig b/devices/redwood/configs/redwood_defconfigdeleted file mode 100644index 170541a..0000000--- a/devices/redwood/configs/redwood_defconfig+++ /dev/null@@ -1,7 +0,0 @@-# HakiOS defconfig for the POCO X5 Pro 5G (redwood, SM7325, devices/redwood): the common kernel's configuration, the SC7280 family's-# facts and this phone's own, put together the way Android puts a device's kernel configuration together.-# What the project's own phone line uses, with the chip's identity and the sensors read as the only additions (stopping a hot run, CONFIG_THERMAL_STOP, is not set).-# Needs the phone's own firmware pulled from your phone (devices/redwood/pull-firmware.sh): `tools/hakios-config.py needs`.-#include common_defconfig-#include sc7280.config-#include redwood.configdiff --git a/devices/redwood/device.conf b/devices/redwood/device.confdeleted file mode 100644index 84fa517..0000000--- a/devices/redwood/device.conf+++ /dev/null@@ -1,25 +0,0 @@-# devices/redwood/device.conf: what this device repository is. tools/hakios-device.py reads it; docs/porting/repositories.md has-# every word, and the device's page (docs/devices/redwood.md) is made from it, so that the status is said in one place.--device redwood- title POCO X5 Pro 5G- vendor Xiaomi- soc sc7280- defconfig redwood_defconfig- firmware pull-firmware.sh- maintainer the HakiOS developers (README.md)- status display works the panel through UEFI's framebuffer; frames drawn by the GPU with gpu=1- status touch works Goodix GT9916 / FocalTech FT3680 on SPI, multitouch (CONFIG_HAKIOS_GOODIX, touchscreen=1)- status buttons works power and volume through the PMIC (CONFIG_HAKIOS_BUTTONS)- status cpu works all 8 cores, the big core at 2.4 GHz (cpus=8 bootcpu=7 cpufreq=1)- status gpu works Adreno 642L, OpenGL ES through Mesa (gpu=1); Metal: buffers and libraries, no drawing yet- status storage works UFS read through the loader; /private/var kept with var_store=1 ufs_write=1- status audio works speakers and microphone through the audio DSP (adsp=1 sound=4 mic=4)- status battery partial the level in the UI through the audio DSP; charging under this kernel is not done- status haptic works Awinic AW86927 (haptic=5)- status camera works Camera.app (cam=5)- status torch partial the PM8350C flash LED and Control Center's button (torch=N); not in the README's list of what works- status wifi works WCN6750 with Linux's ath11k: radio, driver, a network joined (wifi=1)- status bluetooth missing step one only: a read-only look at its pins (bt=1)- status cellular partial the modem boots, sees the network, the SIM is bound, IPA and en1 in place; no registration yet- status thermal partial 27 of 27 sensors read on the phone (thermal=1); the stop (thermal_stop=) not yet seen firingdiff --git a/devices/redwood/prebuilt/BootShim.bin b/devices/redwood/prebuilt/BootShim.bindeleted file mode 100644index 8628583..0000000Binary files a/devices/redwood/prebuilt/BootShim.bin and /dev/null differdiff --git a/devices/redwood/prebuilt/device-tree.dtb b/devices/redwood/prebuilt/device-tree.dtbdeleted file mode 100644index 123163c..0000000Binary files a/devices/redwood/prebuilt/device-tree.dtb and /dev/null differdiff --git a/devices/redwood/prebuilt/mkbootimg.py b/devices/redwood/prebuilt/mkbootimg.pydeleted file mode 100755index b8c73c6..0000000--- a/devices/redwood/prebuilt/mkbootimg.py+++ /dev/null@@ -1,674 +0,0 @@-#!/usr/bin/env python3-#-# Copyright 2015, The Android Open Source Project-#-# Licensed under the Apache License, Version 2.0 (the "License");-# you may not use this file except in compliance with the License.-# You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.--"""Creates the boot image."""--from argparse import (ArgumentParser, ArgumentTypeError,- FileType, RawDescriptionHelpFormatter)-from hashlib import sha1-from os import fstat-from struct import pack--import array-import collections-import os-import re-import subprocess-import tempfile--# Constant and structure definition is in-# system/tools/mkbootimg/include/bootimg/bootimg.h-BOOT_MAGIC = 'ANDROID!'-BOOT_MAGIC_SIZE = 8-BOOT_NAME_SIZE = 16-BOOT_ARGS_SIZE = 512-BOOT_EXTRA_ARGS_SIZE = 1024-BOOT_IMAGE_HEADER_V1_SIZE = 1648-BOOT_IMAGE_HEADER_V2_SIZE = 1660-BOOT_IMAGE_HEADER_V3_SIZE = 1580-BOOT_IMAGE_HEADER_V3_PAGESIZE = 4096-BOOT_IMAGE_HEADER_V4_SIZE = 1584-BOOT_IMAGE_V4_SIGNATURE_SIZE = 4096--VENDOR_BOOT_MAGIC = 'VNDRBOOT'-VENDOR_BOOT_MAGIC_SIZE = 8-VENDOR_BOOT_NAME_SIZE = BOOT_NAME_SIZE-VENDOR_BOOT_ARGS_SIZE = 2048-VENDOR_BOOT_IMAGE_HEADER_V3_SIZE = 2112-VENDOR_BOOT_IMAGE_HEADER_V4_SIZE = 2128--VENDOR_RAMDISK_TYPE_NONE = 0-VENDOR_RAMDISK_TYPE_PLATFORM = 1-VENDOR_RAMDISK_TYPE_RECOVERY = 2-VENDOR_RAMDISK_TYPE_DLKM = 3-VENDOR_RAMDISK_NAME_SIZE = 32-VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE = 16-VENDOR_RAMDISK_TABLE_ENTRY_V4_SIZE = 108--# Names with special meaning, mustn't be specified in --ramdisk_name.-VENDOR_RAMDISK_NAME_BLOCKLIST = {b'default'}--PARSER_ARGUMENT_VENDOR_RAMDISK_FRAGMENT = '--vendor_ramdisk_fragment'---def filesize(f):- if f is None:- return 0- try:- return fstat(f.fileno()).st_size- except OSError:- return 0---def update_sha(sha, f):- if f:- sha.update(f.read())- f.seek(0)- sha.update(pack('I', filesize(f)))- else:- sha.update(pack('I', 0))---def pad_file(f, padding):- pad = (padding - (f.tell() & (padding - 1))) & (padding - 1)- f.write(pack(str(pad) + 'x'))---def get_number_of_pages(image_size, page_size):- """calculates the number of pages required for the image"""- return (image_size + page_size - 1) // page_size---def get_recovery_dtbo_offset(args):- """calculates the offset of recovery_dtbo image in the boot image"""- num_header_pages = 1 # header occupies a page- num_kernel_pages = get_number_of_pages(filesize(args.kernel), args.pagesize)- num_ramdisk_pages = get_number_of_pages(filesize(args.ramdisk),- args.pagesize)- num_second_pages = get_number_of_pages(filesize(args.second), args.pagesize)- dtbo_offset = args.pagesize * (num_header_pages + num_kernel_pages +- num_ramdisk_pages + num_second_pages)- return dtbo_offset---def write_header_v3_and_above(args):- if args.header_version > 3:- boot_header_size = BOOT_IMAGE_HEADER_V4_SIZE- else:- boot_header_size = BOOT_IMAGE_HEADER_V3_SIZE-- args.output.write(pack(f'{BOOT_MAGIC_SIZE}s', BOOT_MAGIC.encode()))- # kernel size in bytes- args.output.write(pack('I', filesize(args.kernel)))- # ramdisk size in bytes- args.output.write(pack('I', filesize(args.ramdisk)))- # os version and patch level- args.output.write(pack('I', (args.os_version << 11) | args.os_patch_level))- args.output.write(pack('I', boot_header_size))- # reserved- args.output.write(pack('4I', 0, 0, 0, 0))- # version of boot image header- args.output.write(pack('I', args.header_version))- args.output.write(pack(f'{BOOT_ARGS_SIZE + BOOT_EXTRA_ARGS_SIZE}s',- args.cmdline))- if args.header_version >= 4:- # The signature used to verify boot image v4.- args.output.write(pack('I', BOOT_IMAGE_V4_SIGNATURE_SIZE))- pad_file(args.output, BOOT_IMAGE_HEADER_V3_PAGESIZE)---def write_vendor_boot_header(args):- if filesize(args.dtb) == 0:- raise ValueError('DTB image must not be empty.')-- if args.header_version > 3:- vendor_ramdisk_size = args.vendor_ramdisk_total_size- vendor_boot_header_size = VENDOR_BOOT_IMAGE_HEADER_V4_SIZE- else:- vendor_ramdisk_size = filesize(args.vendor_ramdisk)- vendor_boot_header_size = VENDOR_BOOT_IMAGE_HEADER_V3_SIZE-- args.vendor_boot.write(pack(f'{VENDOR_BOOT_MAGIC_SIZE}s',- VENDOR_BOOT_MAGIC.encode()))- # version of boot image header- args.vendor_boot.write(pack('I', args.header_version))- # flash page size- args.vendor_boot.write(pack('I', args.pagesize))- # kernel physical load address- args.vendor_boot.write(pack('I', args.base + args.kernel_offset))- # ramdisk physical load address- args.vendor_boot.write(pack('I', args.base + args.ramdisk_offset))- # ramdisk size in bytes- args.vendor_boot.write(pack('I', vendor_ramdisk_size))- args.vendor_boot.write(pack(f'{VENDOR_BOOT_ARGS_SIZE}s',- args.vendor_cmdline))- # kernel tags physical load address- args.vendor_boot.write(pack('I', args.base + args.tags_offset))- # asciiz product name- args.vendor_boot.write(pack(f'{VENDOR_BOOT_NAME_SIZE}s', args.board))-- # header size in bytes- args.vendor_boot.write(pack('I', vendor_boot_header_size))-- # dtb size in bytes- args.vendor_boot.write(pack('I', filesize(args.dtb)))- # dtb physical load address- args.vendor_boot.write(pack('Q', args.base + args.dtb_offset))-- if args.header_version > 3:- vendor_ramdisk_table_size = (args.vendor_ramdisk_table_entry_num *- VENDOR_RAMDISK_TABLE_ENTRY_V4_SIZE)- # vendor ramdisk table size in bytes- args.vendor_boot.write(pack('I', vendor_ramdisk_table_size))- # number of vendor ramdisk table entries- args.vendor_boot.write(pack('I', args.vendor_ramdisk_table_entry_num))- # vendor ramdisk table entry size in bytes- args.vendor_boot.write(pack('I', VENDOR_RAMDISK_TABLE_ENTRY_V4_SIZE))- # bootconfig section size in bytes- args.vendor_boot.write(pack('I', filesize(args.vendor_bootconfig)))- pad_file(args.vendor_boot, args.pagesize)---def write_header(args):- if args.header_version > 4:- raise ValueError(- f'Boot header version {args.header_version} not supported')- if args.header_version in {3, 4}:- return write_header_v3_and_above(args)-- ramdisk_load_address = ((args.base + args.ramdisk_offset)- if filesize(args.ramdisk) > 0 else 0)- second_load_address = ((args.base + args.second_offset)- if filesize(args.second) > 0 else 0)-- args.output.write(pack(f'{BOOT_MAGIC_SIZE}s', BOOT_MAGIC.encode()))- # kernel size in bytes- args.output.write(pack('I', filesize(args.kernel)))- # kernel physical load address- args.output.write(pack('I', args.base + args.kernel_offset))- # ramdisk size in bytes- args.output.write(pack('I', filesize(args.ramdisk)))- # ramdisk physical load address- args.output.write(pack('I', ramdisk_load_address))- # second bootloader size in bytes- args.output.write(pack('I', filesize(args.second)))- # second bootloader physical load address- args.output.write(pack('I', second_load_address))- # kernel tags physical load address- args.output.write(pack('I', args.base + args.tags_offset))- # flash page size- args.output.write(pack('I', args.pagesize))- # version of boot image header- args.output.write(pack('I', args.header_version))- # os version and patch level- args.output.write(pack('I', (args.os_version << 11) | args.os_patch_level))- # asciiz product name- args.output.write(pack(f'{BOOT_NAME_SIZE}s', args.board))- args.output.write(pack(f'{BOOT_ARGS_SIZE}s', args.cmdline))-- sha = sha1()- update_sha(sha, args.kernel)- update_sha(sha, args.ramdisk)- update_sha(sha, args.second)-- if args.header_version > 0:- update_sha(sha, args.recovery_dtbo)- if args.header_version > 1:- update_sha(sha, args.dtb)-- img_id = pack('32s', sha.digest())-- args.output.write(img_id)- args.output.write(pack(f'{BOOT_EXTRA_ARGS_SIZE}s', args.extra_cmdline))-- if args.header_version > 0:- if args.recovery_dtbo:- # recovery dtbo size in bytes- args.output.write(pack('I', filesize(args.recovery_dtbo)))- # recovert dtbo offset in the boot image- args.output.write(pack('Q', get_recovery_dtbo_offset(args)))- else:- # Set to zero if no recovery dtbo- args.output.write(pack('I', 0))- args.output.write(pack('Q', 0))-- # Populate boot image header size for header versions 1 and 2.- if args.header_version == 1:- args.output.write(pack('I', BOOT_IMAGE_HEADER_V1_SIZE))- elif args.header_version == 2:- args.output.write(pack('I', BOOT_IMAGE_HEADER_V2_SIZE))-- if args.header_version > 1:- if filesize(args.dtb) == 0:- raise ValueError('DTB image must not be empty.')-- # dtb size in bytes- args.output.write(pack('I', filesize(args.dtb)))- # dtb physical load address- args.output.write(pack('Q', args.base + args.dtb_offset))-- pad_file(args.output, args.pagesize)- return img_id---class AsciizBytes:- """Parses a string and encodes it as an asciiz bytes object.-- >>> AsciizBytes(bufsize=4)('foo')- b'foo\\x00'- >>> AsciizBytes(bufsize=4)('foob')- Traceback (most recent call last):- ...- argparse.ArgumentTypeError: Encoded asciiz length exceeded: max 4, got 5- """-- def __init__(self, bufsize):- self.bufsize = bufsize-- def __call__(self, arg):- arg_bytes = arg.encode() + b'\x00'- if len(arg_bytes) > self.bufsize:- raise ArgumentTypeError(- 'Encoded asciiz length exceeded: '- f'max {self.bufsize}, got {len(arg_bytes)}')- return arg_bytes---class VendorRamdiskTableBuilder:- """Vendor ramdisk table builder.-- Attributes:- entries: A list of VendorRamdiskTableEntry namedtuple.- ramdisk_total_size: Total size in bytes of all ramdisks in the table.- """-- VendorRamdiskTableEntry = collections.namedtuple( # pylint: disable=invalid-name- 'VendorRamdiskTableEntry',- ['ramdisk_path', 'ramdisk_size', 'ramdisk_offset', 'ramdisk_type',- 'ramdisk_name', 'board_id'])-- def __init__(self):- self.entries = []- self.ramdisk_total_size = 0- self.ramdisk_names = set()-- def add_entry(self, ramdisk_path, ramdisk_type, ramdisk_name, board_id):- # Strip any trailing null for simple comparison.- stripped_ramdisk_name = ramdisk_name.rstrip(b'\x00')- if stripped_ramdisk_name in VENDOR_RAMDISK_NAME_BLOCKLIST:- raise ValueError(- f'Banned vendor ramdisk name: {stripped_ramdisk_name}')- if stripped_ramdisk_name in self.ramdisk_names:- raise ValueError(- f'Duplicated vendor ramdisk name: {stripped_ramdisk_name}')- self.ramdisk_names.add(stripped_ramdisk_name)-- if board_id is None:- board_id = array.array(- 'I', [0] * VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE)- else:- board_id = array.array('I', board_id)- if len(board_id) != VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE:- raise ValueError('board_id size must be '- f'{VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE}')-- with open(ramdisk_path, 'rb') as f:- ramdisk_size = filesize(f)- self.entries.append(self.VendorRamdiskTableEntry(- ramdisk_path, ramdisk_size, self.ramdisk_total_size, ramdisk_type,- ramdisk_name, board_id))- self.ramdisk_total_size += ramdisk_size-- def write_ramdisks_padded(self, fout, alignment):- for entry in self.entries:- with open(entry.ramdisk_path, 'rb') as f:- fout.write(f.read())- pad_file(fout, alignment)-- def write_entries_padded(self, fout, alignment):- for entry in self.entries:- fout.write(pack('I', entry.ramdisk_size))- fout.write(pack('I', entry.ramdisk_offset))- fout.write(pack('I', entry.ramdisk_type))- fout.write(pack(f'{VENDOR_RAMDISK_NAME_SIZE}s',- entry.ramdisk_name))- fout.write(entry.board_id)- pad_file(fout, alignment)---def write_padded_file(f_out, f_in, padding):- if f_in is None:- return- f_out.write(f_in.read())- pad_file(f_out, padding)---def parse_int(x):- return int(x, 0)---def parse_os_version(x):- match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)- if match:- a = int(match.group(1))- b = c = 0- if match.lastindex >= 2:- b = int(match.group(2))- if match.lastindex == 3:- c = int(match.group(3))- # 7 bits allocated for each field- assert a < 128- assert b < 128- assert c < 128- return (a << 14) | (b << 7) | c- return 0---def parse_os_patch_level(x):- match = re.search(r'^(\d{4})-(\d{2})(?:-(\d{2}))?', x)- if match:- y = int(match.group(1)) - 2000- m = int(match.group(2))- # 7 bits allocated for the year, 4 bits for the month- assert 0 <= y < 128- assert 0 < m <= 12- return (y << 4) | m- return 0---def parse_vendor_ramdisk_type(x):- type_dict = {- 'none': VENDOR_RAMDISK_TYPE_NONE,- 'platform': VENDOR_RAMDISK_TYPE_PLATFORM,- 'recovery': VENDOR_RAMDISK_TYPE_RECOVERY,- 'dlkm': VENDOR_RAMDISK_TYPE_DLKM,- }- if x.lower() in type_dict:- return type_dict[x.lower()]- return parse_int(x)---def get_vendor_boot_v4_usage():- return """vendor boot version 4 arguments:- --ramdisk_type {none,platform,recovery,dlkm}- specify the type of the ramdisk- --ramdisk_name NAME- specify the name of the ramdisk- --board_id{0..15} NUMBER- specify the value of the board_id vector, defaults to 0- --vendor_ramdisk_fragment VENDOR_RAMDISK_FILE- path to the vendor ramdisk file-- These options can be specified multiple times, where each vendor ramdisk- option group ends with a --vendor_ramdisk_fragment option.- Each option group appends an additional ramdisk to the vendor boot image.-"""---def parse_vendor_ramdisk_args(args, args_list):- """Parses vendor ramdisk specific arguments.-- Args:- args: An argparse.Namespace object. Parsed results are stored into this- object.- args_list: A list of argument strings to be parsed.-- Returns:- A list argument strings that are not parsed by this method.- """- parser = ArgumentParser(add_help=False)- parser.add_argument('--ramdisk_type', type=parse_vendor_ramdisk_type,- default=VENDOR_RAMDISK_TYPE_NONE)- parser.add_argument('--ramdisk_name',- type=AsciizBytes(bufsize=VENDOR_RAMDISK_NAME_SIZE),- required=True)- for i in range(VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE):- parser.add_argument(f'--board_id{i}', type=parse_int, default=0)- parser.add_argument(PARSER_ARGUMENT_VENDOR_RAMDISK_FRAGMENT, required=True)-- unknown_args = []-- vendor_ramdisk_table_builder = VendorRamdiskTableBuilder()- if args.vendor_ramdisk is not None:- vendor_ramdisk_table_builder.add_entry(- args.vendor_ramdisk.name, VENDOR_RAMDISK_TYPE_PLATFORM, b'', None)-- while PARSER_ARGUMENT_VENDOR_RAMDISK_FRAGMENT in args_list:- idx = args_list.index(PARSER_ARGUMENT_VENDOR_RAMDISK_FRAGMENT) + 2- vendor_ramdisk_args = args_list[:idx]- args_list = args_list[idx:]-- ramdisk_args, extra_args = parser.parse_known_args(vendor_ramdisk_args)- ramdisk_args_dict = vars(ramdisk_args)- unknown_args.extend(extra_args)-- ramdisk_path = ramdisk_args.vendor_ramdisk_fragment- ramdisk_type = ramdisk_args.ramdisk_type- ramdisk_name = ramdisk_args.ramdisk_name- board_id = [ramdisk_args_dict[f'board_id{i}']- for i in range(VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE)]- vendor_ramdisk_table_builder.add_entry(ramdisk_path, ramdisk_type,- ramdisk_name, board_id)-- if len(args_list) > 0:- unknown_args.extend(args_list)-- args.vendor_ramdisk_total_size = (vendor_ramdisk_table_builder- .ramdisk_total_size)- args.vendor_ramdisk_table_entry_num = len(vendor_ramdisk_table_builder- .entries)- args.vendor_ramdisk_table_builder = vendor_ramdisk_table_builder- return unknown_args---def parse_cmdline():- version_parser = ArgumentParser(add_help=False)- version_parser.add_argument('--header_version', type=parse_int, default=0)- if version_parser.parse_known_args()[0].header_version < 3:- # For boot header v0 to v2, the kernel commandline field is split into- # two fields, cmdline and extra_cmdline. Both fields are asciiz strings,- # so we minus one here to ensure the encoded string plus the- # null-terminator can fit in the buffer size.- cmdline_size = BOOT_ARGS_SIZE + BOOT_EXTRA_ARGS_SIZE - 1- else:- cmdline_size = BOOT_ARGS_SIZE + BOOT_EXTRA_ARGS_SIZE-- parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter,- epilog=get_vendor_boot_v4_usage())- parser.add_argument('--kernel', type=FileType('rb'),- help='path to the kernel')- parser.add_argument('--ramdisk', type=FileType('rb'),- help='path to the ramdisk')- parser.add_argument('--second', type=FileType('rb'),- help='path to the second bootloader')- parser.add_argument('--dtb', type=FileType('rb'), help='path to the dtb')- dtbo_group = parser.add_mutually_exclusive_group()- dtbo_group.add_argument('--recovery_dtbo', type=FileType('rb'),- help='path to the recovery DTBO')- dtbo_group.add_argument('--recovery_acpio', type=FileType('rb'),- metavar='RECOVERY_ACPIO', dest='recovery_dtbo',- help='path to the recovery ACPIO')- parser.add_argument('--cmdline', type=AsciizBytes(bufsize=cmdline_size),- default='', help='kernel command line arguments')- parser.add_argument('--vendor_cmdline',- type=AsciizBytes(bufsize=VENDOR_BOOT_ARGS_SIZE),- default='',- help='vendor boot kernel command line arguments')- parser.add_argument('--base', type=parse_int, default=0x10000000,- help='base address')- parser.add_argument('--kernel_offset', type=parse_int, default=0x00008000,- help='kernel offset')- parser.add_argument('--ramdisk_offset', type=parse_int, default=0x01000000,- help='ramdisk offset')- parser.add_argument('--second_offset', type=parse_int, default=0x00f00000,- help='second bootloader offset')- parser.add_argument('--dtb_offset', type=parse_int, default=0x01f00000,- help='dtb offset')-- parser.add_argument('--os_version', type=parse_os_version, default=0,- help='operating system version')- parser.add_argument('--os_patch_level', type=parse_os_patch_level,- default=0, help='operating system patch level')- parser.add_argument('--tags_offset', type=parse_int, default=0x00000100,- help='tags offset')- parser.add_argument('--board', type=AsciizBytes(bufsize=BOOT_NAME_SIZE),- default='', help='board name')- parser.add_argument('--pagesize', type=parse_int,- choices=[2**i for i in range(11, 15)], default=2048,- help='page size')- parser.add_argument('--id', action='store_true',- help='print the image ID on standard output')- parser.add_argument('--header_version', type=parse_int, default=0,- help='boot image header version')- parser.add_argument('-o', '--output', type=FileType('wb'),- help='output file name')- parser.add_argument('--gki_signing_algorithm',- help='GKI signing algorithm to use')- parser.add_argument('--gki_signing_key',- help='path to RSA private key file')- parser.add_argument('--gki_signing_signature_args',- help='other hash arguments passed to avbtool')- parser.add_argument('--gki_signing_avbtool_path',- help='path to avbtool for boot signature generation')- parser.add_argument('--vendor_boot', type=FileType('wb'),- help='vendor boot output file name')- parser.add_argument('--vendor_ramdisk', type=FileType('rb'),- help='path to the vendor ramdisk')- parser.add_argument('--vendor_bootconfig', type=FileType('rb'),- help='path to the vendor bootconfig file')-- args, extra_args = parser.parse_known_args()- if args.vendor_boot is not None and args.header_version > 3:- extra_args = parse_vendor_ramdisk_args(args, extra_args)- if len(extra_args) > 0:- raise ValueError(f'Unrecognized arguments: {extra_args}')-- if args.header_version < 3:- args.extra_cmdline = args.cmdline[BOOT_ARGS_SIZE-1:]- args.cmdline = args.cmdline[:BOOT_ARGS_SIZE-1] + b'\x00'- assert len(args.cmdline) <= BOOT_ARGS_SIZE- assert len(args.extra_cmdline) <= BOOT_EXTRA_ARGS_SIZE-- return args---def add_boot_image_signature(args, pagesize):- """Adds the boot image signature.-- Note that the signature will only be verified in VTS to ensure a- generic boot.img is used. It will not be used by the device- bootloader at boot time. The bootloader should only verify- the boot vbmeta at the end of the boot partition (or in the top-level- vbmeta partition) via the Android Verified Boot process, when the- device boots.- """- args.output.flush() # Flush the buffer for signature calculation.-- # Appends zeros if the signing key is not specified.- if not args.gki_signing_key or not args.gki_signing_algorithm:- zeros = b'\x00' * BOOT_IMAGE_V4_SIGNATURE_SIZE- args.output.write(zeros)- pad_file(args.output, pagesize)- return-- avbtool = 'avbtool' # Used from otatools.zip or Android build env.-- # We need to specify the path of avbtool in build/core/Makefile.- # Because avbtool is not guaranteed to be in $PATH there.- if args.gki_signing_avbtool_path:- avbtool = args.gki_signing_avbtool_path-- # Need to specify a value of --partition_size for avbtool to work.- # We use 64 MB below, but avbtool will not resize the boot image to- # this size because --do_not_append_vbmeta_image is also specified.- avbtool_cmd = [- avbtool, 'add_hash_footer',- '--partition_name', 'boot',- '--partition_size', str(64 * 1024 * 1024),- '--image', args.output.name,- '--algorithm', args.gki_signing_algorithm,- '--key', args.gki_signing_key,- '--salt', 'd00df00d'] # TODO: use a hash of kernel/ramdisk as the salt.-- # Additional arguments passed to avbtool.- if args.gki_signing_signature_args:- avbtool_cmd += args.gki_signing_signature_args.split()-- # Outputs the signed vbmeta to a separate file, then append to boot.img- # as the boot signature.- with tempfile.TemporaryDirectory() as temp_out_dir:- boot_signature_output = os.path.join(temp_out_dir, 'boot_signature')- avbtool_cmd += ['--do_not_append_vbmeta_image',- '--output_vbmeta_image', boot_signature_output]- subprocess.check_call(avbtool_cmd)- with open(boot_signature_output, 'rb') as boot_signature:- if filesize(boot_signature) > BOOT_IMAGE_V4_SIGNATURE_SIZE:- raise ValueError(- f'boot sigature size is > {BOOT_IMAGE_V4_SIGNATURE_SIZE}')- write_padded_file(args.output, boot_signature, pagesize)---def write_data(args, pagesize):- write_padded_file(args.output, args.kernel, pagesize)- write_padded_file(args.output, args.ramdisk, pagesize)- write_padded_file(args.output, args.second, pagesize)-- if args.header_version > 0 and args.header_version < 3:- write_padded_file(args.output, args.recovery_dtbo, pagesize)- if args.header_version == 2:- write_padded_file(args.output, args.dtb, pagesize)- if args.header_version >= 4:- add_boot_image_signature(args, pagesize)---def write_vendor_boot_data(args):- if args.header_version > 3:- builder = args.vendor_ramdisk_table_builder- builder.write_ramdisks_padded(args.vendor_boot, args.pagesize)- write_padded_file(args.vendor_boot, args.dtb, args.pagesize)- builder.write_entries_padded(args.vendor_boot, args.pagesize)- write_padded_file(args.vendor_boot, args.vendor_bootconfig,- args.pagesize)- else:- write_padded_file(args.vendor_boot, args.vendor_ramdisk, args.pagesize)- write_padded_file(args.vendor_boot, args.dtb, args.pagesize)---def main():- args = parse_cmdline()- if args.vendor_boot is not None:- if args.header_version not in {3, 4}:- raise ValueError(- '--vendor_boot not compatible with given header version')- if args.header_version == 3 and args.vendor_ramdisk is None:- raise ValueError('--vendor_ramdisk missing or invalid')- write_vendor_boot_header(args)- write_vendor_boot_data(args)- if args.output is not None:- if args.second is not None and args.header_version > 2:- raise ValueError(- '--second not compatible with given header version')- img_id = write_header(args)- if args.header_version > 2:- write_data(args, BOOT_IMAGE_HEADER_V3_PAGESIZE)- else:- write_data(args, args.pagesize)- if args.id and img_id is not None:- print('0x' + ''.join(f'{octet:02x}' for octet in img_id))---if __name__ == '__main__':- main()\ No newline at end of filediff --git a/devices/redwood/prebuilt/ramdisk b/devices/redwood/prebuilt/ramdiskdeleted file mode 100644index 2995a4d..0000000--- a/devices/redwood/prebuilt/ramdisk+++ /dev/null@@ -1 +0,0 @@-dummy\ No newline at end of filediff --git a/devices/redwood/pull-firmware-root.sh b/devices/redwood/pull-firmware-root.shdeleted file mode 100755index 3baea8a..0000000--- a/devices/redwood/pull-firmware-root.sh+++ /dev/null@@ -1,36 +0,0 @@-#!/bin/bash-# pull-firmware.sh, through root. On some ROMs of this phone (seen on a redwood unit running a-# spoofed-brand KernelSU build) /vendor/firmware_mnt is a vfat mount owned by system with-# fmask=0337, and /vendor/firmware is not readable by the adb shell user either: the plain-# `adb pull` of pull-firmware.sh gets nothing ("not on the phone" for every file) although every-# file is there. This does the same pull by way of su: the firmware is copied, under root, to a-# world-readable staging directory in /data/local/tmp, pulled from there, and the staging directory-# is removed again. Nothing on the phone is changed. Needs the phone in Android with adb and a root-# that answers `su -c` (Magisk, KernelSU).-#-# The layout it leaves is pull-firmware.sh's: fw-gpu/, fw-wifi/, fw-audio/, fw-haptic/, fw-modem/-# (modem.* and image/, the modem's own files for TFTP). Camera firmware is not pulled: its files-# carry the first phone's renamed names and are not needed for the modem or the network.-set -e-cd "$(dirname "$0")/../.."-S=/data/local/tmp/fw-adb get-state >/dev/null-adb shell "su -c 'sh -c \"-S=$S; rm -rf \$S; mkdir -p \$S/gpu \$S/wifi \$S/audio \$S/haptic \$S/modem-cp /vendor/firmware/a660_gmu.bin /vendor/firmware/a660_sqe.fw /vendor/firmware/a660_zap.* \$S/gpu/ 2>/dev/null-cp /vendor/firmware_mnt/image/wpss.* \$S/wifi/-cp /vendor/firmware_mnt/image/adsp.* \$S/audio/-cp /vendor/firmware/aw8697_haptic.bin \$S/haptic/-cp /vendor/firmware_mnt/image/modem.* \$S/modem/-cp -r /vendor/firmware_mnt/image \$S/modem/-chmod -R a+rX \$S\"'"-rm -rf fw-stage-adb pull "$S" fw-stage >/dev/null-rm -rf fw-gpu fw-wifi fw-audio fw-haptic fw-modem-mv fw-stage/gpu fw-gpu; mv fw-stage/wifi fw-wifi; mv fw-stage/audio fw-audio-mv fw-stage/haptic fw-haptic; mv fw-stage/modem fw-modem; rmdir fw-stage-adb shell "su -c 'rm -rf $S'"-for d in fw-gpu fw-wifi fw-audio fw-haptic fw-modem fw-modem/image; do- echo "pull-firmware-root.sh: $d: $(ls -1 "$d" | wc -l | tr -d ' ') files"-done-echo "pull-firmware-root.sh: done; Wi-Fi also wants fw-wifi/mac (the radio's address) and fw-wifi/network (the network's name and passphrase)"diff --git a/devices/redwood/pull-firmware.sh b/devices/redwood/pull-firmware.shdeleted file mode 100755index f2efcdd..0000000--- a/devices/redwood/pull-firmware.sh+++ /dev/null@@ -1,20 +0,0 @@-#!/bin/bash-# Pull the phone's own firmware out of its Android into the fw-*/ directories at the top of the-# repository (never committed: it is the vendor's). The phone is on adb, in Android.-set -e-cd "$(dirname "$0")/../.."-pull() { # DIR SOURCE... (missing files are told, not fatal)- local dir=$1; shift- mkdir -p "$dir"- for f in "$@"; do adb pull "$f" "$dir/" >/dev/null 2>&1 || echo "pull-firmware.sh: $f: not on the phone"; done- echo "pull-firmware.sh: $dir: $(ls -1 "$dir" | wc -l | tr -d ' ') files"-}-adb get-state >/dev/null-pull fw-gpu /vendor/firmware/a660_gmu.bin /vendor/firmware/a660_sqe.fw /vendor/firmware/a660_zap.mdt /vendor/firmware/a660_zap.b00 /vendor/firmware/a660_zap.b01 /vendor/firmware/a660_zap.b02-pull fw-wifi $(for i in mdt b02 b03 b04 b05 b06 b07; do echo /vendor/firmware_mnt/image/wpss.$i; done)-pull fw-audio /vendor/firmware_mnt/image/adsp.mdt $(for i in $(seq -w 2 36); do echo /vendor/firmware_mnt/image/adsp.b$i; done)-pull fw-haptic /vendor/firmware/aw8697_haptic.bin-pull fw-modem /vendor/firmware_mnt/image/modem.mdt $(for i in $(seq -w 0 28); do echo /vendor/firmware_mnt/image/modem.b$i; done)-mkdir -p fw-modem/image && adb pull /vendor/firmware_mnt/image fw-modem/ >/dev/null 2>&1 && echo "pull-firmware.sh: fw-modem/image: the modem's own files (TFTP)"-pull fw-camera $(adb shell ls /vendor/lib64/camera/com.qti.sensormodule.hakios_*.bin /vendor/lib64/camera/com.qti.tuned.hakios_*.bin 2>/dev/null | tr -d '\r')-echo "pull-firmware.sh: done; Wi-Fi also wants fw-wifi/mac (the radio's address) and fw-wifi/network (the network's name and passphrase)"diff --git a/devices/redwood/pull-soc.sh b/devices/redwood/pull-soc.shdeleted file mode 100755index 6bbf763..0000000--- a/devices/redwood/pull-soc.sh+++ /dev/null@@ -1,25 +0,0 @@-#!/bin/bash-# Pull the phone's own device tree over adb and turn it into the SoC boot-args HakiOS needs on this-# device (tools/soc-args.py). The POCO X5 Pro matches the kernel's built-in values, so its soc.args-# comes out empty of surprises; another phone's will carry its addresses. Needs the phone in Android-# with adb. /sys/firmware/fdt is readable by everybody on most ROMs; where only root can read it (seen-# on an SM7325 unit running a KernelSU build) the tree is copied under su to a staging file the shell-# can read, pulled from there, and the staging file is removed again.-set -e -o pipefail-here=$(cd "$(dirname "$0")" && pwd) # before the cd: $0 may be a relative path-cd "$here/../.."-PATH=$PWD/tools/macos-bin/platform-tools:$PATH-tmp=$(mktemp -d)-trap 'rm -rf "$tmp"' EXIT-if ! adb pull /sys/firmware/fdt "$tmp/fdt" >/dev/null 2>&1; then- stage=/data/local/tmp/hakios-fdt- adb shell "su -c 'cat /sys/firmware/fdt > $stage && chmod 644 $stage'" >/dev/null 2>&1 || true- got=0; adb pull "$stage" "$tmp/fdt" >/dev/null 2>&1 || got=1- adb shell "su -c 'rm -f $stage'" >/dev/null 2>&1 || true- [ "$got" -eq 0 ] || { echo "pull-soc.sh: cannot read /sys/firmware/fdt over adb, with or without su"; exit 1; }-fi-# made aside and copied over, so that a failure leaves the soc.args that was there-python3 tools/soc-args.py "$tmp/fdt" > "$tmp/soc.args"-cp "$tmp/soc.args" "$here/soc.args"-cat "$here/soc.args"-echo "pull-soc.sh: wrote $here/soc.args"diff --git a/devices/redwood/soc.args b/devices/redwood/soc.argsdeleted file mode 100644index caa0b6b..0000000--- a/devices/redwood/soc.args+++ /dev/null@@ -1,16 +0,0 @@-soc_ipa_base=0x1e40000-soc_gsi_base=0x1e04000-soc_ipcc=0x408000-soc_aoss=0xc300000-soc_rsc=0x18220000-soc_apps_smmu=0x15000000-soc_cmd_db=0x80860000-soc_mpss_mem=0x8b800000-modem_ipa_fw_at=0x8b710000-soc_smem=0x80900000-soc_imem=0x14600000-soc_ipa_stream=0x480-soc_ipa_stream_uc=0x482-soc_pas_mpss=0x4-soc_pas_ipa=0xf-soc_ipa_fw=yupik_ipa_fwsdiff --git a/devices/redwood/tools/cellular_probe.py b/devices/redwood/tools/cellular_probe.pydeleted file mode 100755index a0e78d6..0000000--- a/devices/redwood/tools/cellular_probe.py+++ /dev/null@@ -1,133 +0,0 @@-#!/usr/bin/env python3-"""Read-only modem inventory from an FDT and, optionally, Android over ADB.--This is a discovery tool. It does not start MPSS or implement a cellular driver.-The output intentionally omits IMEI, IMSI, phone numbers and SIM identifiers.-"""--import argparse-import json-import pathlib-import struct-import subprocess--FDT_MAGIC = 0xD00DFEED-BEGIN_NODE, END_NODE, PROP, NOP, END = 1, 2, 3, 4, 9-KEYWORDS = ("modem", "mpss", "mss", "ipa", "qrtr", "glink", "smem", "smp2p", "remoteproc")-PROPERTY_NAMES = {"compatible", "status", "memory-region", "qcom,pas-id", "qcom,smem", "qcom,smem-id", "reg", "interrupts", "phandle", "linux,phandle"}-ANDROID_PROPERTIES = (- "ro.product.device", "ro.boot.hardware.sku", "ro.board.platform", "ro.boot.hardware", "ro.boot.baseband",- "gsm.version.baseband", "init.svc.vendor.qcrild", "init.svc.vendor.qcrild2",- "init.svc.vendor.qrtr-ns", "init.svc.vendor.ssgqmigd", "gsm.sim.state",-)---def fdt_nodes(data):- if len(data) < 40:- raise ValueError("DTB header is too short")- magic, total, off_struct, off_strings, _, version, _, _, size_strings, size_struct = struct.unpack_from(">10I", data)- if magic != FDT_MAGIC or version < 16 or total > len(data):- raise ValueError("invalid or unsupported DTB")- if off_struct + size_struct > total or off_strings + size_strings > total:- raise ValueError("DTB sections exceed file size")- strings = data[off_strings:off_strings + size_strings]- pos, limit, stack, indexes, nodes = off_struct, off_struct + size_struct, [], [], []- while pos + 4 <= limit:- token = struct.unpack_from(">I", data, pos)[0]- pos += 4- if token == BEGIN_NODE:- stop = data.find(b"\0", pos, limit)- if stop < 0:- raise ValueError("unterminated DTB node")- name = data[pos:stop].decode("ascii", "replace")- stack.append(name)- nodes.append({"path": "/" + "/".join(x for x in stack if x), "properties": {}})- indexes.append(len(nodes) - 1)- pos = (stop + 4) & ~3- elif token == END_NODE:- if not stack:- raise ValueError("unbalanced DTB nodes")- stack.pop()- indexes.pop()- elif token == PROP:- if pos + 8 > limit or not nodes or not stack:- raise ValueError("invalid DTB property")- length, nameoff = struct.unpack_from(">II", data, pos)- pos += 8- if pos + length > limit or nameoff >= len(strings):- raise ValueError("DTB property exceeds section")- name_end = strings.find(b"\0", nameoff)- if name_end < 0:- raise ValueError("unterminated DTB property name")- name = strings[nameoff:name_end].decode("ascii", "replace")- if name in PROPERTY_NAMES:- raw = data[pos:pos + length]- if name in ("compatible", "status"):- value = [x.decode("ascii", "replace") for x in raw.rstrip(b"\0").split(b"\0")]- else:- value = raw.hex()- nodes[indexes[-1]]["properties"][name] = value- pos = (pos + length + 3) & ~3- elif token == NOP:- continue- elif token == END:- if stack:- raise ValueError("unclosed DTB nodes")- return nodes- else:- raise ValueError(f"invalid DTB token {token}")- raise ValueError("DTB has no end token")---def modem_nodes(data):- nodes = fdt_nodes(data)- return [node for node in nodes if any(- word in (node["path"].rsplit("/", 1)[-1] + " " + " ".join(node["properties"].get("compatible", []))).lower()- for word in KEYWORDS- )]---def adb_call(serial, *args):- command = ["adb"] + (["-s", serial] if serial else []) + list(args)- result = subprocess.run(command, capture_output=True, text=True, timeout=15, check=False)- if result.returncode:- raise RuntimeError(result.stderr.strip() or f"adb exited {result.returncode}")- return result.stdout.strip()---def android_inventory(serial):- devices = [line.split()[0] for line in adb_call(None, "devices").splitlines()[1:]- if len(line.split()) >= 2 and line.split()[1] == "device"]- if serial is None:- if len(devices) != 1:- raise RuntimeError(f"expected one authorized Android device, found {len(devices)}; use --serial")- serial = devices[0]- elif serial not in devices:- raise RuntimeError(f"Android device {serial!r} is not authorized or connected")- properties = {key: adb_call(serial, "shell", "getprop", key) for key in ANDROID_PROPERTIES}- subsystem_lines = adb_call(serial, "shell", "for d in /sys/bus/msm_subsys/devices/subsys*; do "- "[ -r \"$d/name\" ] && [ -r \"$d/state\" ] && "- "printf '%s:%s\\n' \"$(cat \"$d/name\")\" \"$(cat \"$d/state\")\"; done")- subsystems = dict(line.split(":", 1) for line in subsystem_lines.splitlines() if ":" in line)- interfaces = adb_call(serial, "shell", "ls", "/sys/class/net").split()- return {"properties": properties, "subsystems": subsystems,- "cellular_interfaces": [name for name in interfaces if name.startswith(("rmnet", "wwan", "ipa"))]}---def main():- parser = argparse.ArgumentParser(description=__doc__)- parser.add_argument("--dtb", type=pathlib.Path, default=pathlib.Path(__file__).resolve().parents[1] / "prebuilt/device-tree.dtb")- parser.add_argument("--adb", action="store_true", help="also query a connected Android phone without changing it")- parser.add_argument("--serial", help="ADB serial when more than one phone is connected")- args = parser.parse_args()- try:- report = {"dtb": str(args.dtb), "modem_related_nodes": modem_nodes(args.dtb.read_bytes())}- if args.adb:- report["android"] = android_inventory(args.serial)- except (OSError, ValueError, RuntimeError, subprocess.TimeoutExpired) as error:- parser.exit(1, f"cellular_probe: {error}\n")- print(json.dumps(report, ensure_ascii=False, indent=2))---if __name__ == "__main__":- main()diff --git a/devices/redwood/tools/modem_firmware.py b/devices/redwood/tools/modem_firmware.pydeleted file mode 100755index e93825a..0000000--- a/devices/redwood/tools/modem_firmware.py+++ /dev/null@@ -1,88 +0,0 @@-#!/usr/bin/env python3-"""Validate a Qualcomm MDT firmware set against a device tree modem region.--This is an offline check. It does not authenticate, start, or contact the modem.-"""--import argparse-import json-import pathlib-import struct--from cellular_probe import fdt_nodes---def cell(prop):- raw = bytes.fromhex(prop)- if len(raw) != 4:- raise ValueError("expected one 32-bit device tree cell")- return struct.unpack(">I", raw)[0]---def inspect(dtb_path, firmware_dir, node_path):- nodes = fdt_nodes(dtb_path.read_bytes())- by_path = {node["path"]: node for node in nodes}- if node_path not in by_path:- raise ValueError(f"modem node {node_path} is absent")- props = by_path[node_path]["properties"]- if "memory-region" not in props or "qcom,pas-id" not in props:- raise ValueError("modem node lacks memory-region or qcom,pas-id")- memory_phandle = cell(props["memory-region"])- matches = [node for node in nodes if any(- cell(node["properties"][name]) == memory_phandle- for name in ("phandle", "linux,phandle") if name in node["properties"])]- if len(matches) != 1:- raise ValueError(f"memory-region phandle {memory_phandle:#x} is not unique")- region = matches[0]- raw_reg = bytes.fromhex(region["properties"].get("reg", ""))- if len(raw_reg) != 16:- raise ValueError("expected a two-cell base and size for modem reserved memory")- base, size = struct.unpack(">QQ", raw_reg)- if size == 0:- raise ValueError("empty modem reserved memory")-- header = (firmware_dir / "modem.mdt").read_bytes()- if len(header) < 52 or header[:5] != b"\x7fELF\x01" or header[5] != 1:- raise ValueError("modem.mdt is not little-endian ELF32")- program_offset = struct.unpack_from("<I", header, 28)[0]- entry_size, count = struct.unpack_from("<HH", header, 42)- if entry_size != 32 or not 1 <= count <= 128 or program_offset + count * entry_size > len(header):- raise ValueError("invalid program header table")- segments = []- total = 0- for index in range(count):- kind, _, _, address, file_size, memory_size, flags, _ = struct.unpack_from(- "<8I", header, program_offset + index * entry_size)- if kind != 1 or (flags >> 24) & 7 == 2 or memory_size == 0:- continue- if file_size > memory_size or address < base or address + memory_size > base + size:- raise ValueError(f"segment {index} exceeds the modem reserved memory")- name = f"modem.b{index:02d}"- if file_size:- actual = (firmware_dir / name).stat().st_size- if actual != file_size:- raise ValueError(f"{name}: {actual} bytes, expected {file_size}")- total += actual- segments.append({"index": index, "address": address, "file_bytes": file_size,- "memory_bytes": memory_size})- if not segments or min(item["address"] for item in segments) != base:- raise ValueError("firmware has no segments starting at the modem memory base")- return {"modem_node": node_path, "memory_node": region["path"], "memory_base": base,- "memory_size": size, "pas_id": cell(props["qcom,pas-id"]), "program_headers": count,- "loadable_segments": len(segments), "file_bytes": total, "segments": segments}---def main():- parser = argparse.ArgumentParser(description=__doc__)- parser.add_argument("--dtb", type=pathlib.Path, required=True)- parser.add_argument("--firmware-dir", type=pathlib.Path, required=True)- parser.add_argument("--node", required=True, help="modem remoteproc node in this device's DTB")- args = parser.parse_args()- try:- print(json.dumps(inspect(args.dtb, args.firmware_dir, args.node), indent=2))- except (OSError, ValueError) as error:- parser.exit(1, f"modem_firmware: {error}\n")---if __name__ == "__main__":- main()diff --git a/devices/redwood/uefi/README.md b/devices/redwood/uefi/README.mddeleted file mode 100644index 8e69a39..0000000--- a/devices/redwood/uefi/README.md+++ /dev/null@@ -1,17 +0,0 @@-# UEFI for redwood--The POCO X5 Pro 5G's platform for HakiOS's UEFI (`uefi/` of the common repository: Mu-Silicium with HakiOS's changes and banner).-It is modelled on `lisa` (the same `KodiakPkg` SoC package).--What is here, in `files/`:--- `Platforms/Xiaomi/redwoodPkg`: the memory map and the driver list;-- `Resources/Configs/redwood.toml`, `Resources/DTBs/redwood.dtb` (the device tree from the phone's vendor_boot);-- `Binaries/redwood`: the vendor's UEFI drivers, **not tracked**: you make this directory yourself from your own phone- (`uefi/README.md` says how); `files/Binaries/redwood/README.md` is kept: it lists the patches that were applied to them.--```sh-devices/redwood/uefi/apply.sh # = uefi/apply.sh redwood-```--The build and the vendor's drivers: [uefi/README.md](../../../uefi/README.md).diff --git a/devices/redwood/uefi/apply.sh b/devices/redwood/uefi/apply.shdeleted file mode 100755index f3b3926..0000000--- a/devices/redwood/uefi/apply.sh+++ /dev/null@@ -1,4 +0,0 @@-#!/bin/bash-# The redwood platform on HakiOS's UEFI: uefi/apply.sh (Mu-Silicium with HakiOS's changes and banner), with this phone's-# platform from files/ here. See README.md here for the vendor's drivers and the build.-exec "$(dirname "$(readlink -f "$0")")/../../../uefi/apply.sh" redwooddiff --git a/devices/redwood/uefi/export.sh b/devices/redwood/uefi/export.shdeleted file mode 100755index d75e70a..0000000--- a/devices/redwood/uefi/export.sh+++ /dev/null@@ -1,13 +0,0 @@-#!/bin/bash-# Save the redwood platform from Mu-Silicium/ into files/ here (uefi/export.sh runs this; HakiOS's own changes are uefi/'s).-set -e-cd "$(dirname "$(readlink -f "$0")")"-MU=${MU:-../../../Mu-Silicium}-rm -rf files-mkdir -p files/Resources/Configs files/Resources/DTBs files/Platforms/Xiaomi files/Binaries-cp -r $MU/Platforms/Xiaomi/redwoodPkg files/Platforms/Xiaomi/-cp $MU/Resources/Configs/redwood.toml files/Resources/Configs/-cp $MU/Resources/DTBs/redwood.dtb files/Resources/DTBs/-cp -r $MU/Binaries/redwood files/Binaries/-find files -name __pycache__ -prune -exec rm -rf {} +-echo "devices/redwood/uefi/export.sh: $(find files -type f | wc -l) files"diff --git a/devices/redwood/uefi/files/Binaries/redwood/README.md b/devices/redwood/uefi/files/Binaries/redwood/README.mddeleted file mode 100644index 15a8cbe..0000000--- a/devices/redwood/uefi/files/Binaries/redwood/README.md+++ /dev/null@@ -1,37 +0,0 @@-## Firmware Infos--- **Device:** POCO X5 Pro 5G (redwood)-- **Region:** Global-- **Version:** `OS1.0.3.0.UMSMIXM` / `BOOT.MXF.1.0-00852-LAHAINA-2.12801.8`--## Patches/Fixes--### ButtonsDxe:--- **Reason:** To make the Power Button usable in UEFI.-- **Patch:** The Special Qcom Key Code (`0x102`) has been Changed to the Key Code Enter (`0xD`).-- **Patch Creator:** [Gustave Monce](https://github.com/gus33000)--### DALSYSDxe:--- **Reason:** To avoid Mismatched Cached Copies.-- **Patch:** Enabled Cache Coherence for UFS.-- **Patch Creator:** [Gustave Monce](https://github.com/gus33000)--### TzDxeLA:--- **Reason:** To make UEFI not Crash during UEFI Boot.-- **Patch:** The Global TZ Applet Variable has been Changed to `TRUE` from `FALSE`.-- **Patch Creator:** [N1kroks](https://github.com/N1kroks/)--### UsbConfigDxe:--- **Reason:** To make USB work in the OS.-- **Patch:** The USB Deinit Code has been Removed from Exit Boot Services Event to allow the OS to continue using the USB Port.-- **Patch Creator:** [Gustave Monce](https://github.com/gus33000)--### UsbMsdDxe:--- **Reason:** To make the Internal Storage be recognised as Hard Drives instead of USB Drives in Mass Storage.-- **Patch:** Changed Removable State to Non-Removable.-- **Patch Creator:** [N1kroks](https://github.com/N1kroks)diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.pydeleted file mode 100644index 2b56dd4..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/DeviceBuild.py+++ /dev/null@@ -1,204 +0,0 @@-##-# Copyright (c) Microsoft Corporation.-# SPDX-License-Identifier: BSD-2-Clause-Patent-##--import datetime-import logging-import os-import uuid--from io import StringIO-from pathlib import Path--from edk2toolext.environment import shell_environment-from edk2toolext.environment.uefi_build import UefiBuilder-from edk2toolext.invocables.edk2_platform_build import BuildSettingsManager-from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager-from edk2toolext.invocables.edk2_setup import (RequiredSubmodule, SetupSettingsManager)-from edk2toolext.invocables.edk2_update import UpdateSettingsManager-from edk2toolext.invocables.edk2_parse import ParseSettingsManager-from edk2toollib.utility_functions import RunCmd--# ####################################################################################### #-# Common Configuration #-# ####################################################################################### #-class CommonPlatform ():- PackagesSupported = ("redwoodPkg")- ArchSupported = ("AARCH64")- TargetsSupported = ("DEBUG", "RELEASE")- Scopes = ('redwood', 'gcc_aarch64_linux', 'edk2-build')- WorkspaceRoot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))- PackagesPath = (- "Platforms/Xiaomi",- "Common/Mu",- "Common/Mu_OEM_Sample",- "Mu_Basecore",- "Silicon/Qualcomm",- "Silicon/Silicium",- "Silicium-ACPI",- "Silicium-ACPI/Platforms/Xiaomi",- "Silicium-ACPI/Silicon/Qualcomm"- )--# ####################################################################################### #-# Configuration for Update & Setup #-# ####################################################################################### #-class SettingsManager (UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager, ParseSettingsManager):-- def GetPackagesSupported (self):- return CommonPlatform.PackagesSupported-- def GetArchitecturesSupported (self):- return CommonPlatform.ArchSupported-- def GetTargetsSupported (self):- return CommonPlatform.TargetsSupported-- def GetRequiredSubmodules (self):- return [- RequiredSubmodule ("Binaries", True),- RequiredSubmodule ("Common/Mu", True),- RequiredSubmodule ("Common/Mu_OEM_Sample", True),- RequiredSubmodule ("Mu_Basecore", True),- RequiredSubmodule ("Silicium-ACPI", True),- RequiredSubmodule ("Silicon/Silicium/OpensslPkg/Library/OpensslLib/openssl", True)- ]-- def SetArchitectures (self, list_of_requested_architectures):- unsupported = set(list_of_requested_architectures) - set(self.GetArchitecturesSupported())-- if (len(unsupported) > 0):- errorString = ("Unsupported Architecture Requested: " + " ".join(unsupported))- logging.critical (errorString)- raise Exception (errorString)-- self.ActualArchitectures = list_of_requested_architectures-- def GetWorkspaceRoot (self):- return CommonPlatform.WorkspaceRoot-- def GetActiveScopes (self):- return CommonPlatform.Scopes-- def FilterPackagesToTest (self, changedFilesList: list, potentialPackagesList: list) -> list:- build_these_packages = []- possible_packages = potentialPackagesList.copy ()-- for f in changedFilesList:- if "BaseTools" in f:- if os.path.splitext(f) not in [".txt", ".md"]:- build_these_packages = possible_packages- break-- if "platform-build-run-steps.yml" in f:- build_these_packages = possible_packages- break-- return build_these_packages-- def GetPlatformDscAndConfig (self) -> tuple:- return ("redwoodPkg/redwood.dsc", {})-- def GetName (self):- return "redwood"-- def GetPackagesPath (self):- return CommonPlatform.PackagesPath--# ####################################################################################### #-# Actual Configuration for Platform Build #-# ####################################################################################### #-class PlatformBuilder (UefiBuilder, BuildSettingsManager):- def __init__ (self):- UefiBuilder.__init__ (self)-- def AddCommandLineOptions (self, parserObj):- parserObj.add_argument('-a', "--arch", dest="build_arch", type=str, default="AARCH64", help="Optional - CSV of architecture to build. AARCH64 is used for PEI and DXE and is the only valid option for this platform.")-- def RetrieveCommandLineOptions (self, args):- if args.build_arch.upper() != "AARCH64":- raise Exception("Invalid Arch Specified. Please see comments in DeviceBuild.py::PlatformBuilder::AddCommandLineOptions")-- def GetWorkspaceRoot (self):- return CommonPlatform.WorkspaceRoot-- def GetPackagesPath (self):- result = [ shell_environment.GetBuildVars().GetValue("FEATURE_CONFIG_PATH", "") ]-- for a in CommonPlatform.PackagesPath:- result.append(a)-- return result-- def GetActiveScopes (self):- return CommonPlatform.Scopes-- def GetName (self):- return "redwoodPkg"-- def GetLoggingLevel (self, loggerType):- return logging.INFO- return super().GetLoggingLevel(loggerType)-- def SetPlatformEnv (self):- logging.debug ("PlatformBuilder SetPlatformEnv")-- self.env.SetValue ("PRODUCT_NAME", "redwood", "Platform Hardcoded")- self.env.SetValue ("ACTIVE_PLATFORM", "redwoodPkg/redwood.dsc", "Platform Hardcoded")- self.env.SetValue ("TARGET_ARCH", "AARCH64", "Platform Hardcoded")- self.env.SetValue ("TOOL_CHAIN_TAG", "CLANGPDB", "set default to clangpdb")- self.env.SetValue ("EMPTY_DRIVE", "FALSE", "Default to false")- self.env.SetValue ("RUN_TESTS", "FALSE", "Default to false")- self.env.SetValue ("SHUTDOWN_AFTER_RUN", "FALSE", "Default to false")- self.env.SetValue ("BLD_*_BUILDID_STRING", "Unknown", "Default")- self.env.SetValue ("BUILDREPORTING", "TRUE", "Enabling build report")- self.env.SetValue ("BUILDREPORT_TYPES", "PCD DEPEX FLASH BUILD_FLAGS LIBRARY FIXED_ADDRESS HASH", "Setting build report types")- self.env.SetValue ("BLD_*_MEMORY_PROTECTION", "TRUE", "Default")- self.env.SetValue ("BLD_*_SHIP_MODE", "FALSE", "Default")- self.env.SetValue ("BLD_*_ENABLE_SECUREBOOT", self.env.GetValue("ENABLE_SECUREBOOT"), "Default")- self.env.SetValue ("BLD_*_FD_BASE", self.env.GetValue("FD_BASE"), "Default")- self.env.SetValue ("BLD_*_FD_SIZE", self.env.GetValue("FD_SIZE"), "Default")- self.env.SetValue ("BLD_*_FD_BLOCKS", self.env.GetValue("FD_BLOCKS"), "Default")-- return 0-- def PlatformPreBuild (self):- return 0-- def PlatformPostBuild (self):- return 0-- def FlashRomImage (self):- return 0--if __name__ == "__main__":- import argparse- import sys-- from edk2toolext.invocables.edk2_platform_build import Edk2PlatformBuild- from edk2toolext.invocables.edk2_setup import Edk2PlatformSetup- from edk2toolext.invocables.edk2_update import Edk2Update-- SCRIPT_PATH = os.path.relpath (__file__)-- parser = argparse.ArgumentParser (add_help=False)-- parse_group = parser.add_mutually_exclusive_group()-- parse_group.add_argument ("--update", "--UPDATE", action='store_true', help="Invokes stuart_update")- parse_group.add_argument ("--setup", "--SETUP", action='store_true', help="Invokes stuart_setup")-- args, remaining = parser.parse_known_args()-- new_args = ["stuart", "-c", SCRIPT_PATH]- new_args = new_args + remaining-- sys.argv = new_args-- if args.setup:- Edk2PlatformSetup().Invoke()- elif args.update:- Edk2Update().Invoke()- else:- Edk2PlatformBuild().Invoke()diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/APRIORI.inc b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/APRIORI.incdeleted file mode 100644index ffd79bf..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/APRIORI.inc+++ /dev/null@@ -1,107 +0,0 @@-APRIORI DXE {- INF MdeModulePkg/Core/Dxe/DxeMain.inf- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf-- INF Binaries/redwood/QcomPkg/Drivers/EnvDxe/EnvDxe.inf-- INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf- INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/SmemDxe/SmemDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/DALSYSDxe/DALSYSDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/HWIODxe/HWIODxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ChipInfoDxe/ChipInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ProjectInfoDxe/ProjectInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/HALIOMMUDxe/HALIOMMUDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ULogDxe/ULogDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/CmdDbDxe/CmdDbDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PwrUtilsDxe/PwrUtilsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/NpaDxe/NpaDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/RpmhDxe/RpmhDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/VcsDxe/VcsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ClockDxe/ClockDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ICBDxe/ICBDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ShmBridgeDxe/ShmBridgeDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/TzDxe/ScmDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/TLMMDxe/TLMMDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/SPMIDxe/SPMIDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/I2CDxe/I2CDxe.inf-- INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/PmicDxe/PmicDxeLa.inf-- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/SdccDxe/SdccDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UFSDxe/UFSDxe.inf-- INF FatPkg/EnhancedFatDxe/Fat.inf-- INF Binaries/redwood/QcomPkg/Drivers/TzDxe/TzDxeLA.inf-- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/DDRInfoDxe/DDRInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/FeatureEnablerDxe/FeatureEnablerDxe.inf--!if $(USE_CUSTOM_DISPLAY_DRIVER) == 1- INF Binaries/redwood/QcomPkg/Drivers/DisplayDxe/DisplayDxe.inf-!else- INF SiliciumPkg/Drivers/SimpleFbDxe/SimpleFbDxe.inf-!endif-- INF Binaries/redwood/QcomPkg/Drivers/PILProxyDxe/PILProxyDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PILDxe/PILDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/IPCCDxe/IPCCDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/GLinkDxe/GLinkDxe.inf-!if $(USE_CUSTOM_DISPLAY_DRIVER) == 1- INF Binaries/redwood/QcomPkg/Drivers/CPRDxe/CPRDxe.inf-!endif-- INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf- INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf- INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf- INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/SPIDxe/SPIDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PmicGlinkDxe/PmicGlinkDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbPwrCtrlDxe/UsbPwrCtrlDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/QcomChargerDxe/QcomChargerDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/ChargerExDxe/ChargerExDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbfnDwc3Dxe/UsbfnDwc3Dxe.inf- INF Binaries/redwood/QcomPkg/Drivers/XhciPciEmulationDxe/XhciPciEmulationDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/XhciDxe/XhciDxe.inf-- INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf- INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf- INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/UsbMsdDxe/UsbMsdDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbConfigDxe/UsbConfigDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ButtonsDxe/ButtonsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/TsensDxe/TsensDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/LimitsDxe/LimitsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/GpiDxe/GpiDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UCDxe/UCDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/RNGDxe/RngDxe.inf-- INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf-}diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/DXE.inc b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/DXE.incdeleted file mode 100644index 35b9500..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/DXE.inc+++ /dev/null@@ -1,100 +0,0 @@- INF MdeModulePkg/Core/Dxe/DxeMain.inf- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf-- INF Binaries/redwood/QcomPkg/Drivers/EnvDxe/EnvDxe.inf-- INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf- INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/ShmBridgeDxe/ShmBridgeDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/TzDxe/ScmDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/TzDxe/TzDxeLA.inf-- INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf- INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf- INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/ChipInfoDxe/ChipInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ProjectInfoDxe/ProjectInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/DALSYSDxe/DALSYSDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/HALIOMMUDxe/HALIOMMUDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/HWIODxe/HWIODxe.inf-- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf- INF FatPkg/EnhancedFatDxe/Fat.inf- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/ClockDxe/ClockDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/SdccDxe/SdccDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/I2CDxe/I2CDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/SPMIDxe/SPMIDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/TLMMDxe/TLMMDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PmicDxe/PmicDxeLa.inf- INF Binaries/redwood/QcomPkg/Drivers/UFSDxe/UFSDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/CmdDbDxe/CmdDbDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PwrUtilsDxe/PwrUtilsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/RpmhDxe/RpmhDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/NpaDxe/NpaDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ULogDxe/ULogDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/VcsDxe/VcsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ICBDxe/ICBDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/SmemDxe/SmemDxe.inf- INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf- INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf- INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf--!if $(USE_CUSTOM_DISPLAY_DRIVER) == 1- INF Binaries/redwood/QcomPkg/Drivers/CPRDxe/CPRDxe.inf-!endif- INF Binaries/redwood/QcomPkg/Drivers/GpiDxe/GpiDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/SPIDxe/SPIDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/FeatureEnablerDxe/FeatureEnablerDxe.inf--!if $(USE_CUSTOM_DISPLAY_DRIVER) == 1- INF Binaries/redwood/QcomPkg/Drivers/DisplayDxe/DisplayDxe.inf-!else- INF SiliciumPkg/Drivers/SimpleFbDxe/SimpleFbDxe.inf-!endif-- INF Binaries/redwood/QcomPkg/Drivers/ButtonsDxe/ButtonsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/ChargerExDxe/ChargerExDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/IPCCDxe/IPCCDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/GLinkDxe/GLinkDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PmicGlinkDxe/PmicGlinkDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/QcomChargerDxe/QcomChargerDxeLA.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbPwrCtrlDxe/UsbPwrCtrlDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/TsensDxe/TsensDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/LimitsDxe/LimitsDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/DDRInfoDxe/DDRInfoDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbfnDwc3Dxe/UsbfnDwc3Dxe.inf- INF Binaries/redwood/QcomPkg/Drivers/XhciPciEmulationDxe/XhciPciEmulationDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/XhciDxe/XhciDxe.inf-- INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf- INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf- INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf-- INF Binaries/redwood/QcomPkg/Drivers/UsbMsdDxe/UsbMsdDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbConfigDxe/UsbConfigDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UsbInitDxe/UsbInitDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/UCDxe/UCDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/RNGDxe/RngDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PILDxe/PILDxe.inf- INF Binaries/redwood/QcomPkg/Drivers/PILProxyDxe/PILProxyDxe.infdiff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/RAW.inc b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/RAW.incdeleted file mode 100644index d429a45..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Include/RAW.inc+++ /dev/null@@ -1,166 +0,0 @@- FILE FREEFORM = A1E235DE-E825-4591-9623-C43175811826 {- SECTION UI = "SecParti.cfg"- SECTION RAW = Binaries/redwood/RawFiles/SecParti.cfg- }-- FILE FREEFORM = 21E9BDD9-6C3F-4F10-84A5-BBEC322741F1 {- SECTION UI = "uefipil.cfg"- SECTION RAW = Binaries/redwood/RawFiles/uefipil.cfg- }--!if $(USE_CUSTOM_DISPLAY_DRIVER) == 1- FILE FREEFORM = 8CAE2C55-FC5A-410B-812B-8CA22F572F36 {- SECTION UI = "Panel_truly_wqxga_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_wqxga_dsc_cmd.xml- }-- FILE FREEFORM = 13AC9DC9-0092-4374-AE1A-06FF35950FD0 {- SECTION UI = "Panel_truly_wqxga_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_wqxga_dsc_vid.xml- }-- FILE FREEFORM = FC6315F9-F8FE-4222-A1E3-226DF55D7592 {- SECTION UI = "Panel_truly_wqxga_dual_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_wqxga_dual_cmd.xml- }-- FILE FREEFORM = 95E7B040-26A2-4511-9ABB-1D95D6DA7082 {- SECTION UI = "Panel_truly_wqxga_dual_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_wqxga_dual_vid.xml- }-- FILE FREEFORM = 8BC595B7-391A-4A9A-8256-5B9983B30392 {- SECTION UI = "Panel_sharp_4k_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_sharp_4k_dsc_cmd.xml- }-- FILE FREEFORM = 19B58ACD-B1F8-4078-B9A5-A33584B680E2 {- SECTION UI = "Panel_sharp_4k_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_sharp_4k_dsc_vid.xml- }-- FILE FREEFORM = 9601EEEE-A8A3-4830-9C1B-EEB7440F566C {- SECTION UI = "Panel_K9D_36_02_0a_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_K9D_36_02_0a_amoled_dsc_cmd.xml- }-- FILE FREEFORM = DD66FE9B-CE71-40B7-AC3A-F3F950ABAF5F {- SECTION UI = "Panel_K9D_42_0d_0b_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_K9D_42_0d_0b_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 1D790C01-DC9F-4C53-ABC3-4C9DE4AC4B9D {- SECTION UI = "Panel_K9B_42_02_0a_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_K9B_42_02_0a_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 246C6105-BF46-4953-821A-C4C873781780 {- SECTION UI = "Panel_K9E_42_02_0a_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_K9E_42_02_0a_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 2E058E2E-1C30-415A-8A49-BBE517DE73A3 {- SECTION UI = "Panel_K9E_35_02_0b_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_K9E_35_02_0b_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 7372316C-C2E9-414F-B7FA-1884ABB80830 {- SECTION UI = "Panel_L9_42_02_0a_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_L9_42_02_0a_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 8397BAC4-FE69-11EC-9F40-23333AA31BF8 {- SECTION UI = "Panel_M20_36_02_0a_amoled_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_M20_36_02_0a_amoled_dsc_vid.xml- }-- FILE FREEFORM = 6546055D-AD36-48A9-9F8D-B3CA2E895D4A {- SECTION UI = "Panel_M20_42_0d_0b_amoled_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_M20_42_0d_0b_amoled_dsc_vid.xml- }-- FILE FREEFORM = 76D0C92F-FF79-4800-919E-B6CE7695F269 {- SECTION UI = "Panel_L9_36_02_0b_amoled_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_L9_36_02_0b_amoled_dsc_cmd.xml- }-- FILE FREEFORM = 62AD1E9F-7964-42F1-BF31-01AD9A71EB53 {- SECTION UI = "Panel_primary_sim_vdo.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_primary_sim_vdo.xml- }-- FILE FREEFORM = 0AE323D6-2EBE-11E8-8349-9BA636A0D80C {- SECTION UI = "Panel_sharp_1080p_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_sharp_1080p_cmd.xml- }-- FILE FREEFORM = 87273B42-311D-11E8-9324-DFB2DADFC3D1 {- SECTION UI = "Panel_truly_1080p_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_1080p_cmd.xml- }-- FILE FREEFORM = BAFD3200-311D-11E8-8651-0FB3CACF38FB {- SECTION UI = "Panel_truly_1080p_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_truly_1080p_vid.xml- }-- FILE FREEFORM = 88CA5ABF-D0AC-4093-A68C-0CFAE1EF9635 {- SECTION UI = "Panel_boe_amoled_wqhd_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_boe_amoled_wqhd_dsc_cmd.xml- }-- FILE FREEFORM = 6523A5C9-91CB-45C0-A2DC-25997CF23369 {- SECTION UI = "Panel_boe_amoled_wqhd_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_boe_amoled_wqhd_dsc_vid.xml- }-- FILE FREEFORM = D7170685-5965-4B44-9305-37CDB199B9BE {- SECTION UI = "Panel_boe_amoled_fhd_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_boe_amoled_fhd_dsc_cmd.xml- }-- FILE FREEFORM = 8F276EE4-E75E-4C3B-8BCC-C37771E26478 {- SECTION UI = "Panel_nt36860_wqhd_dsc_cmd.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_nt36860_wqhd_dsc_cmd.xml- }-- FILE FREEFORM = 6F2D4884-D8A0-11E9-AF7A-D77B1FE990EC {- SECTION UI = "Panel_nt36860_wqhd_dsc_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_nt36860_wqhd_dsc_vid.xml- }-- FILE FREEFORM = D7170685-5965-4B44-9305-37CDB199B9BF {- SECTION UI = "Panel_nt36672e_fhd_plus_60hz_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_nt36672e_fhd_plus_60hz_vid.xml- }-- FILE FREEFORM = 8F276EE4-E75E-4C3B-8BCC-C37771E26479 {- SECTION UI = "Panel_nt36672e_fhd_plus_120hz_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_nt36672e_fhd_plus_120hz_vid.xml- }-- FILE FREEFORM = 6F2D4884-D8A0-11E9-AF7A-D77B1FE990ED {- SECTION UI = "Panel_nt36672e_fhd_plus_144hz_vid.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_nt36672e_fhd_plus_144hz_vid.xml- }-- FILE FREEFORM = 9874B60A-6B80-4D76-8EEB-7862C780EC03 {- SECTION UI = "Panel_r66451_144hz_fhd_plus_dsc_cmd_cphy.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_r66451_144hz_fhd_plus_dsc_cmd_cphy.xml- }-- FILE FREEFORM = 0256CEAF-99CF-49F4-A9C8-D9F1755A5E6C {- SECTION UI = "Panel_r66451_120hz_fhd_plus_dsc_cmd_cphy.xml"- SECTION RAW = Binaries/redwood/RawFiles/Panel_r66451_120hz_fhd_plus_dsc_cmd_cphy.xml- }-!endif-- FILE FREEFORM = 45FE4B7C-150C-45DA-A021-4BEB2048EC6F {- SECTION UI = "QcomChargerCfg.cfg"- SECTION RAW = Binaries/redwood/RawFiles/QcomChargerCfg.cfg- }-- FILE FREEFORM = F780C779-DD7C-47CD-BD1A-5EB414C51704 {- SECTION UI = "BATTERY.PROVISION"- SECTION RAW = Binaries/redwood/RawFiles/BATTERY.PROVISION- }diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.c b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.cdeleted file mode 100644index d812a5f..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.c+++ /dev/null@@ -1,57 +0,0 @@-#include <Library/ConfigurationMapLib.h>--STATIC-EFI_CONFIGURATION_ENTRY_DESCRIPTOR-gConfigurationDescriptor[] = {- // Configuration Map- {"NumCpusFuseAddr", 0x5C04C},- {"EnableShell", 0x1},- {"InitialPagePoolCount", 0x700},- {"SharedIMEMBaseAddr", 0x146AA000},- {"DloadCookieAddr", 0x01FD3000},- {"DloadCookieValue", 0x10},- {"NumCpus", 8},- {"NumActiveCores", 8},- {"MaxLogFileSize", 0x400000},- {"UefiMemUseThreshold", 0xE1},- {"USBHS1_Config", 0x0},- {"UsbFnIoRevNum", 0x00010001},- {"PwrBtnShutdownFlag", 0x0},- {"Sdc1GpioConfigOn", 0x1E92},- {"Sdc2GpioConfigOn", 0x1E92},- {"Sdc1GpioConfigOff", 0xA00},- {"Sdc2GpioConfigOff", 0xA00},- {"EnableSDHCSwitch", 0x1},- {"EnableUfsIOC", 1},- {"UfsSmmuConfigForOtherBootDev", 1},- {"UEFIExitUfsSSURequired", 1},- {"SecurityFlag", 0xC4},- {"DetectRetailUserAttentionHotkey", 0x00},- {"DetectRetailUserAttentionHotkeyCode", 0x17},- {"EnableOEMSetupAppInRetail", 0x0},- {"EnableLogFsSyncInRetail", 0x1},- {"ShmBridgememSize", 0xA00000},- {"EnableMultiThreading", 1},- {"MaxCoreCnt", 8},- {"EarlyInitCoreCnt", 2},- {"EnableUefiSecAppDebugLogDump", 0x0},- {"AllowNonPersistentVarsInRetail", 0x1},- {"EnableDisplayThread", 0x0},- {"EnableDisplayImageFv", 0x1},- {"DDRInfoNotifyFlag", 0x0},- {"EnableVariablePolicyEngine", 0},- {"EnableACPIFallback", 0x0},- {"EnableMultiCoreFvDecompression", 1},- {"EUDEnableAddr", 0x88E2000},- {"MinidumpTALoadingCfg", 0x0}-};--VOID-GetConfigurationMap (- OUT EFI_CONFIGURATION_ENTRY_DESCRIPTOR **ConfigurationDescriptor,- OUT UINT8 *ConfigurationDescriptorCount)-{- // Pass Data- *ConfigurationDescriptor = gConfigurationDescriptor;- *ConfigurationDescriptorCount = ARRAY_SIZE (gConfigurationDescriptor);-}diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.inf b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.infdeleted file mode 100644index 780dbd4..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.inf+++ /dev/null@@ -1,14 +0,0 @@-[Defines]- INF_VERSION = 0x00010005- BASE_NAME = ConfigurationMapLib- FILE_GUID = 5F4798D0-24A3-4519-B4D5-AEE08C3EAAB3- MODULE_TYPE = BASE- VERSION_STRING = 1.0- LIBRARY_CLASS = ConfigurationMapLib--[Sources]- ConfigurationMapLib.c--[Packages]- MdePkg/MdePkg.dec- QcomPkg/QcomPkg.decdiff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.c b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.cdeleted file mode 100644index b902cd4..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.c+++ /dev/null@@ -1,78 +0,0 @@-#include <Library/MemoryMapLib.h>--STATIC-EFI_MEMORY_REGION_DESCRIPTOR-gMemoryDescriptor[] = {- // Name, Address, Length, HobOption, ResourceType, ResourceAttribute, MemoryType, ArmAttribute-- // DDR Regions- {"HYP", 0x80000000, 0x00600000, AddMem, MEM_RES, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},- {"AOP CMD", 0x80600000, 0x00260000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"AOP CMD DB", 0x80860000, 0x00020000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"Reserved", 0x80880000, 0x00004000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"XBL Log Buffer", 0x80884000, 0x00010000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},- {"GPU PRR", 0x80894000, 0x00001000, AddMem, MEM_RES, WRITE_COMBINEABLE, Reserv, UNCACHED_UNBUFFERED_XN },- {"TPMControl", 0x808A4000, 0x00010000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"APSS", 0x808FF000, 0x00001000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK_XN},- {"SMEM", 0x80900000, 0x00200000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"CPUCP", 0x80B00000, 0x00100000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"WLAN FW", 0x80C00000, 0x00C00000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"CDSP Secure Heap", 0x81800000, 0x01E00000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"Sched Heap", 0x83600000, 0x00400000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK_XN},- {"PIL Reserved", 0x85300000, 0x19300000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"FV Region", 0x9F800000, 0x00200000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK_XN},- {"ABOOT FV", 0x9FA00000, 0x00200000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},- {"FD Reserved", 0x9FC00000, 0x00100000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK},- {"UEFI FD", 0x9FD00000, 0x00200000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK},- {"SEC Heap", 0x9FF00000, 0x0008C000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK_XN},- {"MMU PageTables", 0x9FF8D000, 0x00003000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK_XN},- {"UEFI Stack", 0x9FF90000, 0x00040000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK_XN},- {"Log Buffer", 0x9FFF7000, 0x00008000, AddMem, SYS_MEM, SYS_MEM_CAP, RtData, WRITE_BACK_XN},- {"Info Blk", 0x9FFFF000, 0x00001000, AddMem, SYS_MEM, SYS_MEM_CAP, RtData, WRITE_BACK_XN},- {"USB UCSI Temp", 0xA0000000, 0x00002000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"MPSS_EFS", 0xA0800000, 0x00300000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"HYP RESERVED", 0xB0000000, 0x09700000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},- {"Reserv", 0xC0000000, 0x00100000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"TAGS", 0xC0100000, 0x01200000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"QTEE", 0xC1300000, 0x00500000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"TZApps Reserved", 0xC1800000, 0x05000000, HobOnlyNoCacheSetting, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"ADSP RPC", 0xC6800000, 0x00500000, AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED_XN},- {"DXE Heap", 0xC6D00000, 0x07800000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK_XN},- {"TGCM", 0xCE500000, 0x01400000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED_XN},- {"Guest VM", 0xD0000000, 0x10000000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},- {"DBI Dump", 0xE0000000, 0x00F00000, NoHob, MMAP_IO, INITIALIZED, Conv, UNCACHED_UNBUFFERED_XN},- {"Display Reserved", 0xE1000000, 0x02400000, AddMem, MEM_RES, SYS_MEM_CAP, Reserv, WRITE_THROUGH_XN},- {"APSS Ext", 0xE3400000, 0x01700000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK_XN},- {"XNU Payload", 0xF0000000, 0x04000000, AddMem, SYS_MEM, SYS_MEM_CAP, Reserv, WRITE_BACK_XN},-- // Other Memory Regions- {"IMEM Base", 0x14680000, 0x0002B000, NoHob, MMAP_IO, INITIALIZED, Conv, NS_DEVICE},- {"IMEM Cookie Base", 0x146AA000, 0x00001000, AddDev, MMAP_IO, INITIALIZED, Conv, NS_DEVICE},-- // Register Regions- {"IPC_ROUTER_TOP", 0x00400000, 0x00100000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"SECURITY CONTROL", 0x00780000, 0x00010000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"PERIPH_SS_SDC1", 0x007C0000, 0x00100000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"QUP", 0x00900000, 0x00200000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"PRNG_CFG_PRNG", 0x010D0000, 0x00010000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"PCIE_1_AHB", 0x01C08000, 0x00008000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"CRYPTO0 CRYPTO", 0x01DC0000, 0x00040000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"TCSR_TCSR_REGS", 0x01FC0000, 0x00030000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"PERIPH_SS", 0x08800000, 0x00200000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"USB", 0x0A600000, 0x04000000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"AOSS", 0x0B000000, 0x04000000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"TLMM", 0x0F100000, 0x00300000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"SMMU", 0x15000000, 0x00200000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"APSS_HM", 0x17800000, 0x00E00000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE},- {"PCIE_1_AXI", 0x40000000, 0x02000000, AddDev, MMAP_IO, UNCACHEABLE, MmIO, NS_DEVICE}-};--VOID-GetMemoryMap (- OUT EFI_MEMORY_REGION_DESCRIPTOR **MemoryDescriptor,- OUT UINT8 *MemoryDescriptorCount)-{- // Pass Data- *MemoryDescriptor = gMemoryDescriptor;- *MemoryDescriptorCount = ARRAY_SIZE (gMemoryDescriptor);-}diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.inf b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.infdeleted file mode 100644index 3ba49ad..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/Library/MemoryMapLib/MemoryMapLib.inf+++ /dev/null@@ -1,15 +0,0 @@-[Defines]- INF_VERSION = 0x00010005- BASE_NAME = MemoryMapLib- FILE_GUID = D664A3B1-AF81-48F9-9412-A99D81AE96CE- MODULE_TYPE = BASE- VERSION_STRING = 1.0- LIBRARY_CLASS = MemoryMapLib--[Sources]- MemoryMapLib.c--[Packages]- ArmPkg/ArmPkg.dec- MdePkg/MdePkg.dec- SiliciumPkg/SiliciumPkg.decdiff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.dec b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.decdeleted file mode 100644index e69de29..0000000diff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.dsc b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.dscdeleted file mode 100644index 2cd307a..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.dsc+++ /dev/null@@ -1,90 +0,0 @@-##-# Copyright (c) 2011 - 2022, ARM Limited. All rights reserved.-# Copyright (c) 2014, Linaro Limited. All rights reserved.-# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.-# Copyright (c) 2018, Bingxing Wang. All rights reserved.-# Copyright (c) Microsoft Corporation.-#-# SPDX-License-Identifier: BSD-2-Clause-Patent-##--################################################################################-#-# Defines Section - statements that will be processed to create a Makefile.-#-################################################################################-[Defines]- PLATFORM_NAME = redwood- PLATFORM_GUID = 62B40F33-4011-4ACB-8348-1A6BB928C8A6- PLATFORM_VERSION = 0.1- DSC_SPECIFICATION = 0x00010005- OUTPUT_DIRECTORY = Build/redwoodPkg- SUPPORTED_ARCHITECTURES = AARCH64- BUILD_TARGETS = RELEASE|DEBUG- SKUID_IDENTIFIER = DEFAULT- FLASH_DEFINITION = redwoodPkg/redwood.fdf- USE_CUSTOM_DISPLAY_DRIVER = 0-- #- # 0 = SM7325- # 1 = SM7325-AE- # 2 = SM7325-AF- #- SOC_TYPE = 0--!include KodiakPkg/KodiakPkg.dsc.inc--[PcdsFixedAtBuild]- #- # DDR Memory- #- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000-- #- # UEFI Stack- #- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x9FF90000- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x40000-- #- # SMBIOS- #- gSiliciumPkgTokenSpaceGuid.PcdSmbiosSystemManufacturer|"Xiaomi"- gSiliciumPkgTokenSpaceGuid.PcdSmbiosSystemModel|"POCO X5 Pro 5G"- gSiliciumPkgTokenSpaceGuid.PcdSmbiosSystemRetailModel|"redwood"- gSiliciumPkgTokenSpaceGuid.PcdSmbiosSystemRetailSku|"POCO_X5_Pro_5G_redwood"- gSiliciumPkgTokenSpaceGuid.PcdSmbiosSystemBoardModel|"POCO X5 Pro 5G"-- #- # Simple Frame Buffer- #- gSiliciumPkgTokenSpaceGuid.PcdFrameBufferWidth|1080- gSiliciumPkgTokenSpaceGuid.PcdFrameBufferHeight|2400- gSiliciumPkgTokenSpaceGuid.PcdFrameBufferColorDepth|32-- #- # Platform PEI- #- gQcomPkgTokenSpaceGuid.PcdPlatformType|"LA"-- #- # Storage- #- gQcomPkgTokenSpaceGuid.PcdStorageIsUfs3|FALSE--[LibraryClasses]- #- # Memory Libraries- #- MemoryMapLib|redwoodPkg/Library/MemoryMapLib/MemoryMapLib.inf-- #- # QCOM Libraries- #- ConfigurationMapLib|redwoodPkg/Library/ConfigurationMapLib/ConfigurationMapLib.inf--[Components]- #- # ACPI Tables- #- lisa/AcpiTables.infdiff --git a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.fdf b/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.fdfdeleted file mode 100644index eec4720..0000000--- a/devices/redwood/uefi/files/Platforms/Xiaomi/redwoodPkg/redwood.fdf+++ /dev/null@@ -1,133 +0,0 @@-##-# Copyright (c) 2018, Linaro Limited. All rights reserved.-#-# SPDX-License-Identifier: BSD-2-Clause-Patent-##--################################################################################-#-# FD Section-# The [FD] Section is made up of the definition statements and a-# description of what goes into the Flash Device Image. Each FD section-# defines one flash "device" image. A flash device image may be one of-# the following: Removable media bootable image (like a boot floppy-# image,) an Option ROM image (that would be "flashed" into an add-in-# card,) a System "Flash" image (that would be burned into a system's-# flash) or an Update ("Capsule") image that will be used to update and-# existing system flash.-#-################################################################################--[FD.SILICIUM_UEFI]-BaseAddress = $(FD_BASE)|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the FLASH Device.-Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device-ErasePolarity = 1--# This one is tricky, it must be: BlockSize * NumBlocks = Size-BlockSize = 0x1000-NumBlocks = $(FD_BLOCKS)--################################################################################-#-# Following are lists of FD Region layout which correspond to the locations of different-# images within the flash device.-#-# Regions must be defined in ascending order and may not overlap.-#-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by-# the pipe "|" character, followed by the size of the region, also in hex with the leading-# "0x" characters. Like:-# Offset|Size-# PcdOffsetCName|PcdSizeCName-# RegionType <FV, DATA, or FILE>-#-################################################################################--0x00000000|$(FD_SIZE)-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize-FV = FVMAIN_COMPACT--################################################################################-#-# FV Section-#-# [FV] section is used to define what components or modules are placed within a flash-# device file. This section also defines order the components and modules are positioned-# within the image. The [FV] section consists of define statements, set statements and-# module statements.-#-################################################################################--[FV.FvMain]-FvNameGuid = CD8D4C84-20AD-4073-8A28-3400FAE05941-BlockSize = 0x1000-NumBlocks = 0 # This FV gets compressed so make it just big enough-FvAlignment = 8 # FV alignment and FV attributes setting.-ERASE_POLARITY = 1-MEMORY_MAPPED = TRUE-STICKY_WRITE = TRUE-LOCK_CAP = TRUE-LOCK_STATUS = TRUE-WRITE_DISABLED_CAP = TRUE-WRITE_ENABLED_CAP = TRUE-WRITE_STATUS = TRUE-WRITE_LOCK_CAP = TRUE-WRITE_LOCK_STATUS = TRUE-READ_DISABLED_CAP = TRUE-READ_ENABLED_CAP = TRUE-READ_STATUS = TRUE-READ_LOCK_CAP = TRUE-READ_LOCK_STATUS = TRUE-- !include Include/APRIORI.inc- !include Include/DXE.inc- !include Include/RAW.inc-- # RAM Manager- INF SiliciumPkg/Drivers/RamManagerDxe/RamManagerDxe.inf-- # SmBios- INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf- INF SiliciumPkg/Drivers/SmBiosTableDxe/SmBiosTableDxe.inf-- # ACPI- INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf- INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf- INF RuleOverride = ACPITABLE lisa/AcpiTables.inf-- # Device Tree- #INF EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf- #FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 {- # SECTION RAW = redwoodPkg/FdtBlob/sm7325-xiaomi-lisa.dtb- # SECTION UI = "DeviceTreeBlob"- #}-- !include QcomPkg/Extra.fdf.inc--[FV.FVMAIN_COMPACT]-FvAlignment = 8-ERASE_POLARITY = 1-MEMORY_MAPPED = TRUE-STICKY_WRITE = TRUE-LOCK_CAP = TRUE-LOCK_STATUS = TRUE-WRITE_DISABLED_CAP = TRUE-WRITE_ENABLED_CAP = TRUE-WRITE_STATUS = TRUE-WRITE_LOCK_CAP = TRUE-WRITE_LOCK_STATUS = TRUE-READ_DISABLED_CAP = TRUE-READ_ENABLED_CAP = TRUE-READ_STATUS = TRUE-READ_LOCK_CAP = TRUE-READ_LOCK_STATUS = TRUE-- INF SiliciumPkg/Sec/Sec.inf-- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {- SECTION FV_IMAGE = FVMAIN- }- }-- !include SiliciumPkg/Common.fdf.incdiff --git a/devices/redwood/uefi/files/Resources/Configs/redwood.toml b/devices/redwood/uefi/files/Resources/Configs/redwood.tomldeleted file mode 100644index 4b2e1a7..0000000--- a/devices/redwood/uefi/files/Resources/Configs/redwood.toml+++ /dev/null@@ -1,25 +0,0 @@-#-# Boot Shim Configs-#-[boot_shim]-requires_kernel_header = true--#-# UEFI FD Configs-#-[uefi_fd]-base = 0x9FD00000-size = 0x200000--#-# Android Boot Image Kernel Configs-#-[boot_image_kernel]-kernel_compression = "gzip"-append_dtb = true--#-# Android Boot Image Configs-#-[boot_image]-header_version = 1diff --git a/devices/redwood/uefi/files/Resources/DTBs/redwood.dtb b/devices/redwood/uefi/files/Resources/DTBs/redwood.dtbdeleted file mode 100644index 123163c..0000000Binary files a/devices/redwood/uefi/files/Resources/DTBs/redwood.dtb and /dev/null differdiff --git a/socs/README.md b/socs/README.mdnew file mode 100644index 0000000..9137f67--- /dev/null+++ b/socs/README.md@@ -0,0 +1,4 @@+# SoC repositories++`tools/hakios-device.py sync` clones each SoC repository `devices/manifest.conf` names into `socs/<name>/`. A new one:+[How the repositories fit](../docs/porting/repositories.md).diff --git a/socs/sc7280/configs/sc7280.config b/socs/sc7280/configs/sc7280.configdeleted file mode 100644index f70cb7e..0000000--- a/socs/sc7280/configs/sc7280.config+++ /dev/null@@ -1,16 +0,0 @@-# HakiOS fragment: the Qualcomm SC7280 family (SM7325, QCM6490: "yupik", "kodiak") -- what is true of the SoC, whatever phone it is in.-# The processor has eight cores and the biggest is core 7; the temperature sensors, the chip-identity memory and the PMIC arbiter are-# at the addresses of this family (the kernel's defaults, which a port to another SoC overrides: soc_smem, thermal_tm0/1 ...).-# The sensors are read (CONFIG_THERMAL); stopping the run when the phone is hot is CONFIG_THERMAL_STOP, which is NOT set here:-# add CONFIG_THERMAL_STOP=105 to a device's fragment (or THERMAL_STOP=105 to the run) for a phone left alone.-CONFIG_SOC="sc7280"-CONFIG_CPUS=8-CONFIG_BOOTCPU=7-CONFIG_CPUFREQ=y-CONFIG_SOCINFO=y-CONFIG_THERMAL=y-# the drivers of this SoC family: a device with it gets them from here, whatever phone-specific drivers it leaves out-CONFIG_HAKIOS_CPUFREQ=y-CONFIG_HAKIOS_SOCINFO=y-CONFIG_HAKIOS_THERMAL=y-CONFIG_HAKIOS_PMIC=ydiff --git a/socs/sc7280/soc.conf b/socs/sc7280/soc.confdeleted file mode 100644index 9658d4d..0000000--- a/socs/sc7280/soc.conf+++ /dev/null@@ -1,9 +0,0 @@-# socs/sc7280/soc.conf: what this SoC repository is: the facts of a Qualcomm SC7280-family chip, whatever phone it is in.-# A phone with this SoC includes configs/sc7280.config from its defconfig. docs/porting/repositories.md has every word.--soc sc7280- title Qualcomm SC7280 family (SM7325 "Snapdragon 778G", QCM6490; "yupik", "kodiak")- vendor Qualcomm- cores 8, the biggest is core 7- gpu Adreno 642L- maintainer the HakiOS developers (README.md)diff --git a/uefi/BASE b/uefi/BASEdeleted file mode 100644index eacc726..0000000--- a/uefi/BASE+++ /dev/null@@ -1 +0,0 @@-e51cd877e31c8fbb322032dc4cb6715e83d25ad3diff --git a/uefi/README.md b/uefi/README.mddeleted file mode 100644index e4b00e1..0000000--- a/uefi/README.md+++ /dev/null@@ -1,101 +0,0 @@-# HakiOS UEFI--The UEFI firmware HakiOS phones start with: [Project Silicium's Mu-Silicium](https://github.com/Project-Silicium/Mu-Silicium)-at a fixed commit, with HakiOS's changes on top, and the platform of each phone from its device repository.--| What | Where |-|---|---|-| the Mu-Silicium commit it is made on | `BASE` |-| HakiOS's changes to Silicium's files | `hakios.patch` |-| HakiOS's new files (the XNU loader in the boot manager) | `files/` |-| the pictures it shows | `branding/banner.py` makes them |-| a phone's platform (memory map, drivers list, its device tree) | `devices/<name>/uefi/files/` in the device's repository |--## What HakiOS changes--| Part | Change |-|---|---|-| `BootShim/BootShim.S` | copies the `XNUP` container behind the UEFI image to `0xF0000000`, where the loader finds the kernel |-| `BootManagerLib` | starts the XNU loader from that container (`XnuLoader.c`) instead of showing a boot menu |-| `BootLogo.bmp`, `NoBootOS.bmp`, `MassStorage.bmp` | HakiOS's emblem and name in place of Silicium's: what the phone shows while it starts is ours, every time |-| `PcdFirmwareVendor` | `HakiOS` (what the firmware and its SMBIOS tables say they are) |-| `Sec.c` | the first log line: `HakiOS UEFI (Mu-Silicium) for <maker> <model>` |--Mu-Silicium's own code keeps its licence and its authors' notices; this is a fork of it in the open, as its licence allows.--## The pictures--```sh-python3 uefi/branding/banner.py /tmp/banner # BootLogo.bmp, NoBootOS.bmp, MassStorage.bmp-```--They are drawn from a few shapes and a 5x7 pixel font (the emblem is the website's logo, the wordmark HAKI in paper and OS in red),-as 8-bit BMPs with a 256-colour palette, the format and sizes Silicium's are (300x300, 300x300, 500x500). Nothing to install; change-the text or the colours in the file and run `uefi/apply.sh` again.--## Make the tree--```sh-uefi/apply.sh # Mu-Silicium/ at the top: BASE, hakios.patch, files/, the pictures, every device's platform-uefi/apply.sh redwood # ... with one device's platform only-uefi/export.sh # the reverse, after changing something in Mu-Silicium/-```--## The vendor's drivers are not in the repository--A phone's UEFI is made of open code (Project Mu, EDK2) and of drivers that Qualcomm and Xiaomi wrote for-that phone: display, storage, USB, secure boot and more. They are proprietary and have not been-licensed for redistribution, so a device repository carries neither them (`devices/<name>/uefi/files/Binaries/<name>/*`) nor-the UEFI image built with them (`prebuilt/SILICIUM_UEFI.fd`). `tools/provenance-check.py` fails the-build if they come back; it runs on every push, and `tools/provenance.allow` says why each binary that-*is* here may be.--Without that image `mkxnuimg.py` stops with a message that points here. To get one, make both from-**your own phone**:--1. Get your phone's UEFI firmware: the vendor's `xbl` firmware, which is on the phone (with root, the- `xbl` partition) and in the vendor's firmware package for your model and region.- `devices/redwood/uefi/files/Binaries/redwood/README.md` records the version the port was made on (`OS1.0.3.0.UMSMIXM`):- another version may need other patches.-2. Extract the drivers from it with [UEFIReader](https://github.com/WOA-Project/UEFIReader) into- `devices/<name>/uefi/files/Binaries/<name>/`. Its README says no more than what the tool is for ("generate .inf- payloads ... out of an existing UEFI volume", as of 2026-10-26); Mu-Silicium's documentation for a- device describes the layout it expects. **The authors of this repository have not repeated this- extraction since the drivers were taken out of the tree: if you do it, say what worked in an- issue.**-3. Build as below. `mkxnuimg.py` then takes the image from `Mu-Silicium/`.--What you extract is the vendor's, from your own device: keep it on your disk and never commit it.--## Build--Packages as in Mu-Silicium's `setup_env.sh` (Arch: `git base-devel lld nasm clang llvm-aarch64-linux-gnu-gcc python python-pip python-virtualenv`).--```sh-uefi/apply.sh redwood # clones Mu-Silicium (with submodules, ~3 GB), HakiOS's changes, the redwood platform-python3 -m venv venv && venv/bin/pip install -r Mu-Silicium/pip-requirements.txt-cd Mu-Silicium-source ../venv/bin/activate-python3 build_uefi.py -d redwood -r RELEASE # -> Build/redwoodPkg/RELEASE_CLANGPDB/FV/SILICIUM_UEFI.fd-```--The `mu_nasm` dependency comes through NuGet and wants Mono; without Mono, point it at the-system nasm:--```sh-D=Mu_Basecore/BaseTools/Bin/mu_nasm_extdep-mkdir -p $D/Linux-x86-64-echo 'version: 20016.1.1' > $D/extdep_state.yaml-ln -s /usr/bin/nasm /usr/bin/ndisasm $D/Linux-x86-64/-```--After a build, `mkxnuimg.py` (called by `./xl enter`) takes the UEFI from `Mu-Silicium/`, and-`tools/update-prebuilt.sh` refreshes `devices/redwood/prebuilt`. `uefi/export.sh`-is the reverse: it saves the changes from `Mu-Silicium/` back.--## What has been checked--27 October 2026: `uefi/apply.sh`'s steps, run on a checkout of Mu-Silicium at `BASE`, give the same tree as the earlier redwood-port, with the HakiOS pictures, vendor and log line in it. **The firmware has not been built or started with these changes yet**:-the build needs the vendor's drivers of a phone (above). The pictures are in the format and sizes of Silicium's own.diff --git a/uefi/apply.sh b/uefi/apply.shdeleted file mode 100755index c70f0e6..0000000--- a/uefi/apply.sh+++ /dev/null@@ -1,34 +0,0 @@-#!/bin/bash-# HakiOS's UEFI: Project Silicium's Mu-Silicium at the commit in BASE, with HakiOS's changes on top, and the platform of each-# device that has one (devices/<name>/uefi/files/). The result is Mu-Silicium/ at the top of the repository, which mkxnuimg.py-# and tools/update-prebuilt.sh take the image from.-#-# uefi/apply.sh [DEVICE...] default: every device with a devices/<name>/uefi/files/-#-# What HakiOS changes in Mu-Silicium (hakios.patch, files/, branding/):-# BootShim.S copies the "XNUP" container behind the UEFI image to 0xF0000000, where the loader finds the kernel-# BootManagerLib starts the XNU loader from that container (XnuLoader.c) instead of showing a boot menu-# the banner BootLogo.bmp, NoBootOS.bmp and MassStorage.bmp are HakiOS's, made by branding/banner.py, in place of-# Silicium's: the logo the phone shows while it starts is ours, always-# the vendor the firmware says "HakiOS" (PcdFirmwareVendor, the SMBIOS tables) and its first log line is HakiOS's-set -e-HERE=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)-ROOT=$(dirname "$HERE")-MU=${MU:-$ROOT/Mu-Silicium}-[ -e "$MU" ] && { echo "uefi/apply.sh: $MU already exists (uefi/export.sh saves what is in it; move it away for a fresh one)"; exit 1; }-git clone https://github.com/Project-Silicium/Mu-Silicium.git "$MU"-git -C "$MU" checkout -q "$(cat "$HERE/BASE")"-git -C "$MU" submodule update --init --recursive-git -C "$MU" apply --whitespace=nowarn "$HERE/hakios.patch"-cp -r "$HERE/files/." "$MU/"-python3 "$HERE/branding/banner.py" "$MU/Silicon/Silicium/SiliciumPkg/Include/Resources"-devices=("$@")-if [ ${#devices[@]} -eq 0 ]; then- for d in "$ROOT"/devices/*/uefi/files; do [ -d "$d" ] && devices+=("$(basename "$(dirname "$(dirname "$d")")")"); done-fi-for d in "${devices[@]}"; do- [ -d "$ROOT/devices/$d/uefi/files" ] || { echo "uefi/apply.sh: devices/$d has no uefi/files/" >&2; exit 1; }- cp -r "$ROOT/devices/$d/uefi/files/." "$MU/"- echo "uefi/apply.sh: the platform of $d"-done-echo "uefi/apply.sh: done; build with: cd Mu-Silicium && python3 build_uefi.py -d <device> -r RELEASE (uefi/README.md)"diff --git a/uefi/branding/banner.py b/uefi/branding/banner.pydeleted file mode 100755index ed41c3d..0000000--- a/uefi/branding/banner.py+++ /dev/null@@ -1,143 +0,0 @@-#!/usr/bin/env python3-"""The pictures HakiOS's UEFI shows in place of Mu-Silicium's: the boot logo, the "no system to boot" screen and the USB mass-storage screen. Made here from a few shapes and a 5x7 pixel font, with nothing to install, so that anyone can change the text-or the colours and make them again.--The files are what Mu-Silicium's SiliciumPkg/Include/Resources/ holds (Extra.fdf.inc puts them into the firmware volume):-8-bit BMPs with a 256-colour palette, BootLogo.bmp and NoBootOS.bmp 300x300, MassStorage.bmp 500x500.--usage: uefi/branding/banner.py OUTDIR (uefi/apply.sh runs it into the Mu-Silicium tree)-"""-import os-import struct-import sys--INK, RED, PAPER, GREY = (0, 0, 0), (0xE8, 0x17, 0x0F), (0xEF, 0xE9, 0xE6), (0x8A, 0x84, 0x82)-PALETTE = [INK, RED, PAPER, GREY] # indices 0..3; the rest of the 256 are black--FONT = { # 5x7, one string per row, "#" is a pixel- "A": [" ### ", "# #", "# #", "#####", "# #", "# #", "# #"],- "B": ["#### ", "# #", "# #", "#### ", "# #", "# #", "#### "],- "D": ["#### ", "# #", "# #", "# #", "# #", "# #", "#### "],- "E": ["#####", "# ", "# ", "#### ", "# ", "# ", "#####"],- "F": ["#####", "# ", "# ", "#### ", "# ", "# ", "# "],- "G": [" ####", "# ", "# ", "# ##", "# #", "# #", " ### "],- "H": ["# #", "# #", "# #", "#####", "# #", "# #", "# #"],- "I": ["#####", " # ", " # ", " # ", " # ", " # ", "#####"],- "K": ["# #", "# # ", "# # ", "## ", "# # ", "# # ", "# #"],- "L": ["# ", "# ", "# ", "# ", "# ", "# ", "#####"],- "M": ["# #", "## ##", "# # #", "# #", "# #", "# #", "# #"],- "N": ["# #", "## #", "# # #", "# ##", "# #", "# #", "# #"],- "O": [" ### ", "# #", "# #", "# #", "# #", "# #", " ### "],- "R": ["#### ", "# #", "# #", "#### ", "# # ", "# # ", "# #"],- "S": [" ####", "# ", "# ", " ### ", " #", " #", "#### "],- "T": ["#####", " # ", " # ", " # ", " # ", " # ", " # "],- "U": ["# #", "# #", "# #", "# #", "# #", "# #", " ### "],- "W": ["# #", "# #", "# #", "# # #", "# # #", "## ##", "# #"],- "Y": ["# #", "# #", " # # ", " # ", " # ", " # ", " # "],- " ": [" "] * 7,-}---class Canvas:- def __init__(self, size):- self.size = size- self.px = bytearray(size * size) # palette indices, top row first-- def dot(self, x, y, c):- if 0 <= x < self.size and 0 <= y < self.size:- self.px[y * self.size + x] = c-- def rect(self, x0, y0, w, h, c):- for y in range(y0, y0 + h):- for x in range(x0, x0 + w):- self.dot(x, y, c)-- def disc(self, cx, cy, r, c):- for y in range(int(cy - r), int(cy + r) + 1):- for x in range(int(cx - r), int(cx + r) + 1):- if (x - cx) ** 2 + (y - cy) ** 2 <= r * r:- self.dot(x, y, c)-- def pill(self, x0, y0, w, h, c):- """A rectangle with round ends (the emblem's eyes)."""- r = w / 2- self.rect(x0, int(y0 + r), w, int(h - 2 * r), c)- self.disc(x0 + r - 0.5, y0 + r, r, c)- self.disc(x0 + r - 0.5, y0 + h - r, r, c)-- def line(self, x0, y0, x1, y1, width, c):- steps = int(max(abs(x1 - x0), abs(y1 - y0))) + 1- for i in range(steps + 1):- t = i / steps- self.disc(x0 + (x1 - x0) * t, y0 + (y1 - y0) * t, width / 2, c)-- def text(self, s, y, scale, colours, spacing=1):- """S centred at row Y; COLOURS gives each character's colour (a list as long as S, or one for all)."""- width = len(s) * (5 + spacing) * scale - spacing * scale- x = (self.size - width) // 2- for i, ch in enumerate(s):- c = colours[i] if isinstance(colours, list) else colours- for row, bits in enumerate(FONT[ch]):- for col, bit in enumerate(bits):- if bit == "#":- self.rect(x + col * scale, y + row * scale, scale, scale, c)- x += (5 + spacing) * scale-- def emblem(self, cx, top, unit):- """The HakiOS emblem (the website's logo): a red head with two dark eyes and two ears, UNIT pixels to the logo's one."""- red = 1- u = unit- self.line(cx - 9.5 * u, top + 9 * u, cx - 13 * u, top + 0 * u, 2.2 * u, red) # ears- self.line(cx + 9.5 * u, top + 9 * u, cx + 13 * u, top + 0 * u, 2.2 * u, red)- self.disc(cx - 13 * u, top + 0 * u, 2.4 * u, red)- self.disc(cx + 13 * u, top + 0 * u, 2.4 * u, red)- self.disc(cx, top + 18.5 * u, 13 * u, red) # head- self.pill(int(cx - 6.5 * u), int(top + 14.5 * u), int(5 * u), int(7 * u), 0) # eyes- self.pill(int(cx + 1.5 * u), int(top + 14.5 * u), int(5 * u), int(7 * u), 0)-- def bmp(self, path):- """An 8-bit BMP (BITMAPINFOHEADER, 256-colour palette, rows bottom-up, each a multiple of 4 bytes)."""- stride = (self.size + 3) & ~3- palette = b"".join(struct.pack("<BBBB", b, g, r, 0) for r, g, b in PALETTE + [INK] * (256 - len(PALETTE)))- rows = b"".join(bytes(self.px[y * self.size:(y + 1) * self.size]) + b"\0" * (stride - self.size)- for y in reversed(range(self.size)))- offset = 14 + 40 + len(palette)- header = struct.pack("<2sIHHI", b"BM", offset + len(rows), 0, 0, offset)- info = struct.pack("<IiiHHIIiiII", 40, self.size, self.size, 1, 8, 0, len(rows), 3779, 3779, 256, 256)- with open(path, "wb") as f:- f.write(header + info + palette + rows)---def wordmark(c, y, scale):- c.text("HAKIOS", y, scale, [2, 2, 2, 2, 1, 1]) # HAKI in paper, OS in red: the website's wordmark---def main():- if len(sys.argv) != 2:- sys.exit(__doc__)- out = sys.argv[1]- os.makedirs(out, exist_ok=True)-- logo = Canvas(300)- logo.emblem(150, 40, 4.4)- wordmark(logo, 196, 6)- logo.bmp(os.path.join(out, "BootLogo.bmp"))-- none = Canvas(300)- none.emblem(150, 30, 3.2)- wordmark(none, 150, 5)- none.text("NO SYSTEM", 214, 3, 3)- none.text("TO BOOT", 244, 3, 3)- none.bmp(os.path.join(out, "NoBootOS.bmp"))-- storage = Canvas(500)- storage.emblem(250, 60, 6)- wordmark(storage, 300, 8)- storage.text("USB MASS STORAGE", 400, 4, 3)- storage.bmp(os.path.join(out, "MassStorage.bmp"))- print("banner: BootLogo.bmp, NoBootOS.bmp, MassStorage.bmp written to %s" % out)---if __name__ == "__main__":- main()diff --git a/uefi/export.sh b/uefi/export.shdeleted file mode 100755index 213940e..0000000--- a/uefi/export.sh+++ /dev/null@@ -1,15 +0,0 @@-#!/bin/bash-# The reverse of uefi/apply.sh: what was changed in Mu-Silicium/ goes back here. The changes to Silicium's own files go to-# hakios.patch, HakiOS's new files under Silicon/ to files/, and each device's platform to devices/<name>/uefi/files/-# (devices/<name>/uefi/export.sh). The banner pictures are made by branding/banner.py and are not saved: change that instead.-set -e-HERE=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)-ROOT=$(dirname "$HERE")-MU=${MU:-$ROOT/Mu-Silicium}-[ "$(git -C "$MU" rev-parse HEAD)" = "$(cat "$HERE/BASE")" ] || { echo "uefi/export.sh: $MU is not at BASE"; exit 1; }-git -C "$MU" diff -- BootShim Silicon ':!Silicon/Silicium/SiliciumPkg/Include/Resources' > "$HERE/hakios.patch"-rm -rf "$HERE/files"-mkdir -p "$HERE/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib"-cp "$MU"/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.[ch] "$HERE/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/"-for d in "$ROOT"/devices/*/uefi/export.sh; do [ -x "$d" ] && "$d"; done-echo "uefi/export.sh: patch $(wc -l < "$HERE/hakios.patch") lines, $(find "$HERE/files" -type f | wc -l) files"diff --git a/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.c b/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.cdeleted file mode 100644index 65ef539..0000000--- a/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.c+++ /dev/null@@ -1,304 +0,0 @@-/**- XNU loader for redwood, stage 0: diagnostics only.-- Runs when BDS finds nothing to boot. Collects what the real loader will need- (exception level, CPU feature registers, framebuffer, memory map, payload),- writes it as text to the raw "logdump" partition so it can be read back from- Android over adb, and cold-resets. Nothing is shown to the user on purpose:- the phone is driven unattended.-- SPDX-License-Identifier: BSD-2-Clause-Patent-**/--#include <Uefi.h>--#include <Library/BaseLib.h>-#include <Library/BaseMemoryLib.h>-#include <Library/MemoryAllocationLib.h>-#include <Library/PrintLib.h>-#include <Library/UefiBootServicesTableLib.h>-#include <Library/UefiRuntimeServicesTableLib.h>--#include <Protocol/BlockIo.h>-#include <Protocol/GraphicsOutput.h>-#include <Protocol/PartitionInfo.h>--#include "XnuLoader.h"--#define LOG_SIZE SIZE_256KB--STATIC CHAR8 *mLog;-STATIC UINTN mLogLen;--STATIC-VOID-EFIAPI-Log (- IN CONST CHAR8 *Format,- ...)-{- VA_LIST Marker;-- if (mLog == NULL || mLogLen >= LOG_SIZE - 512) {- return;- }-- VA_START (Marker, Format);- mLogLen += AsciiVSPrint (mLog + mLogLen, LOG_SIZE - mLogLen, Format, Marker);- VA_END (Marker);-}--#define READ_SYSREG(Name) ({ UINT64 _Value; __asm__ volatile ("mrs %0, " #Name : "=r" (_Value)); _Value; })--STATIC-EFI_BLOCK_IO_PROTOCOL *-FindPartition (- IN CONST CHAR16 *Name)-{- EFI_STATUS Status;- EFI_HANDLE *Handles;- UINTN Count;-- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPartitionInfoProtocolGuid, NULL, &Count, &Handles);- if (EFI_ERROR (Status)) {- return NULL;- }-- for (UINTN i = 0; i < Count; i++) {- EFI_PARTITION_INFO_PROTOCOL *Info;- EFI_BLOCK_IO_PROTOCOL *BlockIo;-- Status = gBS->HandleProtocol (Handles[i], &gEfiPartitionInfoProtocolGuid, (VOID **)&Info);- if (EFI_ERROR (Status) || Info->Type != PARTITION_TYPE_GPT) {- continue;- }-- if (StrnCmp (Info->Info.Gpt.PartitionName, Name, 36) != 0) {- continue;- }-- Status = gBS->HandleProtocol (Handles[i], &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);- if (!EFI_ERROR (Status)) {- return BlockIo;- }- }-- return NULL;-}--STATIC-VOID-LogCpu ()-{- Log ("[cpu]\n");- Log ("CurrentEL=%lx\n", READ_SYSREG (CurrentEL) >> 2);- Log ("MIDR_EL1=%016lx\n", READ_SYSREG (MIDR_EL1));- Log ("ID_AA64MMFR0_EL1=%016lx\n", READ_SYSREG (ID_AA64MMFR0_EL1));- Log ("ID_AA64MMFR1_EL1=%016lx\n", READ_SYSREG (ID_AA64MMFR1_EL1));- Log ("ID_AA64MMFR2_EL1=%016lx\n", READ_SYSREG (ID_AA64MMFR2_EL1));- Log ("ID_AA64PFR0_EL1=%016lx\n", READ_SYSREG (ID_AA64PFR0_EL1));- Log ("ID_AA64PFR1_EL1=%016lx\n", READ_SYSREG (ID_AA64PFR1_EL1));- Log ("ID_AA64ISAR0_EL1=%016lx\n", READ_SYSREG (ID_AA64ISAR0_EL1));- Log ("ID_AA64ISAR1_EL1=%016lx\n", READ_SYSREG (ID_AA64ISAR1_EL1));- Log ("ID_AA64DFR0_EL1=%016lx\n", READ_SYSREG (ID_AA64DFR0_EL1));- Log ("SCTLR_EL1=%016lx\n", READ_SYSREG (SCTLR_EL1));- Log ("TCR_EL1=%016lx\n", READ_SYSREG (TCR_EL1));- Log ("MAIR_EL1=%016lx\n", READ_SYSREG (MAIR_EL1));- Log ("TTBR0_EL1=%016lx\n", READ_SYSREG (TTBR0_EL1));- Log ("VBAR_EL1=%016lx\n", READ_SYSREG (VBAR_EL1));- Log ("CNTFRQ_EL0=%ld\n", READ_SYSREG (CNTFRQ_EL0));- Log ("MPIDR_EL1=%016lx\n", READ_SYSREG (MPIDR_EL1));- Log ("DAIF=%lx\n", READ_SYSREG (DAIF));-}--STATIC-VOID-LogDisplay ()-{- EFI_STATUS Status;- EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;-- Log ("[display]\n");-- Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);- if (EFI_ERROR (Status)) {- Log ("gop=missing status=%r\n", Status);- return;- }-- Log ("fb_base=%lx fb_size=%lx\n", Gop->Mode->FrameBufferBase, (UINT64)Gop->Mode->FrameBufferSize);- Log ("width=%d height=%d stride=%d format=%d\n",- Gop->Mode->Info->HorizontalResolution, Gop->Mode->Info->VerticalResolution,- Gop->Mode->Info->PixelsPerScanLine, Gop->Mode->Info->PixelFormat);-}--STATIC-VOID-LogMemoryMap ()-{- EFI_STATUS Status;- EFI_MEMORY_DESCRIPTOR *Map;- UINTN MapSize = 0;- UINTN MapKey;- UINTN DescSize;- UINT32 DescVersion;-- Log ("[memmap]\n");-- Status = gBS->GetMemoryMap (&MapSize, NULL, &MapKey, &DescSize, &DescVersion);- if (Status != EFI_BUFFER_TOO_SMALL) {- Log ("getmemorymap status=%r\n", Status);- return;- }-- MapSize += SIZE_4KB;- Map = AllocatePool (MapSize);- if (Map == NULL) {- return;- }-- Status = gBS->GetMemoryMap (&MapSize, Map, &MapKey, &DescSize, &DescVersion);- if (EFI_ERROR (Status)) {- Log ("getmemorymap status=%r\n", Status);- return;- }-- for (UINTN Offset = 0; Offset < MapSize; Offset += DescSize) {- EFI_MEMORY_DESCRIPTOR *Desc = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Map + Offset);-- Log ("%016lx %016lx type=%d attr=%lx\n", Desc->PhysicalStart,- Desc->PhysicalStart + EFI_PAGES_TO_SIZE (Desc->NumberOfPages), Desc->Type, Desc->Attribute);- }-- FreePool (Map);-}--STATIC-VOID-LogPayload ()-{- XNU_PAYLOAD_HEADER *Header = (XNU_PAYLOAD_HEADER *)XNU_PAYLOAD_BASE;-- Log ("[payload]\n");- Log ("base=%lx magic=%08x size=%x\n", (UINT64)XNU_PAYLOAD_BASE, Header->Magic, Header->Size);--}--STATIC-VOID-LogPersistence ()-{- //- // Does RAM written before a reset survive it? The kernel bring-up needs a- // place for progress markers. Uses the tail of the reserved payload region.- // (Device registers are deliberately not probed here: an MMIO read of the- // IMEM / watchdog blocks took a synchronous exception on this platform.)- //- UINT32 *Ram = (UINT32 *)(UINTN)(XNU_PAYLOAD_BASE + XNU_PAYLOAD_MAX_SIZE - SIZE_4KB);-- Log ("[persistence]\n");- Log ("ram_before=%08x %08x\n", Ram[0], Ram[1]);-- Ram[1] = (Ram[0] == XNU_MARKER_MAGIC) ? Ram[1] + 1 : 1;- Ram[0] = XNU_MARKER_MAGIC;-- Log ("ram_after=%08x %08x\n", Ram[0], Ram[1]);-}--STATIC-VOID-FlushLog ()-{- EFI_STATUS Status;- EFI_BLOCK_IO_PROTOCOL *BlockIo;- UINTN BlockSize;- UINTN WriteSize;-- BlockIo = FindPartition (XNU_LOG_PARTITION);- if (BlockIo == NULL) {- return;- }-- BlockSize = BlockIo->Media->BlockSize;- WriteSize = ALIGN_VALUE (mLogLen + 1, BlockSize);-- Status = BlockIo->WriteBlocks (BlockIo, BlockIo->Media->MediaId, 0, WriteSize, mLog);- if (!EFI_ERROR (Status)) {- BlockIo->FlushBlocks (BlockIo);- }-}--//-// The payload is a list of named blobs. If it carries "loader.efi", that is-// the real XNU loader: start it straight from memory, so the loader can be-// iterated on without rebuilding this firmware.-//-STATIC-VOID-StartPayloadLoader ()-{- XNU_PAYLOAD_HEADER *Header = (XNU_PAYLOAD_HEADER *)XNU_PAYLOAD_BASE;- UINT8 *Cursor;- UINT8 *End;-- if (Header->Magic != XNU_PAYLOAD_MAGIC || Header->Size > XNU_PAYLOAD_MAX_SIZE) {- return;- }-- Cursor = (UINT8 *)(Header + 1);- End = Cursor + Header->Size;-- while (Cursor + sizeof (XNU_PAYLOAD_ENTRY) <= End) {- XNU_PAYLOAD_ENTRY *Entry = (XNU_PAYLOAD_ENTRY *)Cursor;-- if (Entry->Name[0] == 0) {- break;- }-- if (AsciiStrnCmp (Entry->Name, "loader.efi", sizeof (Entry->Name)) == 0) {- EFI_HANDLE Handle;-- if (!EFI_ERROR (gBS->LoadImage (FALSE, gImageHandle, NULL, Entry + 1, Entry->Size, &Handle))) {- gBS->StartImage (Handle, NULL, NULL);- }-- return;- }-- Cursor += sizeof (XNU_PAYLOAD_ENTRY) + ALIGN_VALUE (Entry->Size, 16);- }-}--VOID-XnuLoaderMain ()-{- EFI_TIME Time;-- // Normally does not return- StartPayloadLoader ();-- mLog = AllocateZeroPool (LOG_SIZE);- if (mLog != NULL) {- Log ("== XNULOADER LOG v1 ==\n");-- if (!EFI_ERROR (gRT->GetTime (&Time, NULL))) {- Log ("time=%04d-%02d-%02d %02d:%02d:%02d\n", Time.Year, Time.Month, Time.Day, Time.Hour, Time.Minute, Time.Second);- }-- FlushLog ();- LogCpu ();- FlushLog ();- LogDisplay ();- FlushLog ();- LogMemoryMap ();- FlushLog ();- LogPayload ();- FlushLog ();- LogPersistence ();- Log ("== END ==\n");- FlushLog ();- }-- // The phone is unattended: always come back to Android.- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);-}diff --git a/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.h b/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.hdeleted file mode 100644index d620606..0000000--- a/uefi/files/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/XnuLoader.h+++ /dev/null@@ -1,33 +0,0 @@-#ifndef _XNU_LOADER_H_-#define _XNU_LOADER_H_--//-// The boot shim copies everything appended after the UEFI FD to this address.-// The region is marked reserved in the device memory map.-//-#define XNU_PAYLOAD_BASE 0xF0000000ULL-#define XNU_PAYLOAD_MAX_SIZE 0x04000000ULL-#define XNU_PAYLOAD_MAGIC 0x50554E58 // "XNUP"--typedef struct {- UINT32 Magic;- UINT32 Size;-} XNU_PAYLOAD_HEADER;--// The header is followed by entries; an empty name ends the list.-typedef struct {- CHAR8 Name[16];- UINT32 Size;- UINT32 Reserved;- // UINT8 Data[Size], padded to 16 bytes-} XNU_PAYLOAD_ENTRY;--// Raw GPT partition that receives the text log (read back from Android).-#define XNU_LOG_PARTITION L"logdump"--#define XNU_MARKER_MAGIC 0x584E5521 // "XNU!"--VOID-XnuLoaderMain ();--#endif /* _XNU_LOADER_H_ */diff --git a/uefi/hakios.patch b/uefi/hakios.patchdeleted file mode 100644index 650a2bd..0000000--- a/uefi/hakios.patch+++ /dev/null@@ -1,659 +0,0 @@-diff --git a/BootShim/BootShim.S b/BootShim/BootShim.S-index 4d20855..3c3b17b 100644---- a/BootShim/BootShim.S-+++ b/BootShim/BootShim.S-@@ -28,6 +28,27 @@ _CopyLoop:- stp x2, x3, [x5], #16- subs x6, x6, #16- b.ne _CopyLoop-+-+#ifdef PAYLOAD_BASE-+ /* x4 now points just past the FD: an optional "XNUP" payload may follow */-+ ldr w2, [x4]-+ movz w3, #0x4E58-+ movk w3, #0x5055, lsl #16-+ cmp w2, w3-+ b.ne _NoPayload-+ ldr w6, [x4, #4] /* Payload Size */-+ add x6, x6, #23 /* Header + Round Up to 16 */-+ and x6, x6, #~15-+ movz x5, #(PAYLOAD_BASE >> 16), lsl #16-+-+_PayloadLoop:-+ ldp x2, x3, [x4], #16-+ stp x2, x3, [x5], #16-+ subs x6, x6, #16-+ b.ne _PayloadLoop-+-+_NoPayload:-+#endif- ldr x5, =FD_BASE-- _Entry:-diff --git a/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManager.c b/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManager.c-index 9b18ddb..f5bff32 100644---- a/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManager.c-+++ b/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManager.c-@@ -1,241 +1,245 @@--/**-- Copyright (C) DuoWoA authors. All rights reserved.-- Copyright (C) Microsoft Corporation. All rights reserved.---- SPDX-License-Identifier: BSD-2-Clause-Patent--**/----#include <Library/PcdLib.h>--#include <Library/DebugLib.h>--#include <Library/AcpiTableUpdateLib.h>--#include <Library/DeviceBootManagerLib.h>--#include <Library/PlatformBootManagerLib.h>--#include <Library/UefiRuntimeServicesTableLib.h>--#include <Library/UefiBootServicesTableLib.h>--#include <Library/SecureBootHandlerLib.h>--#include <Library/MemoryAllocationLib.h>--#include <Library/MsBootOptionsLib.h>--#include <Library/BootGraphicsLib.h>--#include <Library/BootGraphics.h>--#include <Library/PrintLib.h>----#include <Configuration/BootDevices.h>----#include "BootManager.h"----//--// Global Variables--//--STATIC UINTN XPos = 0;--STATIC UINTN YPos = 0;----//--// BDS Combo Message--//--STATIC CONST CHAR8 *ComboMessage = "[Volume Up] Boot Manager";----VOID--EFIAPI--PlatformBootManagerBeforeConsole ()--{-- // Signal End Of DXE-- EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);---- // Dispatch Deferred Images-- EfiBootManagerDispatchDeferredImages ();---- // Register Boot Options-- MsBootOptionsLibRegisterDefaultBootOptions ();---- // Register Console Variables-- EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&KeypadDevicePath, NULL);-- EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *)&DisplayDevicePath, NULL);-- EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *)&DisplayDevicePath, NULL);---- // Execute Secondary Before Console-- DeviceBootManagerBeforeConsole (NULL, NULL);--}----VOID--PostGopSetup (OUT EFI_GRAPHICS_OUTPUT_PROTOCOL **GopProtocol)--{-- EFI_STATUS Status;-- EFI_GRAPHICS_OUTPUT_PROTOCOL *LocalGopProtocol;---- // Verify Parameters-- if (GopProtocol == NULL) {-- return;-- }---- // Locate GOP Protocol-- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID *)&LocalGopProtocol);-- if (EFI_ERROR (Status) && Status != EFI_UNSUPPORTED) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to Locate GOP Protocol from Handle! Status = %r\n", __FUNCTION__, Status));-- return;-- }---- // Check Status-- if (Status == EFI_UNSUPPORTED) {-- // Locate GOP Protocol-- Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID *)&LocalGopProtocol);-- if (EFI_ERROR (Status)) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to Locate GOP Protocol! Status = %r\n", __FUNCTION__, Status));-- return;-- }---- // Install GOP Protocol-- Status = gBS->InstallProtocolInterface (&gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, EFI_NATIVE_INTERFACE, LocalGopProtocol);-- if (EFI_ERROR (Status)) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to Install GOP Protocol onto \"ConsoleOutHandle\"! Status = %r\n", __FUNCTION__, Status));-- }-- }---- // Pass GOP Protocol-- *GopProtocol = LocalGopProtocol;--}----VOID--EFIAPI--PlatformBootManagerAfterConsole ()--{-- EFI_STATUS Status = EFI_SUCCESS;-- EFI_GRAPHICS_OUTPUT_PROTOCOL *GopProtocol = NULL;---- // Post Setup GOP-- PostGopSetup (&GopProtocol);---- // Display Boot Logo-- Status = DisplayBootGraphic (BG_SYSTEM_LOGO);-- if (EFI_ERROR (Status)) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to Display Boot Logo! Status = %r\n", __FUNCTION__, Status));-- }---- // Register Key Callback-- Status = RegisterKeyCallback ((EFI_DEVICE_PATH_PROTOCOL *)&KeypadDevicePath);-- if (!EFI_ERROR (Status) && GopProtocol != NULL) {-- // Set Screen Resolution-- UINT32 ScreenWidth = GopProtocol->Mode->Info->HorizontalResolution;-- UINT32 ScreenHeight = GopProtocol->Mode->Info->VerticalResolution;---- // Set Combo Message Position-- XPos = (ScreenWidth - AsciiStrLen (ComboMessage) * EFI_GLYPH_WIDTH) / 2;-- YPos = ScreenHeight * 48 / 50;-- }---- // Execute Secondary After Console-- DeviceBootManagerAfterConsole ();--}----VOID--EFIAPI--PlatformBootManagerOnDemandConInConnect ()--{-- // Execute Secondary On Demand-- DeviceBootManagerOnDemandConInConnect ();--}----VOID--EFIAPI--PlatformBootManagerProcessBootCompletion (OUT EFI_BOOT_MANAGER_LOAD_OPTION *BootOption)--{-- return;--}----VOID--EFIAPI--PlatformBootManagerPriorityBoot (IN OUT UINT16 **BootNext)--{-- EFI_STATUS Status;-- EFI_BOOT_MANAGER_LOAD_OPTION LoadOption;-- BOOLEAN BootManagerFlag;---- // Unregister Key Callback-- UnregisterKeyCallback ();---- // Get Boot Manager Flag-- BootManagerFlag = EnterBootManager ();-- if (BootManagerFlag == FALSE) {-- return;-- }---- // Get Boot Manager Load Option-- Status = MsBootOptionsLibGetBootManagerMenu (&LoadOption, NULL);-- if (EFI_ERROR (Status)) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to get Boot Manager Load Option! Status = %r", __FUNCTION__, Status));-- return;-- }---- // Execute Boot Manager Load Option-- EfiBootManagerBoot (&LoadOption);-- EfiBootManagerFreeLoadOption (&LoadOption);--}----VOID--EFIAPI--PlatformBootManagerWaitCallback (IN UINT16 TimeoutRemain)--{-- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;---- // Verify Combo Message Position-- if (XPos == 0 && YPos == 0) {-- return;-- }---- // Get Timeout Time-- UINT16 Timeout = PcdGet16 (PcdPlatformBootTimeOut);---- // Check Remaining Timeout-- if (TimeoutRemain == Timeout || TimeoutRemain == 0) {-- // Set Draw Color-- UINT8 DrawColor = (TimeoutRemain == Timeout) ? 0xFF : 0x00;---- // Set GOP Draw Color-- Color.Red = Color.Green = Color.Blue = DrawColor;---- // Print Combo Message-- AsciiPrintXY (XPos, YPos, &Color, NULL, ComboMessage);-- }--}----VOID--EFIAPI--PlatformBootManagerUnableToBoot ()--{-- EFI_STATUS Status;---- // Execute Secondary Unable To Boot-- DeviceBootManagerUnableToBoot ();---- // Display No Boot OS Logo-- Status = DisplayBootGraphic (BG_NO_BOOT_OS);-- if (EFI_ERROR (Status)) {-- DEBUG ((EFI_D_ERROR, "%a: Failed to Display No Boot OS Logo! Status = %r\n", __FUNCTION__, Status));-- Print (L"No Operating System Found! Please make sure that an OS is Installed.\n");-- }---- // Wait 10s-- gBS->Stall (10000000);---- // Shutdown-- gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);---- // Do Cpu Dead Loop-- CpuDeadLoop ();--}----VOID--EFIAPI--PlatformBootManagerBdsEntry ()--{-- EFI_STATUS Status;---- // Setup Secure Boot-- Status = SetupSecureBoot ();-- ASSERT_EFI_ERROR (Status);---- // Update ACPI Tables-- UpdateAcpiTables ();---- // Execute Secondary BDS Entry-- DeviceBootManagerBdsEntry ();--}-+/**-+ Copyright (C) DuoWoA authors. All rights reserved.-+ Copyright (C) Microsoft Corporation. All rights reserved.-+-+ SPDX-License-Identifier: BSD-2-Clause-Patent-+**/-+-+#include <Library/PcdLib.h>-+#include <Library/DebugLib.h>-+#include <Library/AcpiTableUpdateLib.h>-+#include <Library/DeviceBootManagerLib.h>-+#include <Library/PlatformBootManagerLib.h>-+#include <Library/UefiRuntimeServicesTableLib.h>-+#include <Library/UefiBootServicesTableLib.h>-+#include <Library/SecureBootHandlerLib.h>-+#include <Library/MemoryAllocationLib.h>-+#include <Library/MsBootOptionsLib.h>-+#include <Library/BootGraphicsLib.h>-+#include <Library/BootGraphics.h>-+#include <Library/PrintLib.h>-+-+#include <Configuration/BootDevices.h>-+-+#include "BootManager.h"-+#include "XnuLoader.h"-+-+//-+// Global Variables-+//-+STATIC UINTN XPos = 0;-+STATIC UINTN YPos = 0;-+-+//-+// BDS Combo Message-+//-+STATIC CONST CHAR8 *ComboMessage = "[Volume Up] Boot Manager";-+-+VOID-+EFIAPI-+PlatformBootManagerBeforeConsole ()-+{-+ // Signal End Of DXE-+ EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);-+-+ // Dispatch Deferred Images-+ EfiBootManagerDispatchDeferredImages ();-+-+ // Register Boot Options-+ MsBootOptionsLibRegisterDefaultBootOptions ();-+-+ // Register Console Variables-+ EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&KeypadDevicePath, NULL);-+ EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *)&DisplayDevicePath, NULL);-+ EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *)&DisplayDevicePath, NULL);-+-+ // Execute Secondary Before Console-+ DeviceBootManagerBeforeConsole (NULL, NULL);-+}-+-+VOID-+PostGopSetup (OUT EFI_GRAPHICS_OUTPUT_PROTOCOL **GopProtocol)-+{-+ EFI_STATUS Status;-+ EFI_GRAPHICS_OUTPUT_PROTOCOL *LocalGopProtocol;-+-+ // Verify Parameters-+ if (GopProtocol == NULL) {-+ return;-+ }-+-+ // Locate GOP Protocol-+ Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID *)&LocalGopProtocol);-+ if (EFI_ERROR (Status) && Status != EFI_UNSUPPORTED) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to Locate GOP Protocol from Handle! Status = %r\n", __FUNCTION__, Status));-+ return;-+ }-+-+ // Check Status-+ if (Status == EFI_UNSUPPORTED) {-+ // Locate GOP Protocol-+ Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID *)&LocalGopProtocol);-+ if (EFI_ERROR (Status)) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to Locate GOP Protocol! Status = %r\n", __FUNCTION__, Status));-+ return;-+ }-+-+ // Install GOP Protocol-+ Status = gBS->InstallProtocolInterface (&gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, EFI_NATIVE_INTERFACE, LocalGopProtocol);-+ if (EFI_ERROR (Status)) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to Install GOP Protocol onto \"ConsoleOutHandle\"! Status = %r\n", __FUNCTION__, Status));-+ }-+ }-+-+ // Pass GOP Protocol-+ *GopProtocol = LocalGopProtocol;-+}-+-+VOID-+EFIAPI-+PlatformBootManagerAfterConsole ()-+{-+ EFI_STATUS Status = EFI_SUCCESS;-+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopProtocol = NULL;-+-+ // Post Setup GOP-+ PostGopSetup (&GopProtocol);-+-+ // Display Boot Logo-+ Status = DisplayBootGraphic (BG_SYSTEM_LOGO);-+ if (EFI_ERROR (Status)) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to Display Boot Logo! Status = %r\n", __FUNCTION__, Status));-+ }-+-+ // Register Key Callback-+ Status = RegisterKeyCallback ((EFI_DEVICE_PATH_PROTOCOL *)&KeypadDevicePath);-+ if (!EFI_ERROR (Status) && GopProtocol != NULL) {-+ // Set Screen Resolution-+ UINT32 ScreenWidth = GopProtocol->Mode->Info->HorizontalResolution;-+ UINT32 ScreenHeight = GopProtocol->Mode->Info->VerticalResolution;-+-+ // Set Combo Message Position-+ XPos = (ScreenWidth - AsciiStrLen (ComboMessage) * EFI_GLYPH_WIDTH) / 2;-+ YPos = ScreenHeight * 48 / 50;-+ }-+-+ // Execute Secondary After Console-+ DeviceBootManagerAfterConsole ();-+}-+-+VOID-+EFIAPI-+PlatformBootManagerOnDemandConInConnect ()-+{-+ // Execute Secondary On Demand-+ DeviceBootManagerOnDemandConInConnect ();-+}-+-+VOID-+EFIAPI-+PlatformBootManagerProcessBootCompletion (OUT EFI_BOOT_MANAGER_LOAD_OPTION *BootOption)-+{-+ return;-+}-+-+VOID-+EFIAPI-+PlatformBootManagerPriorityBoot (IN OUT UINT16 **BootNext)-+{-+ EFI_STATUS Status;-+ EFI_BOOT_MANAGER_LOAD_OPTION LoadOption;-+ BOOLEAN BootManagerFlag;-+-+ // Unregister Key Callback-+ UnregisterKeyCallback ();-+-+ // Get Boot Manager Flag-+ BootManagerFlag = EnterBootManager ();-+ if (BootManagerFlag == FALSE) {-+ return;-+ }-+-+ // Get Boot Manager Load Option-+ Status = MsBootOptionsLibGetBootManagerMenu (&LoadOption, NULL);-+ if (EFI_ERROR (Status)) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to get Boot Manager Load Option! Status = %r", __FUNCTION__, Status));-+ return;-+ }-+-+ // Execute Boot Manager Load Option-+ EfiBootManagerBoot (&LoadOption);-+ EfiBootManagerFreeLoadOption (&LoadOption);-+}-+-+VOID-+EFIAPI-+PlatformBootManagerWaitCallback (IN UINT16 TimeoutRemain)-+{-+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;-+-+ // Verify Combo Message Position-+ if (XPos == 0 && YPos == 0) {-+ return;-+ }-+-+ // Get Timeout Time-+ UINT16 Timeout = PcdGet16 (PcdPlatformBootTimeOut);-+-+ // Check Remaining Timeout-+ if (TimeoutRemain == Timeout || TimeoutRemain == 0) {-+ // Set Draw Color-+ UINT8 DrawColor = (TimeoutRemain == Timeout) ? 0xFF : 0x00;-+-+ // Set GOP Draw Color-+ Color.Red = Color.Green = Color.Blue = DrawColor;-+-+ // Print Combo Message-+ AsciiPrintXY (XPos, YPos, &Color, NULL, ComboMessage);-+ }-+}-+-+VOID-+EFIAPI-+PlatformBootManagerUnableToBoot ()-+{-+ EFI_STATUS Status;-+-+ // Nothing else to boot: hand over to the XNU loader (does not return)-+ XnuLoaderMain ();-+-+ // Execute Secondary Unable To Boot-+ DeviceBootManagerUnableToBoot ();-+-+ // Display No Boot OS Logo-+ Status = DisplayBootGraphic (BG_NO_BOOT_OS);-+ if (EFI_ERROR (Status)) {-+ DEBUG ((EFI_D_ERROR, "%a: Failed to Display No Boot OS Logo! Status = %r\n", __FUNCTION__, Status));-+ Print (L"No Operating System Found! Please make sure that an OS is Installed.\n");-+ }-+-+ // Wait 10s-+ gBS->Stall (10000000);-+-+ // Shutdown-+ gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);-+-+ // Do Cpu Dead Loop-+ CpuDeadLoop ();-+}-+-+VOID-+EFIAPI-+PlatformBootManagerBdsEntry ()-+{-+ EFI_STATUS Status;-+-+ // Setup Secure Boot-+ Status = SetupSecureBoot ();-+ ASSERT_EFI_ERROR (Status);-+-+ // Update ACPI Tables-+ UpdateAcpiTables ();-+-+ // Execute Secondary BDS Entry-+ DeviceBootManagerBdsEntry ();-+}-diff --git a/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManagerLib.inf b/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManagerLib.inf-index 2310dc6..12a5a5d 100644---- a/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManagerLib.inf-+++ b/Silicon/Silicium/SiliciumPkg/Library/BootManagerLib/BootManagerLib.inf-@@ -1,50 +1,55 @@--##--# Copyright (C) Microsoft Corporation. All rights reserved.--# SPDX-License-Identifier: BSD-2-Clause-Patent--##----[Defines]-- INF_VERSION = 0x00010018-- BASE_NAME = BootManagerLib-- FILE_GUID = DF8F3324-5448-46BC-872C-BE198ECF2F76-- VERSION_STRING = 1.0-- MODULE_TYPE = DXE_DRIVER-- UEFI_SPECIFICATION_VERSION = 2.7-- LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER----[Sources]-- BootManager.c-- KeyCallback.c----[Packages]-- MdePkg/MdePkg.dec-- PcBdsPkg/PcBdsPkg.dec-- MsCorePkg/MsCorePkg.dec-- MsGraphicsPkg/MsGraphicsPkg.dec-- MdeModulePkg/MdeModulePkg.dec-- SiliciumPkg/SiliciumPkg.dec----[LibraryClasses]-- PcdLib-- DebugLib-- AcpiTableUpdateLib-- DeviceBootManagerLib-- UefiRuntimeServicesTableLib-- UefiBootServicesTableLib-- SecureBootHandlerLib-- MemoryAllocationLib-- MsBootOptionsLib-- BootGraphicsLib-- DevicePathLib-- PrintLib----[Pcd]-- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut----[Guids]-- gEfiEndOfDxeEventGroupGuid----[Protocols]-- gKeypadDeviceProtocolGuid-- gEfiGraphicsOutputProtocolGuid-- gEfiSimpleTextInputExProtocolGuid-+##-+# Copyright (C) Microsoft Corporation. All rights reserved.-+# SPDX-License-Identifier: BSD-2-Clause-Patent-+##-+-+[Defines]-+ INF_VERSION = 0x00010018-+ BASE_NAME = BootManagerLib-+ FILE_GUID = DF8F3324-5448-46BC-872C-BE198ECF2F76-+ VERSION_STRING = 1.0-+ MODULE_TYPE = DXE_DRIVER-+ UEFI_SPECIFICATION_VERSION = 2.7-+ LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER-+-+[Sources]-+ BootManager.c-+ XnuLoader.c-+ KeyCallback.c-+-+[Packages]-+ MdePkg/MdePkg.dec-+ PcBdsPkg/PcBdsPkg.dec-+ MsCorePkg/MsCorePkg.dec-+ MsGraphicsPkg/MsGraphicsPkg.dec-+ MdeModulePkg/MdeModulePkg.dec-+ SiliciumPkg/SiliciumPkg.dec-+-+[LibraryClasses]-+ PcdLib-+ DebugLib-+ AcpiTableUpdateLib-+ DeviceBootManagerLib-+ UefiRuntimeServicesTableLib-+ UefiBootServicesTableLib-+ SecureBootHandlerLib-+ MemoryAllocationLib-+ MsBootOptionsLib-+ BootGraphicsLib-+ DevicePathLib-+ PrintLib-+ BaseLib-+ BaseMemoryLib-+-+[Pcd]-+ gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut-+-+[Guids]-+ gEfiEndOfDxeEventGroupGuid-+-+[Protocols]-+ gKeypadDeviceProtocolGuid-+ gEfiGraphicsOutputProtocolGuid-+ gEfiSimpleTextInputExProtocolGuid-+ gEfiBlockIoProtocolGuid-+ gEfiPartitionInfoProtocolGuid-diff --git a/Silicon/Silicium/SiliciumPkg/Sec/Sec.c b/Silicon/Silicium/SiliciumPkg/Sec/Sec.c-index 8d586b3..511fc76 100644---- a/Silicon/Silicium/SiliciumPkg/Sec/Sec.c-+++ b/Silicon/Silicium/SiliciumPkg/Sec/Sec.c-@@ -44,7 +44,7 @@ PrintFirmwareVersion (VOID)-- // Print UEFI Version Message- DEBUG ((EFI_D_WARN, "\n"));-- DEBUG ((EFI_D_WARN, "Project Silicium for %a %a\n", FixedPcdGetPtr (PcdSmbiosSystemManufacturer), FixedPcdGetPtr (PcdSmbiosSystemModel)));-+ DEBUG ((EFI_D_WARN, "HakiOS UEFI (Mu-Silicium) for %a %a\n", FixedPcdGetPtr (PcdSmbiosSystemManufacturer), FixedPcdGetPtr (PcdSmbiosSystemModel)));- DEBUG ((EFI_D_WARN, "Firmware Version %s Build at %a on %a\n", PcdGetPtr (PcdFirmwareVersionString), __TIME__, __DATE__));- DEBUG ((EFI_D_WARN, "\n"));- }-diff --git a/Silicon/Silicium/SiliciumPkg/SiliciumPkg.dsc.inc b/Silicon/Silicium/SiliciumPkg/SiliciumPkg.dsc.inc-index 00ec09e..a936a7b 100644---- a/Silicon/Silicium/SiliciumPkg/SiliciumPkg.dsc.inc-+++ b/Silicon/Silicium/SiliciumPkg/SiliciumPkg.dsc.inc-@@ -36,7 +36,7 @@- # Firmware Details- #- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"4.0"-- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"Project Silicium"-+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"HakiOS"-- #- # Memory