[PATCH 7/7] ARM: Thumb-2: Restore sensible zImage header layout for CONFIG_THUMB2_KERNEL

Nicolas Pitre nicolas.pitre at linaro.org
Tue Nov 16 15:28:44 EST 2010


On Tue, 16 Nov 2010, Russell King - ARM Linux wrote:

> On Tue, Nov 16, 2010 at 01:14:37PM +0000, Dave Martin wrote:
> > This gets messed up with with CONFIG_THUMB2_KERNEL:
> > 
> >     * The NOPs making up the vector table become halfword-
> >       sized.
> 
> Doesn't matter.
> 
> >     * The magic number and absolute entry point occur too early
> >       and become misaligned.
> 
> Not used anymore - it's practically zero (and unused) for most cases
> now anyway.

I think it is worth preserving this layout regardless.  First of all 
this is really cheap to do, and if whatever bootloader out there is 
relying on it, at least the magic number, then better not break it 
freely.

> >     * The absolute entry point fails to indicate that the entry
> >       point is Thumb code, which will cause incorrect execution
> >       if the bootloader uses this to enter the kernel.
> 
> And as such...

On the other hand... we could simply decide _not_ to fix it on the 
basis that this will create a different header for a pure Thumb2 
image.

Maybe it is a better idea to preserve the current header as is with the 
ARM mode nops and perform the switch to Thumb mode using the branch 
instruction after those 8 nops.  This way the kernel image format will 
remain compatible with existing bootloaders without a need for 
bootloaders to know if the image is ARM or Thumb mode.


Nicolas



More information about the linux-arm-kernel mailing list