configs: Create symlinks to used scripts
As part of the config re-organization, put the scripts needed to create the config files in the configs/ directory. At the top level create symlinks for those scripts. This allows the kernel.spec file to find the scripts it needs and work correctly. No code changes.
This commit is contained in:
parent
c54d82caa9
commit
4be26cbac7
@ -1,89 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script merges together the hierarchy of CONFIG_* files under generic
|
||||
# and debug to form the necessary $PACKAGE_NAME<version>-<arch>-<variant>.config
|
||||
# files for building RHEL kernels, based on the contents of a control file
|
||||
|
||||
PACKAGE_NAME=kernel # defines the package name used
|
||||
|
||||
set errexit
|
||||
set nounset
|
||||
|
||||
control_file="config_generation"
|
||||
|
||||
function combine_config_layer()
|
||||
{
|
||||
dir=$1
|
||||
file="config-$(echo $dir | sed -e 's|/|-|g')"
|
||||
|
||||
if [ $(ls $dir/ | grep -c "^CONFIG_") -eq 0 ]; then
|
||||
touch $file
|
||||
return
|
||||
fi
|
||||
|
||||
cat $dir/CONFIG_* > $file
|
||||
}
|
||||
|
||||
function merge_configs()
|
||||
{
|
||||
archvar=$1
|
||||
arch=$(echo "$archvar" | cut -f1 -d"-")
|
||||
configs=$2
|
||||
name=$PACKAGE_NAME-$archvar.config
|
||||
echo -n "Building $name ... "
|
||||
touch config-merging config-merged
|
||||
for config in $(echo $configs | sed -e 's/:/ /g')
|
||||
do
|
||||
perl merge.pl config-$config config-merging > config-merged
|
||||
if [ ! $? -eq 0 ]; then
|
||||
exit
|
||||
fi
|
||||
mv config-merged config-merging
|
||||
done
|
||||
if [ "x$arch" == "xaarch64" ]; then
|
||||
echo "# arm64" > $name
|
||||
elif [ "x$arch" == "xppc64" ]; then
|
||||
echo "# powerpc" > $name
|
||||
elif [ "x$arch" == "xppc64le" ]; then
|
||||
echo "# powerpc" > $name
|
||||
elif [ "x$arch" == "xs390x" ]; then
|
||||
echo "# s390" > $name
|
||||
elif [ "x$arch" == "xarmv7hl" ]; then
|
||||
echo "# arm" > $name
|
||||
elif [ "x$arch" == "xi686" ]; then
|
||||
echo "# i386" > $name
|
||||
else
|
||||
echo "# $arch" > $name
|
||||
fi
|
||||
sort config-merging >> $name
|
||||
rm -f config-merged config-merging
|
||||
echo "done"
|
||||
}
|
||||
|
||||
glist=$(find baseconfig -type d)
|
||||
dlist=$(find debugconfig -type d)
|
||||
|
||||
for d in $glist $dlist
|
||||
do
|
||||
combine_config_layer $d
|
||||
done
|
||||
|
||||
while read line
|
||||
do
|
||||
if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then
|
||||
continue
|
||||
elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then
|
||||
continue
|
||||
else
|
||||
arch=$(echo "$line" | cut -f1 -d"=")
|
||||
configs=$(echo "$line" | cut -f2 -d"=")
|
||||
|
||||
if [ -n "$SUBARCH" -a "$SUBARCH" != "$arch" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
merge_configs $arch $configs
|
||||
fi
|
||||
done < $control_file
|
||||
|
||||
rm -f config-*
|
1
build_configs.sh
Symbolic link
1
build_configs.sh
Symbolic link
@ -0,0 +1 @@
|
||||
configs/build_configs.sh
|
@ -1,36 +0,0 @@
|
||||
# config-variant=config:config:config
|
||||
# kernel.config files are build on the fly based on this config,
|
||||
# the first arg is arch and variant, the second is a hierarchy of
|
||||
# config options, lowest priority to highest
|
||||
|
||||
# x86_64
|
||||
x86_64=baseconfig:baseconfig-x86:baseconfig-x86-x86_64
|
||||
x86_64-debug=baseconfig:baseconfig-x86:baseconfig-x86-x86_64:debugconfig:debugconfig-x86:debugconfig-x86-x86_64
|
||||
|
||||
# i686
|
||||
i686=baseconfig:baseconfig-x86:baseconfig-x86-i686
|
||||
i686-debug=baseconfig:baseconfig-x86:baseconfig-x86-i686:debugconfig:debugconfig-x86
|
||||
i686-PAE=baseconfig:baseconfig-x86:baseconfig-x86-i686PAE
|
||||
i686-PAEdebug=baseconfig:baseconfig-x86:baseconfig-x86-i686PAE:debugconfig:debugconfig-x86
|
||||
|
||||
# ppc64
|
||||
ppc64=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64
|
||||
ppc64-debug=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64:debugconfig
|
||||
|
||||
# ppc64le
|
||||
ppc64le=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64le
|
||||
ppc64le-debug=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64le:debugconfig
|
||||
|
||||
# s390x
|
||||
s390x=baseconfig:baseconfig-s390x
|
||||
s390x-debug=baseconfig:baseconfig-s390x:debugconfig
|
||||
|
||||
# aarch64
|
||||
aarch64=baseconfig:baseconfig-arm:baseconfig-arm-arm64
|
||||
aarch64-debug=baseconfig:baseconfig-arm:baseconfig-arm-arm64:debugconfig:debugconfig-arm
|
||||
|
||||
# arm
|
||||
armv7hl=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-armv7
|
||||
armv7hl-debug=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-armv7:debugconfig:debugconfig-arm
|
||||
armv7hl-lpae=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-lpae
|
||||
armv7hl-lpae-debug=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-lpae:debugconfig:debugconfig-arm
|
1
config_generation
Symbolic link
1
config_generation
Symbolic link
@ -0,0 +1 @@
|
||||
configs/config_generation
|
89
configs/build_configs.sh
Executable file
89
configs/build_configs.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script merges together the hierarchy of CONFIG_* files under generic
|
||||
# and debug to form the necessary $PACKAGE_NAME<version>-<arch>-<variant>.config
|
||||
# files for building RHEL kernels, based on the contents of a control file
|
||||
|
||||
PACKAGE_NAME=kernel # defines the package name used
|
||||
|
||||
set errexit
|
||||
set nounset
|
||||
|
||||
control_file="config_generation"
|
||||
|
||||
function combine_config_layer()
|
||||
{
|
||||
dir=$1
|
||||
file="config-$(echo $dir | sed -e 's|/|-|g')"
|
||||
|
||||
if [ $(ls $dir/ | grep -c "^CONFIG_") -eq 0 ]; then
|
||||
touch $file
|
||||
return
|
||||
fi
|
||||
|
||||
cat $dir/CONFIG_* > $file
|
||||
}
|
||||
|
||||
function merge_configs()
|
||||
{
|
||||
archvar=$1
|
||||
arch=$(echo "$archvar" | cut -f1 -d"-")
|
||||
configs=$2
|
||||
name=$PACKAGE_NAME-$archvar.config
|
||||
echo -n "Building $name ... "
|
||||
touch config-merging config-merged
|
||||
for config in $(echo $configs | sed -e 's/:/ /g')
|
||||
do
|
||||
perl merge.pl config-$config config-merging > config-merged
|
||||
if [ ! $? -eq 0 ]; then
|
||||
exit
|
||||
fi
|
||||
mv config-merged config-merging
|
||||
done
|
||||
if [ "x$arch" == "xaarch64" ]; then
|
||||
echo "# arm64" > $name
|
||||
elif [ "x$arch" == "xppc64" ]; then
|
||||
echo "# powerpc" > $name
|
||||
elif [ "x$arch" == "xppc64le" ]; then
|
||||
echo "# powerpc" > $name
|
||||
elif [ "x$arch" == "xs390x" ]; then
|
||||
echo "# s390" > $name
|
||||
elif [ "x$arch" == "xarmv7hl" ]; then
|
||||
echo "# arm" > $name
|
||||
elif [ "x$arch" == "xi686" ]; then
|
||||
echo "# i386" > $name
|
||||
else
|
||||
echo "# $arch" > $name
|
||||
fi
|
||||
sort config-merging >> $name
|
||||
rm -f config-merged config-merging
|
||||
echo "done"
|
||||
}
|
||||
|
||||
glist=$(find baseconfig -type d)
|
||||
dlist=$(find debugconfig -type d)
|
||||
|
||||
for d in $glist $dlist
|
||||
do
|
||||
combine_config_layer $d
|
||||
done
|
||||
|
||||
while read line
|
||||
do
|
||||
if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then
|
||||
continue
|
||||
elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then
|
||||
continue
|
||||
else
|
||||
arch=$(echo "$line" | cut -f1 -d"=")
|
||||
configs=$(echo "$line" | cut -f2 -d"=")
|
||||
|
||||
if [ -n "$SUBARCH" -a "$SUBARCH" != "$arch" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
merge_configs $arch $configs
|
||||
fi
|
||||
done < $control_file
|
||||
|
||||
rm -f config-*
|
36
configs/config_generation
Normal file
36
configs/config_generation
Normal file
@ -0,0 +1,36 @@
|
||||
# config-variant=config:config:config
|
||||
# kernel.config files are build on the fly based on this config,
|
||||
# the first arg is arch and variant, the second is a hierarchy of
|
||||
# config options, lowest priority to highest
|
||||
|
||||
# x86_64
|
||||
x86_64=baseconfig:baseconfig-x86:baseconfig-x86-x86_64
|
||||
x86_64-debug=baseconfig:baseconfig-x86:baseconfig-x86-x86_64:debugconfig:debugconfig-x86:debugconfig-x86-x86_64
|
||||
|
||||
# i686
|
||||
i686=baseconfig:baseconfig-x86:baseconfig-x86-i686
|
||||
i686-debug=baseconfig:baseconfig-x86:baseconfig-x86-i686:debugconfig:debugconfig-x86
|
||||
i686-PAE=baseconfig:baseconfig-x86:baseconfig-x86-i686PAE
|
||||
i686-PAEdebug=baseconfig:baseconfig-x86:baseconfig-x86-i686PAE:debugconfig:debugconfig-x86
|
||||
|
||||
# ppc64
|
||||
ppc64=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64
|
||||
ppc64-debug=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64:debugconfig
|
||||
|
||||
# ppc64le
|
||||
ppc64le=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64le
|
||||
ppc64le-debug=baseconfig:baseconfig-powerpc:baseconfig-powerpc-powerpc64le:debugconfig
|
||||
|
||||
# s390x
|
||||
s390x=baseconfig:baseconfig-s390x
|
||||
s390x-debug=baseconfig:baseconfig-s390x:debugconfig
|
||||
|
||||
# aarch64
|
||||
aarch64=baseconfig:baseconfig-arm:baseconfig-arm-arm64
|
||||
aarch64-debug=baseconfig:baseconfig-arm:baseconfig-arm-arm64:debugconfig:debugconfig-arm
|
||||
|
||||
# arm
|
||||
armv7hl=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-armv7
|
||||
armv7hl-debug=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-armv7:debugconfig:debugconfig-arm
|
||||
armv7hl-lpae=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-lpae
|
||||
armv7hl-lpae-debug=baseconfig:baseconfig-arm:baseconfig-arm-armv7:baseconfig-arm-armv7-lpae:debugconfig:debugconfig-arm
|
66
merge.pl
66
merge.pl
@ -1,66 +0,0 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
my @args=@ARGV;
|
||||
my %configvalues;
|
||||
my @configoptions;
|
||||
my $configcounter = 0;
|
||||
|
||||
# optionally print out the architecture as the first line of our output
|
||||
my $arch = $args[2];
|
||||
if (defined $arch) {
|
||||
print "# $arch\n";
|
||||
}
|
||||
|
||||
# first, read the override file
|
||||
|
||||
open (FILE,"$args[0]") || die "Could not open $args[0]";
|
||||
while (<FILE>) {
|
||||
my $str = $_;
|
||||
my $configname;
|
||||
|
||||
if (/\# ([\w]+) is not set/) {
|
||||
$configname = $1;
|
||||
} elsif (/([\w]+)=/) {
|
||||
$configname = $1;
|
||||
}
|
||||
|
||||
if (defined($configname) && !exists($configvalues{$configname})) {
|
||||
$configvalues{$configname} = $str;
|
||||
$configoptions[$configcounter] = $configname;
|
||||
$configcounter ++;
|
||||
}
|
||||
};
|
||||
|
||||
# now, read and output the entire configfile, except for the overridden
|
||||
# parts... for those the new value is printed.
|
||||
|
||||
open (FILE2,"$args[1]") || die "Could not open $args[1]";
|
||||
while (<FILE2>) {
|
||||
my $configname;
|
||||
|
||||
if (/\# ([\w]+) is not set/) {
|
||||
$configname = $1;
|
||||
} elsif (/([\w]+)=/) {
|
||||
$configname = $1;
|
||||
}
|
||||
|
||||
if (defined($configname) && exists($configvalues{$configname})) {
|
||||
print "$configvalues{$configname}";
|
||||
delete($configvalues{$configname});
|
||||
} else {
|
||||
print "$_";
|
||||
}
|
||||
}
|
||||
|
||||
# now print the new values from the overridden configfile
|
||||
my $counter = 0;
|
||||
|
||||
while ($counter < $configcounter) {
|
||||
my $configname = $configoptions[$counter];
|
||||
if (exists($configvalues{$configname})) {
|
||||
print "$configvalues{$configname}";
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user