GithubHelp home page GithubHelp logo

wikkyk / mlb Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 10.0 164 KB

Minimal Linux Bootloader, adapted/adopted from Sebastian Plotz

License: GNU General Public License v3.0

Assembly 40.41% C 59.59%
bootloader

mlb's Introduction

Minimal Linux Bootloader

Minimal Linux Bootloader, adapted/adopted from Sebastian Plotz.

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 at any time.

While I have no plans for adding initrd support, I'm willing to consider it if there is interest.

This bootloader is probably aimed at enthusiasts who are not afraid of breaking things and know how the Linux boot process works. I am not responsible if you render your machine unbootable with MLB.

MLB was originally written by Sebastian Plotz. I've changed the code very slightly and wrote the Makefile and mlbinstall.

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

Dependencies

  • a C99 compiler (tested with GCC 4.7.3)
  • an x86 machine (duh)
  • make (tested with GNU Make 3.82)
  • nasm (tested with NASM 2.10.07)
  • xxd (tested with xxd 1.10)

Building

Simply run make. You will get a binary called mlbinstall which you can use to install the bootloader. If you want to, stick it in /bin or something.

Installing

Don't forget to backup your MBR!

dd if=/dev/sdXN of=/boot/mbr.bak bs=512 count=1

To install MLB, simply invoke

mlbinstall <target> <kernel> <command line> [-vbr]

where:

  • <target> is where you want your bootloader installed (e.g. a file, a block device, whatever)
  • <kernel> is the kernel file to boot
  • <command line> is the command line to pass to the kernel - don't forget to pass root= as mlbinstall will not calculate the root device. Currently the command line cannot be longer than 80 bytes (more just won't fit in the MBR).
  • [-vbr] will make mlbinstall ignore the space for the partition table, giving you 144 bytes for the command line. You can safely use it if you're installing to a Volume Boot Record (partition), e.g. for using with another bootloader in multi-OS setups.

mlbinstall is quite noisy if it detects any problems. Restore your MBR from backup, 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

Contact

Email patches, pull requests, help requests to wiktor /at\ brodlo \dot/ net

Alternatively, send pull requests and/or open issues on github: https://github.com/wiktor-b/mlb

Thanks!

  • wiktor

mlb's People

Contributors

wikkyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mlb's Issues

chainloading issue

read_from_hdd assumes that mlb was installed on the first hard disk (0x80). This assumption breaks when mlb was chainloaded by another bootloader from another disk. BIOS assigns 0x80 to the first hdd according to boot order.

I am not familiar with real mode programming, it might be possible to enumerate all disks and compare MBR disk signature at 0x1B8 to find out which hdd.

Feature Request: initramfs support

Hi,

since I am looking for a replacement for syslinux to save space on my 3,5" 1440kB FDD based Linux Distribution I was kinda directed to this project...

As you said, there is currently no initramfs support but you'd consider it if asked for.

And I'd like to make that request since CONFIG_INITRAMFS_SOURCE would really make it a lot harder and slower to build OS/1337.

Also it would allow the Minimal Linux Bootloader or mlb to be a much easier drop-in replacement for syslinux.

Thanks in advance for your time and feedback.

Yours Faithfully,

Kevin Karhan
OS/1337 Maintainer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.