can we include dosfs?

Ed Sutter edsutterjr at
Mon Jun 20 23:30:15 UTC 2016

> On 21/06/2016 01:42, Ben Gras wrote:
>> A question I have is how we should load ELF files. From some cursory
>> searching it seems there is an ELF loader which only works on a TFS
>> filesystem. Is that right? If so, I wonder which is less work - making
>> a TFS filesystem from the host or adapting that code to also be usable
>> on a FAT FS.
> An ELF loader for any file system would be useful. If it could be a single pass load that would be nice and if this is not possible maybe a load into RAM then parse from there.
> Chris
Here's the code, yanked out of tfsloader.c from uMon 1.19 (attached).
I stripped out all the unnecessary stuff.  I didn't even compile it so, be
prepared for errors.  Should be close though.

Since this is based on TFS, it assumes that the incoming data is just one big binary image.
Ben I know I suggested to do this in one pass, but probably would be best to initially do it
in two just to make sure it works as expected....

2-pass version:
   a) pull the entire image off of DOSFS
   b) pass that image to the elf loader

1-pass version:
   Build the block read interface into the loader so that you can read the section headers while
   pulling the data off the sd card (or whatever); and do the load in one step.

The 1-pass version will be a bit more work, but it will eliminate the concern of putting the
initial (first pass) image in memory that will be loaded into. Plus, once it works it should
be quicker.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf.h
Type: text/x-chdr
Size: 2517 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elfloader.c
Type: text/x-csrc
Size: 3765 bytes
Desc: not available
URL: <>

More information about the umon-devel mailing list