# Template file for 'linux-mainline'
#
# One template, four outputs (driver subpackages):
#   linux-mainline            meta, depends linux=<version>
#   linux-mainline-headers    meta, depends linux-headers=<version>
#   linux              image + modules + maps (post-install: depmod)
#   linux-headers      sanitized headers_install (user API only -
#                             NOT a module-build tree; openbcm needs a
#                             follow-up, see mk/kernel.inc)
#
# NOTE: mainline is a moving target by design (rc snapshots weekly). The
# pin below is TOFU: git.kernel.org publishes no sha256 for the torvalds
# snapshots (only .tar.sign PGP). Re-pin every bump, verify the tag out
# of band.
pkgname=linux-mainline
version=7.3_rc3
revision=0
short_desc="UNOS kernel meta - mainline snapshot"
maintainer="finwo <finwo@pm.me>"
license="GPL-2.0-only"
homepage="https://www.kernel.org"
distfiles="https://git.kernel.org/torvalds/t/linux-7.3-rc3.tar.gz"
checksum=49b24119d7b92da75bba0daf5da4f7735c8cb948757a282e849092dcc681d8dd
# the meta points at this line's kernel build (exact pin incl. revision -
# apk's `=` only matches the full pkgver, so a bare version never matches)
depends="linux=${version}-r${revision}"
hostmakedepends="bc flex bison"
subpackages="linux-mainline-headers linux linux-headers"

short_desc_linux_mainline_headers="UNOS kernel headers meta - mainline snapshot"
depends_linux_mainline_headers="linux-headers=${version}-r${revision}"
short_desc_linux="Linux kernel image and modules"
depends_linux="busybox"
short_desc_linux_headers="Linux kernel sanitized headers"
depends_linux_headers=

# Notes: same recipe as linux-longterm (defconfig + deltas, mk/kernel.inc).
# Deltas re-verified per line - symbols move between releases, the asserts
# fail loud if this list rots. KREL here is 7.3.0-rc3 (derived, not equal
# to the 7.3_rc3 apk version) - all install paths use KREL.

# shellcheck disable=SC1091
. "${UNOS_MKDIR}/kernel.inc"

KDELTA_ENABLE="IKCONFIG IKCONFIG_PROC NET_L3_MASTER_DEV IPV6_MULTIPLE_TABLES BLK_DEV_NVME MMC MMC_BLOCK BRIDGE VLAN_8021Q"
KDELTA_MODULE="NET_VRF"
KDELTA_DISABLE=""
KASSERT_Y="IPV6 IP_MULTIPLE_TABLES IPV6_MULTIPLE_TABLES NET_L3_MASTER_DEV DEVTMPFS_MOUNT BLK_DEV_INITRD SERIAL_8250_CONSOLE MODULES IKCONFIG IKCONFIG_PROC EFI_STUB BLK_DEV_NVME MMC MMC_BLOCK NVME_CORE BRIDGE VLAN_8021Q"
KASSERT_M="NET_VRF"
KASSERT_N="MODULE_SIG"

do_configure() { kernel_configure; }
do_build() { kernel_build; }
do_install() { kernel_install; }

sub_linux_mainline_headers() { :; }
sub_linux() {
  spick boot
  spick lib/modules
}
sub_linux_headers() {
  spick usr/include
}
