Git Product home page Git Product logo

sofa's Introduction

Sofa

Sofa is built atop SeL4 microkernel and provides a set of userland servers and an API to manipulate them.

Features:

System:

  • IPC Model between root server ('kernel_task') and applications
  • Thread in processes
  • UDP stack with virtio device
  • virtio-pci-blk driver (IRQ Not working, polling only for now)
  • VESA support

Process API

  • printf
  • getpid, getppid,
  • spawn,
  • sleep,
  • wait/waitpid,
  • kill,
  • readdir
  • Name server: register service, get service by name,
  • threads
  • VFS: mount, open, close, read
  • Net: socket, bind, recvfrom, sendto
  • module loader

POSIX status

Because we use musl, the current goal is to be as much as possible POSIX compliant. Except for:

  • fork, that might never be implemented. here's why.

Applications

  • init
  • shell
  • udp echo server

Services

  • Process: Enum, Spawn, Kill
  • VFS (read-only for now)
  • net (udp only)
  • DeviceKit
  • init: pretty much empty for now, serves as a use case to implement servers

Build

See dependencies.md for a list of required software.

You should have all the tools and external deps required to build seL4 (some info here).

Then call the update.sh script to fetch all the required components (seL4 kernel, libs, etc.)

Important

The LibSel4MuslcSysMorecoreBytes config var must be set to 0 in the project configuration. This can be done using ccmake ../projects/Sofa/ in the build folder.

sh update.sh
mkdir build
cd build
../init-build.sh  -DPLATFORM=x86_64 -DSIMULATION=TRUE -DRELEASE=FALSE -DLWIP_DEBUG=1 -DLWIP_PATH=../projects/libliwip/
ninja
./simulate --extra-qemu-args "-netdev user,id=net1,hostfwd=udp::3000-:3000 -device virtio-net-pci,netdev=net1 -device virtio-blk-pci,drive=drive0 -drive file=../sysroot.ext2.qcow2,if=none,id=drive0"

Create a qcow2 image

from here:

Note: to mount and edit the volume on the host: see https://gist.github.com/shamil/62935d9b456a6f9877b5.

Test the UDP stack:

start the udpecho program and test it by sending messages from the host:

nc  -u 127.0.0.1 3000

Create an ext2 distribution image:

after build, in the dist folder:

# note that mntP must exist!
sudo sh build.sh sofa.img mntP/
# on sucess:
qemu-system-x86_64 -cpu Nehalem,-vme,+pdpe1gb,-xsave,-xsaveopt,-xsavec,-fsgsbase,-invpcid,enforce -device virtio-blk-pci,drive=drive0 -drive file=sofa.img,if=none,id=drive0 -serial stdio

Resources

sofa's People

Contributors

manu88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

channgo2203

sofa's Issues

Ninja Error

[119/323] Building C object util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c.obj
FAILED: util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c.obj
/usr/bin/ccache /usr/bin/gcc --sysroot=/home/ventrue/SEL4_Based/Sofa-master/build -I/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/include -I/home/ventrue/SEL4_Based/Sofa-master/projects/util_libs/liblwip/include -I/home/ventrue/SEL4_Based/Sofa-master/projects/util_libs/liblwip/include/lwip -I/home/ventrue/SEL4_Based/Sofa-master/build/musllibc/build-temp/stage/include -I/home/ventrue/SEL4_Based/Sofa-master/projects/Sofa/kernel_task/../../util_libs/liblwip/default_opts -m64 -D__KERNEL_64__ -march=nehalem -g -nostdinc -fno-pic -fno-pie -fno-stack-protector -fno-asynchronous-unwind-tables -ftls-model=local-exec -mtls-direct-seg-refs -m64 -D__KERNEL_64__ -march=nehalem -std=gnu11 -MD -MT util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c.obj -MF util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c.obj.d -o util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c.obj -c /home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c
/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/init.c:328:2: error: #error "lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - protocol headers). If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
328 | #error "lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - protocol headers). If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
| ^~~~~
[121/323] Building C object util_libs/liblwip/CMakeFiles/lwip.dir/home/ventrue/SEL4_Based/Sofa-master/projects/libliwip/src/core/ipv4/autoip.c.obj
ninja: build stopped: subcommand failed.

ninja build error

/home/wangjh/work/sofa/Sofa/projects/Sofa/libSofa/src/runtime.c: In function ‘RuntimeInit’:
/home/wangjh/work/sofa/Sofa/projects/Sofa/libSofa/src/runtime.c:96:8: error: ‘struct env’ has no member named ‘io_space’
96 | env.io_space = init_data->io_space;
| ^

What's wrong, any ideas?

add Process signal handling

  • messages to kernel_task might return a flag indicating that a signal is to be handled
  • an other thread (in the process) might run in // and exec sig handlers. It would be libSofa's job to start the sig handler thread at program startup

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.