drivers/firmware/efi/libstub/zboot.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/libstub/zboot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/libstub/zboot.c- Extension
.c- Size
- 2824 bytes
- Lines
- 101
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/efi.hlinux/pe.hasm/efi.hlinux/unaligned.hefistub.h
Detected Declarations
function alloc_preferred_addressfunction efi_cache_sync_imagefunction efi_zboot_entry
Annotated Snippet
if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
// Setting the random seed to 0x0 is the same as
// allocating as low as possible
seed = 0;
} else if (efi_nokaslr) {
efi_info("KASLR disabled on kernel command line\n");
} else {
status = efi_get_random_bytes(sizeof(seed), (u8 *)&seed);
if (status == EFI_NOT_FOUND) {
efi_info("EFI_RNG_PROTOCOL unavailable\n");
efi_nokaslr = true;
} else if (status != EFI_SUCCESS) {
efi_err("efi_get_random_bytes() failed (0x%lx)\n",
status);
efi_nokaslr = true;
}
}
status = efi_random_alloc(alloc_size, min_kimg_align, &image_base,
seed, EFI_LOADER_CODE, 0, EFI_ALLOC_LIMIT);
if (status != EFI_SUCCESS) {
efi_err("Failed to allocate memory\n");
return status;
}
}
// Decompress the payload into the newly allocated buffer
status = efi_zboot_decompress((void *)image_base, alloc_size) ?:
efi_stub_common(handle, image, image_base, cmdline_ptr);
efi_free(alloc_size, image_base);
return status;
}
Annotation
- Immediate include surface: `linux/efi.h`, `linux/pe.h`, `asm/efi.h`, `linux/unaligned.h`, `efistub.h`.
- Detected declarations: `function alloc_preferred_address`, `function efi_cache_sync_image`, `function efi_zboot_entry`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.