Ok, so the problem was that I missed to link libm as well. I didn't noticed libm was needed. Now it works and linux boots successfully.

But I still have some messages during the boot process which weren't there before and is probably some to do with my configuration.
 This is the output:

## Booting kernel from Legacy Image at 70400000 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    8596638 Bytes = 8.2 MiB
   Load Address: 70010000
   Entry Point:  70010000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

kernel initialized
Genode 16.02
int main(): --- create local services ---
int main(): --- start init ---
int main(): transferred 241 MB to init
int main(): --- init created, waiting for exit condition ---
[init] parent provides
[init]   service "ROM"
[init]   service "RAM"
[init]   service "IRQ"
[init]   service "IO_MEM"
[init]   service "IO_PORT"
[init]   service "CAP"
[init]   service "PD"
[init]   service "RM"
[init]   service "CPU"
[init]   service "LOG"
[init]   service "SIGNAL"
[init]   service "VM"
[init] child "tz_vmm"
[init]   RAM quota:  10203136
[init]   ELF binary: tz_vmm
[init]   priority:   0
[init -> tz_vmm] Could not open ROM session for module "config"
[init -> tz_vmm] Could not obtain config file
[init -> tz_vmm] no VFS configured
[init -> tz_vmm] Start virtual machine ...

How do I configure VFS?

Thanks in advance! Tiago

2016-06-01 14:11 GMT+01:00 Tiago Brito <tb.genode@...9...>:
I actually solved this, it looks like the image is to big after adding the binaries. So the solution was setting the bootload to load the image to a higher address:
    before - ext2load mmc 0:1 0x70200000 uImage; bootm 0x70200000
    after - ext2load mmc 0:1 0x70400000 uImage; bootm 0x70400000

But although this is solved it looks like the example still cannot run. This is the output:

## Booting kernel from Legacy Image at 70400000 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    8523403 Bytes = 8.1 MiB
   Load Address: 70010000
   Entry Point:  70010000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

kernel initialized
Genode 16.02
int main(): --- create local services ---
int main(): --- start init ---
int main(): transferred 241 MB to init
int main(): --- init created, waiting for exit condition ---
[init] parent provides
[init]   service "ROM"
[init]   service "RAM"
[init]   service "IRQ"
[init]   service "IO_MEM"
[init]   service "IO_PORT"
[init]   service "CAP"
[init]   service "PD"
[init]   service "RM"
[init]   service "CPU"
[init]   service "LOG"
[init]   service "SIGNAL"
[init]   service "VM"
[init] child "tz_vmm"
[init]   RAM quota:  10203136
[init]   ELF binary: tz_vmm
[init]   priority:   0
[init -> tz_vmm] Could not open ROM session for module "config"
[init -> tz_vmm] Could not obtain config file
[init -> tz_vmm] Could not open ROM session for module "libm.lib.so"
[init -> tz_vmm] abort called - thread: 'main'
[init] virtual void Genode::Child_policy::exit(int): child "tz_vmm" exited with exit value 1

It looks like the output mentions libm, do I need math lib in order to run libpng?
I don't see libm inside $(GENODE_DIR)/repos/libports/ports

Thanks, Tiago

2016-06-01 12:50 GMT+01:00 Tiago Brito <tb.genode@...9...>:


2016-06-01 12:31 GMT+01:00 Stefan Kalkowski <stefan.kalkowski@...1...>:
Hello Tiago,

On 06/01/2016 01:07 PM, Tiago Brito wrote:
> Hi, I've been trying to use libpng inside the secure world of i.MX53 QSB
> TrustZone aware TZ_VMM example.
>
> I want to receive an image from the normal world (running Linux) and do
> some process the image in some way inside the secure world.
>
> I understand the flow of genode and tz_vmm in particular and there are some
> examples on how to communicate data between the normal and secure world, so
> that's not my problem right now. My problem is that I cannot run tz_vmm
> after adding libpng as a lib.
>
> In order to use libpng inside tz_vmm I did the following:
>     1) in $(BUILDDIR)/etc/build.conf uncommented this line
>         REPOSITORIES += $(GENODE_DIR)/repos/libports
>
>     2) inside $(GENODE_DIR)/repos/libports I did:
>         make prepare PKG="libc zlib libpng"
>
>     3) inside $(BUILDDIR)/repos/os/src/server/tz_vmm/spec/imx53 I added the
> following to target.inc
>         LIBS     += libc
>         LIBS     += zlib
>         LIBS     += libpng
>
>     4) then I added #include <png.h> inside main.cc
>
>     5) finally inside $(BUILDDIR) I did
>         make run/tz_vmm
>
> All these steps compiled fine, but when I run this on my board the
> following message comes up:
>
> ## Booting kernel from Legacy Image at 70200000 ...
>    Image Name:
>    Image Type:   ARM Linux Kernel Image (gzip compressed)
>    Data Size:    7888432 Bytes = 7.5 MiB
>    Load Address: 70010000
>    Entry Point:  70010000
>    Verifying Checksum ... OK
>    Uncompressing Kernel Image ... OK
>
> Starting kernel ...
>
> kernel initialized
> Genode 16.02
> int main(): --- create local services ---
> int main(): --- start init ---
> int main(): transferred 242 MB to init
> int main(): --- init created, waiting for exit condition ---
> [init] Could not open ROM session for module "ld.lib.so"
> [init] parent provides
> [init]   service "ROM"
> [init]   service "RAM"
> [init]   service "IRQ"
> [init]   service "IO_MEM"
> [init]   service "IO_PORT"
> [init]   service "CAP"
> [init]   service "PD"
> [init]   service "RM"
> [init]   service "CPU"
> [init]   service "LOG"
> [init]   service "SIGNAL"
> [init]   service "VM"
> [init] Dynamically linked file found, but no dynamic linker binary present
> [init] unknown exception?
> [init] child "tz_vmm"
> [init]   RAM quota:  10203136
> [init]   ELF binary: tz_vmm
> [init]   priority:   0
>
> What have I done wrong? It seems I need to add a binary somewhere, but I
> don't know where. Do I need to compile anything else in order to libpng to
> be usable inside genode?
>
> Thanks in advance!

You missed to add the dynamic linker itself to the files to be loaded.
It is called ld.lib.so and can be found in your build-directory under
bin/. PLease also add all other *.lib.so files to your bootloader
configuration resp. the run-script.

Thanks Stefan, I did what you say and it compiled without any problem, but I still cannot run the example.
I changed the tz_vmm run script like so:
    set boot_modules { core init ld.lib.so libc.lib.so zlib.lib.so libpng.lib.so tz_vmm linux }

It now fails even before launching Genode. This is the output:

## Booting kernel from Legacy Image at 70200000 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    8523403 Bytes = 8.1 MiB
   Load Address: 70010000
   Entry Point:  70010000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... Error: inflate() returned -3
gzip compressed: uncompress error -1
Must RESET board to recover
resetting ...


Does this mean the image is corrupted in any way and thus it cannot be uncompressed?

Thanks, Tiago


Regards
Stefan