On Thu, Jul 13, 2017 at 05:29:08PM +0200, Cliff McDiarmid wrote:
> Hi
> 
> Sorry first mail in wrong format
> 
> 
> I'm running GCC-6.1 on an LFS system.   How 'easy' would it be to recompile 
> GCC for multilib?
>  
> Essentially need to compile a 64bit kernel using a 32bit system so I  need 
> multilib gcc and gcc+
>  
> thanks
>  
> Cliff

Cliff, I'm assuming you only need a 64-bit kernel, if I'm wrong then
disregard this.

Off the top of my head, I think all you need to do to compile a
kernel is a cross-compiled binutils and gcc : in other words, the
first two steps of LFS (but *really* cross-compiling, so you
wouldn't need the -lfs- part of the target, just use the normal
(x86_64-pc-linux-gnu- on gcc-6.1, I think).

Then cross-compile the kernel - there is an environment variable for
a cross-compiler prefix, something like CROSS_COMPILE=.  I forget
how you tell it to let you choose the right kernel architecture, but
for x86 I guess you can just start by choosing 64-bit in the menu.
Not sure how to choose the x86_64 defconfig as an initial target,
but I'm sure google will know (it's essentially just regular
cross-compiling).

But most of the kernel config options will be very different, you
can't just start from an i686 config.

If it succeeds, uname will probably report it as x86_64 - that might
give issues with an i686-pc system toolchain (i.e. it may try to
build 64-bit) - you can use 'linux32' to start a subshell where
everything thinks it is i686 (I used to do that on my underpowered
mac G5 which needed a 64-bit kernel but could use 32-bit userland).

I'm rusty on how I used to do the similar on ppc, but I think it's
basically: build binutils and gcc (only - no need for g++) with your
chosen name and target - probably put then in /opt to ensure they
can't overwrite the system progs if things go wrong, ensure they are
on the PATH both for compiling the kernel and for installing the
modules, then try to fix the config and try to compile.

My memory says there is perhaps a little more to keep all the names
in-line, but what I really remember from the last time I did it on
ppc64 (after a long gap where the box was totally powered off) is
that the error messages were graphic and obvious (e.g. it couldn't
find the prefixed version of one of the tools because I typo'd one
of them or else didn't have the PATH set correctly.

ĸen
-- 
I live in a city. I know sparrows from starlings.  After that
everything is a duck as far as I'm concerned.  -- Monstrous Regiment
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to