Skip to contentSkip to conversation

Questions on adding a new type to mkimage

U-Boot Charles Manning 2 participants 2 messages Feb 20, 2014 – Mar 9, 2014

lore
Share & tools
lore
#0 lore raw

I am in the throes of extending mkimage to add socfpga support. This is my first time in mkimage, so please forgive me being on a learning curve.

It seems that the most "normal" path for mkimage signers is to append some sort of header to the front of the image
ie the flow is

write header out
copy image data with copy_file
call set_header

The socfpga preloader needs something a bit different. It does not add a header, but instead adds a tail (CRC+padding) and mashes some bytes into a known place in the image.

Unfortunately the mkimage framework does not seem to provide an "add tail" function which is really what is needed here.

The only way I can see to extend the size of the image, using the normal mkimage workflow would be to do something like this:

*Provide vrec_header which adds a fake header of 64k - input_size.
* Allow copy_file to then do the copy step.
* I now have a 64k "image" which is 64k-size 0 bytes, followed by the actual input_data.
* When set_header is called, shift the actual input data to where it should be, add the CRC and fix up the padding.

This seems needlessly contrived to work with the framework.

Or the alternative might be just to treat this as a special case....

Thoughts/opinions???

Thanks

Charles

#1 lore raw

Hi Charles,

Quoted 22 lines · Charles Manning

I am in the throes of extending mkimage to add socfpga support. This is my first time in mkimage, so please forgive me being on a learning curve.

It seems that the most "normal" path for mkimage signers is to append some sort of header to the front of the image
ie the flow is

write header out
copy image data with copy_file
call set_header

The socfpga preloader needs something a bit different. It does not add a header, but instead adds a tail (CRC+padding) and mashes some bytes into a known place in the image.

Unfortunately the mkimage framework does not seem to provide an "add tail" function which is really what is needed here.

The only way I can see to extend the size of the image, using the normal mkimage workflow would be to do something like this:

Quoted 8 lines

*Provide vrec_header which adds a fake header of 64k - input_size.
* Allow copy_file to then do the copy step.
* I now have a 64k "image" which is 64k-size 0 bytes, followed by the actual input_data.
* When set_header is called, shift the actual input data to where it should be, add the CRC and fix up the padding.

This seems needlessly contrived to work with the framework.

There is the rather off fflag_handle() function - could you make use of that?

Quoted 4 lines

Or the alternative might be just to treat this as a special case....

Thoughts/opinions???

I don't see a problem with adding to the framework if needed.

Regards,
Simon