Skip to content

dorydev/LinuxFromScratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐧 Linux From Scratch

A simple Linux-based kernel written in C and x86_64 assembly.

📋 Table of Contents

📖 Project Overview

This project aims to create a minimal Linux-based operating system from scratch. It involves writing a kernel in C and assembly, setting up a bootloader, and creating an ISO image that can be run in a virtual machine.

🔧 Prerequisites

Ensure you have the following tools installed:

  • grub
  • nasm
  • gcc
  • xorriso
  • qemu

Alternatively, you can use the build.sh script to install the dependencies:

./build.sh

⚙️ How to Compile

📝 Compile Assembly and C Files

Compile the assembly and C files into object files using nasm and gcc:

nasm -f elf32 boot.s -o boot.o
gcc -m32 -ffreestanding -nostdlib -c kernel.c -o kernel.o

🔗 Link Object Files

Link the object files to create the kernel binary:

ld -m elf_i386 -T linker.ld -o kernel.bin boot.o kernel.o

💿 Create ISO File with GRUB

Create an ISO file using grub:

grub-mkrescue -o LinuxFromScratch.iso LinuxFromScratch/*

🚀 Launch in QEMU

Open the project folder in your terminal and type:

cd LinuxFromScratch
qemu-system-i386 -cdrom LinuxFromScratch.iso

Alternatively, you can use the Makefile for compilation:

  • To build the kernel binary:
make
  • To create a bootable ISO image:
make iso
  • To clean up the build files:
make clean
  • To rebuild the project:
make re
  • To run the kernel directly:
make run
  • To run the kernel with GRUB:
make rungrub

💡 Usage

Once the ISO is created and launched in QEMU, the kernel will display "HELLO WORLD" on the screen. This demonstrates the basic functionality of the kernel and its ability to interact with the VGA buffer.

Congratulations, it works!

About

Simple kernel (will be upgraded later)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •