123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585 |
- # Contributor: David P. <megver83@parabola.nu>
- # Contributor: André Silva <emulatorman@hyperbola.info>
- # Contributor: Márcio Silva <coadde@hyperbola.info>
- # Contributor: fauno <fauno@parabola.nu>
- # Contributor: Sorin-Mihai Vârgolici <smv@yobicore.org>
- # Contributor: Michał Masłowski <mtjm@mtjm.eu>
- # Contributor: Luke R. <g4jc@openmailbox.org>
- # Contributor: Andreas Grapentin <andreas@grapentin.org>
- # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
- # Contributor: bill-auger <bill-auger@programmer.net>
- # Maintainer (arch:linux-lts): Andreas Radke <andyrtr@archlinux.org>
- # Maintainer (arch32:linux-lts): Andreas Baumann <mail@andreasbaumann.cc>
- # CAVEATS:
- # Provides linux-libre-lts{,-docs,-headers} but not linux-lts{,-docs,-headers}.
- # Otherwise, it is not possible to install along-side linux-libre-lts,
- # because linux-libre-lts conflicts and replaces any other package which provides linux-lts.
- # Until we get this sorted out (eg: add linux-libre provision to linux-libre{,lts,...}),
- # the trade-off is that packages which require linux-libre-lts{,-docs,-headers}
- # will pull in linux-libre-lts, even if linux-libre-vanilla-lts is installed.
- # - linux-libre-lts: acpi_call-lts and tp_smapi-lts require linux-libre-lts
- # - linux-libre-lts-headers: nothing requires linux-libre{,-lts}-headers (but provided for completeness)
- # - linux-libre-lts-docs: extra/systeroid requires linux-docs
- pkgbase=linux-libre-vanilla-lts
- pkgver=6.6.32
- _minor_ver=$(sed 's|\([0-9]\+\.[0-9]\+\).*|\1|' <<<${pkgver}) # eg: 6.1
- _upstream_minor_ver=${_minor_ver}-gnu # eg: 6.1-gnu
- _upstream_ver=${pkgver}-gnu # eg: 6.1.5-gnu
- _is_patch_release=$( [[ ${_upstream_minor_ver} != ${_upstream_ver} ]] ; echo $((!$?)) ; )
- pkgrel=2
- pkgdesc="Linux-libre LTS (pristine upstream release)"
- url=https://linux-libre.fsfla.org/
- arch=(armv7h i686 x86_64)
- license=(GPL2)
- makedepends=(
- bc
- cpio
- gettext
- libelf
- pahole
- perl
- python
- tar
- xz
- # htmldocs
- graphviz
- imagemagick
- python-sphinx
- #python-yaml # next major release will probably need this un-commented
- texlive-latexextra
- )
- makedepends_armv7h=(uboot-tools vboot-utils dtc) # required by linux-libre-lts-chromebook
- makedepends_armv7h+=(kmod ) # explicit `depmod`
- options=(
- !debug
- !strip
- )
- _srcname=linux-${_minor_ver}
- source=(https://linux-libre.fsfla.org/pub/linux-libre/releases/${_upstream_minor_ver}/linux-libre-${_upstream_minor_ver}.tar.xz{,.sign}
- https://repo.parabola.nu/other/linux-libre/logos/logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}{,.sig})
- (( _is_patch_release )) && source+=(https://linux-libre.fsfla.org/pub/linux-libre/releases/${_upstream_ver}/patch-${_upstream_minor_ver}-${_upstream_ver}.xz{,.sign})
- source_armv7h=(config.armv7h
- 'kernel.its'
- 'kernel.keyblock'
- 'kernel_data_key.vbprivk'
- linux-libre-vanilla-armv7h.preset)
- source_i686=(config.i686
- no-ultra-zstd.patch)
- source_x86_64=(config.x86_64)
- sha512sums=('ccc9e2ad65f351d129aad604d4bc476627e4243cd09824a85832fece8df5a676bb12d3db9856d91dc3bb1cca6bfa11e1a9dccb1441b12a0f54507595cbeb5694'
- 'SKIP'
- '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3'
- 'SKIP'
- '7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78'
- 'SKIP'
- '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1'
- 'SKIP')
- (( _is_patch_release )) && sha512sums+=('4cce11c92079c657b3d1d596f02322dcfe0aac16cec286f58ea2ba043a62e8ff872fba0e356b28c37fa9f3b0ac62757deecf643ff02947275364acaa14a855cd'
- 'SKIP')
- sha512sums_armv7h=('725c453abb9f8b42148d4dd8d4cf53a6b6512d5fda35aa15bfa998a819e539e19d649e080ff2c0f4a6e00d29ae62ef2868c56cbb42c3d1f720319a513595659d'
- 'f10af02f0cb2d31259d9633e1ba845f555f525789f750fc2ddc51bd18c5ff64fcdd242dae801623887f5ce5cdb5528bce890459f0fab9fd31a28868bb7f6bba5'
- 'bb6718984a7357c9b00c37e4788480e5b8b75018c172ecc1441bc3fc5d2d42444eb5d8c7f9d2e3a7d6fed6d03acb565e3c0559486e494c40a7fe6bd0570c9ede'
- '143dea30c6da00e504c99984a98a0eb2411f558fcdd9dfa7f607d6c14e9e7dffff9cb00121d9317044b07e3e210808286598c785ee854084b993ec9cb14d8232'
- 'f01e7925b262d2874a8a991b1f27d057356a2a384d2012b61be5a631d4e4d7cf87461c8fb9e7f183831f5a829ad204897f1f0545a52df6288a0e04a5c2e31b96')
- sha512sums_i686=('50d3529a9a279a880c07a4bb6f46374b1fb260861b776ab5791136c176ae1f0a24c4b0c8837f06000317017d21cb46ca307b1ee0644385cc200be96a79723ae6'
- 'bca15cc96f64c38adcd13a46752866b5b30555ac21e19b3f7afcd20fcb7ec585c9d990fe8f842f44d5f69d477d72867fe6a9102729f26f93f5a80b372e41ce85')
- sha512sums_x86_64=('a5ba89d6f95d5d18462303cafd751bb9c96fb4266c58afbd60df1eb3deb8be8fa7f6e5d3b48cda4a750b88751b078d783f9cf101af6d449d9d4dbe238efa2d59')
- validpgpkeys=('474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva
- '6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78') # David P.
- # reproducibility
- export KBUILD_BUILD_HOST=parabola
- export KBUILD_BUILD_USER=$pkgbase
- export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
- # per-arch KARCH
- case "$CARCH" in
- i686|x86_64) KARCH=x86;;
- armv7h) KARCH=arm;;
- esac
- # per-arch dependency tweaks
- _BUILD_DOCS=$( [[ "$CARCH" =~ ^(armv7h|i686)$ ]] && echo 0 || echo 1)
- _BUILD_BPFTOOL=$([[ "$CARCH" =~ ^(armv7h|i686)$ ]] && echo 0 || echo 1)
- _BUILD_BPFTOOL=0 # next major release will probably need this LOC deleted
- # FIXME: x86_64 succeeded with CONFIG_DEBUG_INFO_BTF=y and _BUILD_BPFTOOL=0
- # but i686 failed, suggesting to disable CONFIG_DEBUG_INFO_BTF
- if ! (( _BUILD_DOCS )); then
- # temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
- # FIXME: sphinx-build returned an error at ./scripts/sphinx-pre-install line 317.
- makedepends=( ${makedepends[*]/graphviz/} )
- makedepends=( ${makedepends[*]/imagemagick/} )
- makedepends=( ${makedepends[*]/python-sphinx/} )
- makedepends=( ${makedepends[*]/python-yaml/} )
- makedepends=( ${makedepends[*]/texlive-latexextra/} )
- fi
- if ! (( _BUILD_BPFTOOL )); then
- # Also avoid building/running bpftool
- makedepends=( ${makedepends[*]/pahole/} )
- fi
- prepare() {
- cd $_srcname
- # upstream patch release
- if [ "${_minor_ver}" != "$pkgver" ]; then
- echo "Applying upstream patch release"
- patch -Np1 < "../patch-${_minor_ver}-gnu-${pkgver}-gnu"
- fi
- # freedo boot logo
- install -m644 -t drivers/video/logo ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
- echo "Setting version..."
- echo "-$pkgrel" > localversion.10-pkgrel
- echo "${pkgbase#linux}" > localversion.20-pkgname
- sed -i 's|^-libre||' localversion.20-pkgname # minimize diff
- local src
- declare -n per_arch_source=source_${CARCH} # minimize diff
- source+=( "${per_arch_source[@]}" ) # minimize diff
- for src in "${source[@]}"; do
- src="${src%%::*}"
- src="${src##*/}"
- # *.zst n/a - linux-libre patches are compressed only once
- [[ $src = *.patch ]] || continue
- echo "Applying patch $src..."
- patch -Np1 < "../$src"
- done
- echo "Setting config..."
- mv ../config{.$CARCH,} # minimize diff
- cp ../config .config
- make olddefconfig
- diff -u ../config .config || :
- if [ "$CARCH" = "armv7h" ]; then
- # don't run depmod on 'make install'. We'll do this ourselves in packaging
- sed -i '2iexit 0' scripts/depmod.sh
- fi
- make -s kernelrelease > version
- echo "Prepared $pkgbase version $(<version)"
- }
- build() {
- cd $_srcname
- make all
- # Also avoid building/running bpftool
- if (( _BUILD_BPFTOOL )); then
- make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1
- fi
- # temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
- if (( _BUILD_DOCS )); then
- make htmldocs
- fi
- }
- _package() {
- pkgdesc="The $pkgdesc kernel and modules"
- license=(
- 'Apache-2.0 OR MIT'
- 'BSD-2-Clause OR GPL-2.0-or-later'
- BSD-3-Clause
- 'BSD-3-Clause OR GPL-2.0-only'
- 'BSD-3-Clause OR GPL-2.0-or-later'
- BSD-3-Clause-Clear
- GPL-1.0-or-later
- 'GPL-1.0-or-later OR BSD-3-Clause'
- GPL-2.0-only
- 'GPL-2.0-only OR Apache-2.0'
- 'GPL-2.0-only OR BSD-2-Clause'
- 'GPL-2.0-only OR BSD-3-Clause'
- 'GPL-2.0-only OR CDDL-1.0'
- 'GPL-2.0-only OR Linux-OpenIB'
- 'GPL-2.0-only OR MIT'
- 'GPL-2.0-only OR MPL-1.1'
- 'GPL-2.0-only OR X11'
- 'GPL-2.0-only WITH Linux-syscall-note'
- GPL-2.0-or-later
- 'GPL-2.0-or-later OR BSD-2-Clause'
- 'GPL-2.0-or-later OR BSD-3-Clause'
- 'GPL-2.0-or-later OR MIT'
- 'GPL-2.0-or-later OR X11'
- 'GPL-2.0-or-later WITH GCC-exception-2.0'
- ISC
- LGPL-2.0-or-later
- 'LGPL-2.1-only'
- 'LGPL-2.1-only OR BSD-2-Clause'
- LGPL-2.1-or-later
- MIT
- MPL-1.1
- X11
- Zlib
- )
- depends=(
- coreutils
- initramfs
- kmod
- )
- optdepends=(
- 'wireless-regdb: to set the correct wireless channels of your country'
- 'linux-firmware: firmware images needed for some devices'
- )
- optdepends=( "${optdepends[@]/linux/linux-libre}" ) # minimize diff
- provides=(
- # KSMBD-MODULE # no parabola package requires this
- # VIRTUALBOX-GUEST-MODULES # no parabola package requires this
- # WIREGUARD-MODULE # no parabola package requires this
- )
- provides+=("linux-libre-lts=${pkgver}")
- replaces=(
- # virtualbox-guest-modules-arch # no such parabola package since 2021
- # wireguard-arch # no such parabola package since 2020
- )
- backup=("etc/mkinitcpio.d/${pkgbase}.preset")
- cd $_srcname
- local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
- echo "Installing boot image..."
- # systemd expects to find the kernel here to allow hibernation
- # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
- install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
- # On armv7h, the uboot4extlinux-* packages provide and use a extlinux.conf
- # file in /boot/extlinux/. This file is needed for the bootloader to find the
- # kernel, initramfs and devicetree. Because of that we need the kernel image
- # to also be installed in /boot for several reasons:
- #
- # - First the $modulesdir name contains the kernel version, and extlinux.conf
- # is supposed to be edited by hand by users. Users can't be expected to do
- # that at each kernel updates beause at some point they will forget and get
- # a mismatch between the kernel image and modules which often breaks boot.
- # In addition people know that the kernel image is in /boot. Having it in
- # $moduledir instead is not documented anywhere. And we don't have code that
- # can automatically generate an extlinux.conf.
- #
- # - Then we also need the kernel image in /boot to be able to use LVM rootfs
- # as this requires a separate /boot partition and u-boot can't read LVM.
- #
- # - Finally, doing the copy manually might be straigtforward in some cases,
- # as computers like the Lime 2 A20 are well supported, boot on a microSD or
- # other removable storage that can be read by a laptop/desktop computer and
- # even has a display that works at boot. But some of the supported ARM
- # computers have an internal eMMC and no display that works at boot (like
- # the TBS2910 or beaglebone black) and no way to export the internal storage
- # as an usb mass storage (because the ums command is not compiled in u-boot)
- # and sometimes even no way to connect a display at all (like the BegaleBone
- # green). So that makes the simple way of copying a file way more complex.
- # So it is a good idea not to break the boot if possible.
- if [ "$CARCH" = "armv7h" ]; then
- install -Dm644 "$(make -s image_name)" "$pkgdir/boot/vmlinuz-${pkgbase}"
- fi
- # Used by mkinitcpio to name the kernel
- echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
- echo "Installing modules..."
- ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
- DEPMOD=/doesnt/exist modules_install # Suppress depmod
- # remove build link
- rm "$modulesdir"/build
- # licenses
- install -vDm 644 LICENSES/deprecated/{GPL-1.0,ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
- install -vDm 644 LICENSES/preferred/{BSD,MIT}* -t "$pkgdir/usr/share/licenses/$pkgname/"
- install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
- if [ "$CARCH" = "armv7h" ]; then
- echo "Installing device tree binaries..."
- make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs/${pkgbase}" dtbs_install
- fi
- if [ "$CARCH" = "armv7h" ]; then
- local _kernver="$(<version)" # minimize diff
- cp ../{${pkgbase%-lts}-armv7h,linux}.preset # minimize diff
- # now we call depmod...
- depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
- # sed expression for following substitutions
- local _subst="
- s|%PKGBASE%|${pkgbase}|g
- s|%KERNVER%|${_kernver}|g
- "
- echo "Installing mkinitcpio preset..."
- # install mkinitcpio preset file
- sed "${_subst}" ../linux.preset |
- install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
- fi
- }
- _package-headers() {
- pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
- license=(
- BSD-3-Clause
- 'BSD-3-Clause OR GPL-2.0-only'
- GPL-1.0-or-later
- 'GPL-1.0-or-later WITH Linux-syscall-note'
- GPL-2.0-only
- 'GPL-2.0-only OR Apache-2.0'
- 'GPL-2.0-only OR BSD-2-Clause'
- 'GPL-2.0-only OR BSD-3-Clause'
- 'GPL-2.0-only OR CDDL-1.0'
- 'GPL-2.0-only OR Linux-OpenIB'
- 'GPL-2.0-only OR Linux-OpenIB OR BSD-2-Clause'
- 'GPL-2.0-only OR MIT'
- 'GPL-2.0-only OR MPL-1.1'
- 'GPL-2.0-only OR X11'
- 'GPL-2.0-only WITH Linux-syscall-note'
- '(GPL-2.0-only WITH Linux-syscall-note) AND MIT'
- '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause'
- '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause'
- '(GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0'
- '(GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB'
- '(GPL-2.0-only WITH Linux-syscall-note) OR MIT'
- GPL-2.0-or-later
- 'GPL-2.0-or-later OR BSD-2-Clause'
- 'GPL-2.0-or-later OR BSD-3-Clause'
- 'GPL-2.0-or-later OR MIT'
- 'GPL-2.0-or-later WITH Linux-syscall-note'
- '(GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause'
- '(GPL-2.0-or-later WITH Linux-syscall-note) OR MIT'
- 'LGPL-2.0-or-later OR BSD-2-Clause'
- 'LGPL-2.0-or-later WITH Linux-syscall-note'
- ISC
- 'LGPL-2.0-or-later WITH Linux-syscall-note'
- 'LGPL-2.0-or-later OR BSD-2-Clause'
- LGPL-2.1-only
- 'LGPL-2.1-only OR BSD-2-Clause'
- 'LGPL-2.1-only OR MIT'
- 'LGPL-2.1-only WITH Linux-syscall-note'
- LGPL-2.1-or-later
- 'LGPL-2.1-or-later OR BSD-2-Clause'
- 'LGPL-2.1-or-later WITH Linux-syscall-note'
- MIT
- Zlib
- )
- depends=(pahole)
- provides=("linux-libre-lts-headers=${pkgver}")
- cd $_srcname
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
- echo "Installing build files..."
- # next major release will probably need this next LOC
- #(( _BUILD_BPFTOOL )) || touch tools/bpf/bpftool/vmlinux.h
- install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
- localversion.* version vmlinux
- install -Dt "$builddir/kernel" -m644 kernel/Makefile
- install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile
- # next major release will probably need this next LOC
- #(( _BUILD_BPFTOOL )) || rm "$builddir"/vmlinux.h
- if [ "$CARCH" = "i686" ]; then
- install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile_32.cpu
- fi
- cp -t "$builddir" -a scripts
- # required when STACK_VALIDATION is enabled
- if [[ -e tools/objtool/objtool ]]; then
- install -Dt "$builddir/tools/objtool" tools/objtool/objtool
- fi
- # required when DEBUG_INFO_BTF_MODULES is enabled
- if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
- install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
- fi
- echo "Installing headers..."
- cp -t "$builddir" -a include
- cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
- install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
- # ARM-specific headers
- if [ "$CARCH" = "armv7h" ]; then
- local _builddir="${builddir}" # minimize diff
- cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
- fi
- install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
- install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
- # https://bugs.archlinux.org/task/13146
- install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
- # https://bugs.archlinux.org/task/20402
- install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
- install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
- install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
- # https://bugs.archlinux.org/task/71392
- install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
- echo "Installing KConfig files..."
- find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
- echo "Removing unneeded architectures..."
- local arch
- for arch in "$builddir"/arch/*/; do
- [[ $arch = */$KARCH/ ]] && continue
- echo "Removing $(basename "$arch")"
- rm -r "$arch"
- done
- echo "Removing documentation..."
- rm -r "$builddir/Documentation"
- echo "Removing broken symlinks..."
- find -L "$builddir" -type l -printf 'Removing %P\n' -delete
- echo "Removing loose objects..."
- find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
- echo "Stripping build tools..."
- local file
- while read -rd '' file; do
- case "$(file -Sib "$file")" in
- application/x-sharedlib\;*) # Libraries (.so)
- strip -v $STRIP_SHARED "$file" ;;
- application/x-archive\;*) # Libraries (.a)
- strip -v $STRIP_STATIC "$file" ;;
- application/x-executable\;*) # Binaries
- strip -v $STRIP_BINARIES "$file" ;;
- application/x-pie-executable\;*) # Relocatable binaries
- strip -v $STRIP_SHARED "$file" ;;
- esac
- done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
- echo "Stripping vmlinux..."
- strip -v $STRIP_STATIC "$builddir/vmlinux"
- echo "Adding symlink..."
- mkdir -p "$pkgdir/usr/src"
- ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
- # licenses
- install -vDm 644 LICENSES/deprecated/{ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
- install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
- install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
- }
- _package-docs() {
- pkgdesc="Documentation for the $pkgdesc kernel"
- license=(
- BSD-3-Clause
- GFDL-1.1-no-invariants-or-later
- GPL-2.0-only
- 'GPL-2.0-only OR BSD-2-Clause'
- 'GPL-2.0-only OR BSD-3-Clause'
- 'GPL-2.0-only OR GFDL-1.1-no-invariants-or-later'
- 'GPL-2.0-only OR GFDL-1.2-no-invariants-only'
- 'GPL-2.0-only OR MIT'
- GPL-2.0-or-later
- 'GPL-2.0-or-later OR BSD-2-Clause'
- 'GPL-2.0-or-later OR CC-BY-4.0'
- 'GPL-2.0-or-later OR MIT'
- 'GPL-2.0-or-later OR X11'
- 'LGPL-2.1-only OR BSD-2-Clause'
- MIT
- )
- provides=("linux-libre-lts-docs=${pkgver}")
- cd $_srcname
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
- echo "Installing documentation..."
- local src dst
- while read -rd '' src; do
- dst="${src#Documentation/}"
- dst="$builddir/Documentation/${dst#output/}"
- install -Dm644 "$src" "$dst"
- done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
- echo "Adding symlink..."
- mkdir -p "$pkgdir/usr/share/doc"
- ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
- # licenses
- install -vDm 644 LICENSES/deprecated/X11 -t "$pkgdir/usr/share/licenses/$pkgname/"
- install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
- }
- _package-chromebook() {
- pkgdesc="$pkgdesc kernel sign for Veyron Chromebooks"
- depends=("${pkgbase}=${pkgver}")
- provides=("linux-libre-lts=${pkgver}")
- conflicts=(linux-libre{,-vanilla}-chromebook) # just 'cuz i dun wanna
- install=${pkgname}.install
- cd $_srcname
- cp ../kernel.its .
- mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
- dd if=/dev/zero of=bootloader.bin bs=512 count=1
- echo 'console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd' > cmdline
- echo "Creating kernel sign..."
- vbutil_kernel \
- --pack vmlinux.kpart \
- --version 1 \
- --vmlinuz vmlinux.uimg \
- --arch arm \
- --keyblock ../kernel.keyblock \
- --signprivate ../kernel_data_key.vbprivk \
- --config cmdline \
- --bootloader bootloader.bin
- echo "Installing kernel sign..."
- mkdir -p "${pkgdir}/boot"
- cp vmlinux.kpart "${pkgdir}/boot"
- }
- pkgname=(
- "$pkgbase"
- "$pkgbase-headers"
- "$pkgbase-docs"
- )
- [ "$CARCH" = "armv7h" ] && pkgname+=("$pkgbase-chromebook")
- for _p in "${pkgname[@]}"; do
- eval "package_$_p() {
- $(declare -f "_package${_p#$pkgbase}")
- _package${_p#$pkgbase}
- }"
- done
- (( _BUILD_DOCS )) || pkgname=( ${pkgname[*]/$pkgbase-docs/} )
- # FIXME: `mkimage kernel.signed` command fails in _package-chromebook()
- # FATAL ERROR: Couldn't open "arch/arm/boot/dts/exynos5250-snow.dtb": No such file or directory
- # mkimage: Can't open vmlinux.uimg.tmp: No such file or directory
- [[ "$CARCH" == armv7h ]] && pkgname=( ${pkgname[*]/$pkgbase-chromebook/} ) || :
|