2 # JOBoRun : Jwm OpenBox Obarun RUNit
3 # Maintainer : Joe Bo Run <joborun@disroot.org>
4 # PkgSource : url="https://gittea.disroot.org/joborun/jobcore/$pkgname"
5 #-----------------------------------------| DESCRIPTION |---------------------------------------
11 _url="https://www.kernel.org/"
14 bc kmod libelf pahole cpio perl tar xz
15 xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
18 _srcname=linux-$pkgver
19 url="https://cdn.kernel.org/pub/linux/kernel"
21 $url/v$pkgver%%.*.x/$_srcname.tar.{xz,sign}
22 config # the main kernel config file
24 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
25 # 0002-gcc-plugins-modern-gcc-plugin-infrastructure-requres.patch
27 0002-HID-holtek-fix-mouse-probing.patch
30 export KBUILD_BUILD_HOST=joborun
31 export KBUILD_BUILD_USER=$pkgbase
32 export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
36 echo "Setting version... $pkgver"
37 scripts/setlocalversion --save-scmversion
38 echo "-$pkgrel" > localversion.10-pkgrel
39 echo "${pkgbase#linux}" > localversion.20-pkgname
42 for src in "${source[@]}"; do
45 [[ $src = *.patch ]] || continue
46 echo "Applying patch $src..."
47 patch -Np1 < "../$src"
50 echo "Setting joborun config..."
54 make -s kernelrelease > version
55 echo "Prepared $pkgbase version $(<version)"
65 pkgdesc="The $pkgdesc kernel and modules"
66 depends=(coreutils kmod initramfs)
67 optdepends=('crda: to set the correct wireless channels of your country'
68 'linux-firmware: firmware images needed for some devices')
69 provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
70 replaces=(wireguard-lts)
73 local kernver="$(<version)"
74 local modulesdir="$pkgdir/usr/lib/modules/$kernver"
76 echo "Installing boot image..."
77 # systemd expects to find the kernel here to allow hibernation
78 # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
79 install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
81 # Used by mkinitcpio to name the kernel
82 echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
84 echo "Installing modules..."
85 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
87 # remove build and source links
88 rm "$modulesdir"/{source,build}
92 pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
95 local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
97 echo "Installing build files..."
98 install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
99 localversion.* version vmlinux
100 install -Dt "$builddir/kernel" -m644 kernel/Makefile
101 install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
102 cp -t "$builddir" -a scripts
104 # add objtool for external module building and enabled VALIDATION_STACK option
105 install -Dt "$builddir/tools/objtool" tools/objtool/objtool
107 # add xfs and shmem for aufs building
108 mkdir -p "$builddir"/{fs/xfs,mm}
110 echo "Installing headers..."
111 cp -t "$builddir" -a include
112 cp -t "$builddir/arch/x86" -a arch/x86/include
113 install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
115 install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
116 install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
118 # http://bugs.archlinux.org/task/13146
119 install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
121 # http://bugs.archlinux.org/task/20402
122 install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
123 install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
124 install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
126 echo "Installing KConfig files..."
127 find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
129 echo "Removing unneeded architectures..."
131 for arch in "$builddir"/arch/*/; do
132 [[ $arch = */x86/ ]] && continue
133 echo "Removing $(basename "$arch")"
137 echo "Removing documentation..."
138 rm -r "$builddir/Documentation"
140 echo "Removing broken symlinks..."
141 find -L "$builddir" -type l -printf 'Removing %P\n' -delete
143 echo "Removing loose objects..."
144 find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
146 echo "Stripping build tools..."
148 while read -rd '' file; do
149 case "$(file -bi "$file")" in
150 application/x-sharedlib\;*) # Libraries (.so)
151 strip -v $STRIP_SHARED "$file" ;;
152 application/x-archive\;*) # Libraries (.a)
153 strip -v $STRIP_STATIC "$file" ;;
154 application/x-executable\;*) # Binaries
155 strip -v $STRIP_BINARIES "$file" ;;
156 application/x-pie-executable\;*) # Relocatable binaries
157 strip -v $STRIP_SHARED "$file" ;;
159 done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
161 echo "Stripping vmlinux..."
162 strip -v $STRIP_STATIC "$builddir/vmlinux"
164 echo "Adding symlink..."
165 mkdir -p "$pkgdir/usr/src"
166 ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
170 # pkgdesc="Documentation for the $pkgdesc kernel"
173 # local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
175 # echo "Installing documentation..."
177 # while read -rd '' src; do
178 # dst="${src#Documentation/}"
179 # dst="$builddir/Documentation/${dst#output/}"
180 # install -Dm644 "$src" "$dst"
181 # done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
183 # echo "Adding symlink..."
184 # mkdir -p "$pkgdir/usr/share/doc"
185 # ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
188 pkgname=("$pkgbase" "$pkgbase-headers") # "$pkgbase-docs")
189 for _p in "${pkgname[@]}"; do
190 eval "package_$_p() {
191 $(declare -f "_package${_p#$pkgbase}")
192 _package${_p#$pkgbase}
196 #---- license gpg-key sha256sums ----
201 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
202 '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
205 # https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
207 sha256sums=(6f8631b6c382a2b0cfeff1e5f8805c8e1cfbe8d714b6e65f5bb79733c99068eb # linux-5.10.88.tar.xz
208 79115c89c930cde3d0de5305ccc0a073cf4de935d28409da2a5f95cf33f1ed7b # linux-5.10.88.tar.sign
209 6c9ac44e8cf06e37ab981524769c6b982c43cdc26e818740702182361fd55589 # config
210 f02d58b25a7656d6b3efdaa1c63772a1f2251f0a28e107bc90ccb3bf8350bfcd # sha256sums
211 96a72e1652314215da7140956c3abcf495cafd00811eda3cf4ce03ec5f791f1e # 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
212 4753850a30c6a64e2bb27b1c07ea72f3c40b8c7ee73e890bbc4745860ce1798d) # 0002-HID-holtek-fix-mouse-probing.patch