Skip to contentSkip to conversation

hello world application

U-Boot-Users Jhavk 3 participants 4 messages Oct 31, 2004

lore
Share & tools
lore

Jhavk

author
#0 lore raw

I want to make gzipped hello_world application and later execute it using bootm command.

I figured that mkimage is the utility for making
compressed STANDALONE image.

But it needs an option mkimage -d <datafile>

Now what is this datafile? Is it hello_world or
hello_world.bin or hello_world.srec
I tried all 3, but they give different sizes of
gzipped image. So i am confused.

My target architecture is ARM.

Thanks.

__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

#1 lore raw

Hi Jhavk,

Quoted 6 lines

I want to make gzipped hello_world application and later execute it using bootm command.

I figured that mkimage is the utility for making
compressed STANDALONE image.

Quoted 6 lines

But it needs an option mkimage -d <datafile>

Now what is this datafile? Is it hello_world or
hello_world.bin or hello_world.srec
I tried all 3, but they give different sizes of
gzipped image. So i am confused.

Right - the differences are:

hello_world - ELF file generated by compiler. You need an ELF loader for this if you want to execute it (bootm does not contain ELF code). This is usually used for cross debugging as the file to feed to the debugger.

hello_world.srec - MotorolaS-Record file (ascii format) only used for serial download as it can encode binary files in 7 bit. One can think of this as kind of like BASE64 with some address meta information added.

hello_world.bin - This is generated from the ELF file and actually contains a memory dump without any meta information - so you have to ensure that it is being loaded to the correct address. This is the file you should use as the datafile. Be sure to provide the mkimage tool with the correct load and entry points (although the entry point can be overriden with the second argument of bootm for standalone applications). Also be aware that the environment variable "autostart" determines whether a standalone application started with bootm really starts. This is a neat trick for "misusing" the standalone application format to compress simple datafiles needed on the target.

Having this in mind, the different sizes after compression should now be obvious ;)

Cheers
Detlev

Signature · 3 lines
Deutsches Grundgesetz Artikel 14 Absatz 2:
Eigentum verpflichtet. Sein Gebrauch soll zugleich dem Wohle der
Allgemeinheit dienen.
#3 lore raw
In reply to Jhavk
Quoted 2 lines · In message <[email protected]> you wrote:

I want to make gzipped hello_world application and later execute it using bootm command.

Please use correct terms. The "hello_world" is so small that compressing it makes no sense. Maybe you are talking about some other standalone application, which is bigger?

Quoted 7 lines

I figured that mkimage is the utility for making
compressed STANDALONE image.

But it needs an option mkimage -d <datafile>

Now what is this datafile? Is it hello_world or
hello_world.bin or hello_world.srec

It is none of them. You mentioned that you want to build a compressed image, so you must compress the fiule first, and none of hello_world nor hello_world.bin nor hello_world.srec is compressed. Also, ask
yoruself if the processor will be able to find executable
instructions in a S-Record file, or in a ELF header. it will not.

You should run gzip on hello_world.bin and use the resulting compressed binary image as input.

Quoted 2 lines

I tried all 3, but they give different sizes of
gzipped image. So i am confused.

I would be confused if it was different. Since mkimage always adds a 64 byte header, the resulting file sizes MUST be different when you use files with different sizes as input.

Best regards,

Wolfgang Denk

Signature · 4 lines
See us @ Embedded/Electronica Munich, Nov 09 - 12, Hall A.6 Booth 513
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
While most peoples' opinions change, the conviction of their correct-
ness never does.
#2 lore raw
In reply to Detlev Zundel
Quoted 5 lines · In message <[email protected]> you wrote:

hello_world.bin - This is generated from the ELF file and actually contains a memory dump without any meta information - so you have to ensure that it is being loaded to the correct address. This is the file you should use as the datafile. Be sure to provide the mkimage

Not quite. Remember that he wanted to use a _compressed_ image.

Quoted 2 lines

Having this in mind, the different sizes after compression should now be obvious ;)

I bet he never compressed anything.

Best regards,

Wolfgang Denk

Signature · 6 lines
See us @ Embedded/Electronica Munich, Nov 09 - 12, Hall A.6 Booth 513
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
IMPORTANT NOTICE TO PURCHASERS: The Entire Physical Universe,  Inclu-
ding  This Product, May One Day Collapse Back into an Infinitesimally
Small Space. Should  Another  Universe  Subsequently  Re-emerge,  the
Existence of This Product in That Universe Cannot Be Guaranteed.