Boot Naked Linux

41 points - today at 4:03 PM

Source

Comments

simonreiff today at 6:57 PM
Cool 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!
nottorp today at 6:13 PM
> I found “Building a tiny Linux from scratch” which does most of what I do here but in Rust and a year ago

Linux 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.

helterskelter today at 5:57 PM
It'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.
M95D today at 5:48 PM
I... 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-h today at 5:59 PM
I 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...

testycool today at 6:32 PM
"Butt Naked Linux" is how I read it.

I know it's off topic. I accept my downvotes.

megous today at 5:36 PM
You 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.