diff options
-rw-r--r-- | gitrev | 2 | ||||
-rw-r--r-- | kernel.spec | 274 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 202 insertions, 75 deletions
@@ -1 +1 @@ -0e2adab6cf285c41e825b6c74a3aa61324d1132c +3b7c59a1950c75f2c0152e5a9cd77675b09233d6 diff --git a/kernel.spec b/kernel.spec index 56ae624a3..e9068ac6d 100644 --- a/kernel.spec +++ b/kernel.spec @@ -8,15 +8,20 @@ Summary: The Linux kernel # be 0. %global released_kernel 0 -# Sign modules on x86. Make sure the config files match this setting if more -# architectures are added. +# Signing for secure boot authentication %ifarch %{ix86} x86_64 %global signkernel 1 -%global signmodules 1 -%global zipmodules 1 %else %global signkernel 0 +%endif + +# Sign modules on all arches %global signmodules 1 + +# Compress modules only for architectures that build modules +%ifarch noarch +%global zipmodules 0 +%else %global zipmodules 1 %endif @@ -79,7 +84,7 @@ Summary: The Linux kernel # The rc snapshot level %global rcrev 4 # The git snapshot level -%define gitrev 0 +%define gitrev 1 # Set rpm version accordingly %define rpmversion 5.%{upstream_sublevel}.0 %endif @@ -100,6 +105,8 @@ Summary: The Linux kernel %define with_pae %{?_without_pae: 0} %{?!_without_pae: 1} # kernel-debug %define with_debug %{?_with_debug: 1} %{?!_with_debug: 0} +# kernel-doc +%define with_doc %{?_without_doc: 0} %{?!_without_doc: 1} # kernel-headers %define with_headers %{?_without_headers: 0} %{?!_without_headers: 1} %define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers: 1} @@ -129,10 +136,13 @@ Summary: The Linux kernel # verbose build, i.e. no silent rules and V=1 %define with_verbose %{?_with_verbose: 1} %{?!_with_verbose: 0} +# gcov support +%define with_gcov %{?_with_gcov: 1} %{?!_with_gcov: 0} + # Set debugbuildsenabled to 1 for production (build separate debug kernels) # and 0 for rawhide (all kernels are debug kernels). # See also 'make debug' and 'make release'. -%define debugbuildsenabled 1 +%define debugbuildsenabled 0 # Kernel headers are being split out into a separate package %if 0%{?fedora} @@ -179,6 +189,15 @@ Summary: The Linux kernel # The kernel tarball/base version %define kversion 5.%{base_sublevel} + +# turn off debug kernel and kabichk for gcov builds +%if %{with_gcov} +%define with_debug 0 +%define with_kabichk 0 +%define with_kabidupchk 0 +%define with_kabidwchk 0 +%endif + %define make_target bzImage %define image_install_path boot @@ -244,6 +263,12 @@ Summary: The Linux kernel # Overrides for generic default options +# only package docs noarch +%ifnarch noarch +%define with_doc 0 +%define doc_build_fail true +%endif + # don't do debug builds on anything but i686 and x86_64 %ifnarch i686 x86_64 %define with_debug 0 @@ -392,11 +417,17 @@ Requires: kernel-modules-uname-r = %{KVERREL}%{?variant} BuildRequires: kmod, patch, bash, tar, git-core BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex -BuildRequires: net-tools, hostname, bc, elfutils-devel, gcc-plugin-devel +BuildRequires: net-tools, hostname, bc, elfutils-devel %if 0%{?fedora} # Used to mangle unversioned shebangs to be Python 3 BuildRequires: /usr/bin/pathfix.py %endif +%if %{with_headers} +BuildRequires: rsync +%endif +%if %{with_doc} +BuildRequires: xmlto, asciidoc, python3-sphinx +%endif %if %{with_sparse} BuildRequires: sparse %endif @@ -616,6 +647,17 @@ AutoReq: no\ AutoProv: yes\ %{nil} +%package doc +Summary: Various documentation bits found in the kernel source +Group: Documentation +%description doc +This package contains documentation files from the kernel +source. Various bits of information about the Linux kernel and the +device drivers shipped with it are documented in these files. + +You'll want to install this package if you need a reference to the +options that can be passed to Linux kernel modules at load time. + %package headers Summary: Header files for the Linux kernel for use by glibc Obsoletes: glibc-kernheaders < 3.0-46 @@ -648,6 +690,13 @@ Provides: installonlypkg(kernel) This package is required by %{name}-debuginfo subpackages. It provides the kernel source files common to all builds. +%if %{with_gcov} +%package gcov +Summary: gcov graph and source files for coverage data collection. +%description gcov +kernel-gcov includes the gcov graph and source files for gcov coverage collection. +%endif + # # This macro creates a kernel-<subpackage>-debuginfo package. # %%kernel_debuginfo_package <subpackage> @@ -793,7 +842,6 @@ Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc. - %prep # do a few sanity-checks for --with *only builds %if %{with_baseonly} @@ -993,6 +1041,29 @@ mv COPYING COPYING-%{version} # This Prevents scripts/setlocalversion from mucking with our version numbers. touch .scmversion +%if 0%{?fedora} +# Mangle /usr/bin/python shebangs to /usr/bin/python3 +# Mangle all Python shebangs to be Python 3 explicitly +# -p preserves timestamps +# -n prevents creating ~backup files +# -i specifies the interpreter for the shebang +# This fixes errors such as +# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly. +# We patch all sources below for which we got a report/error. +pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \ + tools/kvm/kvm_stat/kvm_stat \ + scripts/show_delta \ + scripts/diffconfig \ + scripts/bloat-o-meter \ + scripts/tracing/draw_functrace.py \ + scripts/spdxcheck.py \ + tools/perf/tests/attr.py \ + tools/perf/scripts/python/stat-cpi.py \ + tools/perf/scripts/python/sched-migration.py \ + Documentation \ + scripts/gen_compile_commands.py +%endif + # Deal with configs stuff mkdir configs cd configs @@ -1035,17 +1106,13 @@ done rm -f kernel-%{version}-*debug.config %endif -%define make make %{?cross_opts} - -CheckConfigs() { - ./check_configs.awk $1 $2 > .mismatches - if [ -s .mismatches ] - then - echo "Error: Mismatches found in configuration files" - cat .mismatches - exit 1 - fi -} +# enable GCOV kernel config options if gcov is on +%if %{with_gcov} +for i in *.config +do + sed -i 's/# CONFIG_GCOV_KERNEL is not set/CONFIG_GCOV_KERNEL=y\nCONFIG_GCOV_PROFILE_ALL=y\n/' $i +done +%endif cp %{SOURCE42} . OPTS="" @@ -1069,18 +1136,6 @@ find . \( -name "*.orig" -o -name "*~" \) -delete >/dev/null # remove unnecessary SCM files find . -name .gitignore -delete >/dev/null -%if 0%{?fedora} -# Mangle /usr/bin/python shebangs to /usr/bin/python3 -# Mangle all Python shebangs to be Python 3 explicitly -# -p preserves timestamps -# -n prevents creating ~backup files -# -i specifies the interpreter for the shebang -pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/ -pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/diffconfig -pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/bloat-o-meter -pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/show_delta -%endif - cd .. ### @@ -1118,6 +1173,8 @@ cp_vmlinux() %define build_hostldflags %{?build_ldflags} -Wl,--build-id=uuid %endif +%define make make %{?cross_opts} %{?make_opts} %{?_smp_mflags} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" + BuildKernel() { MakeTarget=$1 KernelImage=$2 @@ -1126,6 +1183,8 @@ BuildKernel() { Flav=${Flavour:++${Flavour}} InstallName=${5:-vmlinuz} + DoModules=1 + # Pick the right config file for the kernel we're building Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config DevelDir=/usr/src/kernels/%{KVERREL}${Flav} @@ -1160,7 +1219,7 @@ BuildKernel() { # and now to start the build process - make %{?make_opts} mrproper + %{make} mrproper cp configs/$Config .config %if %{signkernel}%{signmodules} @@ -1170,12 +1229,16 @@ BuildKernel() { Arch=`head -1 .config | cut -b 3-` echo USING ARCH=$Arch - make %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch olddefconfig + KCFLAGS="%{?kcflags}" + + %{make} ARCH=$Arch olddefconfig >/dev/null # This ensures build-ids are unique to allow parallel debuginfo perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config - %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags} - %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1 + %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" $MakeTarget %{?sparse_mflags} %{?kernel_mflags} + if [ $DoModules -eq 1 ]; then + %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" modules %{?sparse_mflags} || exit 1 + fi mkdir -p $RPM_BUILD_ROOT/%{image_install_path} mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer @@ -1184,7 +1247,8 @@ BuildKernel() { %endif %ifarch %{arm} aarch64 - %{make} %{?make_opts} ARCH=$Arch dtbs dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer + %{make} ARCH=$Arch dtbs INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer + %{make} ARCH=$Arch dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb find arch/$Arch/boot/dts -name '*.dtb' -type f -delete %endif @@ -1223,18 +1287,29 @@ BuildKernel() { sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac; cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac - # Override $(mod-fw) because we don't want it to install any firmware - # we'll get it from the linux-firmware package and we don't want conflicts - %{make} %{?make_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw= + + if [ $DoModules -eq 1 ]; then + # Override $(mod-fw) because we don't want it to install any firmware + # we'll get it from the linux-firmware package and we don't want conflicts + %{make} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw= + fi + +%if %{with_gcov} + # install gcov-needed files to $BUILDROOT/$BUILD/...: + # gcov_info->filename is absolute path + # gcno references to sources can use absolute paths (e.g. in out-of-tree builds) + # sysfs symlink targets (set up at compile time) use absolute paths to BUILD dir + find . \( -name '*.gcno' -o -name '*.[chS]' \) -exec install -D '{}' "$RPM_BUILD_ROOT/$(pwd)/{}" \; +%endif # add an a noop %%defattr statement 'cause rpm doesn't like empty file list files echo '%%defattr(-,-,-)' > ../kernel${Flavour:+-${Flavour}}-ldsoconf.list if [ $DoVDSO -ne 0 ]; then - %{make} %{?make_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer + %{make} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer if [ -s ldconfig-kernel.conf ]; then - install -D -m 444 ldconfig-kernel.conf \ + install -D -m 444 ldconfig-kernel.conf \ $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf - echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list + echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list fi rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id fi @@ -1407,22 +1482,36 @@ BuildKernel() { # don't include anything going into k-m-e in the file lists rm -rf lib/modules/$KernelVer/extra - # 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 . - %{SOURCE99} modules.list %{_target_cpu} - 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 - if [ -s depmod.out ]; then - echo "Depmod failure" - cat depmod.out - exit 1 + + if [ $DoModules -eq 1 ]; then + # 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 . + %{SOURCE99} modules.list %{_target_cpu} + 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 + if [ -s depmod.out ]; then + echo "Depmod failure" + cat depmod.out + exit 1 + else + rm depmod.out + fi else - rm depmod.out + # Ensure important files/directories exist to let the packaging succeed + echo '%%defattr(-,-,-)' > modules.list + echo '%%defattr(-,-,-)' > k-d.list + mkdir -p lib/modules/$KernelVer/kernel + # Add files usually created by make modules, needed to prevent errors + # thrown by depmod during package installation + touch lib/modules/$KernelVer/modules.order + touch lib/modules/$KernelVer/modules.builtin fi + # remove files that will be auto generated by depmod at rpm -i time pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep} @@ -1450,9 +1539,11 @@ BuildKernel() { rm -f $RPM_BUILD_ROOT/module-dirs.list %if %{signmodules} - # Save the signing keys so we can sign the modules in __modsign_install_post - cp certs/signing_key.pem certs/signing_key.pem.sign${Flav} - cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav} + if [ $DoModules -eq 1 ]; then + # Save the signing keys so we can sign the modules in __modsign_install_post + cp certs/signing_key.pem certs/signing_key.pem.sign${Flav} + cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav} + fi %endif # Move the devel headers out of the root file system @@ -1496,6 +1587,15 @@ BuildKernel %make_target %kernel_image %{use_vdso} lpae BuildKernel %make_target %kernel_image %{_use_vdso} %endif +%if %{with_doc} +# Make the HTML pages. +make htmldocs || %{doc_build_fail} + +# sometimes non-world-readable files sneak into the kernel source tree +chmod -R a=rX Documentation +find Documentation -type d | xargs chmod u+w +%endif + # In the modsign case, we do 3 things. 1) We check the "flavour" and hard # code the value in the following invocations. This is somewhat sub-optimal # but we're doing this inside of an RPM macro and it isn't as easy as it @@ -1559,6 +1659,15 @@ BuildKernel %make_target %kernel_image %{_use_vdso} cd linux-%{KVERREL} +%if %{with_doc} +docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion} + +# copy the source over +mkdir -p $docdir +tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir + +%endif # with_doc + # We have to do the headers install before the tools install because the # kernel headers_install will remove any header files in /usr/include that # it doesn't install itself. @@ -1574,27 +1683,22 @@ find $RPM_BUILD_ROOT/usr/include \ %endif %if %{with_cross_headers} +HDR_ARCH_LIST='arm arm64 powerpc s390 x86' mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers -make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers headers_install_all -find $RPM_BUILD_ROOT/usr/tmp-headers/include \ +for arch in $HDR_ARCH_LIST; do + mkdir $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} + make ARCH=${arch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} headers_install +done + +find $RPM_BUILD_ROOT/usr/tmp-headers \ \( -name .install -o -name .check -o \ -name ..install.cmd -o -name ..check.cmd \) -delete # Copy all the architectures we care about to their respective asm directories -for arch in arm arm64 powerpc s390 x86 ; do -mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include -mv $RPM_BUILD_ROOT/usr/tmp-headers/include/arch-${arch}/asm $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/ -cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-generic $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/. -done - -# Remove the rest of the architectures -rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/arch* -rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-* - -# Copy the rest of the headers over -for arch in arm arm64 powerpc s390 x86 ; do -cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/. +for arch in $HDR_ARCH_LIST ; do + mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include + mv $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch}/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/ done rm -rf $RPM_BUILD_ROOT/usr/tmp-headers @@ -1719,8 +1823,24 @@ fi /usr/*-linux-gnu/include/* %endif +# only some architecture builds need kernel-doc +%if %{with_doc} +%files doc +%defattr(-,root,root) +%{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation/* +%dir %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation +%dir %{_datadir}/doc/kernel-doc-%{rpmversion} +%endif + # empty meta-package %files +%if %{with_gcov} +%ifarch x86_64 s390x ppc64le aarch64 +%files gcov +%{_builddir} +%endif +%endif + # This is %%{image_install_path} on an arch where that includes ELF files, # or empty otherwise. %define elf_image_install_path %{?kernel_image_elf:%{image_install_path}} @@ -1785,6 +1905,12 @@ fi # # %changelog +* Tue Oct 22 2019 Jeremy Cline <jcline@redhat.com> - 5.4.0-0.rc4.git1.1 +- Linux v5.4-rc4-18-g3b7c59a1950c + +* Tue Oct 22 2019 Jeremy Cline <jcline@redhat.com> +- Reenable debugging options. + * Mon Oct 21 2019 Jeremy Cline <jcline@redhat.com> - 5.4.0-0.rc4.git0.1 - Linux v5.4-rc4 @@ -1,2 +1,3 @@ SHA512 (linux-5.3.tar.xz) = 6b5edef47c319a3fa7f6c20a3e0903a5acd89ec75e32dc5f99adcb60c9fe118ea312722d9c3d27e2e3900afa2455afb86e83a8b6bb131009bc79ddbe6fb0595d SHA512 (patch-5.4-rc4.xz) = f32de3fce8cde74450b5cb6a81ffc63a53b0a4492ec1b57a77d3b8bb77d66292cfeeb08edb12c53b2a8f7fc747060832a0cf6f1d5b825d32b161898376fad302 +SHA512 (patch-5.4-rc4-git1.xz) = 2feece5a36ff1b13784b277483ad72160452caf26c0fd48049a2db7ee19bd471125b9ea2d519de8ccb8922083bc25921e7ccf30ed8308b87aff11e230d1288e5 |