Skip to contentSkip to conversation

kernel-configs: fix i386 configs

PATCH In review Eric Biggers 2 participants 3 messages Sep 7, 2018 – Oct 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-configs: fix i386 configs

From: Eric Biggers <[email protected]>

Commit 452331adc6c0 ("kernel-configs: enable virtio_9P and 9P_FS") removed the explicit unsetting of CONFIG_64BIT from some of the i386 kconfigs. So, they actually became x86_64. Fix it by syncing them back up with the x86_64 configs. I also added the script I used to do this.

---
 kernel-configs/i386-config-3.18     |  1 +
 kernel-configs/i386-config-4.1      |  5 +---
 kernel-configs/i386-config-4.14     |  3 +--
 kernel-configs/i386-config-4.4      |  4 +--
 kernel-configs/i386-config-4.9      |  3 +--
 kernel-configs/sync_i386_configs.sh | 38 +++++++++++++++++++++++++++++
 6 files changed, 43 insertions(+), 11 deletions(-)
 create mode 100755 kernel-configs/sync_i386_configs.sh
kernel-configs/i386-config-3.18 +1 -0
index 19eeff1..2dba879 100644
@@ -1,3 +1,4 @@
+# CONFIG_64BIT is not set
 CONFIG_LOCALVERSION="-xfstests"
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
kernel-configs/i386-config-4.1 +1 -4
index 2f3c689..0cad730 100644
@@ -1,3 +1,4 @@
+# CONFIG_64BIT is not set
 CONFIG_LOCALVERSION="-xfstests"
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -10,7 +11,6 @@ CONFIG_CGROUPS=y
 CONFIG_USER_NS=y
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_COMPAT_BRK is not set
-CONFIG_SLAB=y
 CONFIG_JUMP_LABEL=y
 CONFIG_SMP=y
 # CONFIG_X86_EXTENDED_PLATFORM is not set
@@ -43,7 +43,6 @@ CONFIG_INET_UDP_DIAG=y
 CONFIG_NETLINK_DIAG=y
 # CONFIG_WIRELESS is not set
 CONFIG_NET_9P=y
-CONFIG_NET_9P_VIRTIO=y
 CONFIG_DEVTMPFS=y
 CONFIG_MTD=y
 CONFIG_MTD_BLOCK2MTD=y
@@ -133,8 +132,6 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_PAGEALLOC=y
 CONFIG_DEBUG_OBJECTS=y
-CONFIG_DEBUG_SLAB=y
-CONFIG_DEBUG_SLAB_LEAK=y
 CONFIG_DEBUG_KMEMLEAK=y
 CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=3000
 CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
kernel-configs/i386-config-4.14 +1 -2
index 2deade0..ecb9cf6 100644
@@ -1,3 +1,4 @@
+# CONFIG_64BIT is not set
 CONFIG_LOCALVERSION="-xfstests"
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -138,8 +139,6 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_PAGEALLOC=y
 CONFIG_DEBUG_OBJECTS=y
-CONFIG_DEBUG_SLAB=y
-CONFIG_DEBUG_SLAB_LEAK=y
 CONFIG_DEBUG_KMEMLEAK=y
 CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=3000
 CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
kernel-configs/i386-config-4.4 +1 -3
index b21615a..38ede35 100644
@@ -1,3 +1,4 @@
+# CONFIG_64BIT is not set
 CONFIG_LOCALVERSION="-xfstests"
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -10,7 +11,6 @@ CONFIG_CGROUPS=y
 CONFIG_USER_NS=y
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_COMPAT_BRK is not set
-CONFIG_SLAB=y
 CONFIG_JUMP_LABEL=y
 CONFIG_SMP=y
 # CONFIG_X86_EXTENDED_PLATFORM is not set
@@ -138,8 +138,6 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_PAGEALLOC=y
 CONFIG_DEBUG_OBJECTS=y
-CONFIG_DEBUG_SLAB=y
-CONFIG_DEBUG_SLAB_LEAK=y
 CONFIG_DEBUG_KMEMLEAK=y
 CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=3000
 CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
kernel-configs/i386-config-4.9 +1 -2
index 324b6e6..f235cea 100644
@@ -1,3 +1,4 @@
+# CONFIG_64BIT is not set
 CONFIG_LOCALVERSION="-xfstests"
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -138,8 +139,6 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_PAGEALLOC=y
 CONFIG_DEBUG_OBJECTS=y
-CONFIG_DEBUG_SLAB=y
-CONFIG_DEBUG_SLAB_LEAK=y
 CONFIG_DEBUG_KMEMLEAK=y
 CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=3000
 CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
kernel-configs/sync_i386_configs.sh new file +38 -0
new file mode 100755
index 0000000..2d75d64
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Generate the i386 configs from the x86_64 ones.
+
+set -e -u
+
+KCONFIGS_DIR=$(realpath "$(dirname "$0")")
+: "${LINUX_DIR:=$HOME/linux}"
+
+version_at_least()
+{
+    local cur_ver=$1
+    local want_ver=$2
+    [ "$(echo -e "$cur_ver\n$want_ver" | sort -V | head -n1)" = "$want_ver" ]
+}
+
+cd "$KCONFIGS_DIR"
+versions=$(echo x86_64-config-* | sed 's/x86_64-config-//g')
+
+cd "$LINUX_DIR"
+for vers in $versions; do
+    git checkout "stable/linux-$vers.y"
+    if version_at_least "$vers" 3.9; then
+	unset ARCH
+	echo '# CONFIG_64BIT is not set' > .config
+    else
+	export ARCH=i386
+	echo > .config
+    fi
+    cat "$KCONFIGS_DIR/x86_64-config-$vers" >> .config
+    if version_at_least "$vers" 3.7; then
+	make olddefconfig
+    else
+	make oldnoconfig
+    fi
+    make savedefconfig
+    cp -v defconfig "$KCONFIGS_DIR/i386-config-$vers"
+done
Signature · 1 line
2.19.0.rc2.392.g5ba43deb5a-goog
#1 lore raw
Quoted 8 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Commit 452331adc6c0 ("kernel-configs: enable virtio_9P and 9P_FS") removed the explicit unsetting of CONFIG_64BIT from some of the i386 kconfigs. So, they actually became x86_64. Fix it by syncing them back up with the x86_64 configs. I also added the script I used to do this.

Quoted 10 lines
---
 kernel-configs/i386-config-3.18     |  1 +
 kernel-configs/i386-config-4.1      |  5 +---
 kernel-configs/i386-config-4.14     |  3 +--
 kernel-configs/i386-config-4.4      |  4 +--
 kernel-configs/i386-config-4.9      |  3 +--
 kernel-configs/sync_i386_configs.sh | 38 +++++++++++++++++++++++++++++
 6 files changed, 43 insertions(+), 11 deletions(-)
 create mode 100755 kernel-configs/sync_i386_configs.sh

Hi Ted, are you planning to apply this? Thanks!

- Eric

#2 lore raw
In reply to Eric Biggers
Quoted 6 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Commit 452331adc6c0 ("kernel-configs: enable virtio_9P and 9P_FS") removed the explicit unsetting of CONFIG_64BIT from some of the i386 kconfigs. So, they actually became x86_64. Fix it by syncing them back up with the x86_64 configs. I also added the script I used to do this.

The explicit "CONFIG_64BIT is not set" is actually not necessary if you specify ARCH=i386 in the make command --- and in the latest kernel, using ARCH=i386 in the command line is actually required. There was a discussion about this on LKML a few months. I use an explicit ARCH=i386 to build 32-bit kernels in my build scripts, since it's needed for the latest kernels, and if you use ARCH=i386 in the command line, "make savedefconfig" doesn't include the CONFIG_64BIT:

% kbuild32 savedefconfig
make[1]: Entering directory '/build/ext4-3.18'
GEN ./Makefile
scripts/kconfig/conf --savedefconfig=defconfig Kconfig make[1]: Leaving directory '/build/ext4-3.18'

