Hello Le Bao,
I tried the graphical Genode on Codezero demo and I have developed the bare-metal applications on Codezero Hypervisor. So I think that it's good idea if I could boot two container. One container contient the graphical Genode and the other contient my bare-metal app, 'Hello Word'.
So I modified the liker script in base-codezero/src/platform/genode.ld so I could have two container when the script /tools/create_builddir is executed.
Admittedly, I have never played with multiple containers on Codezero. So you are walking on uncharted ground here. One problem that I see is that the Genode run environment configures the Codezero kernel with the default configuration provided at
base-codezero/config/vpb926.cml
This configuration sets up only one container. So the simple 'make run/demo' procedure will result in the use of only a single container. For using multiple containers, you will most likely need to do the configuration and integration work the Codezero way and manually copy the result of the Genode build ('main.elf' and 'modules.elf') into the Codezero container.
I retried the command 'made run/demo'I have the error :
...
scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
My patch only covered the parts of Codezero needed Genode. Here SCons complains about 'conts/baremetal/hello_world/SConstruct', which is not covered in the patch. Replacing 'build_dir' by 'variant_dir' in this file should fix the problem.
And I saw that Code Zero have success to build the final.elf image. So I tried boot the image with qemu-system-arm
VM area at [00001000,50000000) :phys_alloc: Allocator 150660 dump:
...
l4_thread_control returned -3, spid=1
create_thread returned -1 core started local thread "entrypoint" with ID -1 cont1: Hello world from hello_world1!
This does not look bad at all for a start! :-) Genode's core is showing its first life sign (those messages about the allocators are printed by core). Now, something goes wrong when Genode's core tries to spawn the first thread. The problem happens within the 'create_thread' function at 'base-codezero/src/core/thread_start.cc'. We should figure out what the kernel tries to tell us with the error code -3.
A look in the kernel code in the function 'sys_thread_control' at 'src/api/thread.c' reveals that the problem is somehow related to the 'tcb_find' operation (the ESRCH error code is -3). This function operates on the IDs supplied as argument to the syscall. In the 'create_thread' function, the IDs struct is set to { 1, space_no, TASK_ID_INVALID }. Maybe these arguments are wrong in the presence of more than one container? To track down the problem, you could try to find out why exactly 'tcb_find' is failing.
Good luck! Norman