Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ismoreirakt/sbtl
A simple bootloader written in Assembly.
https://github.com/ismoreirakt/sbtl
assembly bootloader c-language makefile
Last synced: about 1 month ago
JSON representation
A simple bootloader written in Assembly.
- Host: GitHub
- URL: https://github.com/ismoreirakt/sbtl
- Owner: IsMoreiraKt
- Created: 2024-11-08T04:01:15.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-08T04:18:15.000Z (3 months ago)
- Last Synced: 2024-12-31T21:21:10.659Z (about 1 month ago)
- Topics: assembly, bootloader, c-language, makefile
- Language: Assembly
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Bootloader
This project implements a bootloader in Assembly and C, which is responsible for loading the kernel of an operating system into memory and starting code execution in 32-bit protected mode.## Project structure
```bash
|-- sbtl/
|-- src/
|-- disk.asm
|-- global-descriptor-table.asm
|-- kernel.c
|-- kernel-entry.asm
|-- master-boot-record.asm
|-- switch-to-32bit.asm
|-- Makefile
|-- README.md
```- **master-boot-record.asm:** Implements the bootloader that is loaded by the BIOS and makes the transition to the kernel.
- **kernel-entry.asm:** Kernel entry point, prepares the environment for C code execution.
- **kernel.c:** Simple kernel that displays a character in video memory.
- **global-descriptor-table.asm:** Defines the GDT required for the transition to protected mode.
- **disk.asm:** Contains auxiliary functions for reading disks.
- **switch-to-32bit.asm:** Transitions from real mode to protected mode.
- **Makefile:** Manages the compilation, linking and execution of the project.## How it works
- **Initial Loading:** The bootloader (“master-boot-record.asm”) is the first code to be executed by the BIOS. It configures the stack and loads the kernel into memory.
- **GDT configuration:** The “global-descriptor-table.asm” file defines the GDT required for the transition to 32-bit protected mode.
- **Transition to Protected Mode:** The “switch-to-32bit.asm” makes the transition to protected mode by activating the protection bit in CR0.
- **Kernel execution:** After the transition, control is passed to the kernel, which executes the main() function written in C.## Compilation and Execution Instructions
Make sure you have `nasm`, `gcc` and the `qemu emulator` installed.#### Compilation and execution
In the root of the project, run:```bash
make
```#### Cleaning
To clear the generated files:```bash
make clean
```