1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor: Joakim Hernberg <jbh@alchemy.lu>
5 pkgver=6.3.0.11.realtime1
9 url="https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt/-/commits/v$pkgver"
29 git+https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt#tag=v$pkgver?signed
33 'ef4a44b21ee57a52e169557f8921cef343d8752505d6ee2ad0bce23c1d0ad742a951c91a5192b9ff0c10218c836247b4e6c252cfc061e03f9bc216a5d4dcaf8d')
35 'e3ee8ac045615dbead40cadb316411e752d6f35fc5fcaea31a1c43a06dcd7ed4244501d5d5286d241b29067cfc5722171894f6b5b9acdff0aa199c3cb813565c')
37 '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman <gregkh@kernel.org>
38 '64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior
39 'C7E7849466FE2358343588377258734B41C31549' # David Runge <dvzrv@archlinux.org>
40 '991F6E3F0765CF6295888586139B09DA5BF0D338' # David Runge <dvzrv@archlinux.org>
43 export KBUILD_BUILD_HOST=archlinux
44 export KBUILD_BUILD_USER=$pkgbase
45 export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
49 make KERNELRELEASE="$(<version)" "$@"
55 echo "Setting version..."
56 echo "-$pkgrel" > localversion.10-pkgrel
57 echo "${pkgbase#linux}" > localversion.20-pkgname
59 # make -s kernelrelease > version # this still appends SCM version :(((
60 echo "$pkgver-$pkgrel${pkgbase#linux}" > version
64 for src in "${source[@]}"; do
67 # allow to pick up the RT patch
68 src="${src//patch.xz/patch}"
69 [[ $src = *.patch ]] || continue
70 echo "Applying patch $src..."
71 patch -Np1 < "../$src"
74 echo "Setting config..."
78 diff -u ../config .config || :
80 echo "Prepared $pkgbase version $(<version)"
89 pkgdesc="The $pkgdesc kernel and modules"
96 'wireless-regdb: to set the correct wireless channels of your country'
97 'linux-firmware: firmware images needed for some devices'
101 VIRTUALBOX-GUEST-MODULES
106 local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
108 echo "Installing boot image..."
109 # systemd expects to find the kernel here to allow hibernation
110 # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
111 install -Dm644 "$(_make -s image_name)" "$modulesdir/vmlinuz"
113 # Used by mkinitcpio to name the kernel
114 echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
116 echo "Installing modules..."
117 _make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
118 DEPMOD=/doesnt/exist modules_install # Suppress depmod
120 # remove build and source links
121 rm "$modulesdir"/{source,build}
125 pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
129 local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
131 echo "Installing build files..."
132 install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
133 localversion.* version vmlinux
134 install -Dt "$builddir/kernel" -m644 kernel/Makefile
135 install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
136 cp -t "$builddir" -a scripts
138 # required when STACK_VALIDATION is enabled
139 install -Dt "$builddir/tools/objtool" tools/objtool/objtool
141 # required when DEBUG_INFO_BTF_MODULES is enabled
142 install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
144 echo "Installing headers..."
145 cp -t "$builddir" -a include
146 cp -t "$builddir/arch/x86" -a arch/x86/include
147 install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
149 install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
150 install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
152 # https://bugs.archlinux.org/task/13146
153 install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
155 # https://bugs.archlinux.org/task/20402
156 install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
157 install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
158 install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
160 # https://bugs.archlinux.org/task/71392
161 install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
163 echo "Installing KConfig files..."
164 find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
166 echo "Removing unneeded architectures..."
168 for arch in "$builddir"/arch/*/; do
169 [[ $arch = */x86/ ]] && continue
170 echo "Removing $(basename "$arch")"
174 echo "Removing documentation..."
175 rm -r "$builddir/Documentation"
177 echo "Removing broken symlinks..."
178 find -L "$builddir" -type l -printf 'Removing %P\n' -delete
180 echo "Removing loose objects..."
181 find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
183 echo "Stripping build tools..."
185 while read -rd '' file; do
186 case "$(file -Sib "$file")" in
187 application/x-sharedlib\;*) # Libraries (.so)
188 strip -v $STRIP_SHARED "$file" ;;
189 application/x-archive\;*) # Libraries (.a)
190 strip -v $STRIP_STATIC "$file" ;;
191 application/x-executable\;*) # Binaries
192 strip -v $STRIP_BINARIES "$file" ;;
193 application/x-pie-executable\;*) # Relocatable binaries
194 strip -v $STRIP_SHARED "$file" ;;
196 done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
198 echo "Stripping vmlinux..."
199 strip -v $STRIP_STATIC "$builddir/vmlinux"
201 echo "Adding symlink..."
202 mkdir -p "$pkgdir/usr/src"
203 ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
207 pkgdesc="Documentation for the $pkgdesc kernel"
210 local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
212 echo "Installing documentation..."
214 while read -rd '' src; do
215 dst="${src#Documentation/}"
216 dst="$builddir/Documentation/${dst#output/}"
217 install -Dm644 "$src" "$dst"
218 done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
220 echo "Adding symlink..."
221 mkdir -p "$pkgdir/usr/share/doc"
222 ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
230 for _p in "${pkgname[@]}"; do
231 eval "package_$_p() {
232 $(declare -f "_package${_p#$pkgbase}")
233 _package${_p#$pkgbase}
237 # vim:set ts=8 sts=2 sw=2 et: