Code Monkey home page Code Monkey logo

kernel's Introduction

GitHub Actions CI Go Report Card

Overview

With gokrazy, you can deploy your Go programs as appliances to a Raspberry Pi or PC (→ supported platforms).

For a long time, we were unhappy with having to care about security issues and Linux distribution maintenance on our various Raspberry Pis.

Then, we had a crazy idea: what if we got rid of memory-unsafe languages and all software we don’t strictly need?

Turns out this is feasible. gokrazy is the result.

→ Learn more at gokrazy.org

GitHub Repository structure

Documentation

gokrazy.org uses hugo for creating and generating the website. You can find the hugo install instructions here: Install Hugo. With hugo you can write documentation in Markdown and generate a static website from it.

The website subdirectory is hugo’s root directory. In order to preview the documentation or to re-generate the website, switch the directory to website.

To preview the website, run the hugo webserver:

hugo serve

Generate the website:

hugo

The updated website content will be stored in the ./docs directory. Do not update anything here manually.

kernel's People

Contributors

anisse avatar brutella avatar bzub avatar damdo avatar dme avatar dtchanpura avatar fxkr avatar gokrazy-bot avatar janisstreib avatar kardianos avatar khirbat avatar lordwelch avatar mdlayher avatar mutantmonkey avatar schubter avatar stapelberg avatar thefinn93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kernel's Issues

re-enable squashfs parallel decompression optimization

In cmd/gokr-build-kernel/build.go, we specify CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU. However, this value has no effect anymore since torvalds/linux@80f7840, which renamed the kernel option.

We should update the config addendum to the intended name and ensure that all options we set in the addendum are actually present in the resulting config as a safe-guard.

Support for Compute Module 4 (CM4)

To enable support for the CM4, we need to include the correct device tree bcm2711-rpi-cm4.dtb into the image. Unlike the other device trees currently included in Gokrazy, the mentioned CM4 device tree does not seem to be included into the upstream kernel yet.
It can be obtained from the raspberry pi firmware repo though.

Workaround

To make the CM4 work with Gokrazy, you need to manually include this file into the boot image, until it is shipped with the kernel.

USB2.0 won't work until you add the dwc2.dtbo into the overlays folder in the boot partition (in conjunction with some variant of dtoverlay=dwc2,dr_mode=host in the config.txt). Additionally, support for your HUB needs to be included into the kernel.

gokr-rebuild-kernel fails with "Exec format error" on OSX 10.11.6

Output on my machine:

 ~  gokr-rebuild-kernel
2018/05/03 13:44:20 building docker container for kernel compilation
Sending build context to Docker daemon  6.246MB
Step 1/9 : FROM debian:stretch
 ---> 8626492fecd3
Step 2/9 : RUN apt-get update && apt-get install -y crossbuild-essential-arm64 bc libssl-dev bison flex
 ---> Using cache
 ---> 74ed838c00a2
Step 3/9 : COPY gokr-build-kernel /usr/bin/gokr-build-kernel
 ---> Using cache
 ---> 0f49723b3ee6
Step 4/9 : COPY 0001-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch /usr/src/0001-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch
 ---> Using cache
 ---> 597e1d8d4ff7
Step 5/9 : COPY 0001-Revert-add-index-to-the-ethernet-alias.patch /usr/src/0001-Revert-add-index-to-the-ethernet-alias.patch
 ---> Using cache
 ---> 00e9560c90d8
Step 6/9 : RUN echo 'builduser:x:501:20:nobody:/:/bin/sh' >> /etc/passwd &&     chown -R 501:20 /usr/src
 ---> Using cache
 ---> 8a0235e1d81c
Step 7/9 : USER builduser
 ---> Using cache
 ---> 0b81d685fb70
Step 8/9 : WORKDIR /usr/src
 ---> Using cache
 ---> 9857ba1b6bf8
Step 9/9 : ENTRYPOINT /usr/bin/gokr-build-kernel
 ---> Using cache
 ---> 05be206b1152
