From cbb8f9d099afc4507bf308ad525e84f140895d04 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 9 Aug 2020 23:58:24 +0200 Subject: [PATCH 01/12] [skip ci] Add Navi Reset flavor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8d4026..dfb6810 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Custom Linux kernels for Promox VE 6. #### Flavors 1. Proxmox -2. Clear Linux +2. [Navi Reset](https://github.com/fabianishere/pve-edge-kernel/issues/5) #### Microarchitectures 1. Generic From 8e12ff11d123d15ab9a5aff01a2f86588060d56f Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 10 Aug 2020 16:32:29 +0200 Subject: [PATCH 02/12] [skip ci] Add instructions for local build --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index dfb6810..5860d46 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,49 @@ by updating `/etc/apparmor/parser.conf` as follows: features-file=/usr/share/apparmor-features/features.stock ``` +## Building manually +You may also choose to manually build one of these kernels yourself. + +#### Prerequisites +Make sure you have at least 30GB of free space available and have the following +packages installed: + +```bash +apt install devscripts asciidoc-base automake bc bison cpio dh-python flex git kmod libdw-dev libelf-dev libiberty-dev libnuma-dev libpve-common-perl libslang2-dev libssl-dev libtool lintian lz4 perl-modules python2-minimal rsync sed sphinx-common tar xmlto zlib1g-dev dwarves +``` +In case you are building a kernel version >= 5.8, make sure you have installed at least [dwarves >= 1.16.0](https://packages.debian.org/bullseye/dwarves). + +#### Obtaining the source +```bash +git clone https://github.com/fabianishere/pve-edge-kernel +cd pve-ede-kernel +git submodule update --init --recursive --depth 1 +``` +Afterwards, select the branch of your likings (e.g. `v5.8.x`). + +#### Building +Invoking the following command will build the kernel and its associated packages: +```bash +make +``` +The Makefile provides several environmental variables to control: + +1. `PVE_BUILD_FLAVOR` + The name of the kernel flavor which represents a selection of kernel + functionality (e.g. [hardened](https://github.com/anthraxx/linux-hardened) or [zen](https://github.com/zen-kernel/zen-kernel)). + This name is part of the kernel version and package name, which means that you + can have multiple flavors of the same kernel installed alongside each other. +2. `PVE_BUILD_TYPE` (default `generic`) + The name of the kernel build type which represents the compilation options of + the kernel (e.g. optimization level or micro architecture). + This name is appended as suffix to the Debian package version in case it is not + the default value. +3. `PVE_BUILD_CC` + The compiler to use for the kernel build. +4. `PVE_BUILD_CFLAGS` + The compilation options to use for the kernel build. Use this variable to specify + the optimization level or micro architecture to build for. + ## Questions If you have any questions or want to see additional versions, flavors or micro architectures being built, feel free to open an issue on Github. From 908898491eb3c35f271632999f3d05663b9776dc Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 16 Sep 2020 20:07:02 +0200 Subject: [PATCH 03/12] Fix instructions for cloning repository This change fixes the instructions for cloning the repository which apparently did not work (#11). --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5860d46..27728e0 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ In case you are building a kernel version >= 5.8, make sure you have installed a ```bash git clone https://github.com/fabianishere/pve-edge-kernel cd pve-ede-kernel -git submodule update --init --recursive --depth 1 +git submodule update --init --depth=1 --recursive submodules/ubuntu-mainline +git submodule update --init --recursive ``` Afterwards, select the branch of your likings (e.g. `v5.8.x`). From 95e869455cb479c574ffcc66c6fdbbd889c614c2 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 16 Sep 2020 20:34:27 +0200 Subject: [PATCH 04/12] [skip ci] Add explanation for upgrading dwarves --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 27728e0..e878f85 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,17 @@ packages installed: apt install devscripts asciidoc-base automake bc bison cpio dh-python flex git kmod libdw-dev libelf-dev libiberty-dev libnuma-dev libpve-common-perl libslang2-dev libssl-dev libtool lintian lz4 perl-modules python2-minimal rsync sed sphinx-common tar xmlto zlib1g-dev dwarves ``` In case you are building a kernel version >= 5.8, make sure you have installed at least [dwarves >= 1.16.0](https://packages.debian.org/bullseye/dwarves). +Unfortunately, this version is currently only available in the Debian Testing and Debian Unstable repositories. To work around this issue, we describe two options: + +1. You may add the Debian Testing repository to your APT sources as described [here](https://serverfault.com/a/382101) and install the newer `dwarves` package as follows: +```shell +apt install -t testing dwarves +``` +2. Alternatively, you may [download](https://packages.debian.org/bullseye/dwarves) the newer `dwarves` (>= 1.16) package from the Debian website and install the package manually, for example: +```shell +wget http://ftp.us.debian.org/debian/pool/main/d/dwarves-dfsg/dwarves_1.17-1_amd64.deb +apt install ./dwarves_1.17-1_amd64.deb +``` #### Obtaining the source ```bash From 6094523bae59fadaacd57ae6d64d2887d0865db0 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 16 Sep 2020 20:39:12 +0200 Subject: [PATCH 05/12] [skip ci] Add additional information about custom kernel builds --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e878f85..423aecd 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ The Makefile provides several environmental variables to control: functionality (e.g. [hardened](https://github.com/anthraxx/linux-hardened) or [zen](https://github.com/zen-kernel/zen-kernel)). This name is part of the kernel version and package name, which means that you can have multiple flavors of the same kernel installed alongside each other. + Note that the name itself does not control the selection of kernel functionality. 2. `PVE_BUILD_TYPE` (default `generic`) The name of the kernel build type which represents the compilation options of the kernel (e.g. optimization level or micro architecture). @@ -92,6 +93,9 @@ The Makefile provides several environmental variables to control: The compilation options to use for the kernel build. Use this variable to specify the optimization level or micro architecture to build for. +Kernel options may be controlled from the [debian/rules](debian/rules) file. To build with +additional patches, you may add them to the [patches/pve](patches/pve) directory. + ## Questions If you have any questions or want to see additional versions, flavors or micro architectures being built, feel free to open an issue on Github. From 3628671f6ceb5079e4cd67efe147e340126f366a Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 16 Sep 2020 23:09:59 +0200 Subject: [PATCH 06/12] Remove master kernel build workflow This change removes the master kernel build workflow since it is being replaced by update workflow which automatically updates the repository based on the specified tag. --- .github/workflows/master.yml | 40 ------------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/master.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index c76f7aa..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Kernel Build - -on: - push: - branches: - - master - - flavor/* - -jobs: - build: - runs-on: [self-hosted] - strategy: - matrix: - include: - - build_type: 'generic' - build_cc: gcc-10 - if: "!contains(github.event.head_commit.message, 'skip ci')" - steps: - - name: Checkout Sources - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Build Kernel - run: make - env: - PVE_BUILD_TYPE: ${{ matrix.build_type }} - PVE_BUILD_CC: ${{ matrix.build_cc }} - PVE_BUILD_CFLAGS: ${{ matrix.build_cflags }} - - name: Read Build Information - id: read_build_info - run: | - echo "::set-output name=release::$(sed '1q;d' release.txt)" - echo "::set-output name=dst::$(sed '1q;d' artifacts.txt)" - echo "::set-output name=hdr::$(sed '2q;d' artifacts.txt)" - echo "::set-output name=tools::$(sed '3q;d' artifacts.txt)" - - name: Upload Artifacts - uses: actions/upload-artifact@v2-preview - with: - name: debs-${{ matrix.build_type }} - path: "*.deb" From bc5cd8b02a0723b7e9925915b68ed20b4569e5ed Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 17 Sep 2020 17:08:35 +0200 Subject: [PATCH 07/12] Ignore build artifacts This change updates the gitignore file of the repository to ignore build artifacts. --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1adde8b..533f933 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ -ubuntu-zesty +# Build artifacts +build *.prepared +config*.org +*.deb +*.ddeb From c5d857229c07d1f24512fb8366f744d83595fc31 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 16 Sep 2020 22:24:33 +0200 Subject: [PATCH 08/12] Add script for automatic updates This change adds a script to automate the updating of the repository to a new Linux kernel release. --- .github/workflows/release.yml | 4 +- Makefile | 3 +- scripts/update.sh | 92 +++++++++++++++++++++++++++++++++++ scripts/version.sh | 68 ++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100755 scripts/update.sh create mode 100755 scripts/version.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2de62b5..16972b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,7 @@ on: jobs: build: + name: Build runs-on: [self-hosted, build] strategy: matrix: @@ -43,6 +44,7 @@ jobs: name: debs-${{ matrix.build_type }} path: "*.deb" publish: + name: Publish runs-on: [self-hosted] needs: build steps: @@ -68,7 +70,7 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: name: pve-edge-kernel ${{ steps.format_release.outputs.release }} body: ${{ steps.format_release.outputs.changelog }} diff --git a/Makefile b/Makefile index 466e6b2..b4311fe 100644 --- a/Makefile +++ b/Makefile @@ -157,4 +157,5 @@ abi-tmp-${KVNAME}: .PHONY: clean clean: rm -rf *~ build *.prepared ${KERNEL_CFG_ORG} - rm -f *.deb *.changes *.buildinfo release.txt artifacts.txt + rm -f *.deb *.ddeb *.changes *.buildinfo release.txt artifacts.txt + rm -f debian/control debian/pve-edge-*.postinst debian/pve-edge-*.prerm debian/pve-edge-*.postrm debian/rules.d/env.mk diff --git a/scripts/update.sh b/scripts/update.sh new file mode 100755 index 0000000..89970fd --- /dev/null +++ b/scripts/update.sh @@ -0,0 +1,92 @@ +#1/bin/bash +# Script to prepare update for new kernel release +set -e +set -o pipefail + +LINUX_REPOSITORY=submodules/ubuntu-mainline + +while getopts "r:t:b:v:h" OPTION; do + case $OPTION in + r) + LINUX_REPOSITORY=$OPTARG + ;; + t) + LINUX_TAG=$OPTARG + ;; + b) + LINUX_BASE=$OPTARG + ;; + v) + LINUX_VERSION=$OPTARG + ;; + + h) + echo "update.sh -rtbh" + echo " -r path to Linux Git repository" + echo " -t tag in Linux Git repository to pick" + echo " -b manual basis for this kernel" + echo " -v manual version for this kernel" + echo " -h this help message" + exit 1 + ;; + *) + echo "Incorrect options provided" + exit 1 + ;; + esac +done + +# Fetch from Git repository +echo "Fetching $LINUX_TAG from Linux Git repository..." + +git --git-dir $LINUX_REPOSITORY/.git fetch origin --depth 1 $LINUX_TAG +git --git-dir $LINUX_REPOSITORY/.git checkout FETCH_HEAD + +if [[ -z "$LINUX_BASE" ]]; then + # Parse the Ubuntu base from which our build is derived + UBUNTU_BASE=$(git --git-dir $LINUX_REPOSITORY/.git log -1 --pretty=%B | sed -n "s/^.*Ubuntu-\([0-9.-]*\).*$/\1/p") + LINUX_BASE="Ubuntu $UBUNTU_BASE" +fi + +if [[ -z "$LINUX_VERSION" ]]; then + # Parse the Linux version from the Linux repository if it not provided by the user + LINUX_VERSION=$(dpkg-parsechangelog -l $LINUX_REPOSITORY/debian.master/changelog --show-field Version | sed -n "s/^\([0-9.]*\).*$/\1/p") +fi + +echo "Using Linux $LINUX_VERSION based on $LINUX_BASE." + +# Prepare Debian changelog +sed -e "s/@KVNAME@/$LINUX_VERSION/g" -e "s/@KVMAJMIN@/$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR/g" < debian/control.in > debian/control + +LINUX_VERSION_MAJOR=$(echo $LINUX_VERSION | cut -d. -f1) +LINUX_VERSION_MINOR=$(echo $LINUX_VERSION | cut -d. -f2) +LINUX_VERSION_PATCH=$(echo $LINUX_VERSION | cut -d. -f3) +LINUX_VERSION_PATCH=${LINUX_VERSION_PATCH:-0} # Default to 0 + +LINUX_PACKAGE_RELEASE_PREVIOUS=$(scripts/version.sh -r) + +# Check whether we need to increment the package release +if [[ $LINUX_VERSION == "$(scripts/version.sh -L)" ]]; then + LINUX_PACKAGE_RELEASE=$((LINUX_PACKAGE_RELEASE_PREVIOUS + 1)) + echo "Incrementing package release to $LINUX_PACKAGE_RELEASE" +else + LINUX_PACKAGE_RELEASE=1 + echo "New package release" +fi + +echo "Updating Makefile..." +# Update the Makefile with the proper version numbers +sed -i Makefile \ + -e "s/^KERNEL_MAJ=[0-9]*$/KERNEL_MAJ=$LINUX_VERSION_MAJOR/" \ + -e "s/^KERNEL_MIN=[0-9]*$/KERNEL_MIN=$LINUX_VERSION_MINOR/" \ + -e "s/^KERNEL_PATCHLEVEL=[0-9]*$/KERNEL_PATCHLEVEL=$LINUX_VERSION_PATCH/" \ + -e "s/^KREL=[0-9]*$/KREL=1/" \ + -e "s/^PKGREL=[0-9]*$/PKGREL=$LINUX_PACKAGE_RELEASE/" + +echo "Generating entry for change log..." +# Generate a changelog entry +debchange -v $LINUX_VERSION-$LINUX_PACKAGE_RELEASE -D edge --force-distribution -U -M "Update to Linux $LINUX_VERSION based on $LINUX_BASE." + +echo "Cleaning up" +rm -f debian/control + diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 0000000..6007332 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Script for parsing version information in the repository +set -e +set -o pipefail + +LINUX_VERSION_MAJOR=$(sed -n "s/^KERNEL_MAJ=\([0-9]*$\)/\1/p" < Makefile | xargs) +LINUX_VERSION_MINOR=$(sed -n "s/^KERNEL_MIN=\([0-9]*$\)/\1/p" < Makefile | xargs) +LINUX_VERSION_PATCHLEVEL=$(sed -n "s/^KERNEL_PATCHLEVEL=\([0-9]*$\)/\1/p" < Makefile | xargs) +LINUX_VERSION_PATCHLEVEL=${LINUX_VERSION_PATCHLEVEL:-0} +LINUX_VERSION=$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR.$LINUX_VERSION_PATCHLEVEL +LINUX_PACKAGE_RELEASE=$(sed -n "s/^PKGREL=\([0-9]*$\)/\1/p" < Makefile | xargs) +LINUX_FLAVOR=$(sed -n "s/^PVE_BUILD_TYPE ?=\(.*\)$/\1/p" < Makefile | xargs) + + +while getopts "MmprfdLh" OPTION; do + case $OPTION in + M) + echo $LINUX_VERSION_MAJOR + exit 0 + ;; + + m) + echo $LINUX_VERSION_MINOR + exit 0 + ;; + p) + echo $LINUX_VERSION_PATCHLEVEL + exit 0 + ;; + r) + echo $LINUX_PACKAGE_RELEASE + exit 0 + ;; + f) + echo $LINUX_FLAVOR + exit 0 + ;; + f) + echo $LINUX_FLAVOR + exit 0 + ;; + L) + echo $LINUX_VERSION + exit 0 + ;; + h) + echo "commit.sh [-Mmprfh]]" + echo " -M major version" + echo " -m minor version" + echo " -p patch version" + echo " -r package release" + echo " -f flavor name" + echo " -L Linux version" + echo " -h this help message" + exit 1 + ;; + *) + echo "Incorrect options provided" + exit 1 + ;; + esac +done + +if [[ -z "$LINUX_FLAVOR" ]]; then + LINUX_FLAVOR_SUFFIX=-$LINUX_FLAVOR +fi + +echo "$LINUX_VERSION$LINUX_FLAVOR_SUFFIX-$LINUX_PACKAGE_RELEASE" From 228a71465f14fc7df8dee690f7016e64665b48d8 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 17 Sep 2020 17:24:01 +0200 Subject: [PATCH 09/12] Add workflow for updating kernel branch This change adds a Github Actions workflow for updating a kernel branch and creating a pull request with the change. --- .github/workflows/update.yml | 71 ++++++++++++++++++++++++++++++++++++ scripts/update.sh | 15 +++++--- scripts/version.sh | 10 +++-- 3 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..1ee03e0 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,71 @@ +name: Kernel Update + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag of the Linux Kernel to update to' + required: true + version: + description: 'Custom version number' + required: false + release: + description: 'Custom release number' + required: false + +jobs: + update: + name: Update + runs-on: [ubuntu-latest] + steps: + - name: Checkout Sources + uses: actions/checkout@v2 + with: + submodules: recursive + - uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Setup System Dependencies + run: sudo apt install devscripts + - name: Update Kernel + id: update + run: | + TAG=${{ github.event.inputs.tag }} + VERSION=${{ github.event.inputs.version }} + RELEASE=${{ github.event.inputs.release }} + VERSION_OPT=${VERSION:+-v ${VERSION}} + RELEASE_OPT=${RELEASE:+-r ${RELEASE}} + ./scripts/update.sh -t ${{ github.event.inputs.tag }} $VERSION_OPT $RELEASE_OPT + echo "::set-output name=version::$(scripts/version.sh -L)" + echo "::set-output name=full::$(scripts/version.sh)" + changelog=$(dpkg-parsechangelog -c 1 -l debian/changelog) + changelog="${changelog//'%'/'%25'}" + changelog="${changelog//$'\n'/'%0A'}" + changelog="${changelog//$'\r'/'%0D'}" + echo "::set-output name=changelog::$changelog" + base=$(scripts/version.sh -B) + echo "::set-output name=base::$base" + echo "::set-output name=branch::${GITHUB_REF##*/}" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ steps.generate-token.outputs.token }} # Custom token needed to recursively trigger workflows + commit-message: | + Add Linux ${{ steps.update.outputs.version }} + + This change updates the kernel to Linux ${{ steps.update.outputs.version }} based on Ubuntu ${{ steps.update.output.base }}. + branch: staging/v${{ steps.update.outputs.full }} + branch-suffix: short-commit-hash + delete-branch: true + title: "Add Linux ${{ steps.update.outputs.version }}" + body: | + Automated pull request to update the kernel to Linux ${{ steps.update.outputs.version }}. + + **Changelog:** + ``` + ${{ steps.update.outputs.changelog }} + ``` + labels: | + release diff --git a/scripts/update.sh b/scripts/update.sh index 89970fd..43d87fa 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -5,9 +5,9 @@ set -o pipefail LINUX_REPOSITORY=submodules/ubuntu-mainline -while getopts "r:t:b:v:h" OPTION; do +while getopts "R:t:b:v:r:h" OPTION; do case $OPTION in - r) + R) LINUX_REPOSITORY=$OPTARG ;; t) @@ -19,13 +19,16 @@ while getopts "r:t:b:v:h" OPTION; do v) LINUX_VERSION=$OPTARG ;; - + r) + LINUX_PACKAGE_RELEASE=$OPTARG + ;; h) echo "update.sh -rtbh" - echo " -r path to Linux Git repository" + echo " -R path to Linux Git repository" echo " -t tag in Linux Git repository to pick" echo " -b manual basis for this kernel" echo " -v manual version for this kernel" + echo " -r manual release version for this kernel" echo " -h this help message" exit 1 ;; @@ -66,7 +69,9 @@ LINUX_VERSION_PATCH=${LINUX_VERSION_PATCH:-0} # Default to 0 LINUX_PACKAGE_RELEASE_PREVIOUS=$(scripts/version.sh -r) # Check whether we need to increment the package release -if [[ $LINUX_VERSION == "$(scripts/version.sh -L)" ]]; then +if [[ -n $LINUX_PACKAGE_RELEASE ]]; then + echo "Using custom package release $LINUX_PACKAGE_RELEASE" +elif [[ $LINUX_VERSION == "$(scripts/version.sh -L)" ]]; then LINUX_PACKAGE_RELEASE=$((LINUX_PACKAGE_RELEASE_PREVIOUS + 1)) echo "Incrementing package release to $LINUX_PACKAGE_RELEASE" else diff --git a/scripts/version.sh b/scripts/version.sh index 6007332..71cdc09 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -3,6 +3,7 @@ set -e set -o pipefail +LINUX_REPOSITORY=submodules/ubuntu-mainline LINUX_VERSION_MAJOR=$(sed -n "s/^KERNEL_MAJ=\([0-9]*$\)/\1/p" < Makefile | xargs) LINUX_VERSION_MINOR=$(sed -n "s/^KERNEL_MIN=\([0-9]*$\)/\1/p" < Makefile | xargs) LINUX_VERSION_PATCHLEVEL=$(sed -n "s/^KERNEL_PATCHLEVEL=\([0-9]*$\)/\1/p" < Makefile | xargs) @@ -11,8 +12,7 @@ LINUX_VERSION=$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR.$LINUX_VERSION_PATCHLEVE LINUX_PACKAGE_RELEASE=$(sed -n "s/^PKGREL=\([0-9]*$\)/\1/p" < Makefile | xargs) LINUX_FLAVOR=$(sed -n "s/^PVE_BUILD_TYPE ?=\(.*\)$/\1/p" < Makefile | xargs) - -while getopts "MmprfdLh" OPTION; do +while getopts "MmprfdLBh" OPTION; do case $OPTION in M) echo $LINUX_VERSION_MAJOR @@ -42,7 +42,11 @@ while getopts "MmprfdLh" OPTION; do L) echo $LINUX_VERSION exit 0 - ;; + ;; + B) + echo $(git --git-dir $LINUX_REPOSITORY/.git log -1 --pretty=%B | sed -n "s/^.*Ubuntu-\([0-9.-]*\).*$/\1/p") + exit 0 + ;; h) echo "commit.sh [-Mmprfh]]" echo " -M major version" From d4cba085b791c5b4bbc9f24233bf25013f057893 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 18 Sep 2020 01:36:42 +0200 Subject: [PATCH 10/12] Add workflow for building release pull requests This change adds a Github Actions workflow to build pull requests from the same repository to test whether they can be merged and released. --- .github/workflows/build-trusted.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build-trusted.yml diff --git a/.github/workflows/build-trusted.yml b/.github/workflows/build-trusted.yml new file mode 100644 index 0000000..708a0fe --- /dev/null +++ b/.github/workflows/build-trusted.yml @@ -0,0 +1,35 @@ +name: Kernel Build (Trusted) + +on: pull_request + +jobs: + build: + name: Build + runs-on: [self-hosted] + strategy: + matrix: + include: + - build_cc: gcc-10 + if: github.event.pull_request.head.repo.full_name == github.repository && !contains(github.event.head_commit.message, 'skip ci') + steps: + - name: Checkout Sources + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build Kernel + run: make + env: + PVE_BUILD_CC: ${{ matrix.build_cc }} + - name: Read Build Information + id: read_build_info + run: | + echo "::set-output name=release::$(sed '1q;d' release.txt)" + echo "::set-output name=dst::$(sed '1q;d' artifacts.txt)" + echo "::set-output name=hdr::$(sed '2q;d' artifacts.txt)" + echo "::set-output name=tools::$(sed '3q;d' artifacts.txt)" + - name: Upload Artifacts + uses: actions/upload-artifact@v2-preview + with: + name: debs-${{ matrix.build_type }} + path: "*.deb" + From cb53262e863f25bc9679ab60264a3738b43d1d5e Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 18 Sep 2020 01:44:12 +0200 Subject: [PATCH 11/12] Fix support for release candidate version parsing --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index 71cdc09..18a8c77 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -9,7 +9,7 @@ LINUX_VERSION_MINOR=$(sed -n "s/^KERNEL_MIN=\([0-9]*$\)/\1/p" < Makefile | xargs LINUX_VERSION_PATCHLEVEL=$(sed -n "s/^KERNEL_PATCHLEVEL=\([0-9]*$\)/\1/p" < Makefile | xargs) LINUX_VERSION_PATCHLEVEL=${LINUX_VERSION_PATCHLEVEL:-0} LINUX_VERSION=$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR.$LINUX_VERSION_PATCHLEVEL -LINUX_PACKAGE_RELEASE=$(sed -n "s/^PKGREL=\([0-9]*$\)/\1/p" < Makefile | xargs) +LINUX_PACKAGE_RELEASE=$(sed -n "s/^PKGREL=\(.*\)$/\1/p" < Makefile | xargs) LINUX_FLAVOR=$(sed -n "s/^PVE_BUILD_TYPE ?=\(.*\)$/\1/p" < Makefile | xargs) while getopts "MmprfdLBh" OPTION; do From ce9c4ef6e51fc93d7bb4b4f8513ef5874016f95f Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 18 Sep 2020 12:54:40 +0200 Subject: [PATCH 12/12] Update release workflow for new flavor naming format --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16972b4..176714f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,9 @@ name: Kernel Release on: push: - tags: v* + tags: + - v* + - flavor/*/v* jobs: build: