All Projects → gokrazy → Gokrazy

gokrazy / Gokrazy

Licence: bsd-3-clause
a native Go userland for your Raspberry Pi 3 or 4 appliances (or amd64 PCs!)

Programming Languages

go
31211 projects - #10 most used programming language
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to Gokrazy

Cameracontrollerapi
The CameraControlerApi is an attempt to control a DSLR via REST functionality.
Stars: ✭ 110 (-94.31%)
Mutual labels:  raspberrypi
Ct Smart Home
A ready-to-use Node-RED setup for home automation
Stars: ✭ 132 (-93.17%)
Mutual labels:  raspberrypi
Piadvanced
This started as a custom install for my pihole!
Stars: ✭ 144 (-92.55%)
Mutual labels:  raspberrypi
Crankshaft
Crankshaft: A turnkey GNU/Linux solution that transforms a Raspberry Pi to an Android Auto head unit.
Stars: ✭ 1,703 (-11.94%)
Mutual labels:  raspberrypi
Pchwrm client
PC Hardware Resource Monitor For Raspberry Pi
Stars: ✭ 130 (-93.28%)
Mutual labels:  raspberrypi
Mysmarthome
⭐️ ALIVE Again! ⭐️ SmartHome - Nothing but smarthome stuff here! Have fun browsing through my home automation setup... ping me on Discord with any questions! 👍
Stars: ✭ 133 (-93.12%)
Mutual labels:  raspberrypi
Create
Software for the HifiBerry/BeoCreate Re-Create project for upcycling vintage loudspeakers
Stars: ✭ 103 (-94.67%)
Mutual labels:  raspberrypi
Pishrink
Make your pi images smaller!
Stars: ✭ 2,255 (+16.6%)
Mutual labels:  raspberrypi
Navio2
C++ and Python sensor examples for developers
Stars: ✭ 132 (-93.17%)
Mutual labels:  raspberrypi
Almond Server
The home server version of Almond
Stars: ✭ 142 (-92.66%)
Mutual labels:  raspberrypi
Gitlab
GitLab CE (Docker image) for ARM devices, this is a mirror repository of
Stars: ✭ 121 (-93.74%)
Mutual labels:  raspberrypi
Gumcp
Web Control Panel for Raspberry Pi
Stars: ✭ 124 (-93.59%)
Mutual labels:  raspberrypi
Rpi Magicmirror Eink
MagicMirror on 7.5 ePaper Waveshare Display with a Raspberry Pi
Stars: ✭ 136 (-92.97%)
Mutual labels:  raspberrypi
Yahm
Yet Another Homematic Management - Skripte zur Einrichtung der Homematic CCU Oberfläche in einem LXC Container unter Debian Jessie auf ARM CPU (z.B.: Raspberry Pi & Co)
Stars: ✭ 113 (-94.16%)
Mutual labels:  raspberrypi
Openauto
AndroidAuto headunit emulator
Stars: ✭ 1,926 (-0.41%)
Mutual labels:  raspberrypi
Rpi Tempruntime
基于树莓派3B,DHT11/DHT22,LCD1602的一个实时温度湿度检测系统
Stars: ✭ 109 (-94.36%)
Mutual labels:  raspberrypi
Os One
一个自制的树莓派操作系统
Stars: ✭ 132 (-93.17%)
Mutual labels:  raspberrypi
Swift On Balena
Docker images for Swift on Raspberry Pi and other ARM devices from balena's base images.
Stars: ✭ 153 (-92.09%)
Mutual labels:  raspberrypi
Ec
Echo Canceller, part of Voice Engine project
Stars: ✭ 145 (-92.5%)
Mutual labels:  raspberrypi
Drawbot
Drawing robot capable of rendering SVG paths over WebSockets. Powered by a Raspberry Pi running Node.js.
Stars: ✭ 142 (-92.66%)
Mutual labels:  raspberrypi

Build Status Go Report Card

Overview

gokrazy packs your Go application(s) into an SD card image for the Raspberry Pi 3 or 4 which — aside from the Linux kernel and proprietary Raspberry Pi bootloader — only contains Go software.

The motivation is that @stapelberg spends way more time on C software and their various issues than he would like. Hence, he is going Go-only where feasible.

Usage

Installation

Install the latest Go version if you haven’t already.

Create a directory for this gokrazy instance and initialize a Go module:

INSTANCE=gokrazy/hello
mkdir -p ~/${INSTANCE?}
cd ~/${INSTANCE?}
go mod init hello

Then, install gokr-packer:

go get github.com/gokrazy/tools/cmd/gokr-packer@latest

Overwriting an SD card for the Raspberry Pi 3 or 4

To re-partition and overwrite the SD card /dev/sdx, use:

gokr-packer -overwrite=/dev/sdx github.com/gokrazy/hello

Then, put the SD card into your Raspberry Pi 3 or 4 and power it up! Once the Raspberry Pi 3 or 4 has booted (takes about 10 seconds), you should be able to reach the gokrazy web interface at the URL which gokr-packer printed.

Under the hood, gokr-packer

  1. …packed the latest firmware and kernel binaries into the boot file system.

  2. …built the specified Go packages using go install and packed all their binaries into the /user directory of the root file system.

  3. …created a minimal gokrazy init program which supervises all binaries (i.e. restarts them when they exit).

Updating your installation

To update gokrazy, including the firmware and kernel binaries, use:

go get -u github.com/gokrazy/tools/cmd/gokr-packer
go get -u github.com/gokrazy/gokrazy
go get -u github.com/gokrazy/kernel
go get -u github.com/gokrazy/firmware
go get -u github.com/gokrazy/rpi-eeprom

To update your gokrazy installation (running on a Raspberry Pi 3 or 4), use:

GOKRAZY_UPDATE=http://gokrazy:mysecretpassword@gokrazy/ gokr-packer github.com/gokrazy/hello

SD card contents

gokrazy uses the following partition table:

num size purpose file system
1 100 MB boot (kernel+firmware) FAT16B
2 500 MB root2 (gokrazy+apps) SquashFS
3 500 MB root3 (gokrazy+apps) SquashFS
4 rest permanent data ext4

The two root partitions are used alternatingly (to avoid modifying the currently active file system) when updating.

If you’d like to store permanent data (i.e. data which will not be overwritten on the next update), you’ll need to create an ext4 file system on the last partition. If your SD card is /dev/sdx, use mkfs.ext4 /dev/sdx4.

Customization

Changing program behavior for gokrazy

gokr-packer sets the “gokrazy” build tag for conditional compilation.

You can find an example commit which implements a gokrazy-specific controller that triggers the main program logic every weekday at 10:00 at https://github.com/stapelberg/zkj-nas-tools/commit/6f90ace35981f78dcd66d611269f17f37ce4b4ef

Changing init behavior

Assuming the application you’d like to create on gokrazy lives in the repository github.com/stapelberg/mediaserver, this is how you can make gokrazy dump the generated init package’s source:

mkdir -p $(go env GOPATH)/src/github.com/stapelberg/mediaserver/cmd/init
gokr-packer \
  -overwrite_init=$(go env GOPATH)/src/github.com/stapelberg/mediaserver/cmd/init/init.go \
  github.com/gokrazy/hello

(Note that the package must result in a binary called “init”.)

Then, edit the github.com/stapelberg/mediaserver package to your liking. When done, pack an image with your own init package:

gokr-packer \
  -init_pkg=github.com/stapelberg/mediaserver/cmd/init \
  -overwrite=/dev/sdx \
  github.com/gokrazy/hello

Repository structure

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].