Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Mirror ofhttps://git.sr.ht/~pmh/mlb2

License

NotificationsYou must be signed in to change notification settings

philhofer/mlb2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal Linux Bootloader, adapted/adopted from Sebastian Plotzby Wiktor Kerr, and then later adapted for use in virtualizedbooting environments by Phil Hofer for use in thedistill project.

This is a single stage x86 bootloader that can boot a single Linux kernel.There is no support for initrd and only one kernel can be configured to boot atany time.

MLB was originally written by Sebastian Plotz. Wiktor Kerr changed the code veryslightly and wrote the original Makefile andmlbinstall. Phil Hofer optimizedthe assembly a bit more and wrote a new Makefile andmlb2install.

http://sebastian-plotz.blogspot.de/

Dependencies

  • a C compiler
  • ld(1)
  • make(1)
  • nasm(1)

Building

Runmake, optionally with CC, LD, CFLAGS, LDFLAGS, etc. set via thecommand line, i.e.make CC=gcc 'CFLAGS=-02'

Themlb2install binary has the MBR boot code embedded in it, soit can simply be copied to its final destination, or you canrunmake install. (The Makefile will respect the conventionalPREFIX andDESTDIR arguments for the install prefix and stagingprefix, respectively.)

Installing

To install MLB, simply invoke

mlb2install <target> <kernel-lba> <command line>

where:

  • <target> is where you want your bootloader installed (e.g. a file, a blockdevice, whatever)
  • <kernel-lba> is the LBA (in 512-byte sectors) of the kernel within thetarget device
  • <command line> is the command line to pass to the kernel - don't forget topassroot= asmlbinstall will not calculate the root device. Currentlythe command line cannot be longer than 99 bytes (more just won't fit in theMBR).

Typically, the kernel will live in reserved (unformatted) space at thebeginning of the drive before the first real MBR partition, or it willbegin at the first partition. (You can simplydd your kernel to theright place once you've arranged the partitions so that it won't be clobberedby other disk manipulation.)

mlb2install is quite noisy if it detects any problems. Restore your MBR frombackup, fix the problems, and try again. If it succeeds, it won't say anything.

Error codes

If MLB fails to boot your kernel, it will print a one-letter error code.Currently, there are two error codes:

Error What it means----- ----------------------------------------  R   Failed reading data from disk  M   Failed moving data to its final location

[8]ページ先頭

©2009-2025 Movatter.jp