You're welcome. Glad I could help.
From the list, most of those functions are implemented in libc, but
overridden in Noux. Please note that Noux provides a system call interface, while libc doesn't normally use or require that, but instead uses Genode's library function calls more directly. The execve function isn't implemented except in Noux AFAIK, but could possibly be implemented without a special environment.
First, if you haven't already, you should follow the instructions for creating a build directory, then build and run one of the many scenarios, e.g. run/demo.
For compiling a simple C application, you first need to have/pick a repos subdirectory. To start out, you could use one of the ones provided, e.g. repos/gems. You then need to create a subdirectory for your application somewhere inside repos/[your repo]/src, e.g. repos/gems/app/simple_c_app. After that, you need to write your C code and place it in a file in that directory. Then write a makefile named target.mk in the same directory with the C code. The makefile should look something like the following:
TARGET = simple_c_app SRC_C = main.c LIBS = base libc posix
When you have your source file(s) and makefile written, and your repo directory added to etc/build.conf in your build directory, you should be able to compile it using "make app/simple_c_app".
If you want to run your app, you need to write a run script. Creating a good run script for testing your app might be difficult, but you can start with something simple. You can start by copying repos/gems/run/pipe.run and modifying that.
For most of this, I'd recommend looking at the pipe example by Emery Hemingway, as found in repos/gems/src/app/pipe, and the aforementioned run script. Please note that the pipe example uses C-style C++. If you want to use pure C, be sure to use the variable SRC_C in the makefile rather than SRC_CC.
I hope this helps.
On Mon, Nov 19, 2018 at 8:42 AM Wouter van Oijen < wouter.van.oijen@technolution.nl> wrote:
Hi "Nobody III" ;-)
Thanks for your reaction! I have some follow-up questions though:
Port files are only necessary to download external code.
Okay, thanks for clearing that up :-)
I'm not sure about your second question. In particular, noux was
intended exclusively for ported software. At this point, its main purpose is to emulate the fork() system call. For software that doesn't require that, I'd recommend just using libc instead. Noux also isn't designed for code isolation within a single noux instance, so that might be an issue as well.
Hmm, now I'm a bit confused. I was under the impression that Noux was necessary for a lot more than just fork(), like things as file access and networking as well. For example, at https://genode.org/documentation/release-notes/11.02 it is mentioned that "without the right environment that presents the program the needed UNIX functionality, those [unmodified, recompiled] programs won't do much. This leads us to the Noux execution environment." And also "Currently the Noux execution environment implements the following system calls: getcwd, write, stat, fstat, fcntl, open, close, dirent, fchdir, read, and execve."
Are these functions now implemented in libc and can they work without Noux? In general, could I then recompile any Unix application that doesn't use fork(), and run it as a Genode component?
If not, what would I need to do compile a simple standard-C application that writes some data to a file and then reads from that file?
I do understand that the code isolation is limited to isolation between different Noux instances and not within the application itself. This is fine for our demo, but thanks for pointing it out.
There are plenty of code isolation examples available, and we can help
you more if you tell us more about what you're trying to do. Then we can give you much better advice on what libraries and RPC interfaces to use. For example, if you want to separate a login screen's GUI from the password verification and login code, I'd recommend using the Report interface and/or the File_system interface.
I'm currently trying to get existing software (specifically: a Mosquitto broker) to build and run in Genode, so I'm not using the Genode interfaces. However, since the Genode build flow is still a big mystery for me, I was first trying to build and run some basic examples... Hence the above questions.
Kind regards, Wouter
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users