Skip to content

Commit be4ca6c

Browse files
andy-shevIngo Molnar
authored and
Ingo Molnar
committed
x86/Documentation: Update algo in init_size description of boot protocol
The init_size description of boot protocol has an example of the runtime start address for the compressed bzImage. For non-relocatable kernel it relies on the pref_address value (if not 0), but for relocatable case only pays respect to the load_addres and kernel_alignment, and it is inaccurate for the latter. Boot loader must consider the pref_address as the Linux kernel relocates to it before being decompressed as nicely described in this commit message a year ago: 43b1d3e ("kexec: Allocate kernel above bzImage's pref_address") Due to this documentation inaccuracy some of the bootloaders (*) made a mistake in the calculations and if kernel image is big enough, this may lead to unbootable configurations. *) In particular, kexec-tools missed that and resently got a couple of changes which will be part of v2.0.30 release. For the record, commit 43b1d3e only fixed the kernel kexec implementation and also missed to update the init_size description. While at it, make an example C-like looking as it's done elsewhere in the document and fix indentation as presribed by the reStructuredText specifications, so the syntax highliting will work properly. Fixes: 43b1d3e ("kexec: Allocate kernel above bzImage's pref_address") Fixes: d297366 ("x86: document new bzImage fields") Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Randy Dunlap <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c809b0d commit be4ca6c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Documentation/arch/x86/boot.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,19 @@ Offset/size: 0x260/4
896896

897897
The kernel runtime start address is determined by the following algorithm::
898898

899-
if (relocatable_kernel)
900-
runtime_start = align_up(load_address, kernel_alignment)
901-
else
902-
runtime_start = pref_address
899+
if (relocatable_kernel) {
900+
if (load_address < pref_address)
901+
load_address = pref_address;
902+
runtime_start = align_up(load_address, kernel_alignment);
903+
} else {
904+
runtime_start = pref_address;
905+
}
906+
907+
Hence the necessary memory window location and size can be estimated by
908+
a boot loader as::
909+
910+
memory_window_start = runtime_start;
911+
memory_window_size = init_size;
903912

904913
============ ===============
905914
Field name: handover_offset

0 commit comments

Comments
 (0)