[PATCH 0/9] x86 boot protocol updates



[ This patch depends on the cross-architecture ELF cleanup patch. ]

This series updates the boot protocol to 2.07 and uses it to implement
paravirtual booting. This allows the bootloader to tell the kernel
what kind of hardware/pseudo-hardware environment it's coming up under,
and the kernel can use the appropriate boot sequence code.

Specifically:

- Update the boot protocol to 2.07, which adds fields to specify the
hardware subarchitecture and some subarchitecture-specific data.
It also specifies a flag to tell the boot code to avoid reloading
segment registers and playing with interrupt state, since it may not
have a visible gdt and/or may not be running in ring 0.
(Note: the segment reload and interrupt flags are conflated into one
flag, but they are not really related. We could have two flags, but
the "cli" is probably completely redundant anyway, since the bootloader
would have to be completely mad to start the kernel with interrupts
enabled.)

- Change the format of bzImage to contain an ELF file. The initial part of
the bzImage is still the boot_params header followed by the 16-bit
setup code needed for booting from BIOS. But rather than having
the self-decompressing kernel follow as a naked blob of code+data,
its actually wrapped in a page-aligned ELF file. This allows the
bootloader to extract it and parse it, and use that to know what
memory the booting kernel will need initially. Xen and lguest need
this because they start the kernel with paging enabled, and so need
to know what initial mappings to create.

- Modify the kernel boot sequence to:
1. avoid reloading the segment state (gdt and segment registers) if the
bootloader asks it to
2. jump to a subarchitecture-specific entrypoint in kernel/head.S.

- Add Xen-specific starup code, which mainly remaps the kernel from
its P=V identity mapping to the normal PAGE_OFFSET mapping.

One open issue is that I haven't made the normal head.S initial
pagetable construction code generally reusable. The default
boot-on-normal x86 hardware still uses it of course, but other
subarchitectures like Voyager and lguest could probably use it as-is,
while still needing to do other specialized things.

The obvious fix is to make it a callable function, but we don't
generally assume there's a stack available at this early stage.
It looks like it would be easy to set one up though.

As a pre-requisite for all the above, I've also cleaned up the bzImage
build process process. I've eliminated the need for the tools/build
program, and instead use the linker to do more heavy lifting. I've also
removed some somewhat obscure uses of ld and objcopy wrap binary files
in ELF .o wrappers, and replaced with with .S files containing .incbin.

The downside is that its making a bit more complex use of linker scripts,
which always opens scope for finding more binutils bugs. Only one way
to find out...

Tested to check the generated kernels boot under qemu's internal bootload
and grub, as well as booting under Xen (with an appropriate update to
the Xen domain builder).

TODO:
- poke Rusty into implementing the lguest bits
- look at Kbuild use in arch/{i386,x86_64}/boot/

J

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: installation help
    ... screen is going blank, it is most likely due to the system booting xorg, ... Boot in single user mode by modifying your kernel boot parameters: ... When displayed the kernel version during boot, ... Ok, booting the kernel. ...
    (Fedora)
  • Re: Dell PE850 and FreeBSD 6.1-RELEASE - Boot Issues
    ... problem with the machine "booting too fast" but my problem is a little ... (The drive has no tray motors, just an electro-mechanical latch which keeps it closed, and unlocks to let a spring pop out the tray by a few millimetres.) ... I have seen an issue like this once before, back in 5.2.1 and 5.3, when trying to get it to boot on some older laptop hardware. ... You may want to try someone's custom compiled kernel, ...
    (freebsd-questions)
  • Re: mkbootdisk w/FC 3
    ... > Is the rescue CD that was released with FC3 no use to you? ... disks for each time I upgrade the kernel so that I can be booting into the ... accustomed to if, for whatever reason, I can't boot in from my bootloader. ...
    (alt.os.linux.redhat)
  • Booting x86.miniroot (standalone RAM) to a specific run-level (via menu.lst.01MAC parameters) ..
    ... I have Solaris a 10 SXCR nv40 server setup to boot clients to the ... of the "kernel" lines ... This one boots with only a small subset of the smf services ... booting x86.miniroot intercepts them to act on them. ...
    (comp.unix.solaris)
  • [PATCH 05/10] i386: make the bzImage payload an ELF file
    ... This patch makes the payload of the bzImage file an ELF file. ... setup_size entry in the boot params, and using that to find the offset ... required to decompress and start booting the kernel. ...
    (Linux-Kernel)