[PATCH] Check generated config files
by Miguel A. Flores Silverio
Double check configuration files in order to avoid discrepancies
like this: https://bugzilla.redhat.com/show_bug.cgi?id=1347454
Signed-off-by: Miguel Flores Silverio <floresmigu3l(a)gmail.com>
These are the steps or stages I understood to take part in the
process of generating the config files to build the diffent kernels.
Stage 1: Copy required files
Copy all the config files and merge.pl in the tree to the
directory with the vanilla version of the kernel
Stage 2: Generate config files dynamically
Dynamically create the config files for the different
architectures and kernel version. The recipe for each of one
the config files is in Makefile.config which uses merge.pl. The
latter takes two config files at a time and its only purpose
is to put them together. The resulting config files are a combination
of config-generic,config-[cpu arch]-generic and config-[cpu arch]-debug
with the name kernel-[kernel version]-[cpu arch].config
Stage 3: Apply any local configs
After all the different config files are generated, if there
are any configuration options in config-local, using merge.pl
apply them to the generated config files.
Stage 4: oldconfig over generated files
for each of the generated configs rename as .config and run
listnewconfigs to find any new config options. Any new options
are saved in .newoptions. If .newoptions contains anything, display
them and stop the compilation. If there are no new options, run
oldnoconfig(?). The resulting .config file is then renamed back and
copied to the configs directory.
Stage 5: Final config
At compilation time the right config file is grabed and copied
to .config and used as the final config file to build the kernel.
My initial approach was to use grep and nested loops which added
several lines to spec file. I also decided to check the config
files at Stage 5, right before compilation.
The spec file is already very complex as it is. I think
it appropiate to keep the solution as short and sweet as possible. So
I am reaching to the Fedora kernel wizards for guidance \o/
---
kernel.spec | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel.spec b/kernel.spec
index 6bab535..8bcf44f 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1278,6 +1278,12 @@ cp_vmlinux()
eu-strip --remove-comment -o "$2" "$1"
}
+CheckConfigs() {
+ generated_config=$1
+ final_config=$2
+ diff -s "$generated_config" "$final_config"
+}
+
BuildKernel() {
MakeTarget=$1
KernelImage=$2
@@ -1314,12 +1320,10 @@ BuildKernel() {
perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
%endif
%endif
-
+ CheckConfigs configs/$Config .config
# and now to start the build process
-
make -s mrproper
cp configs/$Config .config
-
%if %{signkernel}%{signmodules}
cp %{SOURCE11} certs/.
%endif
--
2.7.4
7 years, 8 months
[PATCHv3] Script to highlight state of patches in tree
by Miguel A. Flores Silverio
The intent for this script is to make easier patch management
and documentation.
Signed-off-by: Miguel Flores Silverio <floresmigu3l(a)gmail.com>
* PATCHv1
- use colors to highlight the patch location
- different flags to list patches in PatchList.txt kernl.spec
* PATCHv2
- Fix: match flags with functionality accordignly
- Uses characters instead of colors to identify each patch
not all consoles support color.
- adds extra flag to show patches that are prsent in the tree but
not recorded in PatchList.txt nor kernel.spec
* PATCHv3
- Fix: Logic missing condition for patches in tree recorded in
PatchList.txt but missing in kernel.spec
- Add: Option for patches present in the tree but only recorded in
PatchList.txt
---
scripts/check-patchlist.sh | 113 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
create mode 100755 scripts/check-patchlist.sh
diff --git a/scripts/check-patchlist.sh b/scripts/check-patchlist.sh
new file mode 100755
index 0000000..c8c4d79
--- /dev/null
+++ b/scripts/check-patchlist.sh
@@ -0,0 +1,113 @@
+#! /bin/sh
+# This script was created in a effort to make patch management a bit easier.
+# It list all the patches in the current tree and identifies if they are
+# present in the kernel.spec, PatchList.txt, both files or neither.
+#
+# eg. ./check-patchlist.sh [optional flag]
+
+function usage(){
+ echo "List all the patches currently in the tree. It also helps identify"
+ echo "if the patch is present in kernel.spec or PatchList.txt. "
+ echo "-h, --help "
+ echo "-t, --tracked patches in both kernel.spec and PatchList.txt "
+ echo "-p, --patchlist patches added to PatchList.txt. "
+ echo "-s, --specfile patches added to kernel.spec. "
+ echo "-n, --not-tracked patches int the tree but not in PatchList.txt "
+ echo " nor kernel.spec "
+}
+
+BASEDIR=$(dirname "$( cd $(dirname $BASH_SOURCE[0]) && pwd)")
+pushd $BASEDIR > /dev/null
+
+function list_all(){
+ echo "===========Legend==========================="
+ echo ". In kernel.spec "
+ echo "* In PatchList.txt "
+ echo "+ In PatchList.txt & Kernel.spec "
+ echo "- Neither in PatchList.txt nor kernel.spec"
+ echo "============================================"
+ for patch in $(ls *.patch); do
+ if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+ then
+ echo "+ ${patch}" # Patches in kernel.spec and PatchList.txt
+
+ elif [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+ then
+ echo "* ${patch}" # Patches in PatchList.txt but not in kernel.spec
+
+ elif [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+ then
+ echo ". ${patch}" # Patches in kernel.spec but not in PatchList.txt
+
+ else
+ echo "- ${patch}" # Neither in PatchList.txt nor kernel.spec
+
+ fi
+ done
+}
+
+function list_present_not_added(){
+ for patch in $(ls *.patch); do
+ if [ -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+ then
+ echo $patch
+ fi
+ done
+}
+
+function list_present_added(){
+ for patch in $(ls *.patch); do
+ if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+ then
+ echo $patch
+ fi
+ done
+}
+
+function list_patchList(){
+ for patch in $(ls *.patch); do
+ if [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+ then
+ echo $patch
+ fi
+ done
+
+}
+function list_specfile(){
+ for patch in $(ls *.patch); do
+ if [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+ then
+ echo $patch
+ fi
+ done
+}
+
+if [ -z "$@" ]; then
+ list_all
+else
+
+ for opt in "$@"; do
+ case $opt in
+ -t|--tracked)
+ list_present_added
+ ;;
+ -s|--specfile)
+ list_specfile
+ ;;
+ -h|--help)
+ usage
+ ;;
+ -n|--not-added)
+ list_present_not_added
+ ;;
+ -p|--patchlist)
+ list_patchList
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ done
+fi
+
+popd > /dev/null
--
2.7.4
7 years, 8 months
slub debug
by Chris Murphy
[root@f24m ~]# grep SLUB_DEBUG /boot/config-4.8.0-0.rc1.git0.1.fc25.x86_64
CONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
When I boot with slub_debug=1, I get this at boot time:
[ 0.000000] slub_debug option '1' unknown. skipped
https://fedoraproject.org/wiki/KernelDebugStrategy says under Release section:
In addition, SLUB_DEBUG is enabled, but by default is inactive. You
need to boot with slub_debug=1 to make it perform its usual checks.
https://www.kernel.org/doc/Documentation/vm/slub.txt suggests multiple
possible options, but I'm not sure which one(s) make it boot
functionally like a debug kernel.
--
Chris Murphy
7 years, 8 months
error building master branch
by Devon Miller
I am encountering compile errors building off master. My build system is f24. Any thoughts? I did some google searches but could not find anyone else that had the same problem.
One of the errors is below:
pushd tools/iio/
~/proj/kernel/kernel-4.7.fc26/linux-4.8.0-0.rc0.git7.2.local.fc26.x86_64/tools/iio ~/proj/kernel/kernel-4.7.fc26/linux-4.8.0-0.rc0.git7.2.local.fc26.x86_64
+ make
make[1]: Entering directory '/home/me/proj/kernel/kernel-4.7.fc26/linux-4.8.0-0.rc0.git7.2.local.fc26.x86_64/tools/iio'
gcc -Wall -g -D_GNU_SOURCE -c -o iio_event_monitor.o iio_event_monitor.c
iio_event_monitor.c:58:3: error: 'IIO_PH' undeclared here (not in a function)
[IIO_PH] = "ph",
7 years, 8 months
fedora.git upstream 0-Day build testing
by Josh Boyer
Hi kernel people,
Recently the upstream 0-Day build testing project started building the
exploded kernel git tree for Fedora on kernel.org:
https://git.kernel.org/cgit/linux/kernel/git/jwboyer/fedora.git/
That was somewhat of a surprise. It has found a few things here and
there, mostly in building for configurations or architectures that
Fedora does not support. Sometimes this causes maintainers to be
mailed about build failures somewhat unexpectedly. The most recent
case as the crash driver on openrisc.
The 0-Day maintainer said they can disable it, but I wanted to run it
past the team first. I can see value in doing it, even if it isn't
directly applicable to Fedora itself at the moment. Thoughts?
josh
7 years, 8 months
[PATCH] kenrel.spec: Fix up mixed indents
by Jason L Tibbitts III
[Sorry about the annoying nature of these patches, but you have to start
somewhere....]
There are several instances of mixed spaces and tabs throughout the
kernel. This makes vim yell and rpmlint complain, so....
It doesn't look like there was any consistency in the expected tab widths
used, so I just tried to line things up as it appears to have been
intended.
---
kernel.spec | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/kernel.spec b/kernel.spec
index d381d31..4a90d20 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1270,7 +1270,7 @@ cd ..
# This affects the vDSO images in vmlinux, and the vmlinux image in bzImage.
export AFTER_LINK=\
'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \
- -i $@ > $@.id"'
+ -i $@ > $@.id"'
%endif
cp_vmlinux()
@@ -1367,7 +1367,7 @@ BuildKernel() {
mv vmlinuz.signed $KernelImage
%endif
$CopyKernel $KernelImage \
- $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
+ $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName
@@ -1516,13 +1516,13 @@ BuildKernel() {
}
collect_modules_list networking \
- 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
+ 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
collect_modules_list block \
- 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
+ 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
collect_modules_list drm \
- 'drm_open|drm_init'
+ 'drm_open|drm_init'
collect_modules_list modesetting \
- 'drm_crtc_init'
+ 'drm_crtc_init'
# detect missing or incorrect license tags
( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \
@@ -1553,9 +1553,9 @@ BuildKernel() {
# Find all the module files and filter them out into the core and modules
# lists. This actually removes anything going into -modules from the dir.
find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list
- cp $RPM_SOURCE_DIR/filter-*.sh .
+ cp $RPM_SOURCE_DIR/filter-*.sh .
%{SOURCE99} modules.list %{_target_cpu}
- rm filter-*.sh
+ rm filter-*.sh
# Run depmod on the resulting module tree and make sure it isn't broken
depmod -b . -aeF ./System.map $KernelVer &> depmod.out
@@ -1760,7 +1760,7 @@ make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
find $RPM_BUILD_ROOT/usr/include \
\( -name .install -o -name .check -o \
- -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
+ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
%endif
@@ -1770,7 +1770,7 @@ make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers headers_in
find $RPM_BUILD_ROOT/usr/tmp-headers/include \
\( -name .install -o -name .check -o \
- -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
+ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
# Copy all the architectures we care about to their respective asm directories
for arch in arm arm64 powerpc s390 x86 ; do
--
2.7.4
7 years, 8 months
[PATCH] kernel.spec: Fix build dep on libelf-devel
by Jason L Tibbitts III
The dependency on libelf-devel is wrapped in "%if %{with_perf}".
However, if you're building without perf (as fast-build.sh does) then
you don't have this installed and the build will complain:
Makefile:1037: "Cannot use CONFIG_STACK_VALIDATION, please install
libelf-dev, libelf-devel or elfutils-libelf-devel"
This just lifts the dependency out of the %if section.
---
kernel.spec | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel.spec b/kernel.spec
index 69cf5d5..90bd832 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -373,12 +373,12 @@ Requires: kernel-modules-uname-r = %{KVERREL}%{?variant}
BuildRequires: kmod, patch, bash, sh-utils, tar, git
BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc
-BuildRequires: net-tools, hostname, bc
+BuildRequires: net-tools, hostname, bc, elfutils-devel
%if %{with_sparse}
BuildRequires: sparse
%endif
%if %{with_perf}
-BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison flex xz-devel
+BuildRequires: zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison flex xz-devel
BuildRequires: audit-libs-devel
%ifnarch s390 s390x %{arm}
BuildRequires: numactl-devel
--
2.7.4
7 years, 8 months
[PATCH] Clean up trailing whitespace
by Jason L Tibbitts III
There are a few instances if trailing whitespace throughout the spec.
It's not uncommon for editors to yell about this (such as vim with
syntastic running rpmlint) and the yelling can be annoying so...
---
kernel.spec | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel.spec b/kernel.spec
index 90bd832..d381d31 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -341,7 +341,7 @@ Summary: The Linux kernel
%endif
# Architectures we build tools/cpupower on
-%define cpupowerarchs %{ix86} x86_64 %{power64} %{arm} aarch64
+%define cpupowerarchs %{ix86} x86_64 %{power64} %{arm} aarch64
#
# Packages that need to be installed before the kernel is, because the %%post
@@ -947,7 +947,7 @@ on kernel bugs, as some of these options impact performance noticably.
# And finally the main -core package
%define variant_summary The Linux kernel
-%kernel_variant_package
+%kernel_variant_package
%description core
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system. The kernel handles the basic functions
@@ -2133,7 +2133,7 @@ fi
# plz don't put in a version string unless you're going to tag
# and build.
#
-#
+#
%changelog
* Thu Aug 04 2016 Laura Abbott <labbott(a)redhat.com> - 4.8.0-0.rc0.git6.1
- Linux v4.7-11544-g96b5852
@@ -2383,7 +2383,7 @@ fi
* Wed May 18 2016 Laura Abbott <labbott(a)redhat.com> - 4.7.0-0.rc0.git3.1
- Linux v4.6-3623-g0b7962a
- ata, regulator, gpio, HID, livepatching, networking, dm, block, vfs, fs,
- timers, crypto merges
+ timers, crypto merges
* Tue May 17 2016 Laura Abbott <labbott(a)redhat.com> - 4.7.0-0.rc0.git2.2
- Adjust solib for cpupower
@@ -2716,7 +2716,7 @@ fi
- Reenable debugging options.
* Tue Mar 08 2016 Thorsten Leemhuis <fedora(a)leemhuis.info>
-- add signkernel macro to make signing kernel and signing modules
+- add signkernel macro to make signing kernel and signing modules
independent from each other
- sign modules on all archs
@@ -3672,7 +3672,7 @@ fi
- Inital ARM updates for 4.1
- Temporarily disable AMD ARM64 xgbe-a0 driver
-* Wed Apr 22 2015 Josh Boyer <jwboyer(a)fedoraproject.org>
+* Wed Apr 22 2015 Josh Boyer <jwboyer(a)fedoraproject.org>
- Linux v4.0-9804-gdb4fd9c5d072
* Tue Apr 21 2015 Josh Boyer <jwboyer(a)fedoraproject.org> - 4.1.0-0.rc0.git11.1
@@ -3907,7 +3907,7 @@ fi
- kernel-arm64.patch merge, but leave it off.
- kernel-arm64-fix-psci-when-pg.patch: when -pg (because of ftrace) is enabled
we must explicitly annotate which registers should be assigned, otherwise
- gcc will do unexpected things behind our backs.
+ gcc will do unexpected things behind our backs.
* Tue Feb 17 2015 Josh Boyer <jwboyer(a)fedoraproject.org> - 3.20.0-0.rc0.git7.1
- Linux v3.19-7478-g796e1c55717e
--
2.7.4
7 years, 8 months
[PATCHv5] update script to add a new patch
by Miguel A. Flores Silverio
It enables the builid macro and uses the name of the patch as
label instead of using rpmdev-bumpspec.
Signed-off-by: Miguel Flores Silverio <floresmigu3l(a)gmail.com>
---
* PATCHv2
- Fix: Fail adding a patch with no description
- Fix: Fail to add a patch outside the tree
- Fix: Fail when adding a patch already in the tree directory
- Fix: Fail to add to git when running script outside tree
- enables the buildid and changes it to the patch name being added
* PATCHv3
- replaces "-" [dash] with "_"[uder score] to use patch name
as builid
* PATCHv4
- changed mv for cp
- Fix: conflicts when applying to rawhide
* PATCHv5
- Fix: conflicts when applying to rawhide
scripts/newpatch.sh | 55 ++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 38 insertions(+), 17 deletions(-)
diff --git a/scripts/newpatch.sh b/scripts/newpatch.sh
index 0dc2e83..2d74986 100755
--- a/scripts/newpatch.sh
+++ b/scripts/newpatch.sh
@@ -1,21 +1,42 @@
#!/bin/sh
-# Easy application of new patches.
-# Always adds to the very end. (Bumps last patch nr by 100)
-# Parameters:
-# $1 - patch filename
-# $2 - description
-OLD=$(grep ^Patch kernel.spec | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://)
-NEW=$(($OLD/100*100+100))
+# Facilitates the addition of a new patch to the source tree.
+# -- Moves patch to tree
+# -- Adds patch to kernel.spec list of patches
+# -- Adds patch to git
+# -- change buildid macro to the name of the patch being added
-sed -i "/^Patch$OLD:\ /a#\ $2\nPatch$NEW:\ $1" kernel.spec
-
-LAST=$(grep ^ApplyPatch kernel.spec | tail -n1 | awk '{ print $2 }')
-
-sed -i "/^ApplyPatch $LAST/aApplyPatch $1" kernel.spec
-
-cvs add $1
-
-scripts/bumpspecfile.py kernel.spec "- $2"
-make clog
+# Base directory is relative to where the script is.
+BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")"
+pushd $BASEDIR > /dev/null
+# Check for at least patch
+if [ "$#" -lt 1 ]; then
+ echo "usage: $0 [ /path/to/patch/ ] [ description ]"
+ exit 1
+fi
+PATCHDIR=$1
+DESC=$2
+PATCH="$(basename "$PATCHDIR")"
+# Kernel.spec file in the current tree
+SPECFILE="$BASEDIR/kernel.spec"
+# If adding patch from outside the source tree move it to the source tree
+if [ -z "$(ls | grep $PATCH)" ]; then
+ cp $PATCHDIR $BASEDIR/
+fi
+if [ ! -z "$(grep $PATCH $SPECFILE)" ]
+then
+ echo "$PATCH already in kernel.spec"
+ exit 1
+fi
+# ID number of the last patch in kernel.spec
+LPATCH_ID=$(grep ^Patch $SPECFILE | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://)
+# ID of the next patch to be added to kernel.spec
+NPATCH_ID=$(($LPATCH_ID + 1 ))
+# Add patch with new id at the end of the list of patches
+sed -i "/^Patch$LPATCH_ID:\ /a#\ $DESC\nPatch$NPATCH_ID:\ $PATCH" $SPECFILE
+# Add it to git
+git add $PATCH
+BUILDID_PATCH="$(echo $PATCH | sed 's/\-/\_/g' )"
+sed -i "s/^.*define buildid .*$/%define buildid .$BUILDID_PATCH/" $SPECFILE
+popd > /dev/null
--
2.7.4
7 years, 8 months