1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

stub: Fix booting with old kernels

This fixes a regression introduced in e1636807 that removed setting this
value as it seemingly was not used by the kernel and would actively
break above 4G boots. But old kernels (4.18 in particular) will not boot
properly if it is not filled out by us.
The original issue was using the truncated value to then jump into the
kernel entry point, which we do not do anymore. So setting this value
again on newer kernels is fine.
This commit is contained in:
Jan Janssen 2022-10-16 09:36:21 +02:00 committed by Daan De Meyer
parent 235ae69cbe
commit d388f3d723

View File

@ -107,6 +107,10 @@ static void linux_efi_handover(EFI_HANDLE image, uintptr_t kernel, BootParams *p
kernel += (params->hdr.setup_sects + 1) * KERNEL_SECTOR_SIZE; /* 32bit entry address. */
/* Old kernels needs this set, while newer ones seem to ignore this. Note that this gets truncated on
* above 4G boots, which is fine as long as we do not use the value to jump to kernel entry. */
params->hdr.code32_start = kernel;
#ifdef __x86_64__
kernel += KERNEL_SECTOR_SIZE; /* 64bit entry address. */
#endif