linux/generate-config: disallow conflicting answers to choice questions (#531605)

This commit is contained in:
K900 2026-06-14 17:52:59 +00:00 committed by GitHub
commit 5972e93d5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -1420,13 +1420,10 @@ let
DRM_AMDGPU_USERPTR = yes;
# We want to prefer PREEMPT_LAZY when available, and fall back on PREEMPT_VOLUNTARY.
# It just so happens that kconfig asks for PREEMPT_LAZY first, so doing it like this
# does what we want.
# FIXME: This is stupid and bad.
# See: https://github.com/torvalds/linux/commit/7dadeaa6e851e7d67733f3e24fc53ee107781d0f
# The version cutoff is arbitrary, the real cutoff is somewhere around 6.13 depending on target.
PREEMPT = no;
PREEMPT_LAZY = option yes;
PREEMPT_VOLUNTARY = option yes;
PREEMPT_LAZY = whenAtLeast "6.18" yes;
PREEMPT_VOLUNTARY = whenOlder "6.18" yes;
X86_AMD_PLATFORM_DEVICE = lib.mkIf stdenv.hostPlatform.isx86 yes;
X86_PLATFORM_DRIVERS_DELL = lib.mkIf stdenv.hostPlatform.isx86 (whenAtLeast "5.12" yes);

View file

@ -100,7 +100,13 @@ sub runConfig {
elsif ($line =~ /choice\[(.*)\]: ###$/) {
my $answer = "";
foreach my $name (keys %choices) {
$answer = $choices{$name} if ($answers{$name} || "") eq "y";
if (($answers{$name} || "") eq "y") {
if ($answer eq "") {
$answer = $choices{$name};
} else {
die "conflicting answers!"
}
}
}
print STDERR "CHOICE: $1, ANSWER: $answer\n" if $debug;
print OUT "$answer\n" if $1 =~ /-/;