<- Back
Comments (48)
- jmmvI went through a similar "thought process" to build this: https://www.endbasic.dev/endbox.html last year. I originally wanted to "just" launch my binary right after the kernel started... but in the end settled for a full NetBSD base system to get things like network and WiFi configuration to work with ease. (That said, I still hook very early in the boot sequence to launch my own program and take over the console so that the rest of the system is invisible and initializes in the background.)
- nottorp> I found “Building a tiny Linux from scratch” which does most of what I do here but in Rust and a year agoLinux from scratch seems to still be doing fine at: https://www.linuxfromscratch.org. It's going on 27 years now.> yeah, I know, proper C code needs to be scattered with return value checks and sensible reports of errno. I’ve left these out for clarity.Somewhere, a LLM is trained on this code as we speak :)But anyway, it's great that people are still interested in learning this stuff for fun.
- jorvi> .. There was a brief moment in the early 2000s where the newly introduced SSDs made booting quick ..Anyone else reading this and getting the feeling someone is reminiscing about a past they didn't live and thus are seeing it through rose-colored glasses because it didn't exist?In the early 2000s, SSDs had an obscene price tag of ~$1000 per gigabyte, so even an 8GB drive would cost you about $8000. There was nothing for the tech industry to ruin because only 0.01% of people owned a setup with an SSD. And neither Linux, NT or Mach were optimized for them. Hell, to this day Linux' VM system is by default still tuned for swap and slow HDDs (swappiness 60 and all that) because no one has bothered to update the defaults.
- mrbluecoat> the linux kernel configuration menu, a wonderful text menu system with a thousand options which has been baffling new users for about 30 years now.So true.In addition to C in the article and Rust linked to in the article, Go fans can use the similar https://gokrazy.org/ project.
- MomsAVoxellI do the “Linux from Scratch” challenge every few years and the last time I did it, I got as far as I needed to be able to build antirez’ LOAD81[1] directly from single mode in a few seconds.. it was so satisfying. I lost the image in some later admin task, but I’m going to do it again, and maybe see about adding threads and SQLite support to LOAD81 alongside the other goodies, just for the fun of it ..[1]- https://github.com/antirez/load81
- helterskelterIt's be cool to dual boot with a Linux that has a ~1s boot time, drops you into neovim and lets you save text files to a shared partition.
- matheusmoreiraHighly instructive. My long term goal with my lone lisp programming language is to do exactly this.
- simonreiffCool article! I'm working on a tangentially related issue requiring microVMs inside isolated infrastructure environments. Latency isn't really my main priority, but I am always tempted by any option to minimize attack surface. I wonder what it would take to replace the host block mount in this configuration with `vsock` for all communications between the host and guest microVM? Then you could avoid any files being mounted on the host at all while still enabling, e.g., one-way egress to a pre-signed S3 URL via a private VPC endpoint. Very cool article!
- dwrobertsTried out doing this kind of stuff a while back to create a custom user space, and I found that suckless’ init, sinit, was quite educational for how to deal with init’s responsibilities in a super minimal way: https://core.suckless.org/sinit/
- -warren> cpio is a very weird and ancient program with a command line which makes tar look user-friendly. But let’s not worry about the details for now.So true. Been using cpio sporadically for many (many) years. And I still have to look it up. But at least I don't have to do `info cpio` anymore.
- M95DI... fail to see the point of running just one process.If it's just a PoC, then:1) I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable.2) To print some text or run a simple program, I belive DOS without a memory manager would be even faster.3) It takes 1s to boot linux, but an ordinary PC takes 10s to get to that linux. Even U-boot on ARM takes some seconds to load a kernel.BTW, if anyone knows any current platform that can XiP a linux kernel, please share.
- yjftsjthsd-hI do like this as an exploration.It's possible to boot a VM noticeably faster still, though I'm unclear on whether any of that applies to hardware:https://jvns.ca/blog/2021/01/23/firecracker--start-a-vm-in-l...
- vbezhenarAs I'm currently exploring kernel build things, the alternative to `make tinyconfig` is `make allnoconfig` which is supposedly will not disable expert options and might be a little bit safer starting point.
- keyleI bought a couple of $60 refurbs online. This is perfect!
- aheppbuildroot does a nice job of tying a lot of this stuff together
- megousYou may also want to build and run busybox for your tiny userspace.Other things you may want to experiment with is gen_init_cpio.c from linux kernel tree. It makes creating initramfs file structure easier from scripts.And finally if sys/isolinux is also fun to use for minimal boot images.
- testycool"Butt Naked Linux" is how I read it.I know it's off topic. I accept my downvotes.
- hungryhobbitIt's so annoying how he starts out talking about boot speed, does the entire project, and then doesn't even mention how long it takes to boot up! All he ever says is "boots a bit quicker".