LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 04-01-2007, 02:15 AM   #1
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux 3.1/Busybox. Fedora 19, Raspberry Pi
Posts: 94

Rep: Reputation: 15
Cross compiling


I'm trying to recompile a 2.4.31 kernel to run on a 386, on a development machine that is a 686.

In the days when my development machine was running a 2.2.16 kernel (with the associated build tools) I could do this no problem, but now my development machine has been upgraded to run Fedora Core 5, I'm having compiler problems. e.g.

gcc -D__KERNEL__ -I/home/mike/linux-2.4.31/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i486 -fno-unit-at-a-time -DKBUILD_BASENAME=main -c -o init/main.o init/main.c
In file included from /home/mike/linux-2.4.31/include/linux/kernel.h:15,
from /home/mike/linux-2.4.31/include/linux/wait.h:13,
from /home/mike/linux-2.4.31/include/linux/fs.h:12,
from /home/mike/linux-2.4.31/include/linux/capability.h:17,
from /home/mike/linux-2.4.31/include/linux/binfmts.h:5,
from /home/mike/linux-2.4.31/include/linux/sched.h:9,
from /home/mike/linux-2.4.31/include/linux/mm.h:4,
from /home/mike/linux-2.4.31/include/linux/slab.h:14,
from /home/mike/linux-2.4.31/include/linux/proc_fs.h:5,
from init/main.c:15:
/home/mike/linux-2.4.31/include/asm/byteorder.h:14: warning: type qualifiers ignored on function return type
/home/mike/linux-2.4.31/include/asm/byteorder.h:30: warning: type qualifiers ignored on function return type
In file included from /home/mike/linux-2.4.31/include/linux/byteorder/little_endian.h:11,
from /home/mike/linux-2.4.31/include/asm/byteorder.h:65,
from /home/mike/linux-2.4.31/include/linux/kernel.h:15,
from /home/mike/linux-2.4.31/include/linux/wait.h:13,
from /home/mike/linux-2.4.31/include/linux/fs.h:12,
from /home/mike/linux-2.4.31/include/linux/capability.h:17,
from /home/mike/linux-2.4.31/include/linux/binfmts.h:5,
from /home/mike/linux-2.4.31/include/linux/sched.h:9,
from /home/mike/linux-2.4.31/include/linux/mm.h:4,
from /home/mike/linux-2.4.31/include/linux/slab.h:14,
from /home/mike/linux-2.4.31/include/linux/proc_fs.h:5,
from init/main.c:15:
/home/mike/linux-2.4.31/include/linux/byteorder/swab.h:160: warning: type qualifiers ignored on function return type
/home/mike/linux-2.4.31/include/linux/byteorder/swab.h:173: warning: type qualifiers ignored on function return type
/home/mike/linux-2.4.31/include/linux/byteorder/swab.h:186: warning: type qualifiers ignored on function return type
/home/mike/linux-2.4.31/include/linux/byteorder/swab.h:200: warning: type qualifiers ignored on function return type
In file included from /home/mike/linux-2.4.31/include/linux/prefetch.h:13,
from /home/mike/linux-2.4.31/include/linux/list.h:6,
from /home/mike/linux-2.4.31/include/linux/wait.h:14,
from /home/mike/linux-2.4.31/include/linux/fs.h:12,
from /home/mike/linux-2.4.31/include/linux/capability.h:17,
from /home/mike/linux-2.4.31/include/linux/binfmts.h:5,
from /home/mike/linux-2.4.31/include/linux/sched.h:9,
from /home/mike/linux-2.4.31/include/linux/mm.h:4,
from /home/mike/linux-2.4.31/include/linux/slab.h:14,
from /home/mike/linux-2.4.31/include/linux/proc_fs.h:5,
from init/main.c:15:
/home/mike/linux-2.4.31/include/asm/processor.h:75: error: array type has incomplete element type
In file included from /home/mike/linux-2.4.31/include/linux/fs.h:322,
from /home/mike/linux-2.4.31/include/linux/capability.h:17,
from /home/mike/linux-2.4.31/include/linux/binfmts.h:5,
from /home/mike/linux-2.4.31/include/linux/sched.h:9,
from /home/mike/linux-2.4.31/include/linux/mm.h:4,
from /home/mike/linux-2.4.31/include/linux/slab.h:14,
from /home/mike/linux-2.4.31/include/linux/proc_fs.h:5,
from init/main.c:15:
/home/mike/linux-2.4.31/include/linux/ncp_fs_i.h:26: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp_fs_i.h:27: warning: ‘packed’ attribute ignored for field of type ‘__u8[5u]’
In file included from /home/mike/linux-2.4.31/include/linux/ncp_mount.h:12,
from /home/mike/linux-2.4.31/include/linux/ncp_fs_sb.h:12,
from /home/mike/linux-2.4.31/include/linux/fs.h:733,
from /home/mike/linux-2.4.31/include/linux/capability.h:17,
from /home/mike/linux-2.4.31/include/linux/binfmts.h:5,
from /home/mike/linux-2.4.31/include/linux/sched.h:9,
from /home/mike/linux-2.4.31/include/linux/mm.h:4,
from /home/mike/linux-2.4.31/include/linux/slab.h:14,
from /home/mike/linux-2.4.31/include/linux/proc_fs.h:5,
from init/main.c:15:
/home/mike/linux-2.4.31/include/linux/ncp.h:24: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:25: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:26: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:27: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:28: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:29: warning: ‘packed’ attribute ignored for field of type ‘__u8[]’
/home/mike/linux-2.4.31/include/linux/ncp.h:37: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:38: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:39: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:40: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:41: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:42: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:43: warning: ‘packed’ attribute ignored for field of type ‘__u8[]’
/home/mike/linux-2.4.31/include/linux/ncp.h:137: warning: ‘packed’ attribute ignored for field of type ‘__u8’
/home/mike/linux-2.4.31/include/linux/ncp.h:138: warning: ‘packed’ attribute ignored for field of type ‘__u8[255u]’
/home/mike/linux-2.4.31/include/linux/ncp.h:174: warning: ‘packed’ attribute ignored for field of type ‘__u8’
make: *** [init/main.o] Error 1
[mike@glynys linux-2.4.31]$

I assumed that this was an incompatibility with gcc, so I tried building a gcc-3.0 which was what I used to have under 2.2.16, but I can't compile gcc either. i.e.

gcc -c -DIN_GCC -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -DHAVE_CONFIG_H -I. -Icp -I. -I./cp -I./config -I./../include cp/decl.c -o cp/decl.o
cp/decl.c: In function ‘push_binding_level’:
cp/decl.c:528: error: invalid lvalue in assignment
cp/decl.c: In function ‘pop_binding_level’:
cp/decl.c:584: error: invalid lvalue in assignment
cp/decl.c: In function ‘suspend_binding_level’:
cp/decl.c:599: error: invalid lvalue in assignment
cp/decl.c:621: error: invalid lvalue in assignment
cp/decl.c: In function ‘resume_binding_level’:
cp/decl.c:634: error: invalid lvalue in assignment
cp/decl.c: In function ‘pushdecl_with_scope’:
cp/decl.c:4294: error: invalid lvalue in assignment
cp/decl.c:4296: error: invalid lvalue in assignment
cp/decl.c: In function ‘init_decl_processing’:
cp/decl.c:6405: error: invalid lvalue in assignment
cp/decl.c: In function ‘grokdeclarator’:
cp/decl.c:9932: error: invalid lvalue in assignment
cp/decl.c:9935: error: invalid lvalue in assignment
cp/decl.c: In function ‘start_function’:
cp/decl.c:13472: error: invalid lvalue in assignment
make[1]: *** [cp/decl.o] Error 1
make[1]: Leaving directory `/home/mike/gcc-3.0/gcc'
make: *** [all-gcc] Error 2
[mike@glynys gcc-3.0]$


My current gcc is the standard for Fedora Core 5 i.e.

[mike@glynys build_i386]$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)
[mike@glynys build_i386]$

Why am I having these problems ? Is it an incompatibility with gcc and the kernel source code ? What can I do to sort this out ?

I'm trying to recompile a 2.4.31 kernel to run on a 386, on a development machine that is a 686.

Thanks for taking the time to read this .

 
Old 04-01-2007, 01:55 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
When compiling the kernel your error is
/home/mike/linux-2.4.31/include/asm/processor.h:75: error: array type has incomplete element type
Please post that fragment from the processor.h file (with small context).

It looks that something's undefined. The problem when compiling gcc looks similar.

There are differences between gcc 3.0 and 4 and they cause problems from time to time, but usually not that hard to fix.
 
Old 04-02-2007, 01:15 PM   #3
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux 3.1/Busybox. Fedora 19, Raspberry Pi
Posts: 94

Original Poster
Rep: Reputation: 15
Ho hum. It looks like I need to define the number of CPUs somewhere, or find where it is defined and make sure it really is and not skipped because of conditional compilation.

Thanks for the pointer

68 #define X86_VENDOR_UNKNOWN 0xff
69
70 /*
71 * capabilities of CPUs
72 */
73
74 extern struct cpuinfo_x86 boot_cpu_data;
75 extern struct tss_struct init_tss[NR_CPUS];
76
77 #ifdef CONFIG_SMP
78 extern struct cpuinfo_x86 cpu_data[];
79 #define current_cpu_data cpu_data[smp_processor_id()]
 
Old 04-03-2007, 03:17 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
That's rather strange. Your error is about tss_struct, which is defined later in that file. Try adding
struct tss_struct;
before line 75.
 
Old 04-04-2007, 10:59 AM   #5
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux 3.1/Busybox. Fedora 19, Raspberry Pi
Posts: 94

Original Poster
Rep: Reputation: 15
Tried moving the struct before the extern declarations but it failed then because other things were undefined, so moved the extern declarations to the end. That built OK.

Then the build fails further on compiling do_mounts.c e.g.

init/do_mounts.c:54: error: static declaration of ‘root_device_name’ follows non-static declaration
/home/mike/linux-2.4.31/include/linux/fs.h:1562: error: previous declaration of ‘root_device_name’ was here
init/do_mounts.c: In function ‘identify_ramdisk_image’:

I think there must be some subtle difference in the compiler options between gcc 3.0 and gcc 4.1 and I will be plagued by errors unless I can find out what and why.

Anyway, thanks for your help.

Mike
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-Compiling using Scratchbox. Mejia Linux - Kernel 4 12-06-2006 11:14 AM
Cross Compiling dosnlinux Programming 5 03-01-2006 11:12 AM
cross compiling cerin Linux - Software 1 02-11-2006 10:47 PM
cross-compiling? jon_k Programming 3 12-09-2004 09:36 AM
cross compiling with g++ hornofsalvation Linux - Newbie 2 10-09-2004 10:29 PM


All times are GMT -5. The time now is 03:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration