Skip to content

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

Repositories: the UEFI is a repository of the manifest too; the common repository's tests run without the phone's

shimoku67a62572209a
diff --git a/ci/github-check.yml b/ci/github-check.yml
index e0ec4d6..be13b45 100644
--- a/ci/github-check.yml
+++ b/ci/github-check.yml
@@ -7,6 +7,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ - name: The SoC, device and UEFI repositories devices/manifest.conf names
+ # they are private repositories of their own: a token that can read them, in the secret HAKIOS_SYNC_TOKEN; without it the
+ # checks of the reference phone's configuration and the made device pages are skipped, and say so
+ env:
+ TOKEN: ${{ secrets.HAKIOS_SYNC_TOKEN }}
+ run: |
+ if [ -n "$TOKEN" ]; then
+ git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/"
+ python3 tools/hakios-device.py sync
+ else
+ echo "no HAKIOS_SYNC_TOKEN: only the common repository is checked"
+ fi
- name: Python compiles
run: |
git ls-files '*.py' | xargs -r python3 -m py_compile
@@ -52,7 +64,7 @@ jobs:
python3 tools/hakios-device-test.py
- name: The documentation pages made from the source are current
run: |
- python3 tools/docs-gen.py --check
+ [ ! -d devices/redwood ] || python3 tools/docs-gen.py --check
python3 tools/docs-check.py
- name: The Metal plug-in's reading of a .metallib refuses every file cut short or bent (sanitizers)
run: sh tools/metallib-test.sh
diff --git a/devices/manifest.conf b/devices/manifest.conf
index a89d97b..b0d6887 100644
--- a/devices/manifest.conf
+++ b/devices/manifest.conf
@@ -1,6 +1,6 @@
# devices/manifest.conf: every SoC and device repository HakiOS knows of (Android's repo manifest, UniXNU's devices.toml).
#
-# soc|device <name>
+# soc|device|uefi <name> (the UEFI is one for every device: it goes to uefi/)
# path <directory in this tree> kept here, for now: tools/hakios-device.py split makes it a repository
# repository <git URL> a repository of its own, cloned into socs/<name> or devices/<name>
# revision <commit> ... at this commit (tools/hakios-device.py lock writes it)
@@ -16,3 +16,6 @@ device redwood
device qemu
path devices/qemu
+
+uefi hakios-uefi
+ path uefi
diff --git a/tools/hakios-config-test.py b/tools/hakios-config-test.py
index ef218a0..ea53a2b 100755
--- a/tools/hakios-config-test.py
+++ b/tools/hakios-config-test.py
@@ -45,6 +45,13 @@ def args_of(out):
return out.stdout.split()
+# The reference phone's configuration is what most of this checks against: its repositories (devices/redwood, socs/sc7280) are
+# their own, and a checkout of the common repository alone does not have them until `tools/hakios-device.py sync` clones them.
+if not (os.path.isdir(os.path.join(ROOT, "devices", "redwood", "configs")) and os.path.isdir(os.path.join(ROOT, "socs", "sc7280", "configs"))):
+ print("hakios-config-test: SKIPPED: it checks the reference phone's configuration, and devices/redwood and socs/sc7280 are not "
+ "checked out (tools/hakios-device.py sync redwood sc7280)")
+ sys.exit(0)
+
work = tempfile.mkdtemp(prefix="hakios-config-test-")
try:
cfg = os.path.join(work, "cfg")
diff --git a/tools/hakios-device-test.py b/tools/hakios-device-test.py
index b27bd69..74a3a64 100755
--- a/tools/hakios-device-test.py
+++ b/tools/hakios-device-test.py
@@ -39,22 +39,23 @@ try:
for t in ("hakios-config.py", "hakios-device.py", "boot-args.py", "kernel-version.py"):
shutil.copy(os.path.join(HERE, t), os.path.join(root, "tools", t))
shutil.copytree(os.path.join(ROOT, "configs"), os.path.join(root, "configs"))
- shutil.copytree(os.path.join(ROOT, "socs"), os.path.join(root, "socs"))
+ # a SoC of the test's own, so that the test needs no SoC or device repository checked out (the common one alone runs it)
+ os.makedirs(os.path.join(root, "socs", "fakesoc", "configs"))
+ open(os.path.join(root, "socs", "fakesoc", "soc.conf"), "w").write("soc fakesoc\n\ttitle a SoC made for the test\n")
+ open(os.path.join(root, "socs", "fakesoc", "configs", "fakesoc.config"), "w").write(
+ "# HakiOS fragment: the test's SoC.\nCONFIG_SOC=\"fakesoc\"\nCONFIG_CPUS=8\nCONFIG_THERMAL=y\nCONFIG_HAKIOS_THERMAL=y\n")
for sub in os.listdir(os.path.join(ROOT, "drivers")):
if os.path.isfile(os.path.join(ROOT, "drivers", sub, "conf")):
os.makedirs(os.path.join(root, "drivers", sub))
shutil.copy(os.path.join(ROOT, "drivers", sub, "conf"), os.path.join(root, "drivers", sub, "conf"))
- shutil.copytree(os.path.join(ROOT, "devices", "redwood", "configs"), os.path.join(root, "devices", "redwood", "configs"))
- shutil.copy(os.path.join(ROOT, "devices", "redwood", "device.conf"), os.path.join(root, "devices", "redwood"))
- open(os.path.join(root, "devices", "redwood", "pull-firmware.sh"), "w").close()
- shutil.copy(os.path.join(ROOT, "devices", "manifest.conf"), os.path.join(root, "devices"))
+ shutil.copytree(os.path.join(ROOT, "devices", "qemu"), os.path.join(root, "devices", "qemu"))
- r = tool(root, "hakios-device.py", "new", "fakephone", "--soc", "sc7280", "--title", "Fake Phone")
+ r = tool(root, "hakios-device.py", "new", "fakephone", "--soc", "fakesoc", "--title", "Fake Phone")
check("new: a device repository that check passes", r.returncode == 0 and "all hold together" in r.stdout, r.stdout + r.stderr)
conf = open(os.path.join(root, "devices", "fakephone", "configs", "fakephone.config")).read()
check("new: the phone drivers left out, the SoC's kept, QEMU's untouched",
"# CONFIG_HAKIOS_GOODIX is not set" in conf and "HAKIOS_THERMAL" not in conf and "HAKIOS_VIRTIO" not in conf, conf)
- r = tool(root, "hakios-device.py", "new", "fakephone", "--soc", "sc7280", "--title", "x")
+ r = tool(root, "hakios-device.py", "new", "fakephone", "--soc", "fakesoc", "--title", "x")
check("new: refuses a device that exists", r.returncode != 0 and "already exists" in r.stderr, r.stderr)
r = tool(root, "hakios-device.py", "new", "other", "--soc", "nosuchsoc", "--title", "x")
check("new: refuses a SoC with no repository", r.returncode != 0 and "no socs/nosuchsoc" in r.stderr, r.stderr)
@@ -96,8 +97,8 @@ try:
check("a device repository cannot declare `standard` files", "a SoC or device repository has drivers, not `standard`" in r.stdout + r.stderr,
r.stdout + r.stderr)
os.remove(os.path.join(d, "conf"))
- shutil.copy(os.path.join(root, "socs", "sc7280", "configs", "sc7280.config"),
- os.path.join(root, "devices", "fakephone", "configs", "sc7280.config"))
+ shutil.copy(os.path.join(root, "socs", "fakesoc", "configs", "fakesoc.config"),
+ os.path.join(root, "devices", "fakephone", "configs", "fakesoc.config"))
r = tool(root, "hakios-config.py", "defconfig", "fakephone")
check("the same configuration name in two repositories is refused", r.returncode != 0 and "more than one repository" in r.stderr, r.stderr)
@@ -105,7 +106,7 @@ try:
r = tool(ROOT, "hakios-device.py", "check")
check("the devices and SoCs of this tree hold together", r.returncode == 0, r.stdout + r.stderr)
r = tool(ROOT, "hakios-device.py", "list")
- check("list names redwood, qemu and sc7280", all(n in r.stdout for n in ("redwood", "qemu", "sc7280")), r.stdout)
+ check("list names the QEMU device, which the common repository always has", "qemu" in r.stdout, r.stdout)
finally:
shutil.rmtree(work, ignore_errors=True)
diff --git a/tools/hakios-device.py b/tools/hakios-device.py
index 5a66816..b49cee6 100755
--- a/tools/hakios-device.py
+++ b/tools/hakios-device.py
@@ -85,10 +85,12 @@ def manifest():
path = os.path.join(ROOT, "devices", "manifest.conf")
if not os.path.isfile(path):
return []
- return read_blocks(path, ("device", "soc"), {"device": DEVICE_KEYS, "soc": SOC_KEYS})
+ return read_blocks(path, ("device", "soc", "uefi"), {"device": DEVICE_KEYS, "soc": SOC_KEYS, "uefi": {"path", "repository", "revision"}})
def home(kind, name):
+ if kind == "uefi":
+ return os.path.join(ROOT, "uefi") # one UEFI for every device: Mu-Silicium with HakiOS's changes (uefi/README.md)
return os.path.join(ROOT, "devices" if kind == "device" else "socs", name)
@@ -132,6 +134,12 @@ def cmd_list(_a):
named = {(k, n): f for k, n, f, _l in manifest()}
every = sorted(set(named) | set(present()), key=lambda x: (x[0] != "soc", x[1]))
for kind, name in every:
+ if kind == "uefi":
+ where = one(named[(kind, name)], "repository") or one(named[(kind, name)], "path")
+ there = os.path.isfile(os.path.join(home(kind, name), "apply.sh"))
+ print("%-6s %-10s %-44s %s" % (kind, name, "HakiOS UEFI (Mu-Silicium)" if there else
+ "NOT CHECKED OUT (tools/hakios-device.py sync %s)" % name, where))
+ continue
fields = describe(kind, name)
where = one(named.get((kind, name), {}), "repository") or one(named.get((kind, name), {}), "path") or "(not in the manifest)"
if fields is None: