Currently, the Raspberry Pi 4 B is the recommended platform for using gokrazy, but you can find other supported and upcoming platforms.
If you don’t already have Go installed, install the latest Go version.
Now that you have a working Go installation, install the gokrazy packer (gokr-packer
):
go install github.com/gokrazy/tools/cmd/[email protected]
Run watch -d1 ls -l '/dev/disk/by-id/*'
and insert an SD card. Copy the
highlighted device name:
In this example, we’ll assume the SD card is accessible as /dev/sdx
.
Create a directory for this gokrazy instance and initialize a Go module:
INSTANCE=gokrazy/hello
mkdir -p ~/${INSTANCE?}
cd ~/${INSTANCE?}
go mod init hello
To overwrite the entire SD card /dev/sdx
with a gokrazy installation running a hello world program, use:
gokr-packer \
-overwrite=/dev/sdx \
-serial_console=disabled \
github.com/gokrazy/fbstatus \
github.com/gokrazy/hello \
github.com/gokrazy/serial-busybox
gokr-packer
log output
gokrazy packer v0.0.0-20211121205320-688793dda2da on GOARCH=amd64 GOOS=linux
Build target: CGO_ENABLED=0 GOARCH=arm64 GOOS=linux
Build timestamp: 2021-11-25T09:28:41+01:00
Loading system CA certificates from /etc/ssl/certs/ca-certificates.crt
Building 3 Go packages:
github.com/gokrazy/fbstatus
github.com/gokrazy/hello
github.com/gokrazy/serial-busybox
[done] in 0.48s
Feature summary:
use PARTUUID: true
use GPT PARTUUID: true
2021/11/25 09:28:42 partitioning /dev/sdx (GPT + Hybrid MBR)
2021/11/25 09:28:42 Using sudo to gain permission to format /dev/sdx
2021/11/25 09:28:42 If you prefer, cancel and use: sudo setfacl -m u:${USER}:rw /dev/sdx
2021/11/25 09:28:42 device holds 15931539456 bytes
Creating boot file system
Kernel directory: /home/michael/go/src/github.com/gokrazy/kernel
EEPROM update summary:
pieeprom.upd (sig 5a07872332)
recovery.bin
vl805.bin (sig 3a46dda0da)
[done: creating boot file system] in 0.11s, 66 MiB
MBR summary:
LBAs: vmlinuz=52150 cmdline.txt=135442
PARTUUID: 2e18c40c
Creating root file system
[done: creating root file system] in 0.26s
If your applications need to store persistent data, unplug and re-plug the SD card, then create a file system using e.g.:
mkfs.ext4 /dev/disk/by-partuuid/60c24cc1-f3f9-427a-8199-2e18c40c0004
To boot gokrazy, plug the SD card into a Raspberry Pi 3 or 4 (no other models supported)
Build complete!
To interact with the device, gokrazy provides a web interface reachable at:
http://gokrazy:<i><automatically-generated-random-password></i>@gokrazy/
In addition, the following Linux consoles are set up:
1. foreground Linux framebuffer console on HDMI
It is safe to unplug your SD card once gokr-packer
returns.
After booting from this SD card, your device will:
~/.config/gokrazy/http-password.txt
on Linux or from ~/Library/Application\ Support/gokrazy/http-password.txt
on macOS/Darwin)To interact with your device, you can:
Congratulations! 🎉 You now have a working gokrazy installation!
Next, see the Configuration guide for details on how to user other programs.
If you prefer the serial console, you can optionally connect a serial adapter to
the Raspberry Pi and remove the -serial_console=disabled
flag to
make the primary Linux console end up on the serial console.
When pressing Enter
on the serial console, gokrazy will
interactively start either:
/tmp/serial-busybox/ash
(provided by the serial-busybox package)/perm/sh
, if present (supplied by you, the user)