UBUNTU: [Packaging] Drop support of old config handling

All kernels and their derivatives have been migrated to the new annotations
scheme by now so clean up the tree and drop the support of the old config
handling.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Juerg Haefliger
2023-05-09 16:29:51 +02:00
committed by Paolo Pisati
parent d739a08a84
commit c66e49e483
5 changed files with 2 additions and 446 deletions
-22
View File
@@ -10,7 +10,6 @@ help:
@echo " defaultconfigs : Update core arch configs using defaults"
@echo " genconfigs : Generate core arch configs in CONFIGS/*"
@echo " editconfigs : Edit core arch configs"
@echo " migrateconfigs : Automatically import old configs into annotations"
@echo " printchanges : Print the current changelog entries (from git)"
@echo " insertchanges : Insert current changelog entries (from git)"
@echo " startnewrelease : Start a new changelog set"
@@ -25,34 +24,13 @@ help:
printdebian:
@echo "$(DEBIAN)"
.PHONY: migrateconfigs
migrateconfigs:
ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),)
dh_testdir
conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig genconfigs
rm -rf build
mkdir build
mv $(DEBIAN)/config/annotations build/.annotations
mv $(DEBIAN)/config/README.rst build/.README.rst 2>/dev/null || true
rm -rf $(DEBIAN)/config
mkdir -p $(DEBIAN)/config
debian/scripts/misc/migrate-annotations < build/.annotations > $(DEBIAN)/config/annotations
mv build/.README.rst $(DEBIAN)/config/README.rst 2>/dev/null || true
rm -rf build
kmake='$(kmake)' conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig updateconfigs
endif
configs-targets := updateconfigs defaultconfigs genconfigs editconfigs
.PHONY: $(configs-targets)
$(configs-targets):
dh_testdir
ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),)
conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig $@
else
kmake='$(kmake)' skip_checks=$(do_skip_checks) conc_level=$(conc_level) \
$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
endif
.PHONY: printenv
printenv:
+2 -8
View File
@@ -31,12 +31,6 @@ checks-%: module-check-% module-signature-check-% abi-check-% retpoline-check-%
config-prepare-check-%: $(stampdir)/stamp-prepare-tree-%
@echo Debug: $@
ifneq ($(do_skip_checks),true)
if [ -e $(commonconfdir)/config.common.ubuntu ]; then \
perl -f $(DROOT)/scripts/checks/config-check \
$(builddir)/build-$*/.config "$(arch)" "$*" "$(commonconfdir)" \
"$(skipconfig)" "$(do_enforce_all)"; \
else \
python3 $(DROOT)/scripts/misc/annotations -f $(commonconfdir)/annotations \
--arch $(arch) --flavour $* --check $(builddir)/build-$*/.config; \
fi
python3 $(DROOT)/scripts/misc/annotations -f $(commonconfdir)/annotations \
--arch $(arch) --flavour $* --check $(builddir)/build-$*/.config
endif
-163
View File
@@ -1,163 +0,0 @@
#!/usr/bin/perl
#
# check-config -- check the current config for issues
#
use strict;
use File::Basename;
use File::Spec;
my $P = 'check-config';
my $test = -1;
if ($ARGV[0] eq '--test') {
$test = $ARGV[1] + 0;
} elsif ($#ARGV != 5) {
die "Usage: $P <config> <arch> <flavour> <commonconfig> <warn-only> <enforce-all>\n";
}
my ($configfile, $arch, $flavour, $commonconfig, $warn_only, $enforce_all) = @ARGV;
my %values = ();
# If we are in overridden then still perform the checks and emit the messages
# but do not return failure. Those items marked FATAL will alway trigger
# failure.
my $fail_exit = 1;
$fail_exit = 0 if ($warn_only eq 'true' || $warn_only eq '1');
my $exit_val = 0;
$enforce_all = 0 if $enforce_all eq "no" or $enforce_all eq "false";
# Load up the current configuration values -- FATAL if this fails
print "$P: $configfile: loading config\n";
open(CONFIG, "<$configfile") || die "$P: $configfile: open failed -- $! -- aborting\n";
while (<CONFIG>) {
# Pull out values.
/^#*\s*(CONFIG_\w+)[\s=](.*)$/ or next;
if ($2 eq 'is not set') {
$values{$1} = 'n';
} else {
$values{$1} = $2;
}
}
close(CONFIG);
sub read_annotations {
my ($filename) = @_;
my %annot;
my $form = 1;
my ($config, $value, $options);
# Keep track of the configs that shouldn't be appended because
# they were include_annot from another annotations file.
# That's a hash of undefs, aka a set.
my %noappend;
print "$P: $filename loading annotations\n";
open(my $fd, "<$filename") ||
die "$P: $filename: open failed -- $! -- aborting\n";
while (<$fd>) {
if (/^# FORMAT: (\S+)/) {
die "$P: $1: unknown annotations format\n" if ($1 != 2 && $1 != 3 && $1 != 4);
$form = $1;
}
# Format #3 adds the include directive on top of format #2:
if ($form == 3 && /^\s*include(\s|$)/) {
# Include quoted or unquoted files:
if (/^\s*include\s+"(.*)"\s*$/ || /^\s*include\s+(.*)$/) {
# The include is relative to the current file
my $include_filename = File::Spec->join(dirname($filename), $1);
# Append the include files
my %include_annot = read_annotations($include_filename);
%annot = ( %annot, %include_annot );
# And marked them to not be appended:
my %included_noappend;
# Discard the values and keep only the keys
@included_noappend{keys %include_annot} = ();
%noappend = ( %noappend, %included_noappend );
next;
} else {
die "$P: Invalid include: $_";
}
}
/^#/ && next;
chomp;
/^$/ && next;
/^CONFIG_/ || next;
if ($form == 1) {
($config, $value, $options) = split(' ', $_, 3);
} elsif ($form >= 2) {
($config, $options) = split(' ', $_, 2);
}
if (exists $noappend{$config}) {
delete $annot{$config};
delete $noappend{$config};
}
$annot{$config} = $annot{$config} . ' ' . $options;
}
close($fd);
return %annot;
}
# ANNOTATIONS: check any annotations marked for enforcement
my $annotations = "$commonconfig/annotations";
my %annot = read_annotations($annotations);
my $pass = 0;
my $total = 0;
my ($config, $value, $options, $option, $check, $policy);
for $config (keys %annot) {
$check = $enforce_all;
$options = $annot{$config};
$policy = undef;
while ($options =~ /\s*([^\s<]+)<(.*?)?>/g) {
($option, $value) = ($1, $2);
if ($option eq 'mark' && $value eq 'ENFORCED') {
$check = 1;
} elsif ($option eq 'policy') {
if ($value =~ /^{/) {
$value =~ s/:/=>/g;
$policy = eval($value);
warn "$config: $@" if ($@);
} else {
$policy = undef;
}
}
}
if ($check == 1 && !defined($policy)) {
print "$P: INVALID POLICY (use policy<{...}>) $config$options\n";
$total++;
$check = 0;
}
if ($check) {
# CONFIG_VERSION_SIGNATURE is dynamically set during the build
next if ($config eq "CONFIG_VERSION_SIGNATURE");
my $is = '-';
$is = $values{$config} if (defined $values{$config});
my $value = '-';
for my $which ("$arch-$flavour", "$arch-*", "*-$flavour", "$arch", "*") {
if (defined $policy->{$which}) {
$value = $policy->{$which};
last;
}
}
if ($is eq $value) {
$pass++;
} else {
print "$P: FAIL ($is != $value): $config$options\n";
$exit_val = $fail_exit;
}
$total++;
}
}
print "$P: $pass/$total checks passed -- exit $exit_val\n";
exit $exit_val;
-35
View File
@@ -1,35 +0,0 @@
#!/bin/bash
. debian/debian.env
# We have to be in the top level kernel source directory
if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then
echo "This does not appear to be the kernel source directory." 1>&2
exit 1
fi
. ${DEBIAN}/etc/kernelconfig
ARCH=$(echo $archs | tr " " "\n" | sort -u)
FLAVOUR=$(for arch in ${ARCH}; do
flavours=$(sed -ne 's/^flavours\s*=\s*\(.*\)$/\1/p' ${DEBIAN}/rules.d/${arch}.mk)
for flavour in ${flavours}; do
echo ${arch}-${flavour}
done
done | tr " " "\n" | sort -u)
while read line; do
(echo $line | grep -q '^#') || break
done
cat << EOF
# Menu: HEADER
# FORMAT: 4
# ARCH: $(echo ${ARCH})
# FLAVOUR: $(echo ${FLAVOUR})
EOF
while read line; do
echo ${line}
done
-218
View File
@@ -1,218 +0,0 @@
#!/bin/bash
. debian/debian.env
# Script to merge all configs and run 'make syncconfig' on it to wade out bad juju.
# Then split the configs into distro-commmon and flavour-specific parts
# We have to be in the top level kernel source directory
if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then
echo "This does not appear to be the kernel source directory." 1>&2
exit 1
fi
mode=${1:?"Usage: $0 (oldconfig|editconfig) [do_enforce_all]"}
do_enforce_all=${2:-0}
yes=0
case "$mode" in
update*configs) mode='syncconfig' ;;
default*configs) mode='oldconfig'; yes=1 ;;
edit*configs) ;; # All is good
gen*configs) mode='genconfigs' ;; # All is good
dump*configs) mode='config'; yes=1 ;;
*) echo "$0 called with invalid mode" 1>&2
exit 1 ;;
esac
if [ -z "$gcc" ]; then
echo "ERROR: gcc environment variable must be set"
exit 1
fi
kerneldir="`pwd`"
confdir="$kerneldir/${DEBIAN}/config"
variant="$2"
. $DEBIAN/etc/kernelconfig
bindir="`pwd`/${DROOT}/scripts/misc"
common_conf="$confdir/config.common.ubuntu"
tmpdir=`mktemp -d`
mkdir "$tmpdir/CONFIGS"
if [ "$mode" = "genconfigs" ]; then
keep=1
mode="oldconfig"
test -d CONFIGS || mkdir CONFIGS
fi
warning_partial=
for arch in $archs; do
rm -rf build
mkdir build
# Map debian archs to kernel archs
case "$arch" in
ppc64|ppc64el) kernarch="powerpc" ;;
amd64) kernarch="x86_64" ;;
lpia) kernarch="x86" ;;
sparc) kernarch="sparc64" ;;
armel|armhf) kernarch="arm" ;;
s390x) kernarch="s390" ;;
riscv64) kernarch="riscv" ;;
*) kernarch="$arch" ;;
esac
# Determine cross toolchain to use for Kconfig compiler tests
cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-"
# Arch-specific compiler, if any
archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc)
# Environment variables for 'make *config'. We omit CROSS_COMPILE
# for i386 since it is no longer supported after 19.04, however
# we maintain the configs for hwe.
modify_config=true
env="ARCH=$kernarch DEB_ARCH=$arch"
compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true)
if [ "$compiler_path" != '' ]; then
env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path"
else
echo "WARNING: ${cross_compile}gcc not installed"
modify_config=
warning_partial="$warning_partial $arch"
fi
archconfdir=$confdir/$arch
flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
# Merge configs
# We merge config.common.ubuntu + config.common.<arch> +
# config.flavour.<flavour>
for config in $flavourconfigs; do
fullconf="$tmpdir/$arch-$config-full"
case $config in
*)
: >"$fullconf"
if [ -f $common_conf ]; then
cat $common_conf >> "$fullconf"
fi
if [ -f $archconfdir/config.common.$arch ]; then
cat $archconfdir/config.common.$arch >> "$fullconf"
fi
cat "$archconfdir/$config" >>"$fullconf"
if [ -f $confdir/OVERRIDES ]; then
cat $confdir/OVERRIDES >> "$fullconf"
fi
;;
esac
done
for config in $flavourconfigs; do
if [ -f $archconfdir/$config ]; then
fullconf="$tmpdir/$arch-$config-full"
cat "$fullconf" > build/.config
# Call oldconfig or menuconfig
if [ "$modify_config" ]; then
case "$mode" in
editconfigs)
# Interactively edit config parameters
while : ; do
echo -n "Do you want to edit config: $arch/$config? [Y/n] "
read choice
case "$choice" in
y* | Y* | "" )
make O=`pwd`/build $conc_level $env menuconfig
break ;;
n* | N* )
# 'syncconfig' prevents
# errors for '-' options set
# in common config fragments
make O=`pwd`/build $conc_level $env syncconfig
break ;;
*)
echo "Entry not valid"
esac
done
;;
*)
echo "* Run $mode (yes=$yes) on $arch/$config ..."
if [ "$yes" -eq 1 ]; then
yes "" | make O=`pwd`/build $conc_level $env "$mode"
else
make O=`pwd`/build $conc_level $env "$mode"
fi ;;
esac
fi
cat build/.config > $archconfdir/$config
[ "$modify_config" ] && cat build/.config >"$tmpdir/CONFIGS/$arch-$config"
if [ "$keep" = "1" ]; then
cat build/.config > CONFIGS/$arch-$config
fi
else
echo "!! Config not found $archconfdir/$config..."
fi
done
echo "Running splitconfig.pl for $arch"
echo
# Can we make this more robust by avoiding $tmpdir completely?
# This approach was used for now because I didn't want to change
# splitconfig.pl
(cd $archconfdir; $bindir/splitconfig.pl config.flavour.*; mv config.common \
config.common.$arch; cp config.common.$arch $tmpdir)
done
rm -f $common_conf
# Now run splitconfig.pl on all the config.common.<arch> copied to
# $tmpdir
(cd $tmpdir; $bindir/splitconfig.pl *)
(
cd $confdir;
rm -f *-full
grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf
for arch in $archs; do
grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \
>$arch/config.common.$arch
done
)
echo ""
echo "Running config-check for all configurations ..."
echo ""
fail=0
for arch in $archs; do
archconfdir=$confdir/$arch
flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
for config in $flavourconfigs; do
flavour="${config##*.}"
if [ -f $archconfdir/$config ]; then
fullconf="$tmpdir/CONFIGS/$arch-$config"
[ ! -f "$fullconf" ] && continue
"$bindir/../checks/config-check" "$fullconf" "$arch" "$flavour" "$confdir" "0" "$do_enforce_all" || let "fail=$fail+1"
fi
done
done
rc=0
if [ "$fail" != 0 ]; then
rc=1
echo ""
echo "*** ERROR: $fail config-check failures detected"
echo ""
fi
rm -rf build
if [ "$warning_partial" ]; then
rc=1
echo ""
echo "WARNING: configuration operation applied only to a subset of architectures (skipped$warning_partial)" 1>&2
echo ""
fi
exit "${rc}"