Thanks :) Naeem
-----Original Message----- From: Russell King - ARM Linux [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 4:07 PM To: Afzal, Naeem M Cc: [EMAIL PROTECTED] Subject: Re: size of zImage in arm linux On Thu, Apr 18, 2002 at 03:46:36PM -0700, Afzal, Naeem M wrote: > Actually I am trying to copy zImage from flash from one processor which has > flash to the SDRAM of other processor. SO, there are two scenerios, > 1. Booting from Flash > 2. Booting from Bootloader > for the first scenario, I was going to have two binaries (ROM/RAM), but > during compilation I wanted to figure out size of the second binaries so > that whole binary could be copied to the second processor. I'm not sure you need to work it out during compilation. Hopefully you'll be able to find what you need in this mail. 8) At the start of the compressed image binary (zImage) you'll find: +0 mov r0, r0 +4 mov r0, r0 +8 mov r0, r0 +c mov r0, r0 +10 mov r0, r0 +14 mov r0, r0 +18 mov r0, r0 +1c mov r0, r0 +20 b somewhere +24 .word 0x016f2818 @ Magic numbers to help the loader +28 .word start @ absolute load/run zImage address +2c .word _edata @ zImage end address so, given two zImage files concatenated together, you can check the word at 0x24 for the magic number, and then use the 'start' and '_edata' to work out the length. You can pick these out easily using: $ od -vt x4 -Ax arch/arm/boot/zImage |head -n3 000000 e1a00000 e1a00000 e1a00000 e1a00000 000010 e1a00000 e1a00000 e1a00000 e1a00000 000020 ea000002 016f2818 00000000 000bdd94 ^^^^^^^^^^^^^^^^^^^^^^^^^^ A special note while I'm describing this here. Kernels 2.5.7-rmk1 and previous contained a fixed-address decompressor. You had to run it at the address it was linked at. However, Kernels 2.5.7-rmk2 and later have a (mostly) relocatable decompressor. What this means is: - If you want to run the decompressor from flash, the decompressor must be linked at the address it is to run from and it is not relocatable inside the flash. Why? The decompressor is not able to make the necessary fixups to relocate the code to some other address due to the read-only nature of the memory containing it. In this case, 'start' will contain the address that it was linked to be run from. - If you didn't build to run from ROM or flash, 'start' will be zero. - If you copy the decompressor to RAM, even if it is built to be run from a fixed address within flash, it run from virtually anywhere in RAM. This means that the 'start' does not necessarily describe the address that the image has to be placed in RAM. However, (_edata - start) will always describe the length of the image. _______________________________________________ http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm http://www.arm.linux.org.uk/armlinux/mailinglists.php Please visit the above addresses for information on this list.
