A Go unikernel running on x86 bare metal

EggOS

CI

A Go unikernel running on x86 bare metal

Run a single Go applications on x86 bare metal, written entirely in Go (only a small amount of C and some assembly), support most features of Go (like GC, goroutine) and standard libraries, also come with a network stack that can run most net based libraries.

The entire kernel is a go application running on ring0. There are no processes and process synchronization primitives, only goroutines and channels. There is no elf loader, but there is a Javascript interpreter that can run js script files, and a WASM interpreter will be added to run WASM files later.

Background

Go's runtime provides some basic operating system abstractions. Goroutine corresponds to processes and channel corresponds to inter-process communication. In addition, go has its own virtual memory management, so the idea of running Go programs on bare metal was born.

It turns out that Go has the ability to manipulate hardware resources, thanks to Go's controllable memory layout, the ability to directly translate hardware instructions without a virtual machine, and C-like syntax. These all make it possible for Go to write programs that run on bare metal. However, there are also some challenges. Go piling in many instructions to perform coroutine scheduling and memory GC, which brings some troubles in some places that cannot be reentrant, such as interrupt handling and system calls.

In general, writing kernel in Go is a very interesting experience. On the one hand, it gave me a deep understanding of Go's runtime. On the other hand, it also provided an attempt to write the operating system kernel on bare metal in addition to the C language.

Snapshot

js nes

Feature list

  • Basic Go features, such as GC, goroutine, channel.
  • A simple console support basic line editting.
  • Network stack support tcp/udp.
  • Go style vfs abstraction using afero
  • A nes game emulator using nes
  • A Javascript interpreter using otto
  • VBE based frame buffer.
  • Some simple network apps(httpd, sshd).

Dependencies

  • Go 1.13.x (only tested on Go1.13.x)
  • i386-elf-gcc
  • qemu

MacOS

$ brew tap nativeos/i386-elf-toolchain
$ brew install i386-elf-binutils i386-elf-gcc i386-elf-gdb
$ brew install qemu

Ubuntu

$ sudo apt-get install build-essential qemu

Quickstart

$ make
$ make qemu

Debug

You can directly use the gdb command to debug, or use vscode for graphical debugging.

First you need to install gdb, if you are under macos, execute the following command

brew install i386-elf-gdb

Use the extension Native Debug in vscode to support debugging with gdb

First execute the make qemu-debug command to let qemu start the gdb server, and then use the debug function of vscode to start a debug session. The debug configuration file of vscode is built into the project.

Go provides simple support for gdb, see Debugging Go Code with GDB for details

vscode-gdb

Running on bare metal

If you want eggos to run on bare metal, it is recommended to use grub as the bootloader.

The multiboot.elf generated after executing the make command is a kernel image conforming to the multiboot specification, which can be directly recognized by grub and booted on a bare metal. The sample configuration file refer to boot/grub.cfg

Documentation

For some design details see docs/internal.md

Roadmap

  • WASM runner
  • GUI support
  • 3D graphic
  • x86_64 support
  • SMP support

Bugs

The program still has a lot of bugs, and often loses response or panic. If you are willing to contribute, please submit a PR, thank you!

Special thanks

The birth of my little daughter brought a lot of joy to the family. This project was named after her name xiao dan dan. My wife and mother also gave me a lot of support and let me update this project in my spare time. ❤️ ❤️ ❤️

