1

I've been attempting to build a custom kernel for the 2015.03 release with CONFIG_HOTPLUG_CPU disabled. Following a bunch of threads on this forum and elsewhere I've been able to build a new kernel RPM but the option I'm setting is not taking effect.

The steps so far are:

# Download the kernel source
/usr/bin/get_reference_source -p kernel-$(uname -r)

# Install some needed packages
/usr/bin/yum install -y gcc gcc44 system-rpm-config m4 rpm-build gdb xmlto asciidoc elfutils-devel zlib-devel binutils-devel python-devel perl gettext newt-devel perl-ExtUtils-Embed bison audit-libs-devel python27-devel pciutils-devel

# Add the mockbuild user which seems to be needed by the kernel source RPM
/usr/sbin/useradd mockbuild

# Install the source RPM
/bin/rpm -Uvh /usr/src/srpm/debug/kernel*.src.rpm

# Disable CONFIG_HOTPLUG_CPU
/bin/sed -i 's/HOTPLUG_CPU=y/HOTPLUG_CPU=n/' /usr/src/rpm/SOURCES/config*

# Set a custom build ID in the spec file
/bin/sed -i 's/buildid 31.38/buildid mybuild/' /usr/src/rpm/SPECS/kernel.spec

# Build the RPM
/usr/bin/rpmbuild -bb /usr/src/rpm/SPECS/kernel.spec

# Install the RPM
/usr/bin/yum localinstall /usr/src/rpm/RPMS/x86_64/kernel-3.14.42-31.38.tmo.amzn1.x86_64.rpm

From there I can see that the new kernel is indeed available on disk but CONFIG_HOTPLUG_CPU is still enabled:

$ grep HOTPLUG_CPU= /boot/config-3.14.mybuild*
/boot/config-3.14.42-mybuild.amzn1.x86_64:CONFIG_HOTPLUG_CPU=y
/boot/config-3.14.42-mybuild.amzn1.x86_64:CONFIG_ACPI_HOTPLUG_CPU=y

What else is needed to disable CONFIG_HOTPLUG_CPU and set up the new kernel?

1 Answer 1

1

I eventually solved this by extracting the kernel source, editing the config options, recreating the tarball. It looks like this:

# Extract the Kconfig file to change the kernel options
/bin/tar xfv /usr/src/rpm/SOURCES/linux-${vanilla_kernel}.tar linux-${vanilla_kernel}/arch/x86/Kconfig

# Change the options
/bin/sed -i '/ARCH_HIBERNATION_POSSIBLE/!b;n;c\\tdef_bool n' linux-${vanilla_kernel}/arch/x86/Kconfig
/bin/sed -i '/ARCH_SUSPEND_POSSIBLE/!b;n;c\\tdef_bool n' linux-${vanilla_kernel}/arch/x86/Kconfig
/bin/sed -i '/Support for hot-pluggable CPUs/!b;n;c\t\tdefault n' linux-${vanilla_kernel}/arch/x86/Kconfig

# Add the new Kconfig to the tarball
# There will now be two of these and the last one wins
/bin/tar rf /usr/src/rpm/SOURCES/linux-${vanilla_kernel}.tar linux-${vanilla_kernel}/arch/x86/Kconfig

# Change the build id to include our suffix
/bin/sed -i 's/\(buildid.*\)/\1\.mybuild/' /usr/src/rpm/SPECS/kernel.spec

# Build the new kernel RPM
/usr/bin/rpmbuild -bb /usr/src/rpm/SPECS/kernel.spec

This results in a new set of RPM and I can confirm that CONFIG_HOTPLUG_CPU is not enabled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .