Hello everyone! This blogpost will be about choosing the right linux distro. Lets begin. So what exactly is a linux distro? Linux distro is linux kernel(that may be edited), witch bunch of preinstalled stuff. Most distros come with their own(or commonly used) package manager, and sometimes even distro-specific desktop enviroment(if they even have one). There are lightweight distros, such as one I made that has only 10megabytes in disk size, sadly not having any networking support, but its still preety useful if you need to have modern linux on 7floppies. There are also thicc distros that have everything preinstalled, ones that come with trackers(like android or modern ubuntu). So, what is the best ditro? None. Every linux distro has different uses, and you need to decide on your own, however you can research to make that process easier. So, first of all, there are debian based, arch based etc. distros. From these major releases came everything else, such as from debian ubuntu, from arch came manjaro, and from others came.. well others. I can't obviously list every distro on the planet, because I can't make this blogpost too large for guys using 16-bit computers, so we can only use about 64kibibytes of memory. So here are some major ones: debian: (apt package manager) - quite big in size - stable - most packages avilable from apt - most supported by software companies arch: (pacman package manager) - unstable - small in filesize - faster and for example, red hat linux: (dnf package manager) - secure - stable .. ye thats about it For example, servers commonly use debian or red hat, but just average linux user propably uses something like ubuntu or popos. And, how do you build your own distro?.. well, lets go and do it! First of all, we will download the linux kernel source code from kernel.org. This will propably just be a normal tarball, which you will extract, and will be met with directory with bunch of files. What you wanna do is if you want to edit the kernels source code, now its the time, but we will just compile the kernel. We can use the command `make menuconfig` in the kernels directory to configure our linux, from switching between 64bit and 32bit version of the kernel to choosing what drivers we will include in our kernel. Now when thats done, we can compile the kernel! You can simply save the .config file using the shortcuts in the menuconfig screen, and we can get to compilation using: `make -j8`. The -j8 in this case means we want to use 8threads(if avilable), but you can make it higher if you need to(lower isn't needed, the make wont complain if there are less of them). After we are done with this, lets get our kernel file. The file should be named bzImage, somewhere inside ./arch/x86/boot/..., you can propably find it using the find command. Now that we have our kernel image, lets flash it on our drive right? Well, not yet, we must install busybox, so we can actually do something in the system. We can simply get busybox tarball from their website and compile it(don't forget to compile it as static library). But from now on, the steps will differ alot. There are some systems that use 3 boot stages: 1st stage: 16bit real mode 2nd stage 1st: root is mounted and init file is ran 2nd stage 2nd: init.cpio is mounted and init file is ran 3rd stage(if 2, 2nd): root is mounted 3rd stage: if only the initramfs was loaded, the systems root will now be mounted and you can access your files). We will go with the 2 stage setup, for its simplicity. First, we will need already existing linux installation. Lets say our disk is at /dev/sda First, we set up the drive(all of these commands must be ran by root): `fdisk /dev/sda` - Here, we can delete all partitions and only add one primary Linux type partition `mkfs.ext4 /dev/sda` - We will create a partition for the kernel Now, lets configure syslinux, or in this case, extlinux `mount /dev/sda /mnt` - This mounts our drive to a directory `mkdir /mnt/syslinux` `nano /mnt/syslinux/syslinux.cfg` - Now, we can edit our config file `extlinux /dev/sda --install /mnt` - And then we can finally install the bootloader `cp bzLinux /mnt/` - Copies all the important files to the drive `umount /dev/sda` - Unmount the disk so we can use it Back to the nano command what do we put in such config file tho? Well, I made this simple example: ``` DEFAULT linux LABEL linux KERNEL /bzImage APPEND rw rootwait root=/dev/sda loglevel=4 init=/init ``` As you can see, I am first of all setting the boot drive to be writable using rw, then I am using the rootwait instruction, which helps with intializing the drive itself. Then, I am mounting the drive at the root directory, disabling most of the non-error logs, and finally, setting the init file. What does such file contain? Well, it contains some code you want to execute at startup. What did I put in mine? Lets see: I don't remember exactly, but it was something like this #!/bin/sh mount sysfs -t devfs /sys mount tmpfs -t tmpfs /tmp /bin/sh First, I am mounting some important directories and then starting the shell. After this is done, what else do you need to do to have a working distro.. well nothing really! The busybox authors somehow managed to fit the entire dpkg program into those 2.2megabytes along with everything else, so we can now install any package manager program as long as it supports eighter RPM or DEB formats. Anyways, thats about it for today, I hope you enjoyed!