Re: [PATCH 1/2] x86/boot/compressed/64: Remove .bss/.pgtable from bzImage
From: Sergey Shatunov
Date: Sun Apr 05 2020 - 20:01:03 EST
On Sun, 2020-04-05 at 19:18 -0400, Arvind Sankar wrote:
> I'm not familiar with systemd-boot: when you say systemd-boot stub,
> is
> that something different from the kernel's EFI_STUB option? Or is it
> just a kernel with EFI_STUB enabled and with builtin initramfs +
> builtin
> cmdline?
Basicaly systemd-boot stub is efi application with packed EFI_STUB-
enabled kernel, initrd and cmdline into single file. Source can be
found here:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.c
It doesn't do anything unusual, just extracting data from sections and
calling efi handover.
Final image created by objcopy'ing precompiled stub and adding sections with that stuff:
objcopy \
--add-section .osrel=os_release --change-section-vma
'.osrel=0x20000' \
--add-section .cmdline=cmdline --change-section-vma
'.cmdline=0x30000' \
--add-section .linux=vmlinuz --change-section-vma
'.linux=0x2000000' \
--add-section .initrd=initrd --change-section-vma
'.initrd=0x3000000' \
/usr/lib/systemd/boot/efi/linuxx64.efi.stub output.efi
> The first error message you mention should be from systemd-boot after
> the kernel exits with an EFI_BUFFER_TOO_SMALL error status. The
> second
> one -- is that 'exit_boot() failed' rather than 'exit_efi() failed'?
> I
> can't find the latter string in the tree.
Yeah, probably it's exit_boot()
> Can you also specify a commit tag that is broken + works with this
> patch
> reverted, just to make sure we're looking at the same code?
I'm using latest master branch from Torvalds tree, so latest commit
(for now it's a10c9c710f9ecea87b9f4bbb837467893b4bef01) broken, but
with 3ee372ccce4d4e7c610748d0583979d3ed3a0cf4 reverted works.
Not sure
what I should specify as broken except the
3ee372ccce4d4e7c610748d0583979d3ed3a0cf4 itself.
But as I told 'Buffer
Too Small' changed to 'exit_boot() failed' couple times during
bisecting (it was closely around that commit, probably in commits about
.eh_frame section), but I don't remember exactly commits when this
happened. I could do one more bisecting with more details about each
step if you wish.