2020-01-22 22:02:05 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'debian-*'
|
|
|
|
|
|
|
|
name: Debian
|
|
|
|
|
|
|
|
env:
|
|
|
|
GPG_KEY_ID: 56C464BAAC421453
|
2023-02-01 17:50:57 +00:00
|
|
|
KERNEL_VERSION: 6.1.9
|
2023-01-29 16:33:02 +00:00
|
|
|
KERNEL_REVISION: 1
|
2020-01-30 10:49:50 +00:00
|
|
|
LOCALVERSION: -surface
|
2020-06-14 17:31:39 +00:00
|
|
|
MAINLINE_REPO: git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack
|
|
|
|
MAINLINE_BRANCH: cod/mainline
|
2020-07-04 17:58:02 +00:00
|
|
|
TZ: UTC
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Kernel
|
|
|
|
runs-on: ubuntu-latest
|
2023-01-29 13:51:46 +00:00
|
|
|
container: ubuntu:20.04
|
2020-01-22 22:02:05 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
- name: Install build dependencies
|
|
|
|
run: |
|
|
|
|
sed 's/^deb /deb-src /' /etc/apt/sources.list >> /etc/apt/sources.list
|
2020-07-04 17:58:02 +00:00
|
|
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
|
|
|
|
echo $TZ > /etc/timezone
|
2020-01-22 22:02:05 +00:00
|
|
|
apt-get -y update
|
2023-01-29 13:51:46 +00:00
|
|
|
apt-get -y install build-essential fakeroot rsync git wget software-properties-common \
|
2022-12-09 15:52:07 +00:00
|
|
|
zstd lz4 sbsigntool debhelper dpkg-dev dpkg-sig
|
2020-01-22 22:02:05 +00:00
|
|
|
apt-get -y build-dep linux
|
|
|
|
|
2023-01-29 13:51:46 +00:00
|
|
|
# install python 3.11, required for configuring the kernel via Ubuntu's annotation format
|
|
|
|
add-apt-repository -y ppa:deadsnakes
|
|
|
|
apt-get -y update
|
|
|
|
apt-get -y install python3.11
|
|
|
|
ln -s /usr/bin/python3.11 /usr/bin/python
|
|
|
|
|
|
|
|
apt-get -y upgrade
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
- name: Prepare kernel source
|
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-06-14 17:53:20 +00:00
|
|
|
# setup git
|
|
|
|
git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
|
git config --global user.name "surfacebot"
|
|
|
|
|
2020-06-14 17:31:39 +00:00
|
|
|
# get ubuntu mainline source
|
|
|
|
# see https://kernel.ubuntu.com/~kernel-ppa/mainline
|
2021-10-27 13:01:44 +00:00
|
|
|
git clone "$MAINLINE_REPO" --branch "$MAINLINE_BRANCH/v$KERNEL_VERSION" --depth 1 linux
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-06-14 17:31:39 +00:00
|
|
|
cd linux
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-06-14 18:43:01 +00:00
|
|
|
# apply surface build/packaging patches
|
2020-01-22 22:02:05 +00:00
|
|
|
for PATCH in ../*.patch; do
|
2021-10-27 13:01:44 +00:00
|
|
|
git apply --index --reject ${PATCH}
|
2020-01-22 22:02:05 +00:00
|
|
|
done
|
|
|
|
|
2020-06-14 18:43:01 +00:00
|
|
|
git add .
|
|
|
|
git commit --allow-empty -m "Apply linux-surface packaging patches"
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
# apply surface patches
|
2020-04-02 23:21:12 +00:00
|
|
|
for PATCH in ../../../../patches/${KERNEL_VERSION%.*}/*.patch; do
|
2021-10-27 13:01:44 +00:00
|
|
|
git apply --index --reject ${PATCH}
|
2020-01-22 22:02:05 +00:00
|
|
|
done
|
|
|
|
|
2020-06-14 18:43:01 +00:00
|
|
|
git add .
|
|
|
|
git commit --allow-empty -m "Apply linux-surface patches"
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
- name: Configure
|
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel/linux
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2022-12-09 15:43:17 +00:00
|
|
|
# generate base config
|
|
|
|
./debian/scripts/misc/annotations --arch amd64 --flavour generic --export > ../base.config
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
# merge configs
|
2022-12-09 15:43:17 +00:00
|
|
|
./scripts/kconfig/merge_config.sh \
|
|
|
|
../base.config \
|
|
|
|
../ubuntu.config \
|
2020-04-02 23:21:12 +00:00
|
|
|
../../../../configs/surface-${KERNEL_VERSION%.*}.config
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
- name: Setup secureboot certificate
|
|
|
|
env:
|
|
|
|
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
|
run: |
|
|
|
|
cd pkg
|
|
|
|
|
2020-04-02 23:21:12 +00:00
|
|
|
mkdir -p debian/kernel/linux/keys
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
# unlock/copy key and certificate
|
2020-04-02 23:21:12 +00:00
|
|
|
echo "$SB_KEY" | base64 -d > debian/kernel/linux/keys/MOK.key
|
|
|
|
cp keys/surface.crt debian/kernel/linux/keys/MOK.crt
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-07-04 17:36:15 +00:00
|
|
|
- name: Build kernel
|
2022-12-10 14:17:19 +00:00
|
|
|
env:
|
2022-12-11 10:46:42 +00:00
|
|
|
# The DPKG in Ubuntu 22.04 defaults to using ZSTD,
|
|
|
|
# which is not yet supported by the DPKG in Debian 11
|
2022-12-10 14:17:19 +00:00
|
|
|
KDEB_COMPRESS: xz
|
2020-01-22 22:02:05 +00:00
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel/linux
|
2023-01-03 21:45:57 +00:00
|
|
|
|
|
|
|
# Explicitly set package version, including revision. This is picked up
|
|
|
|
# by 'make bindeb-pkg'.
|
|
|
|
export KDEB_PKGVERSION="${KERNEL_VERSION}${LOCALVERSION}-${KERNEL_REVISION}"
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
make bindeb-pkg -j2
|
|
|
|
|
2020-07-04 17:36:15 +00:00
|
|
|
- name: Build meta-package
|
|
|
|
run: |
|
|
|
|
cd pkg/debian/meta
|
|
|
|
./mkdebian.sh $(make -C ../kernel/linux -s kernelrelease) ${KERNEL_REVISION}
|
2022-12-11 10:42:58 +00:00
|
|
|
dpkg-buildpackage -b -Zxz
|
2020-07-04 17:36:15 +00:00
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
- name: Prepare release
|
|
|
|
run: |
|
|
|
|
mkdir release
|
2020-07-04 17:36:15 +00:00
|
|
|
rm pkg/debian/kernel/linux-libc-dev*.deb
|
2020-04-02 23:21:12 +00:00
|
|
|
mv pkg/debian/kernel/*.deb release
|
2020-07-04 17:36:15 +00:00
|
|
|
mv pkg/debian/*.deb release
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
- name: Sign packages
|
|
|
|
env:
|
|
|
|
GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }}
|
|
|
|
run: |
|
|
|
|
# import GPG key
|
|
|
|
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
|
|
|
|
export GPG_TTY=$(tty)
|
|
|
|
|
|
|
|
# sign package
|
|
|
|
dpkg-sig -g "--batch --no-tty" --sign builder -k $GPG_KEY_ID release/*.deb
|
|
|
|
|
|
|
|
- name: Upload artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-01-22 22:02:05 +00:00
|
|
|
with:
|
|
|
|
name: debian-latest
|
|
|
|
path: release
|
|
|
|
|
2020-02-18 17:57:02 +00:00
|
|
|
release:
|
|
|
|
name: Publish release
|
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2020-02-18 17:57:02 +00:00
|
|
|
with:
|
|
|
|
name: debian-latest
|
2023-02-02 00:05:42 +00:00
|
|
|
path: debian-latest
|
2020-02-18 17:57:02 +00:00
|
|
|
|
|
|
|
- name: Upload assets
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
2020-02-18 17:57:02 +00:00
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_BOT_TOKEN }}
|
|
|
|
file: ./*-latest/*
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
|
|
|
|
2020-01-22 22:02:05 +00:00
|
|
|
repo:
|
|
|
|
name: Update package repository
|
2020-02-18 17:57:02 +00:00
|
|
|
needs: [release]
|
2020-01-22 22:02:05 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-02-18 00:27:28 +00:00
|
|
|
container: debian:sid
|
2020-01-22 22:02:05 +00:00
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2020-02-18 00:27:28 +00:00
|
|
|
apt-get update
|
|
|
|
apt-get install -y git
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
- name: Download artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2020-01-22 22:02:05 +00:00
|
|
|
with:
|
|
|
|
name: debian-latest
|
2023-02-02 00:05:42 +00:00
|
|
|
path: debian-latest
|
2020-01-22 22:02:05 +00:00
|
|
|
|
|
|
|
- name: Update repository
|
|
|
|
env:
|
2020-02-17 19:27:10 +00:00
|
|
|
SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
|
2020-02-18 17:46:03 +00:00
|
|
|
BRANCH_STAGING: u/staging
|
2020-01-22 22:02:05 +00:00
|
|
|
GIT_REF: ${{ github.ref }}
|
|
|
|
run: |
|
2020-02-17 19:27:10 +00:00
|
|
|
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-02-17 19:27:10 +00:00
|
|
|
# clone package repository
|
|
|
|
git clone -b "${BRANCH_STAGING}" "${repo}" repo
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-02-17 19:27:10 +00:00
|
|
|
# copy packages
|
|
|
|
cp debian-latest/* repo/debian/
|
|
|
|
cd repo/debian
|
2020-01-22 22:02:05 +00:00
|
|
|
|
2020-02-17 19:27:10 +00:00
|
|
|
# parse git tag from ref
|
2020-01-22 22:02:05 +00:00
|
|
|
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
|
|
|
|
|
2020-02-17 19:27:10 +00:00
|
|
|
# convert packages into references
|
2020-02-18 02:08:16 +00:00
|
|
|
for pkg in $(find . -name '*.deb'); do
|
2020-02-04 19:40:36 +00:00
|
|
|
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
|
2020-01-22 22:02:05 +00:00
|
|
|
rm $pkg
|
|
|
|
done
|
|
|
|
|
2020-02-17 19:27:10 +00:00
|
|
|
# set git identity
|
|
|
|
git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
|
git config --global user.name "surfacebot"
|
|
|
|
|
|
|
|
# commit and push
|
|
|
|
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
|
|
|
git switch -c "${update_branch}"
|
|
|
|
git add .
|
|
|
|
git commit -m "Update Debian kernel"
|
|
|
|
git push --set-upstream origin "${update_branch}"
|