now you can run http web server based on golang in genode 21.11

Alexander Tormasov a.tormasov at innopolis.ru
Thu Dec 23 15:14:37 CET 2021


added support for ARM64 (V8A).
tested on single platform - foc where rpi3 is available.
all info see below in README.golang

Now you need only one repo - https://github.com/tor-m6/genode-world.git

while temporary patch which allow .go compilation is inside staging of main genode, soon should be available in master,
still please apply manually from here
https://github.com/genodelabs/genode/commit/e6231794f36a481afc9edb058df342f0c8ba1f6c

Note: here I can’t try go_http because drivers_nic package not available for rpi3
Any ideas where I can check that network works using arm64 in qemu with it? 

not sure which other ARM platforms need to be supported - if you have any idea just email me.

Alexander

> 17 дек. 2021 г., в 14:01, Alexander Tormasov via users <users at lists.genode.org> написал(а):
> 
> I have a progress in porting of golang from gcc 10.3 to genode 21.11.
> Seems that now it suitable for external testing.
> 
> More details in
> https://github.com/tor-m6/genode-world/blob/21.11/src/test/go_app/README.golang
> 
> In particular, it is possible to run most of the golang programs, including tcp network (http server from net/http package) in SMP mode (tested on 4 cpu) on genode for nova, foc and linux, run inside qemu (or on linux), for x86_64. May be some other platforms works as well (except sel4- see below).
> 
> To run you need 2 repos:
> https://github.com/tor-m6/genode.git
> Need to checkout 21.11 branch - while it have only one commit introducing .go as a target for compilation.
> 
> support code is in repos/world (don’t forget to uncomment it)
> https://github.com/tor-m6/genode-world.git
> (Need to checkout 21.11 branch)
> 
> I successfully run some tests with channels/async goroutines - some of them (Like Hanoi towers or barber serving) inside
> https://github.com/tor-m6/genode-world/blob/21.11/src/test/go_app/main.go
> 
> also you can run network code like this:
> 
> package main
> 
> import (
>    "fmt"
>    "log"
>    "net/http"
> )
> 
> func main() {
> 
>    http.HandleFunc("/", HelloServer)
>    fmt.Println("Server started at port 80")
>    log.Fatal(http.ListenAndServe(":80", nil))
> }
> 
> func HelloServer(w http.ResponseWriter, r *http.Request) {
>    fmt.Fprintf(w, "Hello, %s!\n", r.URL.Path[1:])
> }
> 
> 
> Future plan: 
> - add arm64 support
> - check sel4 problem
> - add automated generation of part of run file (all shared libs/binaries need to appears in appropriate places to unwind process works correctly)
> - check performance problems on sel4 and foc (probably timeouts/timer, waits too long in the very beginning)
> - try to integrate it in native mode to create workable «go build» code inside genode as native compilation.
> 
> Note1: currently it can’t run on x86_64 sel4 because during initial golang stack unwind process it touch stack guard page, deeply inside _Unwind_Backtrace libgcc function (not sure why - probably this is compiler flags/optimisation issue). Once I have workable version with different debug options…
> 
> Note2: May be it worth to add patch below permanently to main genode?
> 
> diff --git a/repos/base/mk/generic.mk b/repos/base/mk/generic.mk
> index 66e5c309c..aea75e342 100644
> --- a/repos/base/mk/generic.mk
> +++ b/repos/base/mk/generic.mk
> @@ -7,7 +7,7 @@
> # Collect object files and avoid duplicates (by using 'sort')
> #
> SRC_O  += $(addprefix binary_,$(addsuffix .o,$(notdir $(SRC_BIN))))
> -SRC     = $(sort $(SRC_C) $(SRC_CC) $(SRC_ADB) $(SRC_ADS) $(SRC_RS) $(SRC_S) $(SRC_O))
> +SRC     = $(sort $(SRC_C) $(SRC_CC) $(SRC_ADB) $(SRC_ADS) $(SRC_RS) $(SRC_S) $(SRC_O) $(SRC_GO))
> OBJECTS = $(addsuffix .o,$(basename $(SRC)))
> 
> #
> @@ -69,6 +69,16 @@ endif
>        $(MSG_ASSEM)$@
>        $(VERBOSE)$(CC) $(CC_DEF) $(CC_C_OPT) $(INCLUDES) -c $< -o $@
> 
> +#
> +# Compiling Go sources
> +#
> +%.o: %.go
> +       $(MSG_COMP)$@
> +       $(VERBOSE)$(GOLANG) $(CUSTOM_GO_FLAGS) -c -o $@ $<
> +
> +CUSTOM_GO      ?= $(CROSS_DEV_PREFIX)gccgo
> +GOLANG   = $(CUSTOM_GO)
> +
> #
> # Compiling Ada source codes
> #
> 
> _______________________________________________
> Genode users mailing list
> users at lists.genode.org
> https://lists.genode.org/listinfo/users



More information about the users mailing list