[okl4-developer] adding a file in the image using weaver.xml
Geoffrey Lee
glee at ok-labs.com
Mon Nov 3 15:58:41 EST 2008
On Fri, Oct 31, 2008 at 11:04:39AM -0700, Gabi Voiculescu wrote:
> Turns out it worked once I rearanged the code in SConscript.
>
> If you could tell me what variable to use to specify the path to the okl4 directory (instead of /proj/merge/trunk in my case) it would help me on portability.
>
Gabi - you can use the hash character (#) to specify the path of
the top-level source. For an example of how you can use this
please take a look at the SConscript of libc in libs/c.
>
> Thanks,
> Gabi Voiculescu
-gl
>
> Import("*")
> obj = env.KengeProgram("fileex_example",
> weaver = env.WeaverIguanaProgram(),
> LIBS=[ "c", "l4", "ll", "l4e", "iguana", "mutex", "fs"])
>
> #list of files to import in the image
> video = env.Command("/proj/merge/trunk/video/h263", "/proj/merge/trunk/video/converted/h263.3gp", Copy('$TARGET', '$SOURCE') ) # FIXME: find out how to specify root folder for project instead of /proj/merge/trunk
> text = env.Command("/proj/merge/trunk/video/text", "/proj/merge/trunk/video/converted/text.txt", Copy('$TARGET', '$SOURCE') )
>
> weaver = env.WeaverFile()
> env.set_weaver(video,weaver,None)
> env.weaver(obj).add_memsection(video)
>
> weaver = env.WeaverFile()
> env.set_weaver(text,weaver,None)
> env.weaver(obj).add_memsection(text)
>
>
> #this is needed even if I don't see it's purpose
> env.expect_test_data = [("File Test Example works!", None)]
>
> Return("obj")
>
>
>
>
>
> --- On Fri, 10/31/08, Gabi Voiculescu <boy3dfx2 at yahoo.com> wrote:
> From: Gabi Voiculescu <boy3dfx2 at yahoo.com>
> Subject: Re: [okl4-developer] adding a file in the image using weaver.xml
> To: developer at okl4.org
> Date: Friday, October 31, 2008, 5:41 PM
>
> 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>
>
>
>
>
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
>
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
--
More information about the Developer
mailing list