STRUCT RISCV_IMAGE_HEADER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct riscv_image_header(9) 🌸

okay so bestie, welcome to the Kernel API Manual β€” we're doing the RISC-V corner of the kernel today and honestly? it's giving iconic. this is struct riscv_image_header, aka the riscv kernel image header, and it's lowkey the first thing anyone reads when they wanna know what's inside a RISC-V kernel image. main character energy fr fr πŸ’…


✨ NAME ✨

struct riscv_image_header β€” the riscv kernel image header. that's it, that's the vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

no cap, here's the whole thing, character for character, don't touch it:

struct riscv_image_header {
    u32 code0;
    u32 code1;
    u64 text_offset;
    u64 image_size;
    u64 flags;
    u32 version;
    u32 res1;
    u64 res2;
    u64 magic;
    u32 magic2;
    u32 res3;
 };

like… look at her. all those fields. so organized. we stan a well-structured struct πŸ’œ


πŸ‘‘ Members πŸ‘‘

time for the member-by-member breakdown, pls pay attention bestie:

  • code0 β€” Executable code πŸ’–
  • code1 β€” Executable code πŸ’– (yes, again β€” twins, periodt)
  • text_offset β€” Image load offset (little endian)
  • image_size β€” Effective Image size (little endian)
  • flags β€” kernel flags (little endian)
  • version β€” version
  • res1 β€” reserved πŸ™ˆ
  • res2 β€” reserved πŸ™ˆ
  • magic β€” Magic number (RISC-V specific; deprecated) ⚠️ deprecated, bestie β€” noted, not ignored
  • magic2 β€” Magic number 2 (to match the ARM64 'magic' field pos)
  • res3 β€” reserved (will be used for PE COFF offset)
ngl the three "reserved" fields are just seat-warmers sitting there looking pretty, and res3 has a whole future career lined up as a PE COFF offset. we love a glow-up in progress 🌈

🧚 Description 🧚

okay so the whole intention here β€” and this is the important bit β€” is for this header format to be shared between multiple architectures, specifically so we don't get a whole proliferation of image header formats. one header, many archs, no chaos. slay πŸ’…βœ¨


πŸ’€ SEE ALSO πŸ’€

  • Kernel file ./arch/riscv/include/asm/image.h β€” go read the actual header, it's right there, iykyk 🫢

and that's the tea, bestie πŸ“ this lil page came to you straight from the Kernel API Manual, filed under ./arch/riscv/include/asm, and it's dated October 2026 β€” so mark your calendar, screenshot it, send it to the group chat, whatever you gotta do. you understood it, you ate, periodt πŸ’–πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from