int1 Tux's lil' helper
Joined: 08 Nov 2002 Posts: 139
|
Posted: Mon Dec 02, 2002 11:00 pm Post subject: KC14: Kernel CFLAGS |
|
|
KC14. Why isn't the kernel being compiled with the CFLAGS that I set in /etc/make.conf?
The Linux kernel is the core of the Linux operating system, and because of this is independent of any one distribution. In order to compile cleanly and easily across many different systems, the Linux kernel includes its own unique compilation settings as defined within its Makefile. The Gentoo USE and CFLAGS are not used because the kernel has more unique compiliation setting requirements than most compiled applications.
That being said, if you still want to compile your kernel with a specific set of CFLAGS, there are a number of options to do so.
First, you can define the CFLAGS_KERNEL environment variable before you compile the kernel. While there are a number of ways to define these variables depending on the shell you use, one method is:
export CFLAGS_KERNEL="-Wall -Wstrict-prototypes -march=pentium3 -O3 -mmmx -msse -fomit-frame-pointer -falign-functions=4"
Second, you can edit the Makefile in the kernel source directory, changing the HOSTCFLAGS and CFLAGS line to match your settings.
For example, from my modified Makefile in /usr/src/linux from vanilla-sources-2.4.19 on my Pentium 3 laptop:
(line 20)
HOSTCFLAGS = -Wall -Wstrict-prototypes -march=pentium3 -O3 -mmmx -msse -fomit-frame-pointer -falign-functions=4
(line 91)
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O3 -fno-strict-aliasing -fno-common -mmmx -msse -falign-functions=4
Finally, the latest gentoo-sources include a "gcc 3+" option in the processor configuration section. This allows for some refinement by allowing the kernel to set the -march option during kernel compile.
As a final note, you many not want to be too aggressive, since the kernel needs to be stable for you to be able to use your system!
(edited 13 Dec, cleaned up and added gcc 3+ option)
Last edited by int1 on Sat Dec 14, 2002 1:27 am; edited 1 time in total |
|