Skip to content
/ Hydrogen Public

Intermediate loader for AMD64 kernels. C rewrite of HydrogenLegacy.

Notifications You must be signed in to change notification settings

zrho/Hydrogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hydrogen

Hydrogen is an intermediate bootloader for AMD64 kernels. While being loaded itself by a Multiboot 1 compliant boot loader that supports loading of ELF64 binaries, it sets up the system for an AMD64 kernel attached as a Multiboot module.

When developing kernels and operating systems for modern AMD64 platforms one is faced with many legacy interfaces dating back to the roots of X86 and tedious initialization processes. Hydrogen is designed to handle initialization of most interfaces required for development of a 64 bit kernel to hand the developers a well defined and mostly legacy-free system state.

Hydrogen also exports an information table that combines all useful information gathered about the host system from various sources, such as ACPI or the Multiboot info tables.

While Hydrogen assumes reasonable defaults on system initialization, the kernel can take influence on that process by providing an optional header structure.

See SPECIFICATION.mdown and loader/inc/hydrogen.h (also build/hydrogen.h after the loader has been compiled) for a detailed specification of the loader and its ABI.

The test/ directory contains an example kernel that is loaded with Hydrogen and can be used to browse the info tables generated by Hydrogen in a text interface. An bootable image of the test kernel can be built with

make test && make image KERNEL=pwd/build/bin/test64.bin.

The Hydrogen loader requires a Multiboot 1 compliant bootloader with ELF64 support, such as GRUB2. A binary copy of GRUB2 that contains all necessary modules for booting from CD is shipped with this distribution and can be easily built by oneself using the freely available source of the GRUB project.

Build Requirements

Hydrogen requires the following tools to build:

  • gcc (tested with 4.6.3 20120306)
  • ld (tested with 2.21.53.0.1-6.fc16 20110716)
  • mkisofs (tested with 1.1.11)
  • nasm (tested with 2.09.08)

Hydrogen is tested on the following emulators:

  • bochs (2.5.1)
  • qemu (0.15.1)
  • VirtualBox (4.1.12)

Each release is tested on following hardware platforms:

  • Core i7 920, 6GiB DDR3 RAM, AMD Radeon HD 4870
  • Thinkpad X220i, Core i3 2310M, 4GiB DDR3 RAM, Intel HD Graphics 3000

How to Build

The top-level Makefile provides the following targets:

  • loader: Builds the $(PREFIX)/bin/hydrogen.bin loader binary and provides the hydrogen header in $(PREFIX)/inc/hydrogen.h.
  • image: Must be supplied with an absolute path to a KERNEL binary and creates a bootable ISO image $(PREFIX)/boot.iso.
  • test: Produces a test kernel binary in $(PREFIX)/bin/test64.bin.

Reasons for Rewrite

This version of Hydrogen is a rewrite of a former implementation that was written entirely in assembly. As the complexity of the system grew the author felt the need for a rewrite in C code to increase maintainability, flexibility and stability of the software.

Related Work

In development of the Hydrogen Loader the project Pure64 [1] by Return Infinity has been a great inspiration. While serving a quite similar purpose and also sharing the basic design philosophy, Pure64 is a stage 2 loader and has to care about loading the kernel from the boot medium itself, which is why to the date when Hydrogen was started it only supported FAT16 as a file system and did not support loading from devices other than a hard drive.

Hydrogen has been developed out of the wish to profit from GRUB2's wide support of hardware, file systems and devices while still not having to care about the annoying and lengthy setup required for modern AMD64 systems.

The author thanks the Return Infinity team for their great work and the inspiration that came with it.

[1] http://www.returninfinity.com/pure64.html

About

Intermediate loader for AMD64 kernels. C rewrite of HydrogenLegacy.

Resources

Stars

Watchers

Forks

Packages

No packages published