Comments
  • cmd/egg: build failure when specifying build path

    cmd/egg: build failure when specifying build path

    I tried egg build on something very simple:

    (⎈ |local:default)
    prologic@Jamess-iMac
    Fri Aug 06 10:16:51
    ~/tmp/hello-eggos
     130
    $ egg build .
    2021/08/06 10:16:53 eggos not found in go.mod
    2021/08/06 10:16:53 go get github.com/icexin/eggos
    go get: added github.com/icexin/eggos v0.4.0
    malformed import path "-tags": leading dash
    package eggos is not in GOROOT (/usr/local/Cellar/go/1.16/libexec/src/eggos)
    2021/08/06 10:18:02 exit status 1
    (⎈ |local:default)
    prologic@Jamess-iMac
    Fri Aug 06 10:18:02
    ~/tmp/hello-eggos
     1
    $ ls -lah
    total 2.1M
    drwxr-xr-x   6 prologic staff  192 Aug  6 10:18 .
    drwxr-xr-x 151 prologic staff 4.8K Aug  6 10:16 ..
    -rw-r--r--   1 prologic staff   80 Aug  6 10:18 go.mod
    -rw-r--r--   1 prologic staff  98K Aug  6 10:18 go.sum
    -rwxr-xr-x   1 prologic staff 2.0M Aug  6 10:16 hello-eggos
    -rw-r--r--   1 prologic staff   73 Aug  6 10:16 main.go
    (⎈ |local:default)
    prologic@Jamess-iMac
    Fri Aug 06 10:18:47
    ~/tmp/hello-eggos
     0
    $ cat main.go
    package main
    
    import "fmt"
    
    func main() {
    	fmt.Println("Hello eggos!")
    }
    (⎈ |local:default)
    prologic@Jamess-iMac
    Fri Aug 06 10:18:50
    ~/tmp/hello-eggos
     0
    $ cat go.mod
    module hello-eggos
    
    go 1.16
    
    require github.com/icexin/eggos v0.4.0 // indirect
    

    It might be the last 3 lines here:

    malformed import path "-tags": leading dash
    package eggos is not in GOROOT (/usr/local/Cellar/go/1.16/libexec/src/eggos)
    2021/08/06 10:18:02 exit status 1
    

    Bug?

  • `egg run` can't find disk image, `egg run foo.iso` exits immediately after grub

    `egg run` can't find disk image, `egg run foo.iso` exits immediately after grub

    I've written a really simple app at https://github.com/jspc/primes which I'd like to package and run via eggos.

    (The app calculates primes- it seemed like a simple use case to play with eggos).

    The problem I'm facing is that trying to run the app directly with egg run gives me:

    qemu-system-x86_64: multiboot knows VBE. we don't                           
    Could not open option rom 'multiboot_dma.bin': No such file or directory
    SeaBIOS (version ArchLinux 1.15.0-1)
                                                                                                   
                                                   
    iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+0FF914E0+0FEF14E0 CA00
                                                                                                                                                                                               
    Booting from Hard Disk...
    Boot failed: could not read the boot disk
    
    Booting from Floppy...
    Boot failed: could not read the boot disk
    
    Booting from DVD/CD...
    Boot failed: Could not read from CDROM (code 0003)
    Booting from ROM...
    iPXE (PCI 00:03.0) starting execution...ok
    iPXE initialising devices...ok
    
    iPXE 1.20.1+ (g4bd0) -- Open Source Network Boot Firmware -- http://ipxe.org
    Features: DNS HTTP iSCSI TFTP AoE ELF MBOOT PXE bzImage Menu PXEXT
    
    net0: 52:54:00:12:34:56 using 82540em on 0000:00:03.0 (open)
      [Link:up, TX:0 TXE:0 RX:0 RXE:0]
    Configuring (net0 52:54:00:12:34:56)...... ok
    net0: 10.0.2.15/255.255.255.0 gw 10.0.2.2
    Nothing to boot: No such file or directory (http://ipxe.org/2d03e13b)
    No more network devices
    
    No bootable device.          
    

    I've read https://github.com/icexin/eggos/issues/91, and so I get that the first two lines can be ignored, but the fact qemu can't find the boot disk is worrying.

    If I compile an iso file, then I get the grub menu, then just the line Loading /boot/kernel.elf... and then it all quits.

    Am I doing something wrong? I can see a segfault when I run gdb kernel.elf, but I'm not sure whether that's just because running a ring0 app on linux fails fast and loud, or whether there's a different reason.

    Any pointers you can give me toward figuring this out would be really appreciated!

  • End goal?

    End goal?

    I came across your project on one of my feeds… What's your project's end goal? I see some issues you've created which to me seem very complex and large scope of work involved

  • keep the x86_32 code or not?

    keep the x86_32 code or not?

    Eggos will be upgraded to 64-bit in the future. Considering that many codes are strongly related to the architecture, it will be easier to upgrade 64-bit directly without keeping 32-bit code.

    However, x86 32-bit protected mode is a classic mode. Many operating system tutorials or materials are based on 32-bit.

    If want to keep the 32-bit code, the code needs some refactoring to separate the architecture-related code.

  • Compile error with Go 1.15

    Compile error with Go 1.15

    Great work. I'm getting compile errors with Go 1.15 though. I've also tested with Go 1.14.6 and get the same error.

    ../../Go/go/pkg/mod/github.com/icexin/[email protected]/sleep/commit_noasm.go:38:45: undefined: preparingG

    Compiling with 1.14.1 and below works fine however so something was introduced between 1.14.1 and 1.14.6 which causes the error.

    Compiling with Go 1.13 is fine up to version 1.13.6

  • fs: update afero to v1.8.1

    fs: update afero to v1.8.1

    In afero v1.6.0 the FromIOFS type was added (see afero.FromIOFS godoc), which facilitates interopability with the fs.FS interface of the Go standard library.

    To support afero.FromIOFS in eggos, afero was updated to the latest version.

    Note: the afero.FS interface has been updated since v1.4.0 to include the Chown method. As such, the logger, mount and smb file system types were updated to include the Chown method.

    In particular, the fs/logger.logger, fs/mount.MountableFs and fs/stripprefix.fs file system types have been updated to include Chown.

    However, as of yet, a stub implementation of Chown exist for the smb.Fs file system type.

  • fatal error: stopm holding locks

    fatal error: stopm holding locks

    after running phy for seconds, panic with output:

    root@eggos# phy
    fatal error: stopm holding locks
    
    runtime stack:
    runtime.throw({0x7b7d92, 0x13})
            /Users/fanbingxin/local/go1.17rc1/src/runtime/panic.go:1198 +0x6a
    runtime.stopm()
            /Users/fanbingxin/local/go1.17rc1/src/runtime/proc.go:2396 +0xe7
    runtime.exitsyscall0(0x50400690)
            /Users/fanbingxin/local/go1.17rc1/src/runtime/proc.go:4115 +0x17a
    runtime.mcall()
            /Users/fanbingxin/local/go1.17rc1/src/runtime/asm_386.s:331 +0x44
    
    goroutine 1 [runnable]:
    github.com/golang/freetype/raster.(*RGBAPainter).Paint(0x50eca570, {0x50543148, 0x3f, 0x40}, 0x0)
            /Users/fanbingxin/go/pkg/mod/github.com/golang/[email protected]/raster/paint.go:127 +0x3db
    github.com/golang/freetype/raster.(*Rasterizer).Rasterize(0x50542000, {0x8cf484, 0x50eca570})
            /Users/fanbingxin/go/pkg/mod/github.com/golang/[email protected]/raster/raster.go:545 +0x2ae
    github.com/fogleman/gg.(*Context).fill(0x5045ed20, {0x8cf484, 0x50eca570})
            /Users/fanbingxin/go/pkg/mod/github.com/fogleman/[email protected]/context.go:423 +0x1da
    github.com/fogleman/gg.(*Context).FillPreserve(0x5045ed20)
            /Users/fanbingxin/go/pkg/mod/github.com/fogleman/[email protected]/context.go:470 +0x168
    github.com/fogleman/gg.(*Context).Fill(0x5045ed20)
            /Users/fanbingxin/go/pkg/mod/github.com/fogleman/[email protected]/context.go:476 +0x21
    github.com/icexin/eggos/app/phy.(*Drawer).DrawCircle(0x5046a7d0, {0x0, 0x0}, 0x400722222222218e, 0x4051800000000000, {0x3f48c8c9, 0x3f52d2d3)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/phy/draw.go:58 +0x390
    github.com/jakecoffman/cp.DrawShape(0x50485d80, {0x8e382c, 0x5046a7d0})
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/draw.go:42 +0x311
    github.com/jakecoffman/cp.DrawSpace.func1(0x50485d80)
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/draw.go:163 +0x2f
    github.com/jakecoffman/cp.(*BBTree).Each.func1({0x771dc0, 0x5055c680})
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/bbtree.go:95 +0x33
    github.com/jakecoffman/cp.(*HashSet).Each(0x504515f0, 0x51193cd4)
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/hashset.go:143 +0x5b
    github.com/jakecoffman/cp.(*BBTree).Each(0x50518300, 0x50e06c70)
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/bbtree.go:93 +0x4e
    github.com/jakecoffman/cp.DrawSpace(0x5045ec40, {0x8e382c, 0x5046a7d0})
            /Users/fanbingxin/go/pkg/mod/github.com/jakecoffman/[email protected]/draw.go:162 +0x8b
    github.com/icexin/eggos/app/phy.(*Game).Draw(0x5050ae90, 0x5040f968)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/phy/game.go:119 +0x47
    github.com/icexin/eggos/app/phy.main(0x50451590)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/phy/game.go:137 +0x14c
    github.com/icexin/eggos/app.Run({0x5051e2b0, 0x3}, 0x50451590)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/app.go:44 +0x8c
    github.com/icexin/eggos/app/sh.runApp(0x505d0000, {0x5051e2b0, 0x3}, {0x5050ae80, 0x0, 0x0}, 0x0)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/sh/sh.go:67 +0x1c3
    github.com/icexin/eggos/app/sh.doline(0x505d0000, {0x5051e298, 0x3})
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/sh/sh.go:50 +0xc9
    github.com/icexin/eggos/app/sh.main(0x505d0000)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/sh/sh.go:30 +0x144
    github.com/icexin/eggos/app/sh.Bootstrap()
            /Users/fanbingxin/go/src/github.com/icexin/eggos/app/sh/sh.go:80 +0x1fc
    main.main()
            /Users/fanbingxin/go/src/github.com/icexin/eggos/kmain/main.go:48 +0x481
    
    goroutine 6 [syscall, locked to thread]:
    syscall.Syscall(0x1f4, 0x0, 0x0, 0x0)
            /Users/fanbingxin/local/go1.17rc1/src/syscall/asm_linux_386.s:19 +0x5
    github.com/icexin/eggos/kernel.traploop()
            /Users/fanbingxin/go/src/github.com/icexin/eggos/kernel/trap.go:188 +0x11d
    created by github.com/icexin/eggos/kernel.Init
            /Users/fanbingxin/go/src/github.com/icexin/eggos/kernel/postinit.go:9 +0x35
    
    goroutine 7 [runnable, locked to thread]:
    syscall.Syscall(0x1f5, 0x0, 0x0, 0x0)
            /Users/fanbingxin/local/go1.17rc1/src/syscall/asm_linux_386.s:19 +0x5
    github.com/icexin/eggos/kernel.handleForward()
            /Users/fanbingxin/go/src/github.com/icexin/eggos/kernel/syscall.go:330 +0x124
    created by github.com/icexin/eggos/kernel.Init
            /Users/fanbingxin/go/src/github.com/icexin/eggos/kernel/postinit.go:10 +0x4b
    
    goroutine 8 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f8610, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f8610, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f8600, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 9 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f8650, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f8650, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f8640, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 10 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f8690, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f8690, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f8680, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 11 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f86d0, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f86d0, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f86c0, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 12 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f8710, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f8710, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f8700, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 13 [select]:
    gvisor.dev/gvisor/pkg/sync.Gopark(...)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sync/runtime_unsafe.go:27
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker(0x504f8750, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:181 +0x75
    gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch(0x504f8750, 0x1)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/sleep/sleep_unsafe.go:228 +0x2a
    gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start(0x504f8740, 0x504924f4)
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:97 +0x7d
    created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*dispatcher).init
            /Users/fanbingxin/go/pkg/mod/gvisor.dev/[email protected]/pkg/tcpip/transport/tcp/dispatcher.go:163 +0x142
    
    goroutine 14 [select]:
    github.com/icexin/eggos/inet/dhcp.(*Client).renewAfter.func1(0x4e94914f0000, {0x8d9ec0, 0x50451560}, 0x5047de00)
            /Users/fanbingxin/go/src/github.com/icexin/eggos/inet/dhcp/client.go:260 +0xcd
    created by github.com/icexin/eggos/inet/dhcp.(*Client).renewAfter
            /Users/fanbingxin/go/src/github.com/icexin/eggos/inet/dhcp/client.go:257 +0xdb
    
    goroutine 15 [syscall]:
    os/signal.signal_recv()
            /Users/fanbingxin/local/go1.17rc1/src/runtime/sigqueue.go:169 +0xf1
    os/signal.loop()
            /Users/fanbingxin/local/go1.17rc1/src/os/signal/signal_unix.go:24 +0x1a
    created by os/signal.Notify.func1.1
            /Users/fanbingxin/local/go1.17rc1/src/os/signal/signal.go:151 +0x2f
    
  • eggos build error

    eggos build error

    i am getting this error, (https://github.com/icexin/eggos/commit/08f787080e450b4af4bc55f221b67ea73f8bf8c0)

    $ mage qemu
    go: downloading github.com/spf13/viper v1.8.1
    go: downloading github.com/spf13/cobra v1.2.1
    go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: extracting github.com/spf13/viper v1.8.1
    go: downloading github.com/magiconair/properties v1.8.5
    go: downloading github.com/spf13/afero v1.6.0
    go: downloading github.com/spf13/cast v1.3.1
    go: downloading github.com/spf13/jwalterweatherman v1.1.0
    go: downloading github.com/pelletier/go-toml v1.9.3
    go: downloading github.com/hashicorp/hcl v1.0.0
    go: downloading github.com/subosito/gotenv v1.2.0
    go: downloading github.com/mitchellh/mapstructure v1.4.1
    go: extracting github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: downloading github.com/fsnotify/fsnotify v1.4.9
    go: extracting github.com/spf13/cobra v1.2.1
    go: extracting github.com/spf13/jwalterweatherman v1.1.0
    go: downloading gopkg.in/yaml.v2 v2.4.0
    go: extracting github.com/subosito/gotenv v1.2.0
    go: downloading gopkg.in/ini.v1 v1.62.0
    go: extracting github.com/mitchellh/mapstructure v1.4.1
    go: downloading github.com/spf13/pflag v1.0.5
    go: extracting github.com/spf13/afero v1.6.0
    go: extracting github.com/magiconair/properties v1.8.5
    go: extracting github.com/spf13/cast v1.3.1
    go: extracting github.com/fsnotify/fsnotify v1.4.9
    go: extracting github.com/hashicorp/hcl v1.0.0
    go: downloading golang.org/x/sys v0.0.0-20210510120138-977fb7262007
    go: extracting gopkg.in/yaml.v2 v2.4.0
    go: extracting github.com/spf13/pflag v1.0.5
    go: extracting gopkg.in/ini.v1 v1.62.0
    go: extracting github.com/pelletier/go-toml v1.9.3
    go: extracting golang.org/x/sys v0.0.0-20210510120138-977fb7262007
    go: finding github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: finding github.com/spf13/cobra v1.2.1
    go: finding github.com/spf13/pflag v1.0.5
    go: finding github.com/spf13/viper v1.8.1
    go: finding github.com/fsnotify/fsnotify v1.4.9
    go: finding golang.org/x/sys v0.0.0-20210510120138-977fb7262007
    go: finding github.com/hashicorp/hcl v1.0.0
    go: finding github.com/magiconair/properties v1.8.5
    go: finding github.com/mitchellh/mapstructure v1.4.1
    go: finding github.com/pelletier/go-toml v1.9.3
    go: finding github.com/spf13/afero v1.6.0
    go: finding github.com/spf13/cast v1.3.1
    go: finding github.com/spf13/jwalterweatherman v1.1.0
    go: finding github.com/subosito/gotenv v1.2.0
    go: finding gopkg.in/ini.v1 v1.62.0
    go: finding gopkg.in/yaml.v2 v2.4.0
    build github.com/icexin/eggos/cmd/egg: cannot load embed: malformed module path "embed": missing dot in first path element
    Error: running "go build -o ../egg ./egg" failed with exit code 1
    
  • cycle not allowed

    cycle not allowed

    Hello,

    All commands from the egg executable are not working.

    On the root of the cloned project, I for example, trying to run the command:

    shell ./egg run

    I get this following

    shell package github.com/icexin/eggos imports github.com/icexin/eggos: import cycle not allowed 2021/08/31 13:42:17 error building kernel: exit status 1

    I have been trying for all other commands and get the same error as well.

    Thanks

  • towards amd64

    towards amd64

    64 bit mode has the following advantages:

    1. Acceleration can be used in QEMU's debug mode.
    2. Most of go's third-party libraries give priority to amd64.
    3. We can use frame pointer to trace the stack, which makes it easier to debug the kernel.
    4. Faster speed.
  • trying to understand linking process

    trying to understand linking process

    Osdev.wiki use a linker script, but i could not find one in the repo. I want to understand where have you included the process of the linker, can you please guide me through this part.

    Thank you

  • The error in running the example

    The error in running the example "Helloworld"

    when I download the eggos and the source, I try run the "helloworld" by "egg run" command,but I receive error, and How can I do , my env setting error?

    package github.com/icexin/eggos/app/examples/helloworld imports github.com/icexin/eggos imports github.com/icexin/eggos/drivers/e1000 imports github.com/icexin/eggos/inet imports gvisor.dev/gvisor/pkg/abi/linux imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /root/go/pkg/mod/gvisor.dev/[email protected]/pkg/gohacks 2022/06/28 09:52:16 error building kernel: exit status 1

  • draft PR for gaining insight into what is needed for Go 1.17 calling conventions; DO NOT MERGE

    draft PR for gaining insight into what is needed for Go 1.17 calling conventions; DO NOT MERGE

    For context, see the detailed commit messages of:

    • 8cdbd4ff30be64efc808477333ff6bc8ae12bc2a: kernel: invoke sseInit and initFakeFS from rt0 to handle function wrappers of Go 1.17
    • ef26ff142208bf3a1e93e100a1952ce3647b7785: kernel: skip return address of function wrapper in trapret before IRET instruction

    NOTE: this is a draft PR to gain intuition into the problem domain and is not intended to be commited into eggos. DO NOT MERGE.

    NOTE: commit ef26ff142208bf3a1e93e100a1952ce3647b7785 is incompatible with Go versions prior to Go 1.17. In particular, it will not work with Go 1.16. A proper solution should handle both!

    Updates icexin/eggos#100.

  • create Discord channel for chat communication between developers and the community

    create Discord channel for chat communication between developers and the community

    Hi @icexin, @jspc and all eggos developers!

    After having explored eggos, it seems the potential is great, both for developing a deeper understanding of low-level interactions between the Go runtime and the operating system, but also for developing quite unique minimal trusted code base scenarios!

    I would be glad to foster a community around eggos which help connect developers and users through a shared chat communication platform.

    How about we start a Discord server for eggos?

    Let me know what you think. I can configure one if you wish.

    Cheerful regards, Robin

    Edit: for those that wish to join, here is the invite link to join the eggos Discord chat: https://discord.gg/WBnkCUVmGN

  • add support for go1.17

    add support for go1.17

    Go 1.17 implements a new way of passing function arguments and results using registers instead of the stack.

    • https://go.googlesource.com/proposal/+/master/design/40724-register-calling.md
    • https://go.googlesource.com/go/+/refs/heads/dev.regabi/src/cmd/compile/internal-abi.md

    This issue is used to track affected modules and corresponding PRs.

  • Call various kernel inits directly, rather than via an import

    Call various kernel inits directly, rather than via an import

    See: https://github.com/icexin/eggos/issues/98

    Because of the way go loads init functions from packages, any steps which must occur before kernel init (setting loglevels, perhaps) requires a bit of hacking.

    By generating these calls as a first class init function for a given unikernel we can avoid having to hack around the golang init function loader.

    This change adds a generate command to egg, which can be to allow developers to maintain their own eggos include file to allow for developers to change how their unikernel is run, such as being able to change the value of GOMAXPROCS, or disable networking.

    The build command now checks for the presence of this file. If it does not exist then the build command will use the current method of generating a file and overlay. Otherwise it uses the user specified file.

    Finally, the file we generate is prefixed with zz_ to try and influence when the file loads, in order to let user specified init functions (like setting log levels) to run first

Running a Command line tool written in Go on browser with WebAssembly

Running a command line tool written in Go on browser with WebAssembly This repo contains code/assets from the article Files: . ├── article.md

Dec 30, 2022
The bare metal Go smart card
The bare metal Go smart card

Authors Andrea Barisani [email protected] | [email protected] Introduction The GoKey application implements a USB smartcard in pure Go

Dec 8, 2022
TamaGo - bare metal Go for ARM SoCs

TamaGo - bare metal Go for ARM SoCs tamago | https://github.com/f-secure-foundry/tamago Copyright (c) F-Secure Corporation https://foundry.f-secure.co

Dec 29, 2022
A suite of microservices for software-defined networking (SDN) and bare-metal provisioning

M3L is a suite of microservices for software-defined networking (SDN) and bare-metal provisioning, which store their data as Custom Resources in Kubernetes.

Jan 19, 2022
e2d is a command-line tool for deploying and managing etcd clusters, both in the cloud or on bare-metal

e2d is a command-line tool for deploying and managing etcd clusters, both in the cloud or on bare-metal. It also includes e2db, an ORM-like abstraction for working with etcd.

Aug 23, 2022
Nanovms running in Docker x86 container for M1 Mac ARM64.

Docker Ops This project is an attempt to enable Nanos unikernels to be managed by Ops on non-intel architectures such as the Mac M1 ARM64. Unless ther

Nov 22, 2021
Vippy - A Virtual IP/BGP/IPVS Load-Balancer for Equinix Metal

Vippy - A Virtual IP/BGP/IPVS Load-Balancer for Equinix Metal If I figure out how to make it work.. How it works! The Vippy LB PoC uses BGP/IPVS and E

Mar 10, 2022
Terraform-equinix-migration-tool - Tool to migrate code from Equinix Metal terraform provider to Equinix terraform provider

Equinix Terraform Provider Migration Tool This tool targets a terraform working

Feb 15, 2022
Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

Dec 13, 2022
Generate x86 Assembly with Go

Generate x86 Assembly with Go avo makes high-performance Go assembly easier to write, review and maintain. The avo package presents a familiar assembl

Dec 30, 2022
Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

Dec 13, 2022
Experimental system call tracer for Linux x86-64, written in Go

gtrace A system call tracer for Linux x86-64. DISCLAIMER: This software is experimental and not considered stable. Do not use it in mission-critical e

Nov 29, 2022
🏃 An x86-64 assembler written in Go.

asm An x86-64 assembler written in Go. It is used by the Q programming language for machine code generation. Architectures Linux x86-64 (ELF binaries)

Nov 7, 2022
Make HMCL working in Apple Silicon Mac without x86 Java

M1MC Apple have used arm64 architecture on their new Macs. But Minecraft have no

Sep 19, 2022
[TOOL, CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations.

typex Examine Go types and their transitive dependencies. Export results as TypeScript value objects (or types) declaration. Installation go get -u gi

Dec 6, 2022
Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.

fastglue Overview fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework. It

Jun 14, 2022
Bare Bones Encrypted File Uploading Service

eggnog Basic file uploading service in Go. Files are XOR encrypted server side, and are only accessible with the key. It's not perfect encryption, but

Nov 15, 2021
Tinyini - Bare-bones Go library for reading INI-like configuration files

tinyini tinyini is a minimalistic library for parsing INI-like configuration files. example configuration file globalkey = globalvalue [section] key

Jan 10, 2022
Atomic Arbitrage - A base example of a bare implementation of an arbitrage bot

Atomic Arbitrage Atomic Arbitrage is a base example of a bare implementation of

Nov 23, 2022
👷 Library for safely running groups of workers concurrently or consecutively that require input and output through channels
👷 Library for safely running groups of workers concurrently or consecutively that require input and output through channels

Examples Quickstart Multiple Go Workers Passing Fields Getting Started Pull in the dependency go get github.com/catmullet/go-workers Add the import to

Dec 1, 2022