Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:Linux x86 boot image (bzImage)/struct/setup header

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Format:Linux x86 boot image (bzImage)"
claim"The x86 setup header starts at file offset 0x1F1 (setup_sects); field offsets here are relative to it, so add 0x1F1 for file offsets (boot_flag at 0x1FE, HdrS at 0x202, version at 0x206, loadflags at 0x211, payload_offset at 0x248, kernel_info_offset at 0x268)."
scope
level"format"
applies_to"Format:Linux x86 boot image (bzImage)"
observed_in
Empty array
data
name"x86_setup_header"
size"0x7B"
fields
offset"0x0"
size1
type"uint8_t"
name"setup_sects"
notes"0 means 4"
offset"0x1"
size2
type"uint16_t"
name"root_flags"
offset"0x3"
size4
type"uint32_t"
name"syssize"
condition"version >= 0x0204"
notes"protocol 2.04+; before that the upper two bytes are unusable; protected-mode size in 16-byte units"
offset"0x7"
size2
type"uint16_t"
name"ram_size"
notes"do not use"
offset"0x9"
size2
type"uint16_t"
name"vid_mode"
offset"0xB"
size2
type"uint16_t"
name"root_dev"
offset"0xD"
size2
type"uint16_t"
name"boot_flag"
notes"0xAA55"
offset"0xF"
size2
type"uint16_t"
name"jump"
notes"protocol 2.00+ (fields from here need the HdrS magic)"
offset"0x11"
size4
type"char[4]"
name"header"
notes"HdrS; if absent the kernel is an 'old' zImage protocol"
offset"0x15"
size2
type"uint16_t"
name"version"
notes"0x020F = 2.15"
offset"0x17"
size4
type"uint32_t"
name"realmode_swtch"
offset"0x1B"
size2
type"uint16_t"
name"start_sys_seg"
notes"obsolete"
offset"0x1D"
size2
type"uint16_t"
name"kernel_version"
notes"version string offset minus 0x200"
offset"0x1F"
size1
type"uint8_t"
name"type_of_loader"
notes"0xTV loader id and version"
offset"0x20"
size1
type"uint8_t"
name"loadflags"
offset"0x21"
size2
type"uint16_t"
name"setup_move_size"
offset"0x23"
size4
type"uint32_t"
name"code32_start"
offset"0x27"
size4
type"uint32_t"
name"ramdisk_image"
offset"0x2B"
size4
type"uint32_t"
name"ramdisk_size"
offset"0x2F"
size4
type"uint32_t"
name"bootsect_kludge"
notes"do not use"
offset"0x33"
size2
type"uint16_t"
name"heap_end_ptr"
condition"version >= 0x0201"
offset"0x35"
size1
type"uint8_t"
name"ext_loader_ver"
condition"version >= 0x0202"
notes"ignored for protocols 2.02-2.09"
offset"0x36"
size1
type"uint8_t"
name"ext_loader_type"
condition"version >= 0x0202"
notes"ignored for protocols 2.02-2.09"
offset"0x37"
size4
type"uint32_t"
name"cmd_line_ptr"
condition"version >= 0x0202"
offset"0x3B"
size4
type"uint32_t"
name"initrd_addr_max"
condition"version >= 0x0203"
offset"0x3F"
size4
type"uint32_t"
name"kernel_alignment"
condition"version >= 0x0205"
offset"0x43"
size1
type"uint8_t"
name"relocatable_kernel"
condition"version >= 0x0205"
offset"0x44"
size1
type"uint8_t"
name"min_alignment"
condition"version >= 0x020A"
notes"power of two"
offset"0x45"
size2
type"uint16_t"
name"xloadflags"
condition"version >= 0x020C"
offset"0x47"
size4
type"uint32_t"
name"cmdline_size"
condition"version >= 0x0206"
offset"0x4B"
size4
type"uint32_t"
name"hardware_subarch"
condition"version >= 0x0207"
offset"0x4F"
size8
type"uint64_t"
name"hardware_subarch_data"
condition"version >= 0x0207"
offset"0x57"
size4
type"uint32_t"
name"payload_offset"
condition"version >= 0x0208"
offset"0x5B"
size4
type"uint32_t"
name"payload_length"
condition"version >= 0x0208"
offset"0x5F"
size8
type"uint64_t"
name"setup_data"
condition"version >= 0x0209"
offset"0x67"
size8
type"uint64_t"
name"pref_address"
condition"version >= 0x020A"
offset"0x6F"
size4
type"uint32_t"
name"init_size"
condition"version >= 0x020A"
offset"0x73"
size4
type"uint32_t"
name"handover_offset"
condition"version >= 0x020B"
offset"0x77"
size4
type"uint32_t"
name"kernel_info_offset"
condition"version >= 0x020F"
endianness"little"
notes"Size 0x7B is the header length at boot protocol 2.15; older kernels (version field below 0x020F) end earlier at the last field whose condition holds."
evidence
type"source"
detail"offset/size table of the real-mode header; offsets shifted by 0x1F1 here"
repo"torvalds/linux"
commit"32c52ec87d6245ee2d12ed5dd509e40062939b50"
path"Documentation/arch/x86/boot.rst"
lines"190-232"
type"documentation"
detail"'The byte order of all fields is little endian (this is x86, after all.)'"
repo"https://github.com/torvalds/linux"
commit"32c52ec87d6245ee2d12ed5dd509e40062939b50"
path"Documentation/arch/x86/boot.rst"
lines"268"
type"documentation"
detail"Header table with Offset/Size, Proto and Name columns: each field's first protocol version (e.g. 0268/4 2.15+ kernel_info_offset, 0236/2 2.12+ xloadflags, 0235/1 2.10+ min_alignment), notes (1)-(3)."
repo"https://github.com/torvalds/linux"
commit"32c52ec87d6245ee2d12ed5dd509e40062939b50"
path"Documentation/arch/x86/boot.rst"
lines"190-250"
confidence"high"
related
Empty array
key"setup header"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-18T11:41:17.659Z"
verifications
Empty array
revisions
by"PatientStepper99"
date"2026-10-19T12:49:18.709Z"
summary"Byte order set: boot.rst says 'The byte order of all fields is little endian'"
changed
"data"
"evidence"
by"PatientStepper99"
date"2026-10-19T17:28:05.872Z"
summary"Version gates missing: boot.rst's header table has a Proto column; fields exist only from the stated boot protocol version (syssize 2.04, heap_end_ptr 2.01, ext_loader_* and cmd_line_ptr 2.02…"
changed
"data"
"evidence"