Successfully built 05be206b1152
Successfully tagged gokr-rebuild-kernel:latest
2018/05/03 13:44:21 compiling kernel
/bin/sh: 1: /usr/bin/gokr-build-kernel: Exec format error
2018/05/03 13:44:23 docker build: exit status 2

From the output it looks like somehow the "make" commands are blowing up.

Using:

  • go 1.10.1
  • docker 17.05.0-ce_1
  • docker-machine 0.13.0
  • "default" docker image from docker-machine.

I have made the following modifications (which is why I was trying to manually rebuild the kernel in the first place:

diff --git a/cmd/gokr-build-kernel/build.go b/cmd/gokr-build-kernel/build.go
index 7453821..01750bb 100644
--- a/cmd/gokr-build-kernel/build.go
+++ b/cmd/gokr-build-kernel/build.go
@@ -216,6 +216,21 @@ CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_PCA953X_IRQ=y
 CONFIG_GPIO_MAX77620=y
 
+##
+## file: drivers/w1/Kconfig
+##
+CONFIG_W1=y
+
+##
+## file: drivers/w1/masters/Kconfig
+##
+CONFIG_W1_MASTER_GPIO=y
+
+##
+## file: drivers/w1/slaves/Kconfig
+##
+CONFIG_W1_SLAVE_THERM=y
+
 ##
 ## file: drivers/gpu/drm/Kconfig
 ##
diff --git a/config.txt b/config.txt
index 3c23727..b7299c2 100644
--- a/config.txt
+++ b/config.txt
@@ -5,3 +5,4 @@ enable_uart=0
 
 device_tree=rpi-3-b.dtb
 kernel=vmlinuz
+dtoverlay=w1-gpio,gpiopin=4

Enable policy routing

Currently, Tailscale will not configure IPv6 on the tailscale0 interface. This is because it checks to see if policy routing is supported, and if it is not, it will not configure IPv6: https://github.com/tailscale/tailscale/blob/5812093d31c8a7f9c5e3a455f0fd20dcc011d8cd/util/linuxfw/linuxfw.go#L134

It should be possible to turn policy routing on by setting these two config options:

CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IPV6_MULTIPLE_TABLES=y

I'll hopefully have a chance to try this out in the next couple of days. If successful, is this something that can be added to this kernel?

Unable to build custom kernel config

On Linux
I've updated the configAddendum in cmd/gokr-build-kernel/build.go and added the following config options.

CONFIG_MEDIA_SUPPORT=y
CONFIG_VIDEO_DEV=m
CONFIG_VIDEO_V4L2_COMMON=m
CONFIG_VIDEO_MEDIA=m
CONFIG_VIDEO_V4L2=m
CONFIG_VIDEO_CAPTURE_DRIVERS=y
CONFIG_V4L_USB_DRIVERS=y
CONFIG_USB_VIDEO_CLASS=m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

Then I've installed gokr-build-kernel with go install ./cmd/.... When I try to execute gokr-rebuild-kernel, I get the error exec format error.

2023/05/23 14:44:34 building docker container for kernel compilation
Sending build context to Docker daemon 5.492 MB
Step 0 : FROM debian:buster
 ---> 8e1e14d63347
Step 1 : RUN apt-get update && apt-get install -y crossbuild-essential-arm64 bc libssl-dev bison flex kmod
 ---> Running in 5c93bd2c0fd4
exec format error
[8] System error: exec format error
2023/05/23 14:44:37 docker build: exit status 1 (cmd: [docker build --rm=true --tag=gokr-rebuild-kernel .])

On maOS
When I try the steps from above on macOS 12.5, I get the error go: cannot install cross-compiled binaries when GOBIN is set because of https://github.com/gokrazy/kernel/blob/main/cmd/gokr-rebuild-kernel/kernel.go#L141-L144

Any ideas?

Smaller kernel config ?

Hi,

Currently the config runs make defconfig, which generates uses the default combined arm64 defconfig. Is the goal of this project to make a generic kernel, than could work on multiple devices, or is the scope limited to the raspberry pi 3?

If it's the latest, would you be open to a reduced defconfig with less platforms supported ?

Similarly, if the goal is to support more boards, wouldn't the kernel image (without modules) grow a bit big ?

Last but not least, is adding more drivers for use with rpi3 in scope ? I'm thinking of this:
anisse/beatbox-kernel@f597f35 (it needs more testing though before I can submit any PR).

I realize opening an issue is suboptimal for asking questions, but it seemed the best option to discuss this in public.

Enable CONFIG_I2C_BCM2835

The spurious errors caused by enabling I2C was fixed in 4.13 or later, IIRC. In any case it is working in 4.16. Could this be enabled now?

USB floppy drive hangs

I'm currently working on porting a hobby project of mine to using gokrazy. My project uses 3-1/2" floppy disks a storage format.

I've finding that when using gokrazy, my application can't mount an inserted floppy disk. When inserting a disk, the drive whirs like normal, and the media is detected and printed out into the system log. Attempting to mount hangs the process (until the drive is disconnected), and eventually "reset full-speed USB device" is printed by the dwc2 driver.

I can reproduce this with mount from busybox, and a statically compiled mount from util-linux.

I do not have this issue on 32-bit distributions, and I'm finding no issues with the Debian Buster Raspberry Pi 3 preview.

Comparing kernel configurations between the Buster image and gokrazy doesn't yield anything that's wrong to my eyes. CONFIG_BLK_DEV_SD and CONFIG_USB_STORAGE are enabled (and indeed, a standard USB stick mounts).

The Raspberry Pi is connected to my bench power-supply, so I don't believe it's an issue of not enough power. Nor, would that explain why it seems to work well on other distributions.

Do you have any ideas on what I might be missing?

EPD driver for Papirus screen support ?

Hi !
I am currently working on a project and I would like to use gokrazy for a minimalist system.
I need to use a Papirus screen device ad i spent a lot of time to target piece of code i have to change to make it work.

The best option I came up with for now is to modify the gokr-rebuild-kernel to install the drivers (still in progress...) with docker.

What do you think about that ?

Support USB OTG gadget serial with Zero 2 W

It'd be really cool to have USB OTG serial console work with Raspberry Zero 2 W. It should be possible to use the DWC2 g_serial to provide a serial console over USB OTG, without having to use UART for it. This would be great because it doesn't require a serial/TTL adapter and leaves the UART usable for Bluetooth.

gokrazy-build-kernel fails if podman-docker compat binary is installed

Fedora package podman-docker provides a docker binary that emulates docker functionality, but is actually a wrapper around podman. If this is installed, then gokrazy-rebuild-kernel fails.

The reason is that it detects "docker", and therefore elides --userns=keep-id, leading to the owner of /tmp/buildresult (as seen inside the container) staying root, and since the directory is 700 copying vmlinuz to the directory will fail.

Not sure if you'd consider this a bug in gokrazy - one could say it's more a bug in podman-docker. I just wanted to bring this to your atttention since it took me a while to figure this out, in case you'd like to document or hack around it (for example, by probing for podman before docker), but I don't mind if you decide to just close as not a bug. Obviously this can easily be worked around via dnf remove podman-docker.

podman & podman-docker version: 2:1.9.0-1.fc31

gokr-rebuild-kernel output:

...
  OBJCOPY arch/arm64/boot/Image
  GZIP    arch/arm64/boot/Image.gz
2020/05/09 02:57:13 open /tmp/buildresult/vmlinuz: permission denied
2020/05/08 19:57:16 docker run: exit status 1 (cmd: [/usr/bin/docker run --rm --volume /tmp/gokr-rebuild-kernel653178216:/tmp/buildresult:Z gokr-rebuild-kernel])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.