[HN Gopher] Making a micro Linux distro (2023)
       ___________________________________________________________________
        
       Making a micro Linux distro (2023)
        
       Author : turrini
       Score  : 184 points
       Date   : 2025-10-25 13:01 UTC (1 days ago)
        
 (HTM) web link (popovicu.com)
 (TXT) w3m dump (popovicu.com)
        
       | SomeHacker44 wrote:
       | A version of this that targeted RPi would be neat!
        
       | sigwinch wrote:
       | More recently, qemu supports uftrace on the more popular
       | architectures. That's how you answer the pro's question, "but how
       | do I debug this?"
       | 
       | https://news.ycombinator.com/item?id=45533804
        
       | trelane wrote:
       | I wonder why this instead of using Gentoo to explore Linux.
        
         | laweijfmvo wrote:
         | gentoo is "built from source", but its package manager, which
         | is wonderful, does all the heavy lifting. it's a bare
         | distribution, but all the customization is user space stuff. so
         | it's not a great way to learn "linux", IMO. a stage3 tarball is
         | already more of a "mini" distro.
        
           | trelane wrote:
           | Yes, exactly, though you can start from earlier stages too.
           | The process even from stage 1 is well documented. It is all
           | there but you can customize it completely from the ground up.
           | Or, if starting from stage 1, the foundations are there and
           | you have to build it up yourself.
           | 
           | For a newbie (looks to be the intended audience of the
           | article), this gives them a working foundation to start from.
           | They can get progressively more involved with whatever part
           | of Linux they desire, as their experience grows.
        
             | laweijfmvo wrote:
             | ah, ok, i thought they officially discontinued stages 1 and
             | 2 a while ago.
        
       | keyle wrote:
       | Obligatory reference
       | 
       | https://www.linuxfromscratch.org
        
         | webdevver wrote:
         | i once sat down to go through this as a challenge, but started
         | to get bored quickly. skipping ahead, i built bash, configured
         | grub to init=/bin/bash, threw in coreutils, and was very
         | thrilled to see my very own "distro" boot in under a second
         | (not counting bios init ofcourse) on an ancient p3 box.
         | 
         | i think i disabled everything i could think of in the kernel
         | (including filesystem support, which was quickly rectified) for
         | a truly 'minimalist' experience.
         | 
         | it ofcourse didnt do much but it was _very_ responsive.
        
           | rzzzt wrote:
           | Same here, I tried it on a 486 and it became an idle game.
           | Just glancing on it from time to time, lines are still
           | running down the screen, OK, move on to other things.
           | 
           | u-root is mentioned in the article -- I used buildroot and
           | busybox for embedded Linux development while in university:
           | https://buildroot.org/
        
         | throwaway8902 wrote:
         | LFS takes the opposite approach. You build a cross compilation
         | toolchain, build out a full Linux file system, compile a
         | massive number of packages... it's almost two days of work
         | before you even start thinking about a boot loader.
         | 
         | This tutorial gets straight to the heart of the matter. Get a
         | system that boots asap and then add complexity as you discover
         | the shortcomings.
         | 
         | This seems like a much better pedagogical approach for someone
         | not sure how the kernel works or what initramfs is, etc...
        
         | b00ty4breakfast wrote:
         | LFS has been on my todo list for like a decade, I really need
         | to plan a weekend and just do it
        
           | NetOpWibby wrote:
           | You and me both!
        
           | tombert wrote:
           | I did it once, about twelve years ago, just to prove to
           | myself that I could.
           | 
           | It was kind of fun, but I have absolutely no desire to do it
           | again. I tried running it as my "full time" distro but what I
           | ended up with was something extremely fragile and decidedly
           | not fun for me to use.
           | 
           | Nowadays I run a NixOS Minimal install, which is about the
           | level of operating system that I like to work in.
        
           | keyle wrote:
           | I think it's a month thing rather than a weekend thing, no?
        
             | cheschire wrote:
             | Depends on your CPU (due to all the compiling), and if you
             | plan on only doing the base OS or the extended plans too.
        
       | EvanAnderson wrote:
       | This is pretty neat. I remember making floppy-based
       | "distributions" back in '98 to do utility tasks (imaging Windows
       | PCs over UDP broadcast being one I spent a long time on). So many
       | memories of "make bzimage", hanging init scripts, reboots. So
       | many reboots.
       | 
       | Charmingly, the "modern" process doesn't seem wholly dissimilar.
       | I would echo the comments of one of the sibling comments here:
       | Targeting this to RPi would be fun and educational. Maybe I'll
       | give it a try.
        
         | reactordev wrote:
         | That was like me in '98 trying to install Mandrake linux over
         | NetBIOS with a public sftp over ISDN line... one bad block or
         | wrong checksum stalled the whole install. Start over again.
         | Eventually a friend of mine was kind enough to store the sftp
         | contents to a CD as I had already _parted_ my drive. Thankfully
         | we had CD burners but was limited to 2x write speed due to
         | checksum verification failures.
        
       | mouse_ wrote:
       | This entire, beautiful blog post scales wrong on my phone because
       | of this one line of code near the bottom doesn't get wrapped or
       | get its own overflow box: -device virtio-net-
       | device,netdev=usernet -netdev
       | user,id=usernet,hostfwd=tcp::10000-:22
        
       | Levitating wrote:
       | I have a similar little project
       | https://github.com/LevitatingBusinessMan/azathos
       | 
       | I have my own toy init, shell and other utilities. The GNU
       | coreutils are included for debugging.
       | 
       | My current focus is on drawing windows onto the framebuffer.
        
       | pluto_modadic wrote:
       | this is kinda cool. Does that mean you can use u-root to embed as
       | a UEFI image? or to boot a u-root image over PXE netboot?
        
       | pluto_modadic wrote:
       | I wonder what the level of difficulty getting this to run as a
       | cloud image (e.g. on Vultr or Digitalocean) would be. Or getting
       | it to boot a GUI and run firefox.
        
         | c0balt wrote:
         | Running as a cloud image can be relatively easy, you only need
         | the default drivers from the kernel and need to get your image
         | installed.
         | 
         | The latter can be done by booting into another distro and
         | kexec'ing into your own kernel and performing the Installation
         | afterward from memory. See also nixos-anywhere for a practical
         | implementation of this
        
           | ratrocket wrote:
           | On digital ocean (at least) you can upload your own images
           | and boot droplets directly from them.
           | 
           | In the past I've used a script called "alpine-make-vm-image"
           | to run alpine images in digital ocean.
           | 
           | https://github.com/alpinelinux/alpine-make-vm-image
           | 
           | (Maybe that script does some magic to make booting a droplet
           | directly from the image possible. On that I plead ignorance
           | :)
        
         | Nux wrote:
         | Make an image with virtio drivers for network and storage, save
         | it or convert it to qcow2 then register it into Digitalocean
         | etc, it's quite easy.
        
       | ruguo wrote:
       | Thanks a lot for this awesome informative post, I genuinely
       | learned a ton from it!
        
       | termie wrote:
       | I've been working on a micro Linux distro for a couple of months
       | now. User mode is just a single static binary (and a few files to
       | support confidential microVM containers). The initramfs is such
       | an interesting feature, the kernel knows how to unpack cpio
       | archives and just magically drops you into a tmpfs and executes
       | /init. You can have multiple concatenated cpio archives, and each
       | can be compressed, and they all just overlay in sequence. There's
       | an elegance to the design. I also had to write some code to
       | unpack them and learned more than I wanted to.
        
       | abety607 wrote:
       | Ilove
        
       | synergy20 wrote:
       | great for learning, to get one done fast, buildroot is a good
       | candidate
        
       ___________________________________________________________________
       (page generated 2025-10-26 23:02 UTC)