diff --git a/.gitignore b/.gitignore index d9848a9a2..b962f63e9 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,8 @@ kernel-[2345]*/ perf-man-*.tar.gz kernel-headers/ kernel-tools/ +# because of how we manage having two sets of files we copy these +# over depending on Fedora vs. RHEL. Just ignore the one that gets +# used at runtime. +filter-*.sh +x509.genkey diff --git a/Module.kabi_aarch64 b/Module.kabi_aarch64 new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_dup_aarch64 b/Module.kabi_dup_aarch64 new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_dup_ppc64le b/Module.kabi_dup_ppc64le new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_dup_s390x b/Module.kabi_dup_s390x new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_dup_x86_64 b/Module.kabi_dup_x86_64 new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_ppc64le b/Module.kabi_ppc64le new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_s390x b/Module.kabi_s390x new file mode 100644 index 000000000..e69de29bb diff --git a/Module.kabi_x86_64 b/Module.kabi_x86_64 new file mode 100644 index 000000000..e69de29bb diff --git a/check-kabi b/check-kabi new file mode 100644 index 000000000..e69de29bb diff --git a/configs/build_configs.sh b/configs/build_configs.sh index 61c3c0455..4ccb0dc2e 100755 --- a/configs/build_configs.sh +++ b/configs/build_configs.sh @@ -19,8 +19,6 @@ cd $SCRIPT_DIR set errexit set nounset -control_file="config_generation" - cleanup() { rm -f config-* @@ -52,7 +50,9 @@ function merge_configs() arch=$(echo "$archvar" | cut -f1 -d"-") configs=$2 order=$3 - name=$OUTPUT_DIR/$PACKAGE_NAME-$archvar.config + flavor=$4 + + name=$OUTPUT_DIR/$PACKAGE_NAME-$archvar-$flavor.config echo -n "Building $name ... " touch config-merging config-merged @@ -95,33 +95,55 @@ function merge_configs() echo "done" } +function build_flavor() +{ + flavor=$1 + control_file="priority".$flavor + while read line + do + if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then + continue + elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then + continue + elif [ $(echo "$line" | grep -c "^EMPTY") -ne 0 ]; then + empty=$(echo "$line" | cut -f2 -d"=") + for a in $empty + do + echo "# EMPTY" > $OUTPUT_DIR/$PACKAGE_NAME-$a-$flavor.config + + done + elif [ $(echo "$line" | grep -c "^ORDER") -ne 0 ]; then + order=$(echo "$line" | cut -f2 -d"=") + for o in $order + do + glist=$(find $o -type d) + for d in $glist + do + combine_config_layer $d + done + done + else + arch=$(echo "$line" | cut -f1 -d"=") + configs=$(echo "$line" | cut -f2 -d"=") + + if [ -n "$SUBARCH" ]; then + case $arch in + $SUBARCH*) + ;; + *) + continue + esac + fi + + merge_configs $arch $configs "$order" $flavor + fi + done < $control_file +} + while read line do - if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then - continue - elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then - continue - elif [ $(echo "$line" | grep -c "^ORDER") -ne 0 ]; then - order=$(echo "$line" | cut -f2 -d"=") - for o in $order - do - glist=$(find $o -type d) - for d in $glist - do - combine_config_layer $d - done - done - else - arch=$(echo "$line" | cut -f1 -d"=") - configs=$(echo "$line" | cut -f2 -d"=") - - if [ -n "$SUBARCH" -a "$SUBARCH" != "$arch" ]; then - continue - fi - - merge_configs $arch $configs "$order" - fi -done < $control_file + build_flavor $line +done < flavors # A passed in kernel version implies copy to final location # otherwise defer to another script diff --git a/configs/flavors b/configs/flavors new file mode 100644 index 000000000..35a143bac --- /dev/null +++ b/configs/flavors @@ -0,0 +1 @@ +fedora diff --git a/configs/config_generation b/configs/priority.fedora similarity index 100% rename from configs/config_generation rename to configs/priority.fedora diff --git a/configs/process_configs.sh b/configs/process_configs.sh index 846fe2e70..b464d95ce 100755 --- a/configs/process_configs.sh +++ b/configs/process_configs.sh @@ -2,7 +2,20 @@ # # This script takes the merged config files and processes them through oldconfig # and listnewconfig +# +usage() +{ + # alphabetical order please + echo "process_configs.sh [ options ] package_name kernel_version" + echo " -a: report all errors, equivalent to [-c -n -w -i]" + echo " -c: error on mismatched config options" + echo " -i: continue on error" + echo " -n: error on unset config options" + echo " -t: test run, do not overwrite original config" + echo " -w: error on misconfigured config options" + exit 1 +} die() { @@ -14,16 +27,16 @@ die() switch_to_toplevel() { path="$(pwd)" - while test "$path" != "/" + while test -n "$path" do test -e $path/MAINTAINERS && \ - test -d $path/drivers && \ - break + test -d $path/drivers && \ + break path="$(dirname $path)" done - test "$path" != "/" || die "Can't find toplevel" + test -n "$path" || die "Can't find toplevel" echo "$path" } @@ -48,7 +61,7 @@ checkoptions() configs[a[1]]=a[2]; } else { if (configs[a[1]] != "" && configs[a[1]] != a[2]) - print "Found "a[1]"="configs[a[1]]" after generation, had " a[1]"="a[2]" in Source tree"; + print "Found "a[1]"="a[2]" after generation, had " a[1]"="configs[a[1]]" in Source tree"; } } ' $1 $2 > .mismatches @@ -57,14 +70,15 @@ checkoptions() then echo "Error: Mismatches found in configuration files" cat .mismatches - exit 1 + RETURNCODE=1 + [ "$CONTINUEONERROR" ] || exit 1 fi } function process_configs() { # assume we are in $source_tree/configs, need to get to top level - pushd $(switch_to_toplevel) + pushd $(switch_to_toplevel) &>/dev/null for cfg in $SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}*.config do @@ -73,49 +87,97 @@ function process_configs() cfgorig="${cfg}.orig" cat $cfg > $cfgorig + if [ "$arch" = "EMPTY" ] + then + # This arch is intentionally left blank + continue + fi echo -n "Processing $cfg ... " - # an empty grep is good but leaves a return value, so use # 'true' to bypass - make ARCH=$arch KCONFIG_CONFIG=$cfg listnewconfig | grep -E 'CONFIG_' > .newoptions || true + make ARCH=$arch KCONFIG_CONFIG=$cfgorig listnewconfig >& .listnewconfig + grep -E 'CONFIG_' .listnewconfig > .newoptions if test -n "$NEWOPTIONS" && test -s .newoptions then echo "Found unset config items, please set them to an appropriate value" cat .newoptions rm .newoptions - exit 1 + RETURNCODE=1 + [ "$CONTINUEONERROR" ] || exit 1 fi rm .newoptions - make ARCH=$arch KCONFIG_CONFIG=$cfg olddefconfig > /dev/null || exit 1 + grep -E 'config.*warning' .listnewconfig > .warnings + if test -n "$CHECKWARNINGS" && test -s .warnings + then + echo "Found misconfigured config items, please set them to an appropriate value" + cat .warnings + rm .warnings + RETURNCODE=1 + [ "$CONTINUEONERROR" ] || exit 1 + fi + rm .warnings + + rm .listnewconfig + + make ARCH=$arch KCONFIG_CONFIG=$cfgorig olddefconfig > /dev/null || exit 1 echo "# $arch" > ${cfgtmp} - cat "${cfg}" >> ${cfgtmp} + cat "${cfgorig}" >> ${cfgtmp} if test -n "$CHECKOPTIONS" then - checkoptions $cfgtmp $cfgorig + checkoptions $cfg $cfgtmp + fi + # if test run, don't overwrite original + if test -n "$TESTRUN" + then + rm ${cfgtmp} + else + mv ${cfgtmp} ${cfg} fi - mv ${cfgtmp} ${cfg} rm ${cfgorig} echo "done" done - rm "$SCRIPT_DIR"/*.config.old + rm "$SCRIPT_DIR"/*.config*.old popd > /dev/null echo "Processed config files are in $SCRIPT_DIR" } -NEWOPTIONS="" CHECKOPTIONS="" +CONTINUEONERROR="" +NEWOPTIONS="" +TESTRUN="" +CHECKWARNINGS="" + +RETURNCODE=0 while [[ $# -gt 0 ]] do key="$1" case $key in - -n) + -a) + CHECKOPTIONS="x" + CONTINUEONERROR="x" NEWOPTIONS="x" + CHECKWARNINGS="x" ;; -c) CHECKOPTIONS="x" ;; + -h) + usage + ;; + -i) + CONTINUEONERROR="x" + ;; + -n) + NEWOPTIONS="x" + ;; + -t) + TESTRUN="x" + ;; + -w) + CHECKWARNINGS="x" + ;; *) break;; esac @@ -133,3 +195,4 @@ SCRIPT_DIR="$(dirname $SCRIPT)" cd $SCRIPT_DIR process_configs +exit $RETURNCODE diff --git a/cpupower.config b/cpupower.config new file mode 100644 index 000000000..e69de29bb diff --git a/cpupower.service b/cpupower.service new file mode 100644 index 000000000..e69de29bb diff --git a/filter-aarch64.sh.fedora b/filter-aarch64.sh.fedora new file mode 100644 index 000000000..41dc7d19c --- /dev/null +++ b/filter-aarch64.sh.fedora @@ -0,0 +1,18 @@ +#! /bin/bash + +# This is the aarch64 override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +driverdirs="atm auxdisplay bcma bluetooth firewire fmc fpga infiniband isdn leds media memstick message mmc mtd nfc ntb pcmcia power ssb staging tty uio uwb w1" + +ethdrvs="3com adaptec arc alteon atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell micrel myricom neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti via wiznet xircom" + +drmdrvs="amd arm bridge ast exynos hisilicon i2c imx mgag200 meson msm nouveau panel pl111 radeon rockchip tegra sun4i sun4i-drm-hdmi tinydrm vc4" + +singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls" diff --git a/filter-aarch64.sh.rhel b/filter-aarch64.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-armv7hl.sh.fedora b/filter-armv7hl.sh.fedora new file mode 100644 index 000000000..69183432b --- /dev/null +++ b/filter-armv7hl.sh.fedora @@ -0,0 +1,18 @@ +#! /bin/bash + +# This is the armv7hl override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +driverdirs="atm auxdisplay bcma bluetooth firewire fmc fpga infiniband isdn media memstick message nfc ntb pcmcia ssb staging tty uio uwb w1" + +ethdrvs="3com adaptec alteon altera amd atheros broadcom cadence chelsio cisco dec dlink emulex icplus mellanox micrel myricom natsemi neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis sun tehuti via wiznet xircom" + +drmdrvs="amd arm armada bridge ast exynos etnaviv hisilicon i2c imx meson mgag200 msm nouveau omapdrm panel pl111 radeon rockchip sti stm sun4i sun4i-drm-hdmi tegra tilcdc tinydrm vc4" + +singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls bq27xxx_battery_hdq" diff --git a/filter-armv7hl.sh.rhel b/filter-armv7hl.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-i686.sh.fedora b/filter-i686.sh.fedora new file mode 100644 index 000000000..1a13ddf60 --- /dev/null +++ b/filter-i686.sh.fedora @@ -0,0 +1,14 @@ +#! /bin/bash + +# This is the i686 override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +driverdirs="atm auxdisplay bcma bluetooth firewire fmc fpga infiniband isdn leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio uwb w1" + +singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject hid-sensor-hub hid-sensor-magn-3d hid-sensor-incl-3d hid-sensor-gyro-3d hid-sensor-iio-common hid-sensor-accel-3d hid-sensor-trigger hid-sensor-als hid-sensor-rotation hid-sensor-temperature hid-sensor-humidity target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls parport_serial regmap-sdw hid-asus" diff --git a/filter-i686.sh.rhel b/filter-i686.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-modules.sh.fedora b/filter-modules.sh.fedora new file mode 100755 index 000000000..eb246e157 --- /dev/null +++ b/filter-modules.sh.fedora @@ -0,0 +1,153 @@ +#! /bin/bash +# +# Called as filter-modules.sh list-of-modules Arch + +# This script filters the modules into the kernel-core and kernel-modules +# subpackages. We list out subsystems/subdirs to prune from the installed +# module directory. What is left is put into the kernel-core package. What is +# pruned is contained in the kernel-modules package. +# +# This file contains the default subsys/subdirs to prune from all architectures. +# If an architecture needs to differ, we source a per-arch filter-.sh file +# that contains the set of override lists to be used instead. If a module or +# subsys should be in kernel-modules on all arches, please change the defaults +# listed here. + +# Set the default dirs/modules to filter out +driverdirs="atm auxdisplay bcma bluetooth firewire fmc fpga infiniband isdn leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio uwb w1" + +chardrvs="mwave pcmcia" + +netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless" + +ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell mellanox neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti wiznet xircom" + +inputdrvs="gameport tablet touchscreen" + +scsidrvs="aacraid advansys aic7xxx aic94xx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic isci libsas lpfc megaraid mpt2sas mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf wd719x" + +usbdrvs="atm image misc serial wusbcore" + +fsdrvs="affs befs coda cramfs dlm ecryptfs hfs hfsplus jfs jffs2 minix ncpfs nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs" + +netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dccp dsa ieee802154 irda l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless" + +drmdrvs="amd ast bridge gma500 i2c i915 mgag200 nouveau panel radeon" + +iiodrvs="accel adc afe common dac gyro health humidity light magnetometer multiplexer orientation potentiometer potentiostat pressure temperature" + +singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls parport_serial regmap-sdw hid-asus" + +# Grab the arch-specific filter list overrides +source ./filter-$2.sh + +filter_dir() { + filelist=$1 + dir=$2 + + grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp + + if [ $? -ne 0 ] + then + echo "Couldn't remove ${dir}. Skipping." + else + grep -e "${dir}/" ${filelist} >> k-d.list + mv ${filelist}.tmp $filelist + fi + + return 0 +} + +filter_ko() { + filelist=$1 + mod=$2 + + grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp + + if [ $? -ne 0 ] + then + echo "Couldn't remove ${mod}.ko Skipping." + else + grep -e "${mod}.ko" ${filelist} >> k-d.list + mv ${filelist}.tmp $filelist + fi + + return 0 +} + +# Filter the drivers/ subsystems +for subsys in ${driverdirs} +do + filter_dir $1 drivers/${subsys} +done + +# Filter the networking drivers +for netdrv in ${netdrvs} +do + filter_dir $1 drivers/net/${netdrv} +done + +# Filter the char drivers +for char in ${chardrvs} +do + filter_dir $1 drivers/char/${input} +done + +# Filter the ethernet drivers +for eth in ${ethdrvs} +do + filter_dir $1 drivers/net/ethernet/${eth} +done + +# SCSI +for scsi in ${scsidrvs} +do + filter_dir $1 drivers/scsi/${scsi} +done + +# Input +for input in ${inputdrvs} +do + filter_dir $1 drivers/input/${input} +done + +# USB +for usb in ${usbdrvs} +do + filter_dir $1 drivers/usb/${usb} +done + +# Filesystems +for fs in ${fsdrvs} +do + filter_dir $1 fs/${fs} +done + +# Network protocols +for prot in ${netprots} +do + filter_dir $1 kernel/net/${prot} +done + +# DRM +for drm in ${drmdrvs} +do + filter_dir $1 drivers/gpu/drm/${drm} +done + +# Just kill sound. +filter_dir $1 kernel/sound + +# Now go through and filter any single .ko files that might have deps on the +# things we filtered above +for mod in ${singlemods} +do + filter_ko $1 ${mod} +done + +# Go through our generated drivers list and remove the .ko files. We'll +# restore them later. +for mod in `cat k-d.list` +do + rm -rf $mod +done diff --git a/filter-modules.sh.rhel b/filter-modules.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-ppc64le.sh.fedora b/filter-ppc64le.sh.fedora new file mode 100644 index 000000000..24d3f1346 --- /dev/null +++ b/filter-ppc64le.sh.fedora @@ -0,0 +1,14 @@ +#! /bin/bash + +# This is the ppc64le override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +driverdirs="atm auxdisplay bcma bluetooth firewire fmc fpga infiniband isdn leds media memstick message mmc mtd nfc ntb pcmcia platform power ssb staging tty uio uwb w1" + +singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr chtls" diff --git a/filter-ppc64le.sh.rhel b/filter-ppc64le.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-s390x.sh.fedora b/filter-s390x.sh.fedora new file mode 100644 index 000000000..04f7110ad --- /dev/null +++ b/filter-s390x.sh.fedora @@ -0,0 +1,12 @@ +#! /bin/bash + +# This is the s390x override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +# Defaults work so no need to override diff --git a/filter-s390x.sh.rhel b/filter-s390x.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/filter-x86_64.sh.fedora b/filter-x86_64.sh.fedora new file mode 100644 index 000000000..1aa80f2e0 --- /dev/null +++ b/filter-x86_64.sh.fedora @@ -0,0 +1,12 @@ +#! /bin/bash + +# This is the x86_64 override file for the core/drivers package split. The +# module directories listed here and in the generic list in filter-modules.sh +# will be moved to the resulting kernel-modules package for this arch. +# Anything not listed in those files will be in the kernel-core package. +# +# Please review the default list in filter-modules.sh before making +# modifications to the overrides below. If something should be removed across +# all arches, remove it in the default instead of per-arch. + +# Defaults work so no need to override diff --git a/filter-x86_64.sh.rhel b/filter-x86_64.sh.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/generate_all_configs.sh b/generate_all_configs.sh index dde72eaff..14f0f3a24 100755 --- a/generate_all_configs.sh +++ b/generate_all_configs.sh @@ -1,6 +1,36 @@ #!/bin/sh -for i in kernel-*.config; do - NEW=kernel-$VERSION-`echo $i | cut -d - -f2-` +# Adjusts the configuration options to build the variants correctly +# +# arg1: configuration to go in the primary variant +# arg2: are we only generating debug configs + + +PRIMARY=$1 +DEBUGBUILDSENABLED=$2 + +if [ -z $2 ]; then + exit 1 +fi + +if [ $PRIMARY == "fedora" ]; then + SECONDARY=rhel +else + SECONDARY=fedora +fi + +for i in kernel-*-$PRIMARY.config; do + NEW=kernel-$VERSION-`echo $i | cut -d - -f2- | sed s/-$PRIMARY//` + #echo $NEW mv $i $NEW done + +rm kernel-*-$SECONDARY.config + +if [ $DEBUGBUILDSENABLED -eq 0 ]; then + for i in kernel-*debug*.config; do + base=`echo $i | sed -r s/-?debug//g` + NEW=kernel-`echo $base | cut -d - -f2-` + mv $i $NEW + done +fi diff --git a/kernel-aarch64-debug.config b/kernel-aarch64-debug-fedora.config similarity index 100% rename from kernel-aarch64-debug.config rename to kernel-aarch64-debug-fedora.config diff --git a/kernel-aarch64-debug-rhel.config b/kernel-aarch64-debug-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-aarch64-debug-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-aarch64.config b/kernel-aarch64-fedora.config similarity index 100% rename from kernel-aarch64.config rename to kernel-aarch64-fedora.config diff --git a/kernel-aarch64-rhel.config b/kernel-aarch64-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-aarch64-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-armv7hl-debug.config b/kernel-armv7hl-debug-fedora.config similarity index 100% rename from kernel-armv7hl-debug.config rename to kernel-armv7hl-debug-fedora.config diff --git a/kernel-armv7hl.config b/kernel-armv7hl-fedora.config similarity index 100% rename from kernel-armv7hl.config rename to kernel-armv7hl-fedora.config diff --git a/kernel-armv7hl-lpae-debug.config b/kernel-armv7hl-lpae-debug-fedora.config similarity index 100% rename from kernel-armv7hl-lpae-debug.config rename to kernel-armv7hl-lpae-debug-fedora.config diff --git a/kernel-armv7hl-lpae.config b/kernel-armv7hl-lpae-fedora.config similarity index 100% rename from kernel-armv7hl-lpae.config rename to kernel-armv7hl-lpae-fedora.config diff --git a/kernel-i686-debug.config b/kernel-i686-debug-fedora.config similarity index 100% rename from kernel-i686-debug.config rename to kernel-i686-debug-fedora.config diff --git a/kernel-i686.config b/kernel-i686-fedora.config similarity index 100% rename from kernel-i686.config rename to kernel-i686-fedora.config diff --git a/kernel-ppc64le-debug.config b/kernel-ppc64le-debug-fedora.config similarity index 100% rename from kernel-ppc64le-debug.config rename to kernel-ppc64le-debug-fedora.config diff --git a/kernel-ppc64le-debug-rhel.config b/kernel-ppc64le-debug-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-ppc64le-debug-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-ppc64le.config b/kernel-ppc64le-fedora.config similarity index 100% rename from kernel-ppc64le.config rename to kernel-ppc64le-fedora.config diff --git a/kernel-ppc64le-rhel.config b/kernel-ppc64le-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-ppc64le-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-s390x-debug.config b/kernel-s390x-debug-fedora.config similarity index 100% rename from kernel-s390x-debug.config rename to kernel-s390x-debug-fedora.config diff --git a/kernel-s390x-debug-rhel.config b/kernel-s390x-debug-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-s390x-debug-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-s390x.config b/kernel-s390x-fedora.config similarity index 100% rename from kernel-s390x.config rename to kernel-s390x-fedora.config diff --git a/kernel-s390x-rhel.config b/kernel-s390x-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-s390x-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-s390x-zfcpdump-rhel.config b/kernel-s390x-zfcpdump-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-s390x-zfcpdump-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-x86_64-debug.config b/kernel-x86_64-debug-fedora.config similarity index 100% rename from kernel-x86_64-debug.config rename to kernel-x86_64-debug-fedora.config diff --git a/kernel-x86_64-debug-rhel.config b/kernel-x86_64-debug-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-x86_64-debug-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel-x86_64.config b/kernel-x86_64-fedora.config similarity index 100% rename from kernel-x86_64.config rename to kernel-x86_64-fedora.config diff --git a/kernel-x86_64-rhel.config b/kernel-x86_64-rhel.config new file mode 100644 index 000000000..c76e0e471 --- /dev/null +++ b/kernel-x86_64-rhel.config @@ -0,0 +1 @@ +# EMPTY diff --git a/kernel.spec b/kernel.spec index 8822508d7..737527e86 100644 --- a/kernel.spec +++ b/kernel.spec @@ -57,6 +57,12 @@ Summary: The Linux kernel # define buildid .local +%if 0%{?fedora} +%define primary_target fedora +%else +%define primary_target rhel +%endif + # baserelease defines which build revision of this kernel version we're # building. We used to call this fedora_build, but the magical name # baserelease is matched by the rpmdev-bumpspec tool, which you should use. @@ -573,43 +579,133 @@ BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu Source0: https://www.kernel.org/pub/linux/kernel/v5.x/linux-%{kversion}.tar.xz -Source11: x509.genkey -Source15: merge.pl -Source16: mod-extra.list +# Name of the packaged file containing signing key +%ifarch ppc64le +%define signing_key_filename kernel-signing-ppc.cer +%endif +%ifarch s390x +%define signing_key_filename kernel-signing-s390.cer +%endif + +Source10: x509.genkey.rhel +Source11: x509.genkey.fedora +%if %{?released_kernel} + +Source12: securebootca.cer +Source13: secureboot.cer +Source14: secureboot_s390.cer +Source15: secureboot_ppc.cer + +%define secureboot_ca %{SOURCE12} +%ifarch x86_64 aarch64 +%define secureboot_key %{SOURCE13} +%define pesign_name redhatsecureboot301 +%endif +%ifarch s390x +%define secureboot_key %{SOURCE14} +%define pesign_name redhatsecureboot302 +%endif +%ifarch ppc64le +%define secureboot_key %{SOURCE15} +%define pesign_name redhatsecureboot303 +%endif + +%else # released_kernel + +Source12: redhatsecurebootca2.cer +Source13: redhatsecureboot003.cer + +%define secureboot_ca %{SOURCE12} +%define secureboot_key %{SOURCE13} +%define pesign_name redhatsecureboot003 + +%endif # released_kernel + +Source15: mod-extra.list.rhel +Source16: mod-extra.list.fedora Source17: mod-extra.sh Source18: mod-sign.sh Source19: mod-extra-blacklist.sh -Source90: filter-x86_64.sh -Source91: filter-armv7hl.sh -Source92: filter-i686.sh -Source93: filter-aarch64.sh -Source94: filter-ppc64le.sh -Source95: filter-s390x.sh -Source99: filter-modules.sh +Source79: parallel_xz.sh + +Source80: filter-x86_64.sh.fedora +Source81: filter-armv7hl.sh.fedora +Source82: filter-i686.sh.fedora +Source83: filter-aarch64.sh.fedora +Source86: filter-ppc64le.sh.fedora +Source87: filter-s390x.sh.fedora +Source89: filter-modules.sh.fedora + +Source90: filter-x86_64.sh.rhel +Source91: filter-armv7hl.sh.rhel +Source92: filter-i686.sh.rhel +Source93: filter-aarch64.sh.rhel +Source96: filter-ppc64le.sh.rhel +Source97: filter-s390x.sh.rhel +Source99: filter-modules.sh.rhel %define modsign_cmd %{SOURCE18} -Source20: kernel-aarch64.config -Source21: kernel-aarch64-debug.config -Source22: kernel-armv7hl.config -Source23: kernel-armv7hl-debug.config -Source24: kernel-armv7hl-lpae.config -Source25: kernel-armv7hl-lpae-debug.config -Source26: kernel-i686.config -Source27: kernel-i686-debug.config -Source30: kernel-ppc64le.config -Source31: kernel-ppc64le-debug.config -Source32: kernel-s390x.config -Source33: kernel-s390x-debug.config -Source34: kernel-x86_64.config -Source35: kernel-x86_64-debug.config +Source20: kernel-aarch64-rhel.config +Source21: kernel-aarch64-debug-rhel.config +Source30: kernel-ppc64le-rhel.config +Source31: kernel-ppc64le-debug-rhel.config +Source32: kernel-s390x-rhel.config +Source33: kernel-s390x-debug-rhel.config +Source34: kernel-s390x-zfcpdump-rhel.config +Source35: kernel-x86_64-rhel.config +Source36: kernel-x86_64-debug-rhel.config -Source40: generate_all_configs.sh -Source41: generate_debug_configs.sh +Source37: kernel-aarch64-fedora.config +Source38: kernel-aarch64-debug-fedora.config +Source39: kernel-armv7hl-fedora.config +Source40: kernel-armv7hl-debug-fedora.config +Source41: kernel-armv7hl-lpae-fedora.config +Source42: kernel-armv7hl-lpae-debug-fedora.config +Source43: kernel-i686-fedora.config +Source44: kernel-i686-debug-fedora.config +Source45: kernel-ppc64le-fedora.config +Source46: kernel-ppc64le-debug-fedora.config +Source47: kernel-s390x-fedora.config +Source48: kernel-s390x-debug-fedora.config +Source49: kernel-x86_64-fedora.config +Source50: kernel-x86_64-debug-fedora.config -Source42: process_configs.sh -Source43: generate_bls_conf.sh -Source44: mod-internal.list + +Source51: generate_all_configs.sh + +Source52: process_configs.sh +Source53: generate_bls_conf.sh +Source56: update_scripts.sh + +Source54: mod-internal.list +Source55: merge.pl + +Source200: check-kabi + +Source201: Module.kabi_aarch64 +Source202: Module.kabi_ppc64le +Source203: Module.kabi_s390x +Source204: Module.kabi_x86_64 + +Source210: Module.kabi_dup_aarch64 +Source211: Module.kabi_dup_ppc64le +Source212: Module.kabi_dup_s390x +Source213: Module.kabi_dup_x86_64 + +# Source300: kernel-abi-whitelists-%{rpmversion}-%{distro_build}.tar.bz2 +# Source301: kernel-kabi-dw-%{rpmversion}-%{distro_build}.tar.bz2 + +# Sources for kernel-tools +Source2000: cpupower.service +Source2001: cpupower.config + +## Patches needed for building this package + +# Patch1: patch-%{rpmversion}-redhat.patch + +# empty final patch to facilitate testing of kernel patches +# Patch999999: linux-kernel-test.patch # This file is intentionally left empty in the stock kernel. Its a nicety # added for those wanting to do custom rebuilds with altered config opts. @@ -1281,23 +1377,10 @@ cd configs # Drop some necessary files from the source dir into the buildroot cp $RPM_SOURCE_DIR/kernel-*.config . cp %{SOURCE1000} . -cp %{SOURCE15} . -cp %{SOURCE40} . -cp %{SOURCE41} . -cp %{SOURCE43} . +cp %{SOURCE55} . +cp %{SOURCE51} . +VERSION=%{version} ./generate_all_configs.sh %{primary_target} %{debugbuildsenabled} -%if !%{debugbuildsenabled} -# The normal build is a really debug build and the user has explicitly requested -# a release kernel. Change the config files into non-debug versions. -%if !%{with_release} -VERSION=%{version} ./generate_debug_configs.sh -%else -VERSION=%{version} ./generate_all_configs.sh -%endif - -%else -VERSION=%{version} ./generate_all_configs.sh -%endif # Merge in any user-provided local config option changes %ifnarch %nobuildarches @@ -1324,17 +1407,16 @@ do done %endif -cp %{SOURCE42} . +cp %{SOURCE52} . OPTS="" %if %{with_configchecks} -%if 0%{?fedora} - OPTS="$OPTS -n -c" -%else OPTS="$OPTS -w -n -c" %endif -%endif ./process_configs.sh $OPTS kernel %{rpmversion} +cp %{SOURCE56} . +RPM_SOURCE_DIR=$RPM_SOURCE_DIR ./update_scripts.sh %{primary_target} + # end of kernel config %endif @@ -1435,7 +1517,7 @@ BuildKernel() { cp configs/$Config .config %if %{signkernel}%{signmodules} - cp %{SOURCE11} certs/. + cp $RPM_SOURCE_DIR/x509.genkey certs/. %endif Arch=`head -1 .config | cut -b 3-` @@ -1788,11 +1870,11 @@ BuildKernel() { popd # Call the modules-extra script to move things around - %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE16} + %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list # Blacklist net autoloadable modules in modules-extra %{SOURCE19} $RPM_BUILD_ROOT lib/modules/$KernelVer # Call the modules-extra script for internal modules - %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE44} internal + %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE54} internal # # Generate the kernel-core and kernel-modules files lists @@ -1815,7 +1897,7 @@ BuildKernel() { # 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} + ./filter-modules.sh modules.list %{_target_cpu} rm filter-*.sh # Run depmod on the resulting module tree and make sure it isn't broken @@ -1886,9 +1968,8 @@ BuildKernel() { find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete # build a BLS config for this kernel - %{SOURCE43} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}" + %{SOURCE53} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}" -%if 0 # Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer install -m 0644 %{secureboot_ca} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer @@ -1903,7 +1984,6 @@ BuildKernel() { fi fi %endif -%endif %if %{with_ipaclones} MAXPROCS=$(echo %{?_smp_mflags} | sed -n 's/-j\s*\([0-9]\+\)/\1/p') @@ -2324,7 +2404,7 @@ fi # # This macro defines the %%files sections for a kernel package # and its devel and debuginfo packages. -# %%kernel_variant_files [-k vmlinux] +# %%kernel_variant_files [-k vmlinux] # %define kernel_variant_files(k:) \ %if %{2}\ @@ -2353,6 +2433,12 @@ fi /lib/modules/%{KVERREL}%{?3:+%{3}}/source\ /lib/modules/%{KVERREL}%{?3:+%{3}}/updates\ /lib/modules/%{KVERREL}%{?3:+%{3}}/bls.conf\ +%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/kernel-signing-ca.cer\ +%ifarch s390x ppc64le\ +%if 0%{!?4:1}\ +%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/%{signing_key_filename} \ +%endif\ +%endif\ %if %{1}\ /lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\ %endif\ @@ -2383,7 +2469,7 @@ fi %kernel_variant_files %{_use_vdso} %{with_up} %kernel_variant_files %{_use_vdso} %{with_debug} debug %kernel_variant_files %{use_vdso} %{with_pae} lpae -%kernel_variant_files %{_use_vdso} %{with_zfcpdump} zfcpdump +%kernel_variant_files %{_use_vdso} %{with_zfcpdump} zfcpdump 1 %define kernel_variant_ipaclones(k:) \ %if %{1}\ diff --git a/mod-extra.list.fedora b/mod-extra.list.fedora new file mode 100644 index 000000000..8140f5c9e --- /dev/null +++ b/mod-extra.list.fedora @@ -0,0 +1,196 @@ +6pack.ko +a3d.ko +act200l-sir.ko +actisys-sir.ko +adi.ko +aer_inject.ko +af_802154.ko +affs.ko +ali-ircc.ko +analog.ko +appletalk.ko +atm.ko +avma1_cs.ko +avm_cs.ko +avmfritz.ko +ax25.ko +b1.ko +bas_gigaset.ko +batman-adv.ko +baycom_par.ko +baycom_ser_fdx.ko +baycom_ser_hdx.ko +befs.ko +bpqether.ko +br2684.ko +capi.ko +c_can.ko +c_can_platform.ko +clip.ko +cobra.ko +coda.ko +cuse.ko +db9.ko +dccp_diag.ko +dccp_ipv4.ko +dccp_ipv6.ko +dccp.ko +dccp_probe.ko +diva_idi.ko +divas.ko +dlm.ko +ds1wm.ko +ds2482.ko +ds2490.ko +dss1_divert.ko +elsa_cs.ko +ems_pci.ko +ems_usb.ko +esd_usb2.ko +esi-sir.ko +floppy.ko +gamecon.ko +gf2k.ko +gfs2.ko +gigaset.ko +girbil-sir.ko +grip.ko +grip_mp.ko +guillemot.ko +hdlcdrv.ko +hfc4s8s_l1.ko +hfcmulti.ko +hfcpci.ko +hisax.ko +hwa-rc.ko +hysdn.ko +i2400m.ko +i2400m-sdio.ko +i2400m-usb.ko +ieee802154.ko +iforce.ko +interact.ko +ipddp.ko +ipx.ko +isdn.ko +joydump.ko +kingsun-sir.ko +ks959-sir.ko +ksdazzle-sir.ko +kvaser_pci.ko +l2tp_core.ko +l2tp_debugfs.ko +l2tp_eth.ko +l2tp_ip.ko +l2tp_netlink.ko +l2tp_ppp.ko +lec.ko +ma600-sir.ko +magellan.ko +mcp2120-sir.ko +mISDN_core.ko +mISDN_dsp.ko +mkiss.ko +mptbase.ko +mptctl.ko +mptfc.ko +nci.ko +ncpfs.ko +netjet.ko +netrom.ko +nfc.ko +nilfs2.ko +ocfs2_dlmfs.ko +ocfs2_dlm.ko +ocfs2.ko +ocfs2_nodemanager.ko +ocfs2_stackglue.ko +ocfs2_stack_o2cb.ko +ocfs2_stack_user.ko +old_belkin-sir.ko +orinoco_cs.ko +orinoco.ko +orinoco_nortel.ko +orinoco_pci.ko +orinoco_plx.ko +orinoco_usb.ko +pcspkr.ko +plx_pci.ko +pn_pep.ko +pppoatm.ko +rds.ko +rds_rdma.ko +rds_tcp.ko +rose.ko +sch_atm.ko +sch_cbq.ko +sch_choke.ko +sch_drr.ko +sch_dsmark.ko +sch_etf.ko +sch_gred.ko +sch_mqprio.ko +sch_multiq.ko +sch_netem.ko +sch_qfq.ko +sch_red.ko +sch_sfb.ko +sch_teql.ko +sctp.ko +sctp_probe.ko +sidewinder.ko +sja1000.ko +sja1000_platform.ko +slcan.ko +slip.ko +softing_cs.ko +softing.ko +spaceball.ko +spaceorb.ko +stinger.ko +sysv.ko +tcp_bic.ko +tcp_highspeed.ko +tcp_htcp.ko +tcp_hybla.ko +tcp_illinois.ko +tcp_lp.ko +tcp_scalable.ko +tcp_vegas.ko +tcp_veno.ko +tcp_westwood.ko +tcp_yeah.ko +tekram-sir.ko +tmdc.ko +toim3232-sir.ko +trancevibrator.ko +turbografx.ko +twidjoy.ko +ubifs.ko +ufs.ko +umc.ko +usbip-core.ko +usbip-host.ko +uwb.ko +vcan.ko +vhci-hcd.ko +w1_bq27000.ko +w1_ds2408.ko +w1_ds2423.ko +w1_ds2431.ko +w1_ds2433.ko +w1_ds2760.ko +w1_ds2780.ko +w1_ds2781.ko +w1_ds28e04.ko +w1_smem.ko +w1_therm.ko +w6692.ko +walkera0701.ko +wanrouter.ko +warrior.ko +whci.ko +wire.ko +xpad.ko +yam.ko +zhenhua.ko diff --git a/mod-extra.list.rhel b/mod-extra.list.rhel new file mode 100644 index 000000000..e69de29bb diff --git a/parallel_xz.sh b/parallel_xz.sh new file mode 100644 index 000000000..e69de29bb diff --git a/redhatsecureboot003.cer b/redhatsecureboot003.cer new file mode 100644 index 000000000..439b75bf3 Binary files /dev/null and b/redhatsecureboot003.cer differ diff --git a/redhatsecurebootca2.cer b/redhatsecurebootca2.cer new file mode 100644 index 000000000..43502d6bc Binary files /dev/null and b/redhatsecurebootca2.cer differ diff --git a/secureboot.cer b/secureboot.cer new file mode 100644 index 000000000..20e660479 Binary files /dev/null and b/secureboot.cer differ diff --git a/securebootca.cer b/securebootca.cer new file mode 100644 index 000000000..b2354007b Binary files /dev/null and b/securebootca.cer differ diff --git a/update_scripts.sh b/update_scripts.sh new file mode 100755 index 000000000..7cacfb6c1 --- /dev/null +++ b/update_scripts.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ -z $1 ]; then + exit 1 +fi + +TARGET=$1 + +for i in $RPM_SOURCE_DIR/*.$TARGET; do + NEW=$(echo $i | sed -e "s/\.$TARGET//") + cp $i $NEW +done diff --git a/x509.genkey.fedora b/x509.genkey.fedora new file mode 100644 index 000000000..2f90e1bce --- /dev/null +++ b/x509.genkey.fedora @@ -0,0 +1,16 @@ +[ req ] +default_bits = 4096 +distinguished_name = req_distinguished_name +prompt = no +x509_extensions = myexts + +[ req_distinguished_name ] +O = Fedora +CN = Fedora kernel signing key +emailAddress = kernel-team@fedoraproject.org + +[ myexts ] +basicConstraints=critical,CA:FALSE +keyUsage=digitalSignature +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid diff --git a/x509.genkey.rhel b/x509.genkey.rhel new file mode 100644 index 000000000..b1bbe387f --- /dev/null +++ b/x509.genkey.rhel @@ -0,0 +1,16 @@ +[ req ] +default_bits = 3072 +distinguished_name = req_distinguished_name +prompt = no +x509_extensions = myexts + +[ req_distinguished_name ] +O = Red Hat +CN = Red Hat Enterprise Linux kernel signing key +emailAddress = secalert@redhat.com + +[ myexts ] +basicConstraints=critical,CA:FALSE +keyUsage=digitalSignature +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid