mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Wrong barebox_image_size value
@ 2013-09-26 20:30 Rostislav Lisovy
  2013-09-27  6:54 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-09-27  8:05 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Rostislav Lisovy @ 2013-09-26 20:30 UTC (permalink / raw)
  To: barebox

Dear barebox developers and users;
I am compiling barebox for freescale-imx53-smd board. My issue is,
that the image does not contain the correct size record.
The "bootloader size" needed by the flashing tool is initialized in
freescale-mx53-smd/flash_header.c, in structure flash_header,
field .boot_data.size.
Formerly there used to be a hardcoded value 0x40000, nowadays we use
DCD_BAREBOX_SIZE which expands into (barebox_image_size + 4095), where
"barebox_image_size" has real size computed by the linker.
When the value .boot_data.size is filled by hand (as 0x40000), correct
value is stored in the barebox image.
Proof: hexdump -s 0x24 -n 4 barebox-flash-image
0000024 0000 0004

however if .boot_data.size = DCD_BAREBOX_SIZE,
$ hexdump -s 0x24 -n 4 barebox-flash-image
0000024 0fff 0000
where this 0xfff is the "+4095" added to round the value. (I am pretty
sure the offset into the image used by hexdump is correct).

The barebox version I am using most recent git, branch master.
The compiler (maybe here is the point of failure) is
arm-cortex_a8-linux-gnueabi-gcc (crosstool-NG hg+default-86a8d1d467c8)
4.4.6.

I will appreciate any help;
Rostislav Lisovy


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Wrong barebox_image_size value
  2013-09-26 20:30 Wrong barebox_image_size value Rostislav Lisovy
@ 2013-09-27  6:54 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-09-29 12:26   ` Rostislav Lisovy
  2013-09-27  8:05 ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-09-27  6:54 UTC (permalink / raw)
  To: Rostislav Lisovy; +Cc: barebox

On 22:30 Thu 26 Sep     , Rostislav Lisovy wrote:
> Dear barebox developers and users;
> I am compiling barebox for freescale-imx53-smd board. My issue is,
> that the image does not contain the correct size record.
> The "bootloader size" needed by the flashing tool is initialized in
> freescale-mx53-smd/flash_header.c, in structure flash_header,
> field .boot_data.size.
> Formerly there used to be a hardcoded value 0x40000, nowadays we use
> DCD_BAREBOX_SIZE which expands into (barebox_image_size + 4095), where
> "barebox_image_size" has real size computed by the linker.
> When the value .boot_data.size is filled by hand (as 0x40000), correct
> value is stored in the barebox image.
> Proof: hexdump -s 0x24 -n 4 barebox-flash-image
> 0000024 0000 0004
> 
> however if .boot_data.size = DCD_BAREBOX_SIZE,
> $ hexdump -s 0x24 -n 4 barebox-flash-image
> 0000024 0fff 0000
> where this 0xfff is the "+4095" added to round the value. (I am pretty
> sure the offset into the image used by hexdump is correct).
> 
> The barebox version I am using most recent git, branch master.
> The compiler (maybe here is the point of failure) is
> arm-cortex_a8-linux-gnueabi-gcc (crosstool-NG hg+default-86a8d1d467c8)
> 4.4.6.

do you compile a relocation binary?

if yes the barebox size is 0 for the linker script

I send a patch for the -next to start to fix the issue but I think we need
other fixup

Best Regards,
J.
> 
> I will appreciate any help;
> Rostislav Lisovy
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Wrong barebox_image_size value
  2013-09-26 20:30 Wrong barebox_image_size value Rostislav Lisovy
  2013-09-27  6:54 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-09-27  8:05 ` Sascha Hauer
  2013-09-29 12:30   ` Rostislav Lisovy
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2013-09-27  8:05 UTC (permalink / raw)
  To: Rostislav Lisovy; +Cc: barebox

Hi Rostislav,

On Thu, Sep 26, 2013 at 10:30:29PM +0200, Rostislav Lisovy wrote:
> Dear barebox developers and users;
> I am compiling barebox for freescale-imx53-smd board. My issue is,
> that the image does not contain the correct size record.
> The "bootloader size" needed by the flashing tool is initialized in
> freescale-mx53-smd/flash_header.c, in structure flash_header,
> field .boot_data.size.
> Formerly there used to be a hardcoded value 0x40000, nowadays we use
> DCD_BAREBOX_SIZE which expands into (barebox_image_size + 4095), where
> "barebox_image_size" has real size computed by the linker.
> When the value .boot_data.size is filled by hand (as 0x40000), correct
> value is stored in the barebox image.
> Proof: hexdump -s 0x24 -n 4 barebox-flash-image
> 0000024 0000 0004
> 
> however if .boot_data.size = DCD_BAREBOX_SIZE,
> $ hexdump -s 0x24 -n 4 barebox-flash-image
> 0000024 0fff 0000
> where this 0xfff is the "+4095" added to round the value. (I am pretty
> sure the offset into the image used by hexdump is correct).

Probably you are not building the defconfig, right? Compiling the
defconfig gives me the correct value and it's at offset 0x424 in the
image, not at 0x24.
Maybe you are compiling a relocatable image as Jean-Christophe
mentioned, then you would see this problem.

> 
> The barebox version I am using most recent git, branch master.
> The compiler (maybe here is the point of failure) is
> arm-cortex_a8-linux-gnueabi-gcc (crosstool-NG hg+default-86a8d1d467c8)
> 4.4.6.

That should be ok.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Wrong barebox_image_size value
  2013-09-27  6:54 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-09-29 12:26   ` Rostislav Lisovy
  0 siblings, 0 replies; 5+ messages in thread
