[okl4-developer] adding a file in the image using weaver.xml

Gabi Voiculescu boy3dfx2 at yahoo.com
Sat Nov 1 02:41:20 EST 2008


Hello.

I have taken your example source, adapted it to compile and made a new iguana example.

If I try the following SConstruct with commenting the entries for video (or text
respectively) everything works. File paths are ok. I get the respective file added to my
image and in my example I can open it (as long as I add a prefix of 16 bytes to the file specifying the file size, before I initiate the buid, otherwise <fs/fs.h>: okl4_open() won't work).

My problem is the following SConstruct only allows me to add one file.  

Can you tell me what is the cause /if there is a way to fix this impediment of being able to add only one file to weaver.xml?

What part of the SConstruct code is responsible for creating the .linkaddress file? 


Thanks,
Gabi Voiculescu

The build output:
...............
[LINK] build2/iguana/bin/vserial

GNU ld version 2.15

Copyright 2002 Free Software Foundation, Inc.

This program is free software; you may redistribute it under the terms of

the GNU General Public License.  This program has absolutely no warranty.

[CC  ] build2/iguana/fileex_example/object/src/main.o

[VIRT] video/h263.linkaddress

Copy("video/h263", "/proj/profile/h263.3gp")

[VIRT] video/text.linkaddress

scons: *** [video/text.linkaddress] /proj/merge/trunk/video/text.linkaddress: No such file or directory

scons: building terminated because of errors.

make: *** [fileex] Error 2

My SConstruct

Import("*")
obj = env.KengeProgram("fileex_example",
                       weaver = env.WeaverIguanaProgram(),
                       LIBS=[ "c", "l4", "ll", "l4e", "mutex", "fs"])


#copy video file into okl4 directory and create object 'video' -gabi
video = env.Command("/proj/merge/trunk/video/h263", "/proj/profile/h263.3gp",  Copy('$TARGET', '$SOURCE') ) # FIXME: find out how to say root folder for the project instead of /proj/merge/trunk...for portability

#create another memsection including a text file...so we can wiev file inners
text  = env.Command("/proj/merge/trunk/video/text", "/proj/merge/trunk/text.txt", Copy('$TARGET', '$SOURCE') )

weaver = env.WeaverFile()

#weaver = env.WeaverIguanaProgram(),
env.set_weaver(video, weaver, None)
env.set_weaver(text, weaver, None)

#add memsection entry into my app
env.weaver(obj).add_memsection(video)
env.weaver(obj).add_memsection(text)

Return("obj")





--- On Tue, 10/28/08, Malcolm Purvis <malcolmp at ok-labs.com> wrote:
From: Malcolm Purvis <malcolmp at ok-labs.com>
Subject: Re: [okl4-developer] adding a file in the image using weaver.xml
To: "Gabi Voiculescu" <boy3dfx2 at yahoo.com>
Cc: developer at okl4.org
Date: Tuesday, October 28, 2008, 1:16 AM

>>>>> "Gabi" == Gabi Voiculescu
<boy3dfx2 at yahoo.com> writes:

Gabi> I want to be able to add a (a video) file in my
Gabi> binary image, in okl4 (not oklinux).

Hi Gabi,

What you want is to have the following XML:

<program name="prog" file="/path/to/program" >
    <memsection name="video" file="/path/to/video" />
</program>

This will put the video file in the image and your program can find the
location of the file with the code:

         env_memsection_base(iguana_getenv("VIDEO"));

As for making the build system generate this automatically, in 2.1.1 the
sequence would be something like:

---------------------------------------------------------------------------
video = env.Command() # Generate video file.
weaver = env.WeaverFile()
env.set_weaver(video, weaver, None)

prog = env.KengeProgram()
env.weaver(prog).add_memsection(video)
---------------------------------------------------------------------------

In 3.0, the build system support for generating XML data was redesigned
so the sequence would now be something like:

---------------------------------------------------------------------------
video = env.Command() # Generate video file.

prog = env.KengeProgram()
cell.add_program(prog)
cell.add_file(prog, video)
---------------------------------------------------------------------------

Malcolm

-- 
                    Malcolm Purvis <malcolmp at ok-labs.com>




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20081031/f33f0f7f/attachment.htm 


More information about the Developer mailing list