This resolves two issues: - When used with a real floppy device, it would complain that it did not exist as it was not a regular file - It would fail when attempting to create the LBOOT directory when it already exists, as `mmd` does not have an option to not fail when the target directory exists |
||
|---|---|---|
| docs | ||
| inc | ||
| src | ||
| stage1 | ||
| tools | ||
| .defconfig | ||
| .gitignore | ||
| Kconfig | ||
| lboot.cfg.example | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| stage1.mk | ||
| stage2.ld | ||
| stage2.mk | ||
LBoot
x86 bootloader for floppy disks. For a working example of LBoot being used, see Lambda OS.
Current Support
- Filesystems
- FAT12
- Limited to the boot device
- No long filename support
- FAT12
- Serial transfer protocols
- XMODEM
- Kernel Format
- ELF
- Multiboot 2 (optional)
CMDLINEBOOTLOADER_NAMEMODULEBASIC_MEMINFOMMAPACPI_OLDACPI_NEW
- Outputs
- VGA
- Serial
Features can be toggled via inc/config.h. Stage 2 size based on features:
- All features disabled: ~20 KiB
- With all features: ~23 KiB
- With all debugging enabled: ~25 KiB
Future Work
- Loading kernel via Kermit
- Flat binary support
- Kernel relocation support (maybe)
- Look into adding minimal FAT12 support to stage 1 loader
- Currently this is leveraging an additional tool (
sector_mapper) to generate a list of sectors to load for stage 2. This makes writing/updating the bootloader to the floppy more complicated than is probably necessary. - Simply giving the stage 1 loader the first sector of the stage 2 file would probably be sufficient.
- Currently this is leveraging an additional tool (
Building
Requirements:
makegccorclangmtoolsfor generating floppy imagemenuconfigor similar, for easy configuration- Not required,
.configfile can be modified by hand - If no
.configfile is present,.defconfigis used instead - For a standalone Kconfig-compatible
menuconfig, see Kconfiglib
- Not required,
To build, simply run make in the main directory. This will generate a boot.img
file containing the bootloader. A configuration and kernel file will need to be
provided.
To write the bootloader to an existing floppy disk or image, use the following from within the root of the repository:
tools/lboot_prepare.sh <floppy disk/image>
Testing
LBoot has been tested both within QEMU, and on a Compaq Armada 1700, booting the Lambda Kernel
Config
LBoot is configured using a text file (currently must be named LBOOT.CFG in the
LBOOT directory of the boot filesystem). The syntax is simple, but somewhat
strict. Each configuration line is a key-value pair separated by a =. There
must be no spaces on either side of the =, and lines not containing a = are
effectively comments.
The following are the currently supported set of configuration keys:
CFGVER: Config version, must be 1KERNEL: Kernel file to loadCMDLINE: Commandline to pass to kernelMODULE: File to load as a module.- Each instance will add a new module, currently up to 4 are supported.
Files can be any of the following:
- Plain filename - Attempts to find the file on the boot filesystem
xmodem://COMx- Loads file via XMODEM, where x is the serial port to use, 1-4
