Giter Site home page Giter Site logo

cforfun's Introduction

CForFun

This GitHub aims to be a testing platform for Linux Kernel development and study. It compiles several project to explore specific aspects of the low-level system through simplified re-implementation of specific features or through various module development.

Project #1 : Simple Master Boot Record (MBR) Analyser

Corresponding to the first 512 bytes of a storing device (e.g HDD and such), the Master Boot Record (MBR) is the place loaded by the BIOS at the booting phase. It is segmented as the following :

  • The Boot loader (for example GRUB), an executable code in charge of loading the kernel
  • The partition table describing the 4 partitions of the device
  • The magic number to validate the MBR

This project takes a storing device file as argument (typically /dev/sda or VM image files), read the first 512 bytes and tries to analyse the partition table. One usage example is shown below :

./bin/partition_record_reader sample/archvm.bin

Example screenshot

This program aimed to provide a simplified but still equivalent output as the fdisk command :

fdisk -l sample/archvm.bin

Example screenshot

Documentation :

Project #2 : Simple Initramfs Tools

At the boot stage, the initramfs (Initial RAM Filesystem) is an intermediary and optional step between the bootloader (e.g grub and such) and the actual kernel. If the hardware and root device configuration is well-known the kernel can initialize itself and mount the root partition alone using built-in drivers, but in certain cases an initramfs is necessary. In it most simplistic form the initramfs provides an early userspace to mount the different devices (especially the root partition) and start the kernel, but its behavior can be extended to specific usages such as :

  • Mounting an encrypted or logical root partition
  • Providing rescue shell if something goes wrong
  • Loads specific modules necessary to boot
  • etc

This project consists of a bash script that allows to both list the content of an initramfs archive and also create a basic initramfs booting on the /dev/sda1 root partition. Those 2 usages are shown below :

./initramfs_basictools create

Example screenshot

This command creates an initramfs archive that boots on the /dev/sda1 root partition.

./initramfs_basictools list initramfs-linux.img

Example screenshot

This command list the content of an initramfs archive, it is a simplified version of the lsinitramfs command (in a way it only supports gzip formatted archive) :

lsinitramfs initramfs-linux.img

Example screenshot

Documentation :

cforfun's People

Contributors

mokuhazushi avatar

Watchers

 avatar

cforfun's Issues

[P2] Clean-up phase really necessary ?

In the gentoo 'Custom Initramfs' tutorial they include a clean-up phase where the /proc and /sys (sometime also /dev) filesystems have to be unmount before switching root. When I include this clean-up phase the initramfs does not work anymore leading to a kernel panic.

I also never found any clean-up phase in the initramfs image given in the sample folder (this file archive was generated automatically when installing the arch VM via mkinitcpio command (see https://wiki.archlinux.org/index.php/installation_guide#Initramfs).

Is this clean-up phase really necessary ? This needs more investigation.

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.