grub2-dev: Finding your way around

1 
1 3 Finding your way around
1 *************************
1 
1 Here is a brief map of the GRUB code base.
1 
1    GRUB uses Autoconf and Automake, with most of the Automake input
1 generated by a Python script.  The top-level build rules are in
1 'configure.ac', 'grub-core/Makefile.core.def', and 'Makefile.util.def'.
1 Each block in a '*.def' file represents a build target, and specifies
1 the source files used to build it on various platforms.  The '*.def'
1 files are processed into Automake input by 'gentpl.py' (which you only
1 need to look at if you are extending the build system).  If you are
1 adding a new module which follows an existing pattern, such as a new
1 command or a new filesystem implementation, it is usually easiest to
1 grep 'grub-core/Makefile.core.def' and 'Makefile.util.def' for an
1 existing example of that pattern to find out where it should be added.
1 
1    In general, code that may be run at boot time is in a subdirectory of
1 'grub-core', while code that is only run from within a full operating
1 system is in a subdirectory of the top level.
1 
1    Low-level boot code, such as the MBR implementation on PC BIOS
1 systems, is in the 'grub-core/boot/' directory.
1 
1    The GRUB kernel is in 'grub-core/kern/'.  This contains core
1 facilities such as the device, disk, and file frameworks, environment
1 variable handling, list processing, and so on.  The kernel should
1 contain enough to get up to a rescue prompt.  Header files for kernel
1 facilities, among others, are in 'include/'.
1 
1    Terminal implementations are in 'grub-core/term/'.
1 
1    Disk access code is spread across 'grub-core/disk/' (for accessing
1 the disk devices themselves), 'grub-core/partmap/' (for interpreting
1 partition table data), and 'grub-core/fs/' (for accessing filesystems).
1 Note that, with the odd specialised exception, GRUB only contains code
1 to _read_ from filesystems and tries to avoid containing any code to
1 _write_ to filesystems; this lets us confidently assure users that GRUB
1 cannot be responsible for filesystem corruption.
1 
1    PCI and USB bus handling is in 'grub-core/bus/'.
1 
1    Video handling code is in 'grub-core/video/'.  The graphical menu
1 system uses this heavily, but is in a separate directory,
1 'grub-core/gfxmenu/'.
1 
1    Most commands are implemented by files in 'grub-core/commands/', with
1 the following exceptions:
1 
1    * A few core commands live in 'grub-core/kern/corecmd.c'.
1 
1    * Commands related to normal mode live under 'grub-core/normal/'.
1 
1    * Commands that load and boot kernels live under 'grub-core/loader/'.
1 
1    * The 'loopback' command is really a disk device, and so lives in
1      'grub-core/disk/loopback.c'.
1 
1    * The 'gettext' command lives under 'grub-core/gettext/'.
1 
1    * The 'loadfont' and 'lsfonts' commands live under 'grub-core/font/'.
1 
1    * The 'serial', 'terminfo', and 'background_image' commands live
1      under 'grub-core/term/'.
1 
1    * The 'efiemu_*' commands live under 'grub-core/efiemu/'.
1 
1    * OS-dependent code should be under 'grub-core/osdep/'
1 
1    * Utility programs meant to be run from a full operating system
1      (except OS-dependent code mentioned previously) are in 'util/'.
1 
1    There are a few other special-purpose exceptions; grep for them if
1 they matter to you.
1