SPECS (LINUX_2_6): kernel.spec - pass all the config files through kernel-c...

Przemyslaw Iskra sparky at pld-linux.org
Fri Sep 26 21:53:02 CEST 2008


On Fri, Sep 26, 2008 at 09:14:02PM +0200, sparky wrote:
> Author: sparky                       Date: Fri Sep 26 19:14:02 2008 GMT
> Module: SPECS                         Tag: LINUX_2_6
> ---- Log message:
> - pass all the config files through kernel-config.awk
> -- tested on number of different bcond combinations the result is the same as before

For old PLD kernel hackers this may not seem like a correct way to create
.config files, so I'll try to explain it a little bit.


Unlike in kernel make oldconfig, config building script (kernel-config.awk)
has exactly defined behaviour when it finds repeated option:
- if some option is defined twice in the same file than die screaming
- if some option was previously defined in annother config source than
  warn about it and output only the _first_ occurrance

In kernel.spec case, if anything is specified in important.config it
will overwrite any redefinitions of that option from subsequent files.
This eliminates the need to use the ugly sed -i trick.

> +	# prepare local and important options
> +	cat <<-EOCONFIG > important.config
> +%if 0%{?debug:1}
> +		CONFIG_DEBUG_SLAB=y
> +		CONFIG_DEBUG_PREEMPT=y
> +		CONFIG_RT_DEADLOCK_DETECT=y
> +%endif


Second thing. There are two architectures specified in kernel-config.awk,
basearch=%{_target_base_arch}, which for athlon architecture would be
i386 and arch=%{_target_cpu}, which for athlon would be athlon. 'arch'
takes precedence over 'basearch', and 'basearch' takes precedence over
'all'.

Option looking like this one:
CONFIG_SOMETHING all=n ppc= i386=m i686=y pentium3=y pentium4=y athlon=y
- on powerpc won't return anything
- on i686 and above will return: CONFIG_SOMETHING=y
- on i386, i485, i586 will return: CONFIG_SOMETHING=m
- on any other architecture will return: # CONFIG_SOMETHING is not set


> +		# this part can be moved into i386 config file
> +		CONFIG_M386 i386=y i486=n i586=n i686=n pentium3=n pentium4=n athlon=n
> +		CONFIG_M486 i386=n i486=y
> +		CONFIG_M586 i386=n i586=y
> +		CONFIG_M686 i386=n i686=y
> +		CONFIG_MPENTIUMIII i386=n pentium3=y
> +		CONFIG_MPENTIUM4 i386=n pentium4=y
> +		CONFIG_MK7 i386=n athlon=y
> +
> +		CONFIG_MATH_EMULATION i386=y i686=n pentium3=n pentium4=n athlon=n
> +  %ifarch i686 athlon pentium3 pentium4
> +    %if %{with pae}
> +		CONFIG_HIGHMEM4G=n
> +		CONFIG_HIGHMEM64G=y
> +		CONFIG_X86_PAE=y
> +    %endif
> +  %endif


Also you should know that there are many allowed methods to specify an
option, any combination of those may be used in all the config files:

- lines returning: # CONFIG_SOMETHING is not set
CONFIG_SOMETHING=n
SOMETHING=n
CONFIG_SOMETHING all=n
SOMETHING all=n
# CONFIG_SOMETHING is not set

- lines returning: CONFIG_SOMETHING=y
CONFIG_SOMETHING=y
SOMETHING=y
CONFIG_SOMETHING all=y
SOMETHING all=y

- lines returning different values on different architectures:
CONFIG_SOMETHING=y ppc=n
SOMETHING=y ppc=n
CONFIG_SOMETHING all=y ppc=n
SOMETHING all=y ppc=n


-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ........... LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mail....sparky<at>pld-linux.org


More information about the pld-devel-en mailing list