@@ -4,9 +4,9 @@ set -eu -o pipefail
44
55# # Update docker image tag, because kernel build is using `uname -r` when defining package version variable
66# KERNEL_VERSION=$(curl -s https://www.kernel.org | grep '<strong>' | head -3 | tail -1 | cut -d'>' -f3 | cut -d'<' -f1)
7- KERNEL_VERSION=5.9.7
7+ KERNEL_VERSION=5.10.47
88# KERNEL_REPOSITORY=git://kernel.ubuntu.com/virgin/linux-stable.git
9- KERNEL_REPOSITORY=https://git.kernel.org/pub/scm/ linux/kernel/ git/stable/linux-stable.git
9+ KERNEL_REPOSITORY=https://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/ linux/+ git/mainline-crack
1010REPO_PATH=$( pwd)
1111WORKING_PATH=/root/work
1212KERNEL_PATH=" ${WORKING_PATH} /linux-kernel"
@@ -35,72 +35,75 @@ get_next_version () {
3535# ## Clean up
3636rm -rfv ./* .deb
3737
38- mkdir " ${WORKING_PATH} " && cd " ${WORKING_PATH} "
39- cp -rf " ${REPO_PATH} " /{patches,templates} " ${WORKING_PATH} "
38+ mkdir -p " ${WORKING_PATH} " && cd " ${WORKING_PATH} "
39+ mkdir -p " ${WORKING_PATH} /patches"
40+ cp -rf " ${REPO_PATH} " /templates " ${WORKING_PATH} "
4041rm -rf " ${KERNEL_PATH} "
4142
42- # ## Dependencies
43+ # Install Build Dependencies
4344export DEBIAN_FRONTEND=noninteractive
44- apt-get update
45- apt-get install -y build-essential fakeroot libncurses-dev bison flex libssl-dev libelf-dev \
46- openssl dkms libudev-dev libpci-dev libiberty-dev autoconf wget xz-utils git \
47- bc rsync cpio dh-modaliases debhelper kernel-wedge curl
45+ apt-get update \
46+ && apt-get upgrade -y \
47+ && apt-get install -y --no-install-recommends \
48+ autoconf automake autopoint autotools-dev bsdmainutils debhelper dh-autoreconf git fakeroot\
49+ dh-strip-nondeterminism distro-info-data dwz file gettext gettext-base groff-base \
50+ intltool-debian libarchive-zip-perl libbsd0 libcroco3 libdebhelper-perl libelf1 libexpat1 \
51+ libfile-stripnondeterminism-perl libglib2.0-0 libicu66 libmagic-mgc libmagic1 libmpdec2 \
52+ libpipeline1 libpython3-stdlib libpython3.8-minimal libpython3.8-stdlib libsigsegv2 \
53+ libssl1.1 libsub-override-perl libtool libuchardet0 libxml2 \
54+ lsb-release m4 man-db mime-support po-debconf python-apt-common python3 python3-apt \
55+ python3-minimal python3.8 python3.8-minimal sbsigntool tzdata dctrl-tools kernel-wedge \
56+ libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev \
57+ libiberty-dev autoconf bc build-essential libusb-1.0-0-dev libhidapi-dev curl wget \
58+ cpio makedumpfile libcap-dev libnewt-dev libdw-dev rsync gnupg2 ca-certificates\
59+ libunwind8-dev liblzma-dev libaudit-dev uuid-dev libnuma-dev lz4 xmlto equivs \
60+ cmake pkg-config zstd
61+
62+
63+ # Build dwarves (depends on libbpf) tools using the latest ubuntu (impish) source packages
64+ mkdir /dwarves \
65+ && cd /dwarves \
66+ && echo " deb-src http://archive.ubuntu.com/ubuntu impish main universe" > /etc/apt/sources.list.d/impish-sources.list \
67+ && chown _apt /dwarves \
68+ && apt-get update \
69+ && apt-get source libbpf \
70+ && sdir=$( find . -name ' libbpf*' -type d) \
71+ && cd $sdir \
72+ && sed -i -re ' s/debhelper-compat \(= 13\)/debhelper-compat \(= 12\)/' debian/control \
73+ && dpkg-buildpackage \
74+ && cd .. && dpkg -i libbpf-dev_* _amd64.deb libbpf0_* _amd64.deb \
75+ && apt-get source dwarves-dfsg \
76+ && sdir=$( find . -name ' dwarves*' -type d) \
77+ && cd $sdir \
78+ && sed -i -re ' s/debhelper-compat \(= 13\)/debhelper-compat \(= 12\)/' debian/control \
79+ && dpkg-buildpackage \
80+ && cd .. && dpkg -i dwarves_* _amd64.deb \
81+ && cd / && rm -rf /dwarves \
82+ && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/*
4883
4984# ## get Kernel
50- git clone --depth 1 --single-branch --branch " v${KERNEL_VERSION} " \
51- " ${KERNEL_REPOSITORY} " " ${KERNEL_PATH} "
85+ git clone --depth 1 --single-branch --branch " cod/mainline/v${KERNEL_VERSION} " " ${KERNEL_REPOSITORY} " " ${KERNEL_PATH} "
5286cd " ${KERNEL_PATH} " || exit
5387
5488# ### Create patch file with custom drivers
5589echo >&2 " ===]> Info: Creating patch file... "
5690KERNEL_VERSION=" ${KERNEL_VERSION} " WORKING_PATH=" ${WORKING_PATH} " " ${REPO_PATH} /patch_driver.sh"
5791
58- # ### Apply patches
59- cd " ${KERNEL_PATH} " || exit
60-
61- echo >&2 " ===]> Info: Applying patches... "
62- [ ! -d " ${WORKING_PATH} /patches" ] && {
63- echo ' Patches directory not found!'
64- exit 1
65- }
66-
67-
68- while IFS= read -r file; do
69- echo " ==> Adding $file "
70- patch -p1 < " $file "
71- done < <( find " ${WORKING_PATH} /patches" -type f -name " *.patch" | grep -vE ' [2]00[0-9]' | sort)
72-
73- chmod a+x " ${KERNEL_PATH} " /debian/rules
74- chmod a+x " ${KERNEL_PATH} " /debian/scripts/*
75- chmod a+x " ${KERNEL_PATH} " /debian/scripts/misc/*
76-
7792echo >&2 " ===]> Info: Bulding src... "
7893
7994cd " ${KERNEL_PATH} "
80- make clean
81- cp " ${WORKING_PATH} /templates/default-config" " ${KERNEL_PATH} /.config"
82- make olddefconfig
83-
84- # Get rid of the dirty tag
85- echo " " > " ${KERNEL_PATH} " /.scmversion
8695
87- # Build Deb packages
88- make -j " $( getconf _NPROCESSORS_ONLN) " deb-pkg LOCALVERSION=-mbp KDEB_PKGVERSION=" $( make kernelversion) -$( get_next_version mbp-alt) "
96+ sed -i -re ' s/dwarves/dwarves (>=1.17-1)/g' debian.master/control.stub.in
8997
90- # Create alternative Kernel
91- echo >&2 " ===]> Info: Create alternative kernel ... "
92- make distclean
9398make clean
94- while IFS= read -r file; do
95- echo " ==> Adding $file "
96- patch -p1 < " $file "
97- done < <( find " ${WORKING_PATH} /patches" -type f -name " *.patch" | grep -E ' [2]00[0-9]' | sort)
9899cp " ${WORKING_PATH} /templates/default-config" " ${KERNEL_PATH} /.config"
99100make olddefconfig
101+
102+ # Get rid of the dirty tag
100103echo " " > " ${KERNEL_PATH} " /.scmversion
101104
102105# Build Deb packages
103- make -j " $( getconf _NPROCESSORS_ONLN) " deb-pkg LOCALVERSION=-mbp-alt KDEB_PKGVERSION=" $( make kernelversion ) -$( get_next_version mbp) "
106+ make -j " $( getconf _NPROCESSORS_ONLN) " deb-pkg LOCALVERSION=-mbp KDEB_PKGVERSION=" ${KERNEL_VERSION} -$( get_next_version mbp) "
104107
105108# ### Copy artifacts to shared volume
106109echo >&2 " ===]> Info: Copying debs and calculating SHA256 ... "
0 commit comments