Hacker News new | past | comments | ask | show | jobs | submit login
Gokrazy – a pure-Go userland for Raspberry Pi 3 appliances (gokrazy.github.io)
178 points by dchuk on Mar 4, 2017 | hide | past | web | favorite | 30 comments



A while ago, I had the "krazy" idea of writing my own single binary Go router software on top of linux kernel. Turns out it's fairly easy to get up and running with literally having nothing but a kernel image and a single executable that gets called on boot. My kernel booted in less than 2 second on a VM.


I guess the next step would be to try a uni-kernel. ClickOS claims to be able to boot in 20ms.

http://unikernel.org/projects/


Use LING (Erlang on Xen). Fast boot, great libraries and tools for building network applications and introspection, and still hosts its own shell (albeit an Erlang one) you could remote into if you so desired.


Also, MigrageOS is amazingly fast, and can use tons of existing OCaml libraries.


Or just use IncludeOS, and you'll have the option to recompile most of the software out there (as IncludeOS is C++).


Including the memory corruption bugs written by those that use it as "C with C++ compiler".


I still have that idea, want to work on something together?


Wouldn't the kernel take the same time to boot whether it is your single Go binary or the usual Linux userland?


I guess he meant to boot the whole thing, which means kernel plus userspace.


This is basically what a docker image is.


Docker is just a container, anything you can boot you can put in a container. That doesn't make what he did "basically a docker image".


It's more like a busybox image.


Very cool project! I'm just getting started with Go and my target platform is the Raspberry Pi (and other low-powered ARM boards). Will the newly-announced Zero W support this?


Unfortunately not. The arm64 architecture is a requirement (see also https://www.reddit.com/r/golang/comments/5xgf8u/gokrazy_a_pu...), and the Zero W uses the older BCM2835 SoC, which is not arm64.


It's armv6 and golang may be dropping support for it https://github.com/golang/go/issues/17082


Ah, that's a little annoying, but I think my expectations for what I can get out of a $10 computer are getting out of hand. Looks like I'm going to have to check out the Pi 3.


The documentation says to compile with GOARCH=amd64; isn't RPI3 an ARM architecture? Is that a typo, or am I misunderstanding something?


Either a typo that was fixed in the meanwhile, or you misread. It currently reads "arm64".


Ah, I probably misread. Thanks!


this seems fun.

I wonder though if bringing Go or Rust bare metal onto the Pi would give you the smallest attack surface?

http://blog.thiago.me/raspberry-pi-bare-metal-programming-wi...


Go doesn't currently run on bare metal, though I think there are forks that do. At any rate, this would be unusable for most interesting programs unless you plan to rewrite all of the things the kernel gives you in Go/Rust (though there are projects which aim to do this as well).


The most usable thing would be to prove to naysayers that it is possible to use Go in such scenarios.

Another usable thing would be to program bare metal devices without memory corruption issues.


Anything like this available for .NET Core?


Yes, .NET Micro Framework is a thing.

Also what's notable is that it was opened up in 2009--a full five years before all the hubbub about core and corefx. And it's under Apache 2.0, so if any organization has any problems swallowing the terms of MS's patent grant on .NET Core, they have a more palatable option.

http://netmf.github.io


What would it take to get this to support other ARM boards? (Especially the Orange Pi in my case.)


They have no plans to but would entertain someone volunteering: https://www.reddit.com/r/golang/comments/5xgf8u/gokrazy_a_pu...


If I ever write a Go thing I'll be sure to call it Getnuts.


does it support docker?


no, docker does not work with CGO_ENABLED=0


Excellent. Perhaps it's finally time to build a wunderground-consulting sprinkler timer...




Applications are open for YC Winter 2020

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

Search: