
Me and my friend managed to fit the Linux kernel until under <800 kilobytes, along with a Ramdisk that is under than <750 kilobytes. Here is a little guide on how to make a minuscule, and (somewhat) usable Linux distro. (using the help of https://blinry.org/tiny-linux/)
Download the Linux source code. Run, then `cd` into the Linux directory. Now, run `make tinyconfig`. (When you run `make` to compile it, the kernel will be made at ./arch/x86/boot/BzImage)
WARNING: Running `make` at this point will make an unusable Linux install. To fix this, the following things need to be enabled: `make menuconfig`, and go to `General setup > Configure standard kernel features ` and enable it. then, Enter it and enable `Enable support for printk`. And, go to `Device Drivers > Character devices`, then `Enable TTY`. You only need `Virtual terminal`, and `Support for console on virtual terminal` for it to be usable, and enable `Executable file formats > Kernel support for ELF binaries`, and lastly, `General setup > Initial RAM filesystem and RAM disk (initramfs/initrd) support`
Let's make the Ramdisk! Make a new blank directory (preferably something like `root` or `ramdisk` and `cd` into it. Now, make the following directories: `mkdir bin sbin etc home lib root proc run usr var`.
You can use any language of your choice, but I like C, so lets use C! Make a new directory (not in the ramdisk directory!) and make it something like `init`. `cd` into that, and make a new file, preferably called `init.c`. Use `nano`, `vi`, or any text editor you like to make a simple Hello World Init program.
Compile the code with `gcc init.c -o init -m32 -static`, and copy it to `ramdisk/`, it can be in the root of `ramdisk`, but if you prefer, `etc`, `bin`, or `sbin`. And, `cd` into the ramdisk or root directory. Run:
Now, install QEMU using `sudo apt install qemu-system`. Now, `cd ..` out of the root/ramdisk folder, and run `qemu-system-x86_64 -kernel (where you have BzImage) -initrd ./initrd
If you see the system boot up with a "Hello, World!" Then Congratulations! We managed to compile BusyBox statically and put it's bare essentials in /bin/.
Good luck!
Download the Linux source code. Run
Code:
git clone --depth=1 --branch=v6.12 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
WARNING: Running `make` at this point will make an unusable Linux install. To fix this, the following things need to be enabled: `make menuconfig`, and go to `General setup > Configure standard kernel features ` and enable it. then, Enter it and enable `Enable support for printk`. And, go to `Device Drivers > Character devices`, then `Enable TTY`. You only need `Virtual terminal`, and `Support for console on virtual terminal` for it to be usable, and enable `Executable file formats > Kernel support for ELF binaries`, and lastly, `General setup > Initial RAM filesystem and RAM disk (initramfs/initrd) support`
Let's make the Ramdisk! Make a new blank directory (preferably something like `root` or `ramdisk` and `cd` into it. Now, make the following directories: `mkdir bin sbin etc home lib root proc run usr var`.
You can use any language of your choice, but I like C, so lets use C! Make a new directory (not in the ramdisk directory!) and make it something like `init`. `cd` into that, and make a new file, preferably called `init.c`. Use `nano`, `vi`, or any text editor you like to make a simple Hello World Init program.
Code:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Compile the code with `gcc init.c -o init -m32 -static`, and copy it to `ramdisk/`, it can be in the root of `ramdisk`, but if you prefer, `etc`, `bin`, or `sbin`. And, `cd` into the ramdisk or root directory. Run:
Code:
find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > ../initrd
Now, install QEMU using `sudo apt install qemu-system`. Now, `cd ..` out of the root/ramdisk folder, and run `qemu-system-x86_64 -kernel (where you have BzImage) -initrd ./initrd
If you see the system boot up with a "Hello, World!" Then Congratulations! We managed to compile BusyBox statically and put it's bare essentials in /bin/.
Good luck!

"I refuse to answer the question on the grounds that I don't know the answer" -Douglas Adams
