4 ms·
I am very fond of the idea of a from-scratch userspace written entirely in Go. I've been dreaming of building something like gokrazy for servers. Or possibly so
by cedws 3y ago
I am very fond of the idea of a from-scratch userspace written entirely in Go. I've been dreaming of building something like gokrazy for servers. Or possibly something like Bottlerocket OS in Go.
I experimented a few weeks ago with packaging a custom kernel and minimal Go init binary into a disk image bootable on GCE. No bootloader needed, just EFI loading the kernel directly.
- hyperthesis 3y agoTo some extent, android is this with java. For a low-powered device, would a Go usespace bring particular benefits? (Though, even the cheapest phones today aren't really "low-powered" anymore)
- yjftsjthsd-h 3y agoGo has memory safety (via GC rather than fancy ownership, but if it works it works); that's an asset anywhere that can afford the overhead. Edit: In order to preempt the argument others are having: Safer than C, anyways, while being much easier than rust.
- pjmlp 3y agoIf only we didn't need the const dance for enumerations, even Pascal like ones, to yet another 10 years, I guess.
- jrockway 3y agoI don't have a big problem using codegen to get "syntax" for enumerations. "go generate ./..." before you checkin, save yourself some typing. I have used this in the past: https://github.com/abice/go-enum https://github.com/abice/go-enum But mostly use protos as much as possible these days. (The enum is going to be in the API, might as well use the same object inside the app.)
- pjmlp 3y agoI left that kind of gimmicks behind me in C++ compilers for MS-DOS.
- pjmlp 3y agoThere are USB security keys running Go bare metal, https://www.withsecure.com/en/solutions/innovative-security-hardware/usb-armory https://www.withsecure.com/en/solutions/innovative-security-... Look for TamaGo on the page.
- marcus_holmes 3y agoSame - I've been playing around with Unikernels for the same reason. Running my web server as the only process on the machine really appeals. Attack surface is tiny, basically non-existent. If the web server falls over, reboot the machine (which should be fast because it only has to load the kernel & the Go program). It's basically the opposite of containers, which I like hehe.
- fuzztester 3y agoInteresting. Which unikernel do you use?
- marcus_holmes 3y agoI've been looking at a few. https://github.com/cloudius-systems/osv https://github.com/cloudius-systems/osv https://ops.city/ https://ops.city/ (also nanovms) - this is one that I actually got working to at least demo state
- fuzztester 3y agoInteresting, and thanks. I didn't know about those. I kind of thought you may have used MirageOS, which I had read about earlier. It is done in OCaml. https://mirage.io/ https://mirage.io/
- marcus_holmes 3y agoThat's fascinating, thanks for the link. But I'm coding in Go, and it looks like (from skimming the docs) that MirageOS only works with OCaml. I'll have to look further.
- fuzztester 3y agoWelcome. Yes, IIRC it is written in and only works with OCaml.
- preisschild 3y agoTalos Linux basically implements their entire userspace in Go and its similar to BottleRocketOS, because it is designed to host Kubernetes. https://www.talos.dev/ https://www.talos.dev/ https://github.com/siderolabs/talos https://github.com/siderolabs/talos
- cedws 3y agoWow cool, thanks.
- pjmlp 3y agoSee TamaGo, https://github.com/usbarmory/tamago https://github.com/usbarmory/tamago Or TinyGo, https://tinygo.org/docs/reference/microcontrollers/ https://tinygo.org/docs/reference/microcontrollers/
- deleted 3y ago[deleted]
- lifty 3y agoAnother project that aims to deliver this is Linuxkit (https://github.com/linuxkit/linuxkit https://github.com/linuxkit/linuxkit). All the components they ship are written in memory safe languages (usually Go) and run as containers under containerd. You can build a custom image very easily, fully defined as a YAML file.
- 0xdeadbeefbabe 3y agoThere is also u-root which is "A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go." https://github.com/u-root/u-root https://github.com/u-root/u-root