Git Product home page Git Product logo

carboot's Introduction

carboot

This project is a small x86_64 bootloader capable of reading FAT32 and mapping PE32+ images. It is the bootloader for carbon and is designed to do the bare minimum required for loading a kernel, it will simply load your kernel from inside the /SYSTEM/ directory, and load all files under /SYSTEM/BOOT/, it can deal with imports too, as long as the imported module is placed inside /SYSTEM/BOOT/ and will relocate your kernel and any dependencies into the upper 2MB of the 64 bit address space (0xFFFFFFFFFFE00000), all bootloader structures are placed in the 2MB of memory starting at 0xFFFFFFFFFFC00000, just before your kernel. The project is still very under-developed but hopefully that will change over time.

LOADER_BLOCK

This structure is passed to your kernel's entry point and contains all information about the environment.

typedef struct _LOADER_BLOCK {
    ULONG32               LoaderSig;
    ULONG32               RootSerial;

    ULONG32               RegionCount;
    ULONG32               FileCount;
    ULONG32               MapCount;

    LOADER_LOGICAL_REGION RegionList[ LOADER_REGION_LIST_LENGTH ];
    LOADER_BOOT_FILE      FileList[ LOADER_FILE_LIST_LENGTH ];
    LOADER_SYSTEM_MAP     MapList[ LOADER_MAP_LIST_LENGTH ];
    LOADER_BOOT_GRAPHICS  Graphics;
} LOADER_BLOCK, *PLOADER_BLOCK;

Your kernel entry point should look something like this:

void
KiSystemStartup(
    PLOADER_BLOCK Loader
);

Example All loader structures are inside ldef.h.

Memory map

1: 0x0000000000000000-0x0000000000200000 identity mapped, contains the bootloader module & some structures.
2: 0x0000000000200000-0x0000000000400000 2MB usable, for parts of the LOADER_BLOCK structure and system modules.
3: 0xFFFFFFFFFFC00000-0xFFFFFFFFFFE00000 maps to 1.
4: 0xFFFFFFFFFFE00000-0xFFFFFFFFFFFFFFFF maps to 2.

Examples

Single-module example which prints Hello World can be found here.
Multi-module example which prints Hello World, and imports functions from an external boot dependency can be found here.

Usage

Extract boot.zip to boot.vhd, open an administrator command prompt in the root directory, type build and the script will use diskpart to read/write to the FAT32 VHD. It will copy CARBLOAD.SYS, KERNEL.SYS and HAL.SYS from the multi-module example onto the VHD and then detach the VHD in-order to run it with QEMU.

Build

This project was written using Visual Studio 2017, compile as build x86_64.

carboot's People

Contributors

fengjixuchui avatar irql avatar

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.