Arch: single registry, broad aliases, x86_64 canonical#821
Merged
Conversation
098c882 to
d87ba87
Compare
ee2681d to
2adeddf
Compare
d87ba87 to
388e2b4
Compare
c544e17 to
9102e90
Compare
388e2b4 to
32a062b
Compare
106ae1f to
e8ec7a6
Compare
32a062b to
48d2db9
Compare
e8ec7a6 to
8738a7e
Compare
99b376e to
da51102
Compare
8738a7e to
72b1945
Compare
added 2 commits
June 11, 2026 17:39
Consolidate the seven scattered/duplicated architecture tables into one source
of truth and let users write any common spelling for an arch.
- New src/penguin/arch_registry.py (pure stdlib): one ArchSpec per arch holding
every per-namespace name (arch_subdir, dylib_subdir, kmod_subdir, qemu/panda
arch, machine, cpu, kconf, kernel_fmt/kernel_whole, serial, console, endianness)
plus accepted aliases. normalize_arch()/spec()/accessors are alias-tolerant.
- Flip x86 canonical to x86_64 (intel64 becomes an alias), matching the on-disk
asset names. Broad aliases for every arch (arm64->aarch64, ppc64le/powerpc64el
->powerpc64le, amd64->x86_64, ...).
- Refactor consumers to read the registry, deleting the duplicate tables:
utils.get_arch_subdir/get_driver_kmod_path, arch.get_dylib_subdir,
dropin_compile.DYLIB_DIRS (also fixes its missing-intel64 bug),
q_config.qemu_configs/load_q_config (now returns a fresh dict and fixes the
powerpc64le KeyError + the in-place mutation), abi_info (rekey intel64->x86_64
+ arch_abi_info() helper), and the nvram2 dylib-override duplicate. Rewire the
serial (config_patchers) and console (penguin_run) inline branches.
- Normalize core.arch to canonical at config-load (after merge), so all
downstream consumers and the realized config use one spelling; widen the schema
Literal to canonical+aliases (with a unit test asserting it equals
arch_registry.all_names()); canonicalize {{ arch }} in templating.
- Safe transition for the two assets still named by config arch
(guesthopper.<arch>, sysroots/<arch>): utils.resolve_arch_asset prefers the
canonical name and falls back to an alias filename that exists, so x86 keeps
working until the guesthopper sibling artifact is renamed. Dockerfile sysroots
stage renamed intel64 -> x86_64. Update plugin arch maps (live_image, unwind,
kffi) for the flip.
Identifier-namespace code (arch.arch_filter/arch_end, static_analyses) is left
emitting intel64 by design; normalization happens at the identifier->config
boundary (config_patchers.set_arch_info).
72b1945 to
022af4b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth PR in the config-reshape series. Targets
config-reshape-patches(#820) (it overlapsarch.py,utils.get_arch_subdir, andtemplating.build_context). Merge #818 → #820 → this.Makes architecture naming consistent and forgiving: one source of truth, accept any common spelling, and flip the odd-one-out
intel64tox86_64.One registry
src/penguin/arch_registry.py(pure stdlib) defines oneArchSpecper arch holding every per-namespace name —arch_subdir,dylib_subdir,kmod_subdir, qemu/panda arch, machine, cpu, kconf,kernel_fmt/kernel_whole, serial (major,minor), console fixup, endianness — plus accepted aliases.normalize_arch()/spec()/accessors are alias-tolerant. A unit test asserts the schema Literal equalsarch_registry.all_names(), so it can't drift.Broad aliases,
x86_64canonicalYou can now write
x86_64,intel64,amd64,arm64,ppc64le,powerpc64el, … — all normalize to one canonical name at load.x86_64is now canonical (intel64 is an accepted alias), matching the on-disk asset layout where x86_64 was always the odd one out.Consolidation (deletes the duplicates)
Refactored every consumer to read the registry:
utils.get_arch_subdir/get_driver_kmod_path,arch.get_dylib_subdir,dropin_compile.DYLIB_DIRS,q_config.qemu_configs,abi_info, thenvram2dylib-override copy, and the inline serial/console branches. Bugs fixed along the way:q_configload_q_config("powerpc64le")no longerKeyErrors (it keyed the stalepowerpc64el), and it now returns a fresh dict instead of mutating a shared module dict.dropin_compile.DYLIB_DIRSwas missingintel64(would look indylibs/intel64) — gone.Safe transition (no x86 breakage)
The only two assets named by the config arch are
guesthopper.<arch>andsysroots/<arch>.utils.resolve_arch_assetprefers the canonical (x86_64) name and falls back to an alias filename that actually exists, so x86 rehosting keeps working against the currentguesthopper.intel64artifact. The in-repo Dockerfilesysrootsstage is renamedintel64→x86_64.Cross-repo follow-up (deferred, non-breaking): rename the guesthopper sibling artifact
guesthopper.intel64→guesthopper.x86_64. The resolver covers the interim.Left intentionally
arch.arch_filter/arch_endandstatic_analyseskeep emittingintel64— that's the ELF-identifier namespace, distinct from config arch; normalization happens at the identifier→config boundary (set_arch_info).Known pre-existing smell (not changed)
penguin_prep.pykeeps its ownARCH_ABI_INFOcopy (drifted fromabi_info.pyon powerpc64/powerpc64le); I rekeyed/normalized it but didn't merge the duplicate to avoid behavior change. Flagged for a follow-up.Testing
tests/unit_tests/test_config.py: 75 passing on host — alias normalization (all arches, case-insensitive, unknown raises), Literal↔registry sync, subdir/dylib/kmod parity vs the OLD tables,load_configwithintel64andx86_64producing identical realized configs,q_configpowerpc64le + fresh-dict, abi rekey, dropin dedupe, templating alias→canonical. Recommendtests/comprehensive/test.shacross the arch matrix in-container before merge.