Jeremy Fitzhardinge <jeremy at goop.org> writes: > Eric W. Biederman wrote: >> To pick a nit. Bootloaders should never use ELF sections only ELF segments. >> In particular that is what the note segment is for. >> > > Yes, that's definitely the right answer in this case. I'll give this a spin and > see how it looks. > >> Just to verify, the goal when we are done is to have one binary >> kernel that will run on real hardware, under Xen, and paravirtualized VMware, >> and on any other hypervisor that comes along. >> > > Correct. Though as you point out, you may need both the bzImage and the vmlinux > files from a particular build for file-format reasons. I don't expect that to be the case long term. You can put an ELF header where the x86 boot sector used to live. I should be submitting patches for that in a week or so. >> As I understand it. That goal requires a bzImage with an ELF header :) >> Which we will have shortly. >> > > OK. Is there some documentation or discussion I can look at to see how that > would fit together? What's actually in the ELF header? A quick synopsis: The true elf header. typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf32_Half e_type; /* Object file type */ Elf32_Half e_machine; /* Architecture */ Elf32_Word e_version; /* Object file version */ Elf32_Addr e_entry; /* Entry point virtual address */ Elf32_Off e_phoff; /* Program header table file offset */ Elf32_Off e_shoff; /* Section header table file offset */ Elf32_Word e_flags; /* Processor-specific flags */ Elf32_Half e_ehsize; /* ELF header size in bytes */ Elf32_Half e_phentsize; /* Program header table entry size */ Elf32_Half e_phnum; /* Program header table entry count */ Elf32_Half e_shentsize; /* Section header table entry size */ Elf32_Half e_shnum; /* Section header table entry count */ Elf32_Half e_shstrndx; /* Section header string table index */ } Elf32_Ehdr; A program segment header. typedef struct { Elf32_Word p_type; /* Segment type */ Elf32_Off p_offset; /* Segment file offset */ Elf32_Addr p_vaddr; /* Segment virtual address */ Elf32_Addr p_paddr; /* Segment physical address */ Elf32_Word p_filesz; /* Segment size in file */ Elf32_Word p_memsz; /* Segment size in memory */ Elf32_Word p_flags; /* Segment flags */ Elf32_Word p_align; /* Segment alignment */ } Elf32_Phdr; The header of an elf Note. typedef struct { Elf32_Word n_namesz; /* Length of the note's name. */ Elf32_Word n_descsz; /* Length of the note's descriptor. */ Elf32_Word n_type; /* Type of the note. */ } Elf32_Nhdr; Pretty simple and easy to work with. The structures above are the only ones a bootloader should care about. The LSB should have links to the full documentation. Eric