efi_relocate_kernel(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is the efi_relocate_kernel(9) page from the Kernel API Manual, and the name section is literally efi_relocate_kernel β€” copy memory area. that’s the whole name, bestie, no extra lore 🫢

✨ SYNOPSIS ✨

efi_status_t efi_relocate_kernel (unsigned long *image_addr , unsigned
long image_size , unsigned long alloc_size , unsigned long
preferred_addr , unsigned long alignment , unsigned long min_addr );

πŸŽ€ ARGUMENTS πŸŽ€

  • image_addr β€” pointer to the address of the memory area to copy. yes, a pointer-to-address situation, stay with me πŸ’…
  • image_size β€” size of the memory area to copy.
  • alloc_size β€” minimum size of memory to allocate. it must be greater or equal to image_size β€” this is a hard requirement, not a suggestion πŸ‘‘
  • preferred_addr β€” the preferred target address.
  • alignment β€” minimum alignment of the allocated memory area. it should be a power of two.
  • min_addr β€” minimum target address.

🌸 DESCRIPTION 🌸

So what it does: copy a memory area to a newly allocated memory area that’s aligned according to alignment, but at least EFI_ALLOC_ALIGN β€” yes, EFI_ALLOC_ALIGN is the floor, bestie. If the preferred address is not available, the allocated address will not be below min_addr. On exit, image_addr is updated to the target copy address that was used. literally it hands you the new address through that pointer πŸ’–

This function is used to copy the Linux kernel verbatim. It does not apply any relocation changes. read that again: verbatim, no relocation changes, periodt. no cap, don’t expect it to fix up addresses for you πŸ”₯

πŸ¦‹ RETURN πŸ¦‹

status code β€” yep, that’s the return: a status code. short and iconic, ngl 😌

🌈 SEE ALSO 🌈

  • Kernel file ./drivers/firmware/efi/libstub/loongarch-stub.c β€” go peek if you want the source-side vibe πŸ‘€

okay that’s the whole page, bestie πŸ’œ this one’s sourced from ./drivers/firmware/efi/libstub and dated October 2026. mwah, go copy some memory responsibly πŸ’‹βœ¨

πŸ“¦ where this page comes from