-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dracut.sh): use dynamically uefi's sections offset #2277
Conversation
a5a8d9b
to
c34a839
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this!
c34a839
to
0ee7dde
Compare
I forgot to mention that the offsets should really be aligned to the PE binary's SectionAlignment header field. |
Thanks for that clarification. I am going to look on at. |
0ee7dde
to
3215ae3
Compare
On my last changes, during the UEFI generation, it will parse the initial PE file's header (the stub) checking if it is a good PE format and catch the value of |
3215ae3
to
9672ee1
Compare
9672ee1
to
17786bd
Compare
94252ac
to
85ab666
Compare
* Uefi section are creating by `objcopy` with hardcoded sections offset. This commit allow to have the correct offset between each part of the efi file, needed to create an UKI. Offsets are simply calculated so no sections overlap, as recommended in https://wiki.archlinux.org/title/Unified_kernel_image#Manually Moreover, efi stub file's header is parsed to apply the correct offsets according the section alignment factor. * Remove EFI_SECTION_VMA_INITRD, no need anymore as initrd section offset dynamically calculated Fixes dracutdevs#2275 Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
85ab666
to
98bda69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Needs confirmation, but I think strtonum does not seem to be available in all awk variants. https://www.gnu.org/software/gawk/manual/html_node/Strtonum-Function.html Specifically on debian mawk is more popular than gawk, see #2002 (comment) This PR seems to break UEFI generation if gawk is not installed. Had we had #2166 landed, we would have seen the failure as part of the PR review. |
objcopy
with hardcoded sections offset. This patch allow to have a dynamic set of offsets between each part of the efi file, needed to create an UKI. Offsets are simply calculated so no sections overlap, see https://wiki.archlinux.org/title/Unified_kernel_image#ManuallyMoreover, efi stub file's header is parsed to apply the correct offsets according to the section alignment factor. More information here: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-windows-specific-fields-image-only
Checklist
Fixes #2275