https://github.com/farlepet/lboot
x86 bootloader
https://github.com/farlepet/lboot
Last synced: 10 months ago
JSON representation
x86 bootloader
- Host: GitHub
- URL: https://github.com/farlepet/lboot
- Owner: farlepet
- License: mit
- Created: 2022-07-31T01:23:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-08T21:27:25.000Z (about 3 years ago)
- Last Synced: 2025-01-11T22:20:39.512Z (12 months ago)
- Language: C
- Size: 237 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LBoot
=====
x86 bootloader for floppy disks. For a working example of LBoot being used, see
[Lambda OS](https://github.com/farlepet/lambda-os).

Current Support
---------------
- Filesystems
- FAT12
- Limited to the boot device
- No long filename support
- Serial transfer protocols
- XMODEM
- Kernel Format
- ELF
- Multiboot 2 (optional)
- `CMDLINE`
- `BOOTLOADER_NAME`
- `MODULE`
- `BASIC_MEMINFO`
- `MMAP`
- `ACPI_OLD`
- `ACPI_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.
Building
--------
Requirements:
- `make`
- `gcc` or `clang`
- `mtools` for generating floppy image
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
```
Testing
-------
LBoot has been tested both within QEMU, and on a Compaq Armada 1700, booting the
[Lambda Kernel](https://github.com/farlepet/lambda-kern)
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 1
- `KERNEL`: Kernel file to load
- `CMDLINE`: Commandline to pass to kernel
- `MODULE`: 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