From: Rostislav Lisovy @ 2013-09-29 12:26 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Thank you for your help;
The problem is really the relocatable binary.
I did not use freescale_mx53_smd_defconfig because I wanted to do it
"may way" (which is wrong in this case).
If I unset config options RELOCATABLE and PBL_RELOCATABLE (or unset
PBL_IMAGE), the proper size value is written to the image.

Best regards;
Rostislav Lisovy


On Fri, 2013-09-27 at 08:54 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote: 
> On 22:30 Thu 26 Sep     , Rostislav Lisovy wrote:
> > Dear barebox developers and users;
> > I am compiling barebox for freescale-imx53-smd board. My issue is,
> > that the image does not contain the correct size record.
> > The "bootloader size" needed by the flashing tool is initialized in
> > freescale-mx53-smd/flash_header.c, in structure flash_header,
> > field .boot_data.size.
> > Formerly there used to be a hardcoded value 0x40000, nowadays we use
> > DCD_BAREBOX_SIZE which expands into (barebox_image_size + 4095), where
> > "barebox_image_size" has real size computed by the linker.
> > When the value .boot_data.size is filled by hand (as 0x40000), correct
> > value is stored in the barebox image.
> > Proof: hexdump -s 0x24 -n 4 barebox-flash-image
> > 0000024 0000 0004
> > 
> > however if .boot_data.size = DCD_BAREBOX_SIZE,
> > $ hexdump -s 0x24 -n 4 barebox-flash-image
> > 0000024 0fff 0000
> > where this 0xfff is the "+4095" added to round the value. (I am pretty
> > sure the offset into the image used by hexdump is correct).
> > 
> > The barebox version I am using most recent git, branch master.
> > The compiler (maybe here is the point of failure) is
> > arm-cortex_a8-linux-gnueabi-gcc (crosstool-NG hg+default-86a8d1d467c8)
> > 4.4.6.
> 
> do you compile a relocation binary?
> 
> if yes the barebox size is 0 for the linker script
> 
> I send a patch for the -next to start to fix the issue but I think we need
> other fixup
> 
> Best Regards,
> J.
> > 
> > I will appreciate any help;
> > Rostislav Lisovy
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Wrong barebox_image_size value
  2013-09-27  8:05 ` Sascha Hauer
@ 2013-09-29 12:30   ` Rostislav Lisovy
  0 siblings, 0 replies; 5+ messages in thread
From: Rostislav Lisovy @ 2013-09-29 12:30 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hello Sascha;
You are right; The problem is I did not use the defconfig, thus building
relocatable binary. After using freescale_mx53_smd_defconfig, proper
size value is stored in the image.
Thank you for the help;

Rostislav Lisovy


On Fri, 2013-09-27 at 10:05 +0200, Sascha Hauer wrote: 
> Hi Rostislav,
> 
> On Thu, Sep 26, 2013 at 10:30:29PM +0200, Rostislav Lisovy wrote:
> > Dear barebox developers and users;
> > I am compiling barebox for freescale-imx53-smd board. My issue is,
> > that the image does not contain the correct size record.
> > The "bootloader size" needed by the flashing tool is initialized in
> > freescale-mx53-smd/flash_header.c, in structure flash_header,
> > field .boot_data.size.
> > Formerly there used to be a hardcoded value 0x40000, nowadays we use
> > DCD_BAREBOX_SIZE which expands into (barebox_image_size + 4095), where
> > "barebox_image_size" has real size computed by the linker.
> > When the value .boot_data.size is filled by hand (as 0x40000), correct
> > value is stored in the barebox image.
> > Proof: hexdump -s 0x24 -n 4 barebox-flash-image
> > 0000024 0000 0004
> > 
> > however if .boot_data.size = DCD_BAREBOX_SIZE,
> > $ hexdump -s 0x24 -n 4 barebox-flash-image
> > 0000024 0fff 0000
> > where this 0xfff is the "+4095" added to round the value. (I am pretty
> > sure the offset into the image used by hexdump is correct).
> 
> Probably you are not building the defconfig, right? Compiling the
> defconfig gives me the correct value and it's at offset 0x424 in the
> image, not at 0x24.
> Maybe you are compiling a relocatable image as Jean-Christophe
> mentioned, then you would see this problem.
> 
> > 
> > The barebox version I am using most recent git, branch master.
> > The compiler (maybe here is the point of failure) is
> > arm-cortex_a8-linux-gnueabi-gcc (crosstool-NG hg+default-86a8d1d467c8)
> > 4.4.6.
> 
> That should be ok.
> 
> Sascha
> 



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-29 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-26 20:30 Wrong barebox_image_size value Rostislav Lisovy
2013-09-27  6:54 ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-29 12:26   ` Rostislav Lisovy
2013-09-27  8:05 ` Sascha Hauer
2013-09-29 12:30   ` Rostislav Lisovy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox