mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
Native Solo5 bindings
A shared library implementation of the unikernel middleware. https://github.com/Solo5/solo5 Fix #2945
This commit is contained in:
parent
5a4dab88d6
commit
bc539ce892
12
repos/libports/include/solo5/stdint.h
Normal file
12
repos/libports/include/solo5/stdint.h
Normal file
@ -0,0 +1,12 @@
|
||||
#include <base/fixed_stdint.h>
|
||||
|
||||
typedef genode_uint8_t uint8_t;
|
||||
typedef genode_int8_t int8_t;
|
||||
typedef genode_uint16_t uint16_t;
|
||||
typedef genode_int16_t int16_t;
|
||||
typedef genode_uint32_t uint32_t;
|
||||
typedef genode_int32_t int32_t;
|
||||
typedef genode_uint64_t uint64_t;
|
||||
typedef genode_int64_t int64_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
typedef unsigned long size_t;
|
4
repos/libports/lib/import/import-solo5.mk
Normal file
4
repos/libports/lib/import/import-solo5.mk
Normal file
@ -0,0 +1,4 @@
|
||||
SOLO5_PORT_DIR := $(call select_from_ports,solo5)
|
||||
|
||||
INC_DIR += $(SOLO5_PORT_DIR)/include/solo5
|
||||
INC_DIR += $(call select_from_repositories,/include/solo5)
|
14
repos/libports/lib/mk/solo5.mk
Normal file
14
repos/libports/lib/mk/solo5.mk
Normal file
@ -0,0 +1,14 @@
|
||||
REQUIRES += 64bit
|
||||
|
||||
SHARED_LIB = yes
|
||||
|
||||
include $(REP_DIR)/lib/import/import-solo5.mk
|
||||
|
||||
INC_DIR += $(SOLO5_PORT_DIR)/src/lib/solo5/bindings
|
||||
INC_DIR += $(REP_DIR)/src/lib/solo5
|
||||
|
||||
CC_OPT += -D__SOLO5_BINDINGS__ -Drestrict=__restrict__
|
||||
|
||||
SRC_CC = bindings.cc
|
||||
|
||||
vpath %.cc $(SOLO5_PORT_DIR)/src/lib/solo5/bindings/genode
|
13
repos/libports/lib/symbols/solo5
Normal file
13
repos/libports/lib/symbols/solo5
Normal file
@ -0,0 +1,13 @@
|
||||
solo5_abort T
|
||||
solo5_app_main U
|
||||
solo5_block_info T
|
||||
solo5_block_read T
|
||||
solo5_block_write T
|
||||
solo5_clock_monotonic T
|
||||
solo5_clock_wall T
|
||||
solo5_console_write T
|
||||
solo5_exit T
|
||||
solo5_net_info T
|
||||
solo5_net_read T
|
||||
solo5_net_write T
|
||||
solo5_yield T
|
1
repos/libports/ports/solo5.hash
Normal file
1
repos/libports/ports/solo5.hash
Normal file
@ -0,0 +1 @@
|
||||
38981f1a735dfaa4bffc241db5d3b31e2b47163c
|
13
repos/libports/ports/solo5.port
Normal file
13
repos/libports/ports/solo5.port
Normal file
@ -0,0 +1,13 @@
|
||||
LICENSE := ISC
|
||||
VERSION := HEAD
|
||||
DOWNLOADS := solo5.archive
|
||||
|
||||
OWNER := Solo5
|
||||
REPO := solo5
|
||||
REV := 58e855e149b069174b97176dcc0cba077e8a7440
|
||||
URL(solo5) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
|
||||
SHA(solo5) := b90e727a75b447caa5668c4babf306e1d34c0d1534665900f09d559ef47366a9
|
||||
DIR(solo5) := src/lib/solo5
|
||||
|
||||
DIRS := include/solo5
|
||||
DIR_CONTENT(include/solo5) = src/lib/solo5/include/solo5/solo5.h
|
14
repos/libports/recipes/api/solo5/content.mk
Normal file
14
repos/libports/recipes/api/solo5/content.mk
Normal file
@ -0,0 +1,14 @@
|
||||
content: include lib/symbols/solo5 LICENSE
|
||||
|
||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/solo5)/src/lib/solo5
|
||||
|
||||
include:
|
||||
mkdir -p $@
|
||||
cp -r $(PORT_DIR)/include $@
|
||||
cp -r $(REP_DIR)/include $@
|
||||
|
||||
lib/symbols/solo5:
|
||||
$(mirror_from_rep_dir)
|
||||
|
||||
LICENSE:
|
||||
cp $(PORT_DIR)/$@ $@
|
1
repos/libports/recipes/api/solo5/hash
Normal file
1
repos/libports/recipes/api/solo5/hash
Normal file
@ -0,0 +1 @@
|
||||
-
|
1
repos/libports/recipes/src/solo5/api
Normal file
1
repos/libports/recipes/src/solo5/api
Normal file
@ -0,0 +1 @@
|
||||
solo5
|
21
repos/libports/recipes/src/solo5/content.mk
Normal file
21
repos/libports/recipes/src/solo5/content.mk
Normal file
@ -0,0 +1,21 @@
|
||||
PORT_DIR_SOLO5 := $(call port_dir,$(REP_DIR)/ports/solo5)
|
||||
|
||||
SRC_DIR = src/lib/solo5
|
||||
|
||||
MIRROR_FROM_REP_DIR = \
|
||||
include/solo5 \
|
||||
lib/import/import-solo5.mk \
|
||||
lib/mk/solo5.mk \
|
||||
|
||||
content: $(SRC_DIR) $(MIRROR_FROM_REP_DIR)
|
||||
|
||||
$(SRC_DIR):
|
||||
mkdir -p $@
|
||||
cp -rH $(REP_DIR)/$@/* $@/
|
||||
cp -r $(PORT_DIR_SOLO5)/$@/* $@/
|
||||
cp -r $(PORT_DIR_SOLO5)/include/solo5/solo5.h $@/
|
||||
cp $(PORT_DIR_SOLO5)/$@/LICENSE .
|
||||
echo 'LIBS=solo5' > $@/target.mk
|
||||
|
||||
$(MIRROR_FROM_REP_DIR):
|
||||
$(mirror_from_rep_dir)
|
1
repos/libports/recipes/src/solo5/hash
Normal file
1
repos/libports/recipes/src/solo5/hash
Normal file
@ -0,0 +1 @@
|
||||
-
|
6
repos/libports/recipes/src/solo5/used_apis
Normal file
6
repos/libports/recipes/src/solo5/used_apis
Normal file
@ -0,0 +1,6 @@
|
||||
base
|
||||
os
|
||||
block_session
|
||||
nic_session
|
||||
rtc_session
|
||||
timer_session
|
117
repos/libports/run/mirage_net.run
Normal file
117
repos/libports/run/mirage_net.run
Normal file
@ -0,0 +1,117 @@
|
||||
if {![have_spec x86_64]} {
|
||||
puts "\nSolo5 requires a 64bit architecture\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if {![file exists bin/mirage]} {
|
||||
puts ""
|
||||
puts "A mirage image must be provided at 'bin/mirage' to execute this scenario."
|
||||
puts ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
if {[have_spec linux]} {
|
||||
puts ""
|
||||
puts "This scenario is not available for the Linux platform."
|
||||
puts ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
import_from_depot \
|
||||
genodelabs/src/[base_src] \
|
||||
genodelabs/src/init \
|
||||
genodelabs/src/rtc_drv \
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
|
||||
set build_components {
|
||||
drivers/nic
|
||||
drivers/rtc
|
||||
lib/solo5
|
||||
}
|
||||
|
||||
append_platform_drv_build_components
|
||||
|
||||
lappend_if [expr {[nic_drv_binary] == "nic_drv"}] build_components drivers/nic
|
||||
lappend_if [expr {[nic_drv_binary] == "usb_drv"}] build_components drivers/usb
|
||||
|
||||
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
||||
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
||||
return gpio_drv }
|
||||
|
||||
lappend_if [have_spec gpio] build_components drivers/gpio
|
||||
|
||||
build $build_components
|
||||
|
||||
append config {
|
||||
<config>
|
||||
<default caps="256"/>
|
||||
<parent-provides>
|
||||
<service name="CPU"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="LOG"/>
|
||||
<service name="PD"/>
|
||||
<service name="RAM"/>
|
||||
<service name="RM"/>
|
||||
<service name="ROM"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service> </default-route>}
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append_if [have_spec gpio] config "
|
||||
<start name=\"[gpio_drv]\" caps=\"140\">
|
||||
<resource name=\"RAM\" quantum=\"4M\"/>
|
||||
<provides><service name=\"Gpio\"/></provides>
|
||||
<config/>
|
||||
</start>"
|
||||
|
||||
append config {
|
||||
<start name="timer" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
</start>
|
||||
<start name="nic_drv">
|
||||
<binary name="} [nic_drv_binary] {"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
</start>
|
||||
<start name="rtc_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Rtc"/></provides>
|
||||
</start>
|
||||
<start name="mirage" caps="256">
|
||||
<resource name="RAM" quantum="32M"/>
|
||||
<config> <nic/> <rtc/> </config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
set boot_modules {
|
||||
mirage
|
||||
rtc_drv
|
||||
solo5.lib.so
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
append_platform_drv_boot_modules
|
||||
|
||||
lappend boot_modules [nic_drv_binary]
|
||||
|
||||
lappend_if [have_spec gpio] boot_modules [gpio_drv]
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -nographic -net user"
|
||||
|
||||
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
|
||||
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
||||
|
||||
run_genode_until forever
|
99
repos/libports/run/solo5.run
Normal file
99
repos/libports/run/solo5.run
Normal file
@ -0,0 +1,99 @@
|
||||
if {![have_spec 64bit]} {
|
||||
puts "\nSolo5 requires a 64bit architecture\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if {[have_spec linux]} {
|
||||
puts "\nRunscript not compatible with base-linux drivers\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
import_from_depot \
|
||||
genodelabs/src/[base_src] \
|
||||
genodelabs/src/init \
|
||||
genodelabs/src/rtc_drv \
|
||||
|
||||
install_config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="PD"/>
|
||||
<service name="RAM"/>
|
||||
<service name="ROM"/>
|
||||
<service name="IO_PORT"/>
|
||||
</parent-provides>
|
||||
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service> </default-route>
|
||||
|
||||
<start name="timer" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="rtc_drv" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Rtc"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="nic_loopback" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Nic"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="ram_blk" caps="96">
|
||||
<resource name="RAM" quantum="40M"/>
|
||||
<provides> <service name="Block"/> </provides>
|
||||
<config size="32M" block_size="4096"/>
|
||||
</start>
|
||||
|
||||
<start name="test" caps="256">
|
||||
<binary name="sequence"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<config>
|
||||
<start name="solo5-test_hello">
|
||||
<config>
|
||||
<solo5 cmdline="Hello_Solo5"/>
|
||||
<rtc/> <nic/> <blk/>
|
||||
</config>
|
||||
</start>
|
||||
<start name="solo5-test_fpu"/>
|
||||
<start name="solo5-test_globals"/>
|
||||
<start name="solo5-test_quiet"/>
|
||||
<start name="solo5-test_blk">
|
||||
<config> <blk/> </config>
|
||||
</start>
|
||||
<start name="solo5-test_time">
|
||||
<config> <rtc/> </config>
|
||||
</start>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
build {
|
||||
app/sequence
|
||||
server/nic_loopback
|
||||
server/ram_blk
|
||||
test/solo5
|
||||
}
|
||||
|
||||
build_boot_image {
|
||||
nic_loopback
|
||||
ram_blk
|
||||
sequence
|
||||
solo5.lib.so
|
||||
solo5-test_blk
|
||||
solo5-test_fpu
|
||||
solo5-test_globals
|
||||
solo5-test_hello
|
||||
solo5-test_quiet
|
||||
solo5-test_time
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
|
||||
run_genode_until {child "test" exited with exit value 0} 40
|
123
repos/libports/run/solo5_ping.run
Normal file
123
repos/libports/run/solo5_ping.run
Normal file
@ -0,0 +1,123 @@
|
||||
if {![have_spec x86_64]} {
|
||||
puts "\nSolo5 requires a 64bit architecture\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if {[have_spec linux]} {
|
||||
puts "\nRunscript not compatible with base-linux drivers\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
import_from_depot \
|
||||
genodelabs/src/[base_src] \
|
||||
genodelabs/src/init \
|
||||
genodelabs/src/rtc_drv \
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
|
||||
append config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="128"/>}
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append config {
|
||||
<start name="timer" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="rtc_drv" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Rtc"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="nic_drv" caps="150">
|
||||
<binary name="} [nic_drv_binary] {"/>
|
||||
<resource name="RAM" quantum="20M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
} [nic_drv_config] {
|
||||
</start>
|
||||
|
||||
<start name="nic_bridge" caps="200">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Nic"/></provides>
|
||||
<config mac="02:02:02:02:03:00">
|
||||
<policy label_prefix="solo5" ip_addr="10.0.0.2"/>
|
||||
<default-policy/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nic"> <child name="nic_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="solo5-test_ping_serve" caps="256">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config>
|
||||
<solo5 cmdline="limit"/>
|
||||
<nic/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ping">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<config interface="10.0.0.72/24"
|
||||
dst_ip="10.0.0.2"
|
||||
period_sec="1"
|
||||
verbose="no"
|
||||
count="8"/>
|
||||
<route>
|
||||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
append build_components {
|
||||
app/ping
|
||||
drivers/nic
|
||||
server/nic_bridge
|
||||
test/solo5/ping_serve
|
||||
}
|
||||
|
||||
append_platform_drv_build_components
|
||||
build $build_components
|
||||
|
||||
append boot_modules {
|
||||
nic_bridge
|
||||
ping
|
||||
} [nic_drv_binary] {
|
||||
solo5-test_ping_serve
|
||||
solo5.lib.so
|
||||
}
|
||||
|
||||
append_platform_drv_boot_modules
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -nographic "
|
||||
|
||||
run_genode_until {child "ping" exited with exit value 0} 60
|
2
repos/libports/src/lib/solo5/target.mk
Normal file
2
repos/libports/src/lib/solo5/target.mk
Normal file
@ -0,0 +1,2 @@
|
||||
TARGET = dummy-solo5
|
||||
LIBS = solo5
|
1
repos/libports/src/test/solo5/abort/target.mk
Normal file
1
repos/libports/src/test/solo5/abort/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/blk/target.mk
Normal file
1
repos/libports/src/test/solo5/blk/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/exception/target.mk
Normal file
1
repos/libports/src/test/solo5/exception/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/fpu/target.mk
Normal file
1
repos/libports/src/test/solo5/fpu/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/globals/target.mk
Normal file
1
repos/libports/src/test/solo5/globals/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/hello/target.mk
Normal file
1
repos/libports/src/test/solo5/hello/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/ping_serve/target.mk
Normal file
1
repos/libports/src/test/solo5/ping_serve/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
1
repos/libports/src/test/solo5/quiet/target.mk
Normal file
1
repos/libports/src/test/solo5/quiet/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
8
repos/libports/src/test/solo5/test.inc
Normal file
8
repos/libports/src/test/solo5/test.inc
Normal file
@ -0,0 +1,8 @@
|
||||
TEST_NAME := test_$(subst $(REP_DIR)/src/test/solo5/,,$(PRG_DIR))
|
||||
TARGET = solo5-$(TEST_NAME)
|
||||
|
||||
LIBS += solo5
|
||||
|
||||
SRC_C += $(TEST_NAME).c
|
||||
|
||||
vpath %.c $(call select_from_ports,solo5)/src/lib/solo5/tests/$(TEST_NAME)
|
1
repos/libports/src/test/solo5/time/target.mk
Normal file
1
repos/libports/src/test/solo5/time/target.mk
Normal file
@ -0,0 +1 @@
|
||||
include $(REP_DIR)/src/test/solo5/test.inc
|
@ -97,6 +97,7 @@ seoul-auto
|
||||
signal
|
||||
slab
|
||||
smartcard
|
||||
solo5
|
||||
stdcxx
|
||||
sub_rm
|
||||
synced_interface
|
||||
|
Loading…
Reference in New Issue
Block a user