Hacker News new | past | comments | ask | show | jobs | submit login

Ooooh this is very cute.

I'm toying with building a little OS using the Linux kernel and an all-Go userspace, and one of the goals is to make the entire system as easy to cross-compile (both host OS and host/guest CPU arch) as possible. Linux being non-trivial to compile (let alone cross-compile) has been so far quite a nuissance, so I'll definitely be having a closer look at this.




The idea there sounds a lot like https://gokrazy.org/, which builds a minimal go userland, wrapping one or more user provided go applications, and bundles in a linux kernel.

Targets mostly at single board computers, and I think it downloads pre-built kernels (and bootloaters if needed), rather than trying to build them directly, since getting a working cross compilation toolchain set up and plumbed into the kernel compilation process is still a pain.

I've personally only used yocto/open-embedded for that which does nicely handle building the cross-compilation toolchain, kernel image, and modules. But it is kinda overkill for that task, being designed to build a whole userland too.


Yep, both gokrazy and u-root serve as inspirations/references (there's a lot of tricky stuff like configuring the network or the framebuffer). Using a kernel from Debian while figuring out my options - glad there seem to be so many.

The ultimate goal is to make it very straightforward to change any part of the system source and try it out in action, so the only things you need installed to get started are Go and Qemu. Further down the road I'd love to extend these principles to hacking the kernel - I'd probably like a simpler kernel, maybe OpenBSD or NetBSD, but I'm less familiar with those.


2nding gokrazy as a very nice embedded target for pi's.


You might enjoy looking at one of my projects, a toy Linux distro compilable from a single Makefile. https://github.com/snacsnoc/snacklinux

It uses musl and builds using a musl cross compiler, working x86 and arm64 builds. You could easily build a toolchain for your desired arch and make a simple distro, adding in any user space tools.


cross compilation equally non-trivial. set CROSS_COMPILE= and ARCH= and making the appropriate changes to .config (either set ARCH and `make defconfig`, or modify the relevant parts in `make menuconfig`). then build as usual




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: