compiling 2.6.37 kernel in THUMB2 mode

Dave Martin dave.martin at linaro.org
Fri Feb 18 04:26:42 EST 2011


On Thu, Feb 17, 2011 at 5:30 PM,  <vb at vsbe.com> wrote:

[...]

>
> Hi Dave,
>
> thank you again for the hints.
>
> I am trying to build an image for a Tegra2 based platform, it s a
> 2.6.37 based tree with a fair amount of private additions (to be
> upstreamed at some point), which does now come up and run in ARM mode.
> I am trying to see if it can run in Thumb mode.
>
> It looks like certain files need to be compiled in ARM mode even when
> THUMB2_KERNEL is enabled, but I don't see this happening in 2.6.37, I
> was wondering how this is done in your tree.

Generally, this can be kept to a minimum.

On OMAP, the low-level PM code calls into firmware which cannot cope
with interworking between ARM and Thumb.  The PM code on the ARM side
could be made to work with this even if it is mostly built in Thumb,
but that would be complex and not really worth the pain.

You may have this problem if you're trying to communicate with
firmware, but it's best if you port everything else to be buildable in
Thumb-2: the primary reason is that for backwards compatibility
reasons, much of the assembler code in the kernel doesn't support
ARM/Thumb interworking either.  This means that mixing ARM and Thumb
code in the kernel will lead to problems unless you're careful.

>
> I tried building an OMAP image, but it does not build in Thumb mode,
> and Thumb can't even be enabled for it because CPU_V6 configured in.
> So I was wondering if this tree has some other working config which
> does use Thumb mode. I'll look at the config files you mentioned, but
> any suggestions/warnings about converting a kernel to work in Thumb
> mode are welcome,

Assuming you started with omap2plus_defconfig, you need to remove
CONFIG_ARCH_OMAP2 from the config.  It's not possible to incorporate
support for omap2 with CONFIG_THUMB2_KERNEL enabled because ARMv6
doesn't support Thumb-2.

Here's the config I was using:
http://people.linaro.org/~dmart/arm_omap-thumb2+v2_config (based on
the linaro config-- note: you don't need to build all the modules!
Just make zImage or uImage)

Hope that helps!
---Dave



More information about the linux-arm-kernel mailing list