Re: x86_64 kernel with i586 userland plus SDK?

Bruce Ashfield <bruce.ashfield@...>

On 12/17/18 7:25 AM, Richard Weinberger wrote:
[Resending with correct mail]
On Mon, Dec 17, 2018 at 11:34 AM <richard.purdie@...> wrote:

On Mon, 2018-12-17 at 11:26 +0100, Richard Weinberger wrote:
On Wed, Nov 28, 2018 at 9:42 AM Richard Purdie
<richard.purdie@...> wrote:
The system can definitely do it, its just not something we tend to
very often so its not entirely clear the best way to do it.

What may work is selecting the i586 tune from an x64-64 target

Copying qemux86-64.conf to qemux86-64-2.conf and changing it to
DEFAULTTUNE ?= "i586" did appear to start to build at least in a
test here...
I went this approach for now.
That way I get i586 userland and an SDK with both 32bit and 64bit
The SDK offers me multiple environment files to include.

What I don't understand right now is, how can i tell the kernel
that it has
to use the 64bit toolchain to build the kernel?

Any hints?
I think (but am going from memory) that the x86 toolchains can generate
64 and 32 bit code with the right compiler option. The kernel just
passes in the right options if configured to build as 64 bit even if it
has the 32 bit toolchain?
This was my hope, and this is also what I get when doing such builds manually.
Having a x86_64 gcc and building userspace with "-m32" appended.
Yocto seems to try a different approach.
When I use qemux86-64.conf with DEFAULTTUNE being "i586" it generates a 32bit
toolchain by default.
Build Configuration:
BB_VERSION = "1.38.0"
BUILD_SYS = "x86_64-linux"
TARGET_SYS = "i686-poky-linux"
MACHINE = "myqemux86-64"
DISTRO = "poky"
TUNE_FEATURES = "m32 i586"
What I need is a x86_64-poky-linux toolchain with -m32 set for everything except
kernel (and modules).
For the most part the kernel builds do not take any flags from the
outside, i.e. they are all generated based on the kernel build
structure, not what is calling the build. (unless you bury flags
into the definition of $(CC), etc, but I wouldn't recommend that.

So if you have a 64 bit capable toolchain, have a 64 bit configured
kernel (i.e. CONFIG_64BIT=y), are passing -m32 to usespace .. the
kernel really should build 64bit.

Have you tried that and are seeing the kernel still be built with the
32bit toolchain ?


Join to automatically receive all group messages.