[U-Boot] [PATCH] tools: mkimage can read input on /dev/stdin

Julien Castets castets.j at gmail.com
Sat Sep 27 19:28:38 CEST 2014


On Sat, Sep 27, 2014 at 3:25 PM, Wolfgang Denk <wd at denx.de> wrote:
> Sorry, but I don't understand this.   Where are the image(s) coming
> from, then?  Who or what is feeding the pipe?

Sorry, I wrote quickly.

In my situation:
- I have a Python implementation of a TFTP server
- when the file named "uboot.bootscript" is requested, a template is
rendered. Currently, this template is stored in a temporary file
- A new process is created to call mkimage, with the temporary file as
input and another temporary file as output (mkimage -A arm -O linux -a
0 -e 0 -T script -C none -n 'comment' -d tmp_input tmp_output)
- Finally, the output file content is returned to the client

Instead of creating two temporary file, two pipes could be used (-d
/dev/stdin /dev/stdout), which, in my case, would be more efficient
(even if I don't really have performance issues).

>> > What is the size and performance impact of the suggested change for
>> > typical use cases?
>>
>> None. The behaviour is exactly the same.
>
> I don't believe you.  Sizes rare certainly not identical, and neither
> is the performance.  Did you do any real measurements?

mmap is useful when you need to make random access in a file, or to
optimize memory: when a file is mmapped, the kernel only loads the
parts of the file that are accessed. In the case of mkimage, the file
is read sequentially (meaning all of it will be retrieved from the
disk).

-- 
Julien Castets
+33 (0)6.85.20.10.03


More information about the U-Boot mailing list