
Custom Linux Kernel and BusyBox Setup
Welcome to the guide where we embark on a journey to build our very own custom Linux kernel and BusyBox, because why settle for pre-packaged when you can have it your way? Get ready to dive into the world of minimalistic and customizable Linux operating systems!
Step-by-Step Instructions
Step 1: Install Dependencies
First things first, let’s make sure we have all the necessary tools and packages. Run the following command:
sudo apt update && sudo apt install wget bzip2 libncurses-dev flex bison bc libelf-dev libssl-dev xz-utils autoconf gcc make libtool git vim libpng-dev libfreetype-dev g++ extlinux nano
Step 2: Download and Prepare the Linux Kernel
-
Download the Linux Kernel:
Terminal window wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.4.tar.xz -
Extract the Kernel:
Terminal window tar xf linux-6.9.4.tar.xzcd linux-6.9.4 -
Configure the Kernel:
Terminal window make menuconfig -
Compile the Kernel:
Terminal window make -j 4 -
Create a Directory for the Distro:
Terminal window mkdir /distrocp arch/x86/boot/bzImage /distro/
Step 3: Set Up BusyBox
-
Download BusyBox:
Terminal window cd ~wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2 -
Extract BusyBox:
Terminal window tar xf busybox-1.36.1.tar.bz2cd busybox-1.36.1 -
Configure BusyBox:
Terminal window make menuconfig -
Compile and Install BusyBox:
Terminal window make -j 4make CONFIG_PREFIX=/distro install
Step 4: Set Up MicroWindows
-
Clone MicroWindows:
Terminal window git clone https://github.com/ghaerr/microwindowscd microwindows/src/ -
Configure MicroWindows:
Terminal window cp Configs/config.linux-fb confignano config -
Compile MicroWindows:
Terminal window make -j 4make installmake x11-demo -
Set Up a Sample GUI Application:
Terminal window mkdir x11-democd x11-demo/nano gui.c -
Compile the GUI Application:
Terminal window cd ..mv x11-demo /distro/cd /distro/x11-demo/gcc gui.c -lNX11 -lnano-X -I /microwindows/src/nx11/X11-local/mv a.out /distro/nirs-test-app
Step 5: Prepare the Distro Environment
-
Create Necessary Directories:
Terminal window mkdir -p /distro/lib/x86_64-linux-gnu/mkdir /distro/lib64 -
Copy Required Libraries:
Terminal window cp /lib/x86_64-linux-gnu/libpng16.so.16 /distro/lib/x86_64-linux-gnu/libpng16.so.16cp /lib/x86_64-linux-gnu/libz.so.1 /distro/lib/x86_64-linux-gnu/libz.so.1cp /lib/x86_64-linux-gnu/libfreetype.so.6 /distro/lib/x86_64-linux-gnu/libfreetype.so.6cp /lib/x86_64-linux-gnu/libc.so.6 /distro/lib/x86_64-linux-gnu/libc.so.6cp /lib/x86_64-linux-gnu/libm.so.6 /distro/lib/x86_64-linux-gnu/libm.so.6cp /lib/x86_64-linux-gnu/libbrotlidec.so.1 /distro/lib/x86_64-linux-gnu/libbrotlidec.so.1cp /lib64/ld-linux-x86-64.so.2 /distro/lib64/ld-linux-x86-64.so.2cp /lib/x86_64-linux-gnu/libbrotlicommon.so.1 /distro/lib/x86_64-linux-gnu/libbrotlicommon.so.1 -
Copy Nano-X Binaries:
Terminal window cp -r /microwindows/src/bin /distro/nanoxcp /microwindows/src/runapp /distro/nanox/
Step 6: Create the Bootable Image
-
Create and Format the Image:
Terminal window cd /distro/truncate -s 200MB boot.imgmkfs boot.imgmkdir mntmount boot.img mnt -
Install Extlinux:
Terminal window extlinux -i mnt/ -
Copy Files to the Image:
Terminal window mv bin bzImage lib lib64 linuxrc nanox nirs-test-app sbin usr mnt -
Create Additional Directories:
Terminal window cd mnt/mkdir var etc root dev tmp proc -
Unmount the Image:
Terminal window cd ..umount mnt
Release Notes
Simple GUI-Based Linux Distro - Version 1.0
Overview: This release marks the initial version of our simple GUI-based Linux distribution, developed to run on QEMU. This distribution leverages the Linux kernel, BusyBox for essential Unix utilities, and Nano-X for graphical capabilities. This lightweight and efficient distro provides a basic graphical user interface and can serve as a foundational base for further customization and development.
Key Features:
- Linux Kernel 6.9.4
- BusyBox 1.36.1
- Nano-X/MicroWindows
- Sample GUI Application (
nirs-test-app
)
Installation Instructions:
- Install dependencies.
- Download and compile the Linux kernel.
- Setup BusyBox.
- Setup MicroWindows.
- Prepare the distro environment.
- Create a bootable image.
Known Issues:
- Limited GUI capabilities.
- Hardware compatibility primarily tested on QEMU.
Future Plans:
- Enhance GUI features.
- Broader hardware support.
- Provide detailed documentation.
Resources:
Acknowledgments: We extend our gratitude to the open-source community and the developers of the Linux kernel, BusyBox, and MicroWindows for their invaluable contributions.
_Contributors: @mranv