real    0m0.715s
user    0m0.492s
sys     0m0.251s

% grep CONFIG_64BIT /build/ext4-3.18/.config
# CONFIG_64BIT is not set
% grep -c CONFIG_64BIT /build/ext4-3.18/defconfig
0

... where kbuild32 does:

time nice make O="$BLD_DIR_32" ARCH=i386 -j$N $*

As a result, your script isn't going to actually guarantee the CONFIG_64BIT is explicitly unset in the defconfig. (In fact, I have a similar script, called "update-kernel-config" which is in the META branch, and I used it to automate the generation of the defconfigs in commit 452331adc6c0. Check out the META branch if you're curious how I do my automated build and release.)

Bottom line: depending on the explicit unset of CONFIG_64BIT won't work on more modern kernels, so future build scripts will need to explicitly use ARCH=i386 in the make command. (I'll attach my kbuild and kbuild32 scripts in case you are interested.) Still, I don't mind adding the explicit unsetting of CONFIG_64BIT to the kernel configs, since they are harmless and they will work for the more modern kernels. But the kernel sync scripts will to explicitly add the CONFIG_64BIT unset line if it's not there.

Cheers,

- Ted

#!/bin/bash

# N=$(($(getconf _NPROCESSORS_ONLN) / 2))
N=$(($(getconf _NPROCESSORS_ONLN) * 1))

mkdir -p .git/kbuild
if test -f .git/kbuild/config ; then
. .git/kbuild/config
elif test -f .git/kbuild.conf ; then
. .git/kbuild.conf
mv .git/kbuild.conf .git/kbuild/config
else
echo "Missing kbuild configuration file!"
exit 1
fi

if test -z "$BLD_DIR_32" ; then
echo "No BLD_DIR_32 directory"
exit 1
fi

if test ! -d "$BLD_DIR_32" ; then

    mkdir -p "$BLD_DIR_32"
    if test -f .git/kbuild/kernel-config ; then
	cp .git/kbuild/kernel-config-32 "$BLD_DIR_32/.config"
    fi
    for i in x509.genkey signing_key.pem signing_key.x509
    do
	if test -f ".git/kbuild/$i" ; then
	    mkdir -p "$BLD_DIR_32/certs"
	    cp ".git/kbuild/$i" "$BLD_DIR_32/certs"
	fi
    done

fi

time nice make O="$BLD_DIR_32" ARCH=i386 -j$N $*

cp "$BLD_DIR_32/.config" .git/kbuild/kernel-config-32 for i in x509.genkey signing_key.pem signing_key.x509 do

    if test -f "$BLD_DIR_32/certs/$i" ; then
	    cp "$BLD_DIR_32/certs/$i" .git/kbuild
    fi

done

#!/bin/bash

# N=$(($(getconf _NPROCESSORS_ONLN) / 2))
N=$(($(getconf _NPROCESSORS_ONLN) * 1))

mkdir -p .git/kbuild
if test -f .git/kbuild/config ; then
. .git/kbuild/config
elif test -f .git/kbuild.conf ; then
. .git/kbuild.conf
mv .git/kbuild.conf .git/kbuild/config
else
echo "Missing kbuild configuration file!"
exit 1
fi

if test ! -d "$BLD_DIR" ; then
mkdir -p "$BLD_DIR"
if test -f .git/kbuild/kernel-config ; then
cp .git/kbuild/kernel-config "$BLD_DIR/.config"
fi
for i in x509.genkey signing_key.pem signing_key.x509 do
if test -f ".git/kbuild/$i" ; then
mkdir -p "$BLD_DIR/certs"
cp ".git/kbuild/$i" "$BLD_DIR/certs"
fi
done
fi

time nice make O="$BLD_DIR" ARCH=${KERN_ARCH:-x86_64} -j$N $*

cp "$BLD_DIR/.config" .git/kbuild/kernel-config for i in x509.genkey signing_key.pem signing_key.x509 do
if test -f "$BLD_DIR/certs/$i" ; then
cp "$BLD_DIR/certs/$i" .git/kbuild
fi
done