-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added sections below image base #4
Comments
FWIW, I also tried using objcopy \
--preserve-dates \
--enable-deterministic-archives \
--add-section ".kernel=$KERNEL" --set-section-flags .kernel=code,readonly \
--add-section ".cmdline=$CMDLINE" --set-section-flags .cmdline=data,readonly \
--add-section ".initrd=$INITRD" --set-section-flags .initrd=data,readonly \
target/x86_64-unknown-uefi/debug/hello-uefi.efi \
ESP/efi/boot/bootx64.efi But the result in the same. |
Looks like > objdump -p ESP/efi/boot/bootx64.efi | grep ImageBase
ImageBase 0000000140000000 I'm not sure if I know how to address this in
|
@WhyNotHugo -- did you ever figure out how to resolve or work around this problem? I was successfully using efi-mkuki until changing the kernel that I'm using from 5.15 to 6.8, and my base OS image from Ubuntu 22.04LTS to Ubuntu 24.04LTS. I now have the object loaded below base error too. |
I couldn't figure out how to make this work with At the time, I wrote my own custom code using a library that handled PE for this. It was a horrible pile of hacks. I can't seem to find any of it now, sorry. |
I found the problem to be /usr/lib/systemd/boot/efi/linuxx64.efi.stub that is included in Ubuntu 24.04LTS's systemd-efi-bin package. Using this stub to produce the unified kernel image results in the following warning from objcopy: objcopy:/tmp/NEW_ROOT1224/boot/efi/EFI/ubuntu/vmlinuz.efi:.osrel:sectionbelowimagebase If I copied the same file from an Ubuntu 22.04LTS system (in systemd package) and used that instead, I got an EFI binary that boots. So, at least for now, that is my work-around. |
Given that gummiboot and other stubs rely on the now-deprecated handover protocol, I'm writing my own little stub loader.
The loader by itself "runs" and can inspect its own PE table to find PE sections (e.g.: the kernel, cmdline, initrd). However, I'm having a hard time assembling a binary which actually contains the stub plus these three.
I'm basically using the following:
Which warns:
Indeed, it seems that the new sections are added to the begging of the file, not to the end of it:
For reference, this is by stub before running
mkuki
:The resulting binary doesn't run. I'm pretty sure that it is not valid due to the order of the sections (e.g.: the image base should be at the beginning). However, I can't figure out how to force a different order.
For reference, using
mkuki
with gummiboot's stub results in a different ordering:I tried using
objcopy
manually, but ended up having the same issue. Any ideas how to address this?The text was updated successfully, but these errors were encountered: