summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJustin M. Forbes <jforbes@fedoraproject.org>2020-08-12 08:03:24 -0500
committerJustin M. Forbes <jforbes@fedoraproject.org>2020-08-12 08:03:24 -0500
commit47a895f435cccb2cb14eb5d0c52d2f6d4d904907 (patch)
tree628be9cf983bcdfedd940131f8f7187020cff5f2 /scripts
parent29d3f64f7e887d5cf9ae5f496febe5954fc49117 (diff)
downloadkernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.tar.gz
kernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.tar.xz
kernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.zip
Linux v5.8.1
Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/add-changelog.sh12
-rw-r--r--scripts/check-configs.pl83
-rwxr-xr-xscripts/create_headers_tarball.sh84
-rwxr-xr-xscripts/cross-aarch643
-rwxr-xr-xscripts/cross-arm3
-rwxr-xr-xscripts/fast-build.sh13
-rwxr-xr-xscripts/fixup-bumpspec.sh10
-rwxr-xr-xscripts/generate-git-snapshot.sh44
-rw-r--r--scripts/kernel-version.sh8
-rwxr-xr-xscripts/rawhide-rc.sh50
-rwxr-xr-xscripts/rawhide-snapshot.sh66
-rwxr-xr-xscripts/stable-update.sh84
12 files changed, 460 insertions, 0 deletions
diff --git a/scripts/add-changelog.sh b/scripts/add-changelog.sh
new file mode 100755
index 000000000..fa0157afb
--- /dev/null
+++ b/scripts/add-changelog.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Emulate the changelog part of rpmdev-bumpspec without the bumping of the
+# rev. Because Laura keeps typoing her name and the date.
+
+CURDATE=`date +"%a %b %d %Y"`
+PACKAGER=`rpmdev-packager`
+CHANGELOG="%changelog\n* $CURDATE $PACKAGER\n- $1\n"
+
+awk -v CHANGE="$CHANGELOG" '/%changelog/ {print CHANGE} \
+ !/%changelog/ { print $0 }' \
+ < kernel.spec > kernel.spec.tmp
+mv kernel.spec.tmp kernel.spec
diff --git a/scripts/check-configs.pl b/scripts/check-configs.pl
new file mode 100644
index 000000000..c74acf1d4
--- /dev/null
+++ b/scripts/check-configs.pl
@@ -0,0 +1,83 @@
+# By Paul Bolle October 2014.
+#
+# Contributed to the public domain by its author.
+
+use 5.016;
+use warnings;
+use autodie;
+
+use File::Find;
+
+my @Kconfigs;
+
+my $Kconfigre = qr/Kconfig.*/;
+my $configre = qr/^\s*(menu)?config\s+(?<config>(\w+))$/;
+my $CONFIG_re = qr/\bCONFIG_(?<CONFIG_>(\w+))/;
+
+sub match {
+ push( @Kconfigs, $File::Find::name ) if ($_ =~ $Kconfigre);
+}
+
+sub parse_kconfig {
+ my ($path) = @_;
+
+ my @ret;
+
+ open( my $kconfig, "<", $path );
+ my $slurp = do { local $/ = undef; <$kconfig> };
+ close( $kconfig );
+ my @lines = split ( /\n/, $slurp );
+ foreach my $line (@lines) {
+ if ($line =~ /$configre/) {
+ push( @ret, $+{config} );
+ }
+ }
+
+ @ret;
+}
+
+sub parse_shipped {
+ my ($path) = @_;
+
+ my @ret;
+
+ open( my $shipped, "<", $path );
+ my $slurp = do { local $/ = undef; <$shipped> };
+ close( $shipped );
+ my @lines = split ( /\n/, $slurp );
+ my $i = 1;
+ foreach my $line (@lines) {
+ if ($line =~ /$CONFIG_re/) {
+ push( @ret, [$i, $+{CONFIG_}] );
+ }
+ $i++;
+ }
+
+ @ret;
+}
+
+exit main ( @ARGV );
+
+sub main {
+ my %configs;
+
+ find( \&match, @_ );
+
+ foreach my $Kconfig (@Kconfigs) {
+ my (@tmp) = parse_kconfig( $Kconfig );
+ foreach my $config ( @tmp ) {
+ $configs{ $config }++;
+ }
+ }
+
+ foreach my $shipped (glob("*.config")) {
+ my (@tmp) = parse_shipped( $shipped );
+ foreach my $ref ( @tmp ) {
+ say( STDERR "$shipped:$ref->[0]: No Kconfig symbol matches 'CONFIG_$ref->[1]'" )
+ unless (grep( /^$ref->[1]$/, keys( %configs )));
+ }
+ }
+
+ 0;
+}
+
diff --git a/scripts/create_headers_tarball.sh b/scripts/create_headers_tarball.sh
new file mode 100755
index 000000000..f6aa13fe4
--- /dev/null
+++ b/scripts/create_headers_tarball.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# This script is aimed at generating the headers from the kernel sources.
+# You should have a checkout of kernel-headers inside the kernel directory 'fedpkg clone kernel-headers'
+# You will need to prep the kernel sources with 'make prep' or 'fedpkg prep' before running this script
+#
+# Author: Herton R. Krzesinski <herton@redhat.com>
+# Author: Justin M. Forbes <jforbes@redhat.com>
+
+set -e
+
+# Location of kernel-headers checkout
+CURRENTDIR=`pwd`
+PKGLOC='kernel-headers'
+
+if [ ! -f $PKGLOC/kernel-headers.spec ]; then
+ echo "Missing checkout of kernel-headers in $PKGLOC"
+ exit 1
+fi
+
+# Kernel version information taken from kernel.spec and change to prepared sources directory
+MAJORVER='5'
+RELEASED=`grep "%global released_kernel" kernel.spec| cut -d ' ' -f 3`
+BASERELEASE=`cat kernel.spec | grep "%global baserelease" | cut -d ' ' -f 3`
+BASE=`grep "%define base_sublevel" kernel.spec| cut -d ' ' -f 3`
+STABLE=`grep "%define stable_update" kernel.spec| cut -d ' ' -f 3`
+RC=`grep "%global rcrev" kernel.spec| cut -d ' ' -f 3`
+GITREV=`grep "%define gitrev" kernel.spec| cut -d ' ' -f 3`
+BUILDID=`grep "^%define buildid" kernel.spec| cut -d ' ' -f 3`
+if [ $RELEASED -eq 0 ]; then
+ cd kernel-$MAJORVER.$BASE.fc??
+ NEWBASE=$(($BASE+1))
+ KVER=$MAJORVER.$NEWBASE.0-0.rc$RC.git$GITREV
+ cd linux-$MAJORVER.$NEWBASE.0-0.rc$RC.git$GITREV.$BASERELEASE$BUILDID.fc*/
+else
+ cd kernel-$MAJORVER.$BASE.fc??/linux-$MAJORVER.$BASE.$STABLE-$BASERELEASE$BUILDID.fc*/
+ KVER=$MAJORVER.$BASE.$STABLE
+fi
+
+# ARCH_LIST below has the default list of supported architectures
+# (the architectures names may be different from rpm, you list here the
+# names of arch/<arch> directories in the kernel sources)
+ARCH_LIST="arm arm64 powerpc riscv s390 x86"
+
+headers_dir=$(mktemp -d)
+trap 'rm -rf "$headers_dir"' SIGHUP SIGINT SIGTERM EXIT
+
+archs=${ARCH_LIST:-$(ls arch)}
+echo $archs
+
+# Upstream rmeoved the headers_install_all target so do it manually
+for arch in $archs; do
+ mkdir $headers_dir/arch-$arch
+ make ARCH=$arch INSTALL_HDR_PATH=$headers_dir/arch-$arch KBUILD_HEADERS=install headers_install
+done
+find $headers_dir \
+ \( -name .install -o -name .check -o \
+ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
+
+TARBALL=$CURRENTDIR/$PKGLOC/kernel-headers-$KVER.tar.xz
+pushd $headers_dir
+ tar -Jcf $TARBALL *
+popd
+
+echo wrote $TARBALL
+
+# Update kernel-headers.spec
+cd $CURRENTDIR/$PKGLOC/
+
+BASE=$BASE perl -p -i -e 's|%define base_sublevel.*|%define base_sublevel $ENV{'BASE'}|' kernel-headers.spec
+BASERELEASE=$(($BASERELEASE-1))
+BASERELEASE=$BASERELEASE perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'BASERELEASE'}|' kernel-headers.spec
+
+if [ $RELEASED -eq 0 ]; then
+ [ -n "$BUILDID" ] && sed -i -e 's/^# define buildid .local/%define buildid '$BUILDID'/' kernel-headers.spec
+ RC=$RC perl -p -i -e 's|%global rcrev.*|%global rcrev $ENV{'RC'}|' kernel-headers.spec
+ GITREV=$GITREV perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'GITREV'}|' kernel-headers.spec
+ rpmdev-bumpspec -c "Linux v$MAJORVER.$NEWBASE-rc$RC.git$GITREV" kernel-headers.spec
+else
+ STABLE=$STABLE perl -p -i -e 's|%define stable_update.*|%define stable_update $ENV{'STABLE'}|' kernel-headers.spec
+ rpmdev-bumpspec -c "Linux v$MAJORVER.$BASE.$STABLE" kernel-headers.spec
+fi
+echo "Modified $CURRENTDIR/$PKGLOC/kernel-headers.spec"
+echo "Don't forget to upload the sources"
diff --git a/scripts/cross-aarch64 b/scripts/cross-aarch64
new file mode 100755
index 000000000..dc0645e49
--- /dev/null
+++ b/scripts/cross-aarch64
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rpmbuild --target aarch64 --with cross --without debuginfo --without perf --without tools --define "__strip /usr/bin/aarch64-linux-gnu-strip" --rebuild $1
diff --git a/scripts/cross-arm b/scripts/cross-arm
new file mode 100755
index 000000000..0aae07741
--- /dev/null
+++ b/scripts/cross-arm
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rpmbuild --target armv7hl --with cross --without debuginfo --without perf --without tools --define "__strip /usr/bin/arm-linux-gnu-strip" --rebuild $1
diff --git a/scripts/fast-build.sh b/scripts/fast-build.sh
new file mode 100755
index 000000000..8286a110f
--- /dev/null
+++ b/scripts/fast-build.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# Description:
+# rpmbuild combo to build the given architecture without
+# debugging information, perf or tools.
+#
+# Sample usage:
+# ./fast-build.sh x86_64 kernel-4.7.0-0.rc1.git1.2.fc25.src.rpm
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+ echo "usage: $0 [ arch ] [ kernel-x.x.x.fcxx.src.rpm ] "
+fi
+
+rpmbuild --target $1 --without debug --without debuginfo --without perf --without tools --rebuild $2
diff --git a/scripts/fixup-bumpspec.sh b/scripts/fixup-bumpspec.sh
new file mode 100755
index 000000000..1a38de222
--- /dev/null
+++ b/scripts/fixup-bumpspec.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# rpmdev-bumpspec 'helpfully' bumps the release which we don't always want.
+# This script fixes it up.
+
+RELEASE=`grep "%global baserelease" kernel.spec | cut -d ' ' -f 3`
+export RELEASE=$(($RELEASE-1))
+perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'RELEASE'}|' kernel.spec
+TODAY=`date +"%a %b %d %Y"`
+awk -v DATE="$TODAY" 'START { marked = 0; } $0 ~ DATE { if (marked == 1) { print $0 } else {out=$1; for(i = 2; i <= NF - 2; i++) { out=out" "$i } print out; marked = 1; } } $0 !~ DATE { print $0; }' < kernel.spec > kernel.spec.tmp
+mv kernel.spec.tmp kernel.spec
diff --git a/scripts/generate-git-snapshot.sh b/scripts/generate-git-snapshot.sh
new file mode 100755
index 000000000..242200ef6
--- /dev/null
+++ b/scripts/generate-git-snapshot.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# This script allows for the generation of a git snapshot between the upstream
+# git tree and the current tree.
+#
+# Prerequisites:
+# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc
+# or wherever.
+
+# Look to see if LINUX_GIT is set in local .bashrc
+if [ -f ~/.bashrc ]; then
+ source ~/.bashrc
+fi
+
+if [ ! -d "$LINUX_GIT" ]; then
+ echo "error: set \$LINUX_GIT to point at upstream git tree"
+ exit 1
+fi
+
+VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | sed s/[\(\)]//g)
+
+if [ -z "$VER" ] ;
+then
+ VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | sed s/[\(\)]//g)
+fi
+
+OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //)
+export NEWGIT=$(($OLDGIT+1))
+
+pushd $LINUX_GIT
+
+git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT
+xz -9 /tmp/patch-$VER-git$NEWGIT
+DESC=$(git describe)
+git rev-list --max-count=1 HEAD > /tmp/gitrev
+popd
+
+mv /tmp/patch-$VER-git$NEWGIT.xz .
+mv /tmp/gitrev .
+
+perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
+
+perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec
+
+rpmdev-bumpspec -c "Linux $DESC" kernel.spec
diff --git a/scripts/kernel-version.sh b/scripts/kernel-version.sh
new file mode 100644
index 000000000..e2ec93a5a
--- /dev/null
+++ b/scripts/kernel-version.sh
@@ -0,0 +1,8 @@
+VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | tr -d "()")
+
+if [ -z "$VER" ] ;
+then
+ VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | tr -d "()")
+fi
+
+
diff --git a/scripts/rawhide-rc.sh b/scripts/rawhide-rc.sh
new file mode 100755
index 000000000..a4e15820a
--- /dev/null
+++ b/scripts/rawhide-rc.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Generate a commit for a rawhide RC release
+
+source scripts/kernel-version.sh
+
+klist -s
+if [ ! $? -eq 0 ]; then
+ echo "klist couldn't read the credential cache."
+ echo "Do you need to fix your kerberos tokens?"
+ exit 1
+fi
+
+make release
+# fixup the release because rpmdev-bumpspec *sigh*
+scripts/fixup-bumpspec.sh
+fedpkg commit -c
+
+# Figure out what is our RC
+RC=`grep "%global rcrev" kernel.spec| cut -d ' ' -f 3`
+RC=$(($RC+1))
+BASE=`grep "%define base_sublevel" kernel.spec| cut -d ' ' -f 3`
+OLDBASE=$BASE
+# See comment in kernel.spec about the base numbering
+BASE=$(($BASE+1))
+MAJORVER=5
+
+# Kill all patches
+awk '!/patch/ { print $0 }' < sources > sources.tmp
+mv sources.tmp sources
+
+# Grab the tarball
+if [ ! -f patch-$MAJORVER.$BASE-rc$RC.xz ]; then
+ wget -O patch-$MAJORVER.$BASE-rc$RC https://git.kernel.org/torvalds/p/v$MAJORVER.$BASE-rc$RC/v$MAJORVER.$OLDBASE
+ if [ ! $? -eq 0 ]; then
+ exit 1
+ fi
+ xz -9 patch-$MAJORVER.$BASE-rc$RC
+ fedpkg upload patch-$MAJORVER.$BASE-rc$RC.xz
+fi
+
+# bump rcrev in the spec and set git snapshot to 0
+RC=$RC perl -p -i -e 's|%global rcrev.*|%global rcrev $ENV{'RC'}|' kernel.spec
+
+perl -p -i -e 's|%define gitrev.*|%define gitrev 0|' kernel.spec
+
+perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
+
+rpmdev-bumpspec -c "Linux v$MAJORVER.$BASE-rc$RC" kernel.spec
+
+echo "Don't forget to bump kernel-tools"
diff --git a/scripts/rawhide-snapshot.sh b/scripts/rawhide-snapshot.sh
new file mode 100755
index 000000000..210216b98
--- /dev/null
+++ b/scripts/rawhide-snapshot.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# A coffeeproof rawhide script. You should be able to run this before the
+# coffee has kicked in and generate a good rawhide commit.
+#
+# - Updates the local Fedora tree to master and verifies that you are working
+# off of the correct master
+# - Updates the upstream tree to the latest master.
+# - Generates a git snapshot via generate-git-snapshot.sh
+# - Clears out old git snapshots from the sources
+# - Uploads the new snapshot
+
+source scripts/kernel-version.sh
+
+klist -s
+if [ ! $? -eq 0 ]; then
+ echo "klist couldn't read the credential cache."
+ echo "Do you need to fix your kerberos tokens?"
+ exit 1
+fi
+
+git fetch origin
+if [ "$(git rev-parse origin/master)" != "$(git rev-parse HEAD)" ]; then
+ echo "I just did a git fetch and this branch does not match master"
+ echo "Re-check out this branch to work off of the latest master"
+ exit 1
+fi
+
+if [ ! -d "$LINUX_GIT" ]; then
+ echo "error: set \$LINUX_GIT to point at an upstream git tree"
+ exit 1
+fi
+
+git -C $LINUX_GIT pull
+if [ ! $? -eq 0 ]; then
+ echo "Git pull failed. Is your tree clean/correct?"
+ exit 1
+fi
+
+git -C $LINUX_GIT describe --tags HEAD | grep -q "\-g"
+if [ ! $? -eq 0 ]; then
+ echo "Trying to snapshot off of a tagged git."
+ echo "I don't think this is what you want"
+ exit 1
+fi
+
+if [ "$(git -C $LINUX_GIT rev-parse origin/master)" == `cat gitrev` ]; then
+ echo "Last snapshot commit matches current master. Nothing to do"
+ echo "\o/"
+ exit 0
+fi
+
+GIT=`grep "%define gitrev" kernel.spec | cut -d ' ' -f 3`
+if [ "$GIT" -eq 0 ]; then
+ make debug
+ ./scripts/fixup-bumpspec.sh
+ fedpkg commit -c
+fi
+
+./scripts/generate-git-snapshot.sh
+
+#Nuke the old patch from the source
+awk '!/git/ { print $0 }' < sources > sources.tmp
+mv sources.tmp sources
+
+GIT=`grep "%define gitrev" kernel.spec | cut -d ' ' -f 3`
+fedpkg upload patch-$VER-git$GIT.xz
diff --git a/scripts/stable-update.sh b/scripts/stable-update.sh
new file mode 100755
index 000000000..259a338c1
--- /dev/null
+++ b/scripts/stable-update.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+#
+# Author: Laura Abbott <labbott@fedoraproject.org>
+#
+# Apply a stable patch update to the Fedora tree. This takes care of
+# - Downloading the patch from kernel.org
+# - Uploading the source file
+# - Removing old patch files
+# - Updating the spec file stable version
+# - Adding a proper changelog entry
+#
+# Based on steps from https://fedoraproject.org/wiki/Kernel/DayToDay#Stable_kernel_update
+#
+# Args: Stable version to update (e.g. 4.7.7, 4.8.1)
+
+if [ $# -lt 1 ]; then
+ echo "Need a version"
+ exit 1
+fi
+
+VERSION=`echo $1 | cut -d . -f 1`
+if [ -z $VERSION ]; then
+ echo "Malformed version $1"
+ exit 1
+fi
+PATCHLEVEL=`echo $1 | cut -d . -f 2`
+if [ -z $VERSION ]; then
+ echo "Malformed version $1"
+ exit 1
+fi
+SUBLEVEL=`echo $1 | cut -d . -f 3`
+if [ -z $VERSION ]; then
+ echo "Malformed version $1"
+ exit 1
+fi
+
+if [ ! -f patch-$1.xz ]; then
+ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-$1.xz
+ if [ ! $? -eq 0 ]; then
+ echo "Download fail"
+ exit 1
+ fi
+fi
+
+# This all needs to be updated for the new generation system
+#
+# if [ ! -f "patch-$1.sign" ]; then
+# wget "https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-$1.sign"
+# if [ ! $? -eq 0 ]; then
+# echo "Signature download failed"
+# exit 1
+# fi
+# fi
+
+# xzcat "patch-$1.xz" | gpg2 --verify "patch-$1.sign" -
+# if [ ! $? -eq 0 ]; then
+# echo "Patch file has invalid or untrusted signature!"
+# echo "See https://www.kernel.org/category/signatures.html"
+# exit 1
+# fi
+
+grep $1 sources &> /dev/null
+if [ ! $? -eq 0 ]; then
+ fedpkg upload patch-$1.xz
+
+ # Cryptic awk: search for the previous patch level (if one exists) and
+ # remove it from the source file
+ awk -v VER=$VERSION.$PATCHLEVEL.$((SUBLEVEL-1)) '$0 !~ VER { print $0; }' < sources > sources.tmp
+ mv sources.tmp sources
+fi
+
+# Update the stable level
+awk -v STABLE=$SUBLEVEL '/%define stable_update/ \
+ { print "%define stable_update " STABLE } \
+ !/%define stable_update/ { print $0 }' \
+ < kernel.spec > kernel.spec.tmp
+mv kernel.spec.tmp kernel.spec
+
+# Reset the base release for use with rpmdev-bumpspec
+BASERELEASE=`cat kernel.spec | grep "%global baserelease" | cut -d ' ' -f 3 | head -c 1`00
+BASERELEASE=$(($BASERELEASE-1))
+BASERELEASE=$BASERELEASE perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'BASERELEASE'}|' kernel.spec
+
+rpmdev-bumpspec -c "Linux v$1" kernel.spec