Re: compiling 32-bit kernel for 64-bit platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/7/06, vikaas sohal <vikaassohal@xxxxxxxxx> wrote:

Hi,

I'm trying to compile a 32-bit linux kernel to run on my x86_64, so that i
can run RTAI. I have tried following the instructions for cross-compilation
on the kernelnewbies FAQ, and have searched for help on the web, but think I
am still missing something basic.

I do this to compile a 32 bit i386 kernel on my x86_64 bit machine.
For all the commands, just append the string "ARCH=i386" . Dunno the
exact validity of this procedure, but hey it works for me... (I think
the 32 bit tool chain is installed by default on most (all?) 64 bit
distributions - mine is Fedora Core 3)

# make xconfig ARCH=i386
# make ARCH=i386


Here's what I've done so far:

---

1. used rpm to check for binutils, etc.

2. downloaded the i686 cross-compiler from
http://developer.osdl.org/dev/plm/cross_compile/ .
Installed this in /var/crosstools

3. added the cross-compile tool directory to the path, i.e. "export
PATH=$PATH:/var/crosstool/i686-unknown-linux-gnu/gcc-4.0.0-glibc-2.3.5"

4. configured the kernel, i.e., "make
CROSS_COMPILE=i686-unknown-linux-gnu- ARCH=i386 menuconfig"
and verfied that the configuration included generic x86 support (instead of
support for an x86_64 processor)

5. tried to compile the kernel.  according to the kernelnewbies FAQ, i
should be able to run, "make
CROSS_COMPILE=i686-unknown-linux-gnu- all," but this
doesn't find the cross-compiler, i.e. i get the following error: "make:
i686-unknown-linux-gnu-gcc: Command not found."

6. So then i tried explicitly specifying the location of the cross-compiler,
i.e., "make
CROSS_COMPILE=/var/crosstool/i686-unknown-linux-gnu/gcc-
3.4.2-glibc-2.3.3/i686-unknown-linux-gnu/bin/ ARCH=i386 all".  However, now
i get errors suggesting that i am still compiling a 64-bit kernel, e.g.:
"integer constant is too large for 'unsigned long' type", "warning: right
shift count >= width of type", and " warning: cast from pointer to integer
of different size".

7. i tried adding the flag, "CFLAGS=-m32" to tell gcc to do a 32-bit
compilation, but i get the same errors.

----

again, i've tried to follow the information i've found online so far, but
seem to be missing something basic.  can anyone help?

thanks,
vikaas


Bhanu.


--
I look to the future because that's where I'm going to spend the rest
of my life.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux