Stop embedding a boot script in the EFI binaries - #7
Merged
Conversation
Every EFI target is now built without EMBED=, so it downloads autoexec.ipxe
and executes it. autoexec/ -- the opt-in duplicate tree that used to be the
only place an EMBED-less binary lived -- is gone, because the root now IS
that build. 10secdelay/ keeps its BIOS files and loses its EFI ones.
WHY
An embedded script is compiled into 15 binaries. Changing FOG's boot logic
therefore meant a toolchain and a 20-minute rebuild, which is why the
EMBED-less variant was added in the first place (GH-957) -- and then left as
an opt-in nobody opted into, because opting in meant knowing the difference
and editing DHCP.
It is also the only shape that works under Secure Boot: efi_autoexec.c is
FILE_SECBOOT ( PERMITTED ) and an embedded script is not.
WHY THE ROOT COULD NOT SIMPLY GAIN autoexec.ipxe BEFORE
efi_probe() calls efi_autoexec_load() unconditionally, so an EMBED-marked
binary still DOWNLOADS the script -- it just never runs it, because
first_image() returns the embedded one ahead of it. Nothing then unregisters
it, and at boot initrd_load_all() concatenates every registered non-hidden
image into the ramdisk in registration order. autoexec.ipxe registered first,
so the kernel gets 2 KB of iPXE script where init.xz's compression magic
should be and panics:
VFS: Unable to mount root fs on "/dev/ram0" or unknown-block(1,0)
(forums #18213). And efi_autoexec_network() falls back to /autoexec.ipxe when
the binary's own directory has none -- so ONE embedded EFI binary anywhere in
the tree was enough to poison every client that fell back to the root. That
is why the EMBED-less binaries had to be quarantined under autoexec/ and why
the installer deleted any autoexec.ipxe it found at the root.
Removing EMBED from every EFI target removes the constraint rather than
working around it. An EMBED-less binary EXECUTES the script, and image_exec()
unregisters it for the duration, so it is gone before boot runs.
THE 10-SECOND DELAY
10secdelay/ existed because the delay was two lines -- an echo and a sleep --
compiled in. On EFI that is now an edit to autoexec.ipxe, which fogproject's
installer makes via --boot-delay. Legacy BIOS has no efi_autoexec_load() and
so has no script to edit, which is why 10secdelay/ survives with BIOS files
only.
src-efi/ipxescript and src-efi/ipxescript10sec are deleted: nothing reads them
now. src/ipxescript stays -- the BIOS binaries still embed it.
VERIFIED
- strings(1) on the built EFI binaries finds no "Checking net0 for DHCP",
while finding 15 other iPXE strings, so the absence is real and not an
artefact of compression.
- BIOS still carries two distinct embedded scripts: undionly.kkpxe 102977
bytes vs 10secdelay/undionly.kkpxe 103060.
- tools/check-linked-objects.sh passes unchanged on all three baselines
(340/341/338 objects). Dropping EMBED changes which script bytes land in
embedded.o, not which objects the linker pulls in, so no option drifted.
3 tasks
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.
Every EFI target is now built without
EMBED=, so it downloadsautoexec.ipxeand executes it.autoexec/— the opt-in duplicate tree that used to be the only place an EMBED-less binary lived — is gone, because the root now is that build.10secdelay/keeps its BIOS files and loses its EFI ones.Why
An embedded script is compiled into 15 binaries, so changing FOG's boot logic meant a toolchain and a 20-minute rebuild. That is why the EMBED-less variant was added (GH-957) — and then left as an opt-in nobody opted into, because opting in meant knowing the difference existed and editing DHCP.
It is also the only shape that works under Secure Boot:
efi_autoexec.cisFILE_SECBOOT ( PERMITTED )and an embedded script is not.Why the root could not simply gain an
autoexec.ipxebeforeefi_probe()callsefi_autoexec_load()unconditionally, so an EMBED-marked binary still downloads the script — it just never runs it, becausefirst_image()returns the embedded one ahead of it. Nothing then unregisters it, and at bootinitrd_load_all()concatenates every registered non-hidden image into the ramdisk in registration order.autoexec.ipxeregistered first, so the kernel gets 2 KB of iPXE script whereinit.xz's compression magic should be, and panics:(forums #18213). And
efi_autoexec_network()falls back to/autoexec.ipxewhen the binary's own directory has none — so one embedded EFI binary anywhere in the tree was enough to poison every client that fell back to the root. Hence the quarantine underautoexec/, and hence the installer deleting anyautoexec.ipxeit found at the root.Removing
EMBED=from every EFI target removes the constraint instead of working around it. An EMBED-less binary executes the script, andimage_exec()unregisters it for the duration, so it is gone beforebootruns.The 10-second delay
10secdelay/existed because the delay was two lines — anechoand asleep— compiled in. On EFI that is now an edit toautoexec.ipxe, which fogproject's installer makes via a new--boot-delay. Legacy BIOS has noefi_autoexec_load()and therefore no script to edit, which is why10secdelay/survives with BIOS files only.src-efi/ipxescriptandsrc-efi/ipxescript10secare deleted — nothing reads them now.src/ipxescriptstays; the BIOS binaries still embed it.Verified
strings(1)on the built EFI binaries finds noChecking net0 for DHCP, while finding 15 other iPXE strings — so the absence is real, not an artefact of compression.undionly.kkpxe102977 bytes vs10secdelay/undionly.kkpxe103060.tools/check-linked-objects.shpasses unchanged on all three baselines (340/341/338 objects). DroppingEMBED=changes which script bytes land inembedded.o, not which objects the linker pulls in, so no option drifted.Breaking
A DHCP
filenamebeginningautoexec/stops resolving. The replacement is the same name without that prefix. FOG's own generateddhcpd.conf/Kea config never used those paths, so only hand-written configs are affected; fogproject's installer removes the stale directory and prints the mapping.Pairs with FOGProject/fogproject#TBD.