mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Lee Revell <rlrevell@joe-job.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Kyle McMartin <kyle@mcmartin.ca>
Subject: Re: i386 -> x86_64 cross compile failure (binutils bug?)
Date: Fri, 09 Dec 2005 16:25:06 -0500	[thread overview]
Message-ID: <1134163506.5238.18.camel@localhost.localdomain> (raw)
In-Reply-To: <1134161906.18432.15.camel@mindpipe>

On Fri, 2005-12-09 at 15:58 -0500, Lee Revell wrote:
> Also, isn't it a bug for the Makefile not to pass -m64 if I specify
> ARCH=x86_64?  If I don't change the CFLAGS I get:
> 
> $ make ARCH=x86_64                              
>   CHK     include/linux/version.h
>   CC      arch/x86_64/kernel/asm-offsets.s
> arch/x86_64/kernel/asm-offsets.c:1: error: code model 'kernel' not
> supported in the 32 bit mode
> make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
> make: *** [prepare0] Error 2

Lee,

For my x86_64, I gave up on trying to do it through the normal path
(having a plain debian unstable system), and finally just downloaded the
gcc toolchain (gcc, binutils, and glibc) and built them as cross
compilers with the prefix x86_64-linux-

For binutils I made a directory binutils_x86_64 and in there I used:

../binutils-2.16/configure  --prefix=/usr/local/x86_64 --target=x86_64-linux

For gcc (first pass) I used:

../gcc-4.0.2/configure   --prefix=/usr/local/x86_64 --target=x86_64-linux \
--enable-shared --disable-threads --enable-languages=c

That's enough to get a gcc that builds the kernel.

Then I built glibc, and then once again the gcc with:

../gcc-4.0.2/configure   --prefix=/usr/local/x86_64 --target=x86_64-linux \
--enable-shared --with-headers=/usr/local/x86_64/include \
--with-libs=/usr/local/x86_64/lib --disable-multilib \
--enable-languages=c

Probably not the best way, but it worked for me ;-)

Now I also installed a hack make program in /usr/local/bin that is used first:

---
#!/bin/sh

if [ ! -z $__MY_MAKE_RUNNING__ ]; then
        /usr/bin/make $*
        exit $?
fi

__MY_MAKE_RUNNING__=1
export __MY_MAKE_RUNNING__

pwd=`pwd | sed -ne '/\/home\/rostedt\/work\/kernels\//p'`

if [ -z $pwd ]; then
        m="intmake"
else
        m="amdmake"
fi

# prove to me that I'm running the right one
echo $m
$m $*
---

with amdmake in /usr/local/bin:
---
PATH=$PATH:/usr/local/x86_64/bin/ make CROSS_COMPILE=x86_64-linux- ARCH=x86_64 $*
---


and intmake also in /usr/local/bin:
---
make ARCH=i386 $*
---


So now all the kernels in my /home/rostedt/work/kernels are built with
the cross compiling x86_64 and all other kernels for intel i386.  I know
this is a major hack, but I don't have time to pretty this up!

-- Steve



  reply	other threads:[~2005-12-09 21:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-09 18:50 Lee Revell
2005-12-09 19:50 ` Ken Moffat
2005-12-09 19:59   ` Lee Revell
2005-12-09 21:30     ` Ken Moffat
2005-12-09 21:40       ` Lee Revell
2005-12-09 22:19         ` Ken Moffat
2005-12-09 19:58 ` Kyle McMartin
2005-12-09 20:21   ` Lee Revell
2005-12-09 20:41     ` Kyle McMartin
2005-12-09 20:58       ` Lee Revell
2005-12-09 21:25         ` Steven Rostedt [this message]
2005-12-09 21:35           ` Lee Revell
2005-12-09 21:10       ` Lee Revell
2005-12-09 21:19         ` Kyle McMartin
2005-12-09 22:37 ` Jeffrey Hundstad
2005-12-10  0:05   ` Lee Revell
2005-12-10  0:23     ` Jeffrey Hundstad
2005-12-10  1:28       ` Lee Revell
2005-12-10  1:50       ` Lee Revell
2005-12-10  8:56         ` Andi Kleen
2005-12-10  5:12           ` Lee Revell
2005-12-10  7:19             ` Andi Kleen
2005-12-10  7:43               ` Lee Revell
2005-12-10 19:34               ` Lee Revell
2005-12-11  0:00                 ` Andi Kleen
2005-12-11  0:26                   ` Lee Revell
2005-12-16 23:40                   ` Lee Revell
2005-12-23  5:59                   ` Lee Revell
2006-01-11 16:48                   ` Lee Revell
2006-01-11 16:54                     ` Andi Kleen
2005-12-09 22:43 ` Xavier Bestel
2005-12-10  1:31   ` Lee Revell
2005-12-10 20:34     ` Xavier Bestel
2005-12-10 20:48       ` Lee Revell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1134163506.5238.18.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlrevell@joe-job.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®