Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 144
Rep:
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.
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.
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 144
Original Poster
Rep:
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.
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 144
Original Poster
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.