Skip to content

Commit

Permalink
feat(zfs): build sysext for Flatcar 3510.2.8
Browse files Browse the repository at this point in the history
donch committed Oct 6, 2023
1 parent 6843bac commit f3fad3a
Showing 41 changed files with 5,741 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ jobs:
strategy:
max-parallel: 6
matrix:
flatcarversion: ["3510.2.6", "3510.2.7"]
flatcarversion: ["3510.2.6", "3510.2.7", "3510.2.8"]
permissions:
# allow the action to create a release
contents: write
201 changes: 201 additions & 0 deletions files/zfs/3510.2.8/overlay/eclass/dist-kernel-utils.eclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# Copyright 2020-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: dist-kernel-utils.eclass
# @MAINTAINER:
# Distribution Kernel Project <[email protected]>
# @AUTHOR:
# Michał Górny <[email protected]>
# @SUPPORTED_EAPIS: 7 8
# @BLURB: Utility functions related to Distribution Kernels
# @DESCRIPTION:
# This eclass provides various utility functions related to Distribution
# Kernels.

# @ECLASS_VARIABLE: KERNEL_IUSE_SECUREBOOT
# @PRE_INHERIT
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-null value, inherits secureboot.eclass
# and allows signing of generated kernel images.

if [[ ! ${_DIST_KERNEL_UTILS} ]]; then

case ${EAPI} in
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then
inherit secureboot
fi

# @FUNCTION: dist-kernel_build_initramfs
# @USAGE: <output> <version>
# @DESCRIPTION:
# Build an initramfs for the kernel. <output> specifies the absolute
# path where initramfs will be created, while <version> specifies
# the kernel version, used to find modules.
#
# Note: while this function uses dracut at the moment, other initramfs
# variants may be supported in the future.
dist-kernel_build_initramfs() {
debug-print-function ${FUNCNAME} "${@}"

[[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments"
local output=${1}
local version=${2}

local rel_image_path=$(dist-kernel_get_image_path)
local image=${output%/*}/${rel_image_path##*/}

local args=(
--force
# if uefi=yes is used, dracut needs to locate the kernel image
--kernel-image "${image}"

# positional arguments
"${output}" "${version}"
)

ebegin "Building initramfs via dracut"
dracut "${args[@]}"
eend ${?} || die -n "Building initramfs failed"
}

# @FUNCTION: dist-kernel_get_image_path
# @DESCRIPTION:
# Get relative kernel image path specific to the current ${ARCH}.
dist-kernel_get_image_path() {
case ${ARCH} in
amd64|x86)
echo arch/x86/boot/bzImage
;;
arm64)
echo arch/arm64/boot/Image.gz
;;
arm)
echo arch/arm/boot/zImage
;;
hppa|ppc|ppc64|sparc)
# https://www.kernel.org/doc/html/latest/powerpc/bootwrapper.html
# ./ is required because of ${image_path%/*}
# substitutions in the code
echo ./vmlinux
;;
riscv)
echo arch/riscv/boot/Image.gz
;;
*)
die "${FUNCNAME}: unsupported ARCH=${ARCH}"
;;
esac
}

# @FUNCTION: dist-kernel_install_kernel
# @USAGE: <version> <image> <system.map>
# @DESCRIPTION:
# Install kernel using installkernel tool. <version> specifies
# the kernel version, <image> full path to the image, <system.map>
# full path to System.map.
dist-kernel_install_kernel() {
debug-print-function ${FUNCNAME} "${@}"

[[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments"
local version=${1}
local image=${2}
local map=${3}

# if dracut is used in uefi=yes mode, initrd will actually
# be a combined kernel+initramfs UEFI executable. we can easily
# recognize it by PE magic (vs cpio for a regular initramfs)
local initrd=${image%/*}/initrd
local magic
[[ -s ${initrd} ]] && read -n 2 magic < "${initrd}"
if [[ ${magic} == MZ ]]; then
einfo "Combined UEFI kernel+initramfs executable found"
# install the combined executable in place of kernel
image=${initrd%/*}/uki.efi
mv "${initrd}" "${image}" || die
# We moved the generated initrd, prevent dracut from running again
# https://github.com/dracutdevs/dracut/pull/2405
shopt -s nullglob
local plugins=()
for file in "${EROOT}"/etc/kernel/install.d/*.install; do
plugins+=( "${file}" )
done
for file in "${EROOT}"/usr/lib/kernel/install.d/*.install; do
if ! has "${file##*/}" 50-dracut.install 51-dracut-rescue.install "${plugins[@]##*/}"; then
plugins+=( "${file}" )
fi
done
shopt -u nullglob
export KERNEL_INSTALL_PLUGINS="${KERNEL_INSTALL_PLUGINS} ${plugins[@]}"
fi

if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then
# Kernel-install requires uki's are named uki.efi, sign in-place
secureboot_sign_efi_file "${image}" "${image}"
fi

ebegin "Installing the kernel via installkernel"
# note: .config is taken relatively to System.map;
# initrd relatively to bzImage
installkernel "${version}" "${image}" "${map}"
eend ${?} || die -n "Installing the kernel failed"
}

# @FUNCTION: dist-kernel_reinstall_initramfs
# @USAGE: <kv-dir> <kv-full>
# @DESCRIPTION:
# Rebuild and install initramfs for the specified dist-kernel.
# <kv-dir> is the kernel source directory (${KV_DIR} from linux-info),
# while <kv-full> is the full kernel version (${KV_FULL}).
# The function will determine whether <kernel-dir> is actually
# a dist-kernel, and whether initramfs was used.
#
# This function is to be used in pkg_postinst() of ebuilds installing
# kernel modules that are included in the initramfs.
dist-kernel_reinstall_initramfs() {
debug-print-function ${FUNCNAME} "${@}"

[[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments"
local kernel_dir=${1}
local ver=${2}

local image_path=${kernel_dir}/$(dist-kernel_get_image_path)
local initramfs_path=${image_path%/*}/initrd
if [[ ! -f ${image_path} ]]; then
eerror "Kernel install missing, image not found:"
eerror " ${image_path}"
eerror "Initramfs will not be updated. Please reinstall your kernel."
return
fi
if [[ ! -f ${initramfs_path} && ! -f ${initramfs_path%/*}/uki.efi ]]; then
einfo "No initramfs or uki found at ${image_path}"
return
fi

dist-kernel_build_initramfs "${initramfs_path}" "${ver}"
dist-kernel_install_kernel "${ver}" "${image_path}" \
"${kernel_dir}/System.map"
}

# @FUNCTION: dist-kernel_PV_to_KV
# @USAGE: <pv>
# @DESCRIPTION:
# Convert a Gentoo-style ebuild version to kernel "x.y.z[-rcN]" version.
dist-kernel_PV_to_KV() {
debug-print-function ${FUNCNAME} "${@}"

[[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments"
local pv=${1}

local kv=${pv%%_*}
[[ -z $(ver_cut 3- "${kv}") ]] && kv+=".0"
[[ ${pv} == *_* ]] && kv+=-${pv#*_}
echo "${kv}"
}

_DIST_KERNEL_UTILS=1
fi
4 changes: 4 additions & 0 deletions files/zfs/3510.2.8/overlay/metadata/layout.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
masters = portage-stable
thin-manifests = true
sign-commits = false
sign-manifests = false
1 change: 1 addition & 0 deletions files/zfs/3510.2.8/overlay/profiles/repo_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zfs-overlay
2 changes: 2 additions & 0 deletions files/zfs/3510.2.8/overlay/sys-fs/udev-init-scripts/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIST udev-init-scripts-34.tar.gz 3660 BLAKE2B 954b003c78b31649fef69213a5424098f40e17e7ed11f4ec1443247950ea60db8536f37ca603caa06e5c9f8bab07b5ac3cb8c9435144532a97ff04836c24da49 SHA512 ed48bcd0815e235b2b3fa38f857cd97f164aac7c6ea805be87890eb06a0d52064bd733da240c6e2a34c8c73e10fd047b5e53096de06f17bc81d8266d70c0cc9d
DIST udev-init-scripts-35.tar.gz 3666 BLAKE2B fddae466428605ea930519e8a47e0ea91f89f9eacc1fd97c137d175142125b12c3d045aec68db35a463de444ac6d8c037cca55f9628f10576c968259d566a9e4 SHA512 da9d2093149967e2e1b9bc7190ddfd55a87c9ae2177e3216f7cb2694fc9b64037eb6f2599ad8a4b7594ef32ced88fbb319c92904bc72a81ea5404945f8a8378a
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
</maintainer>
</pkgmetadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
OLD_PN=udev-gentoo-scripts
OLD_P=${OLD_PN}-${PV}

if [ "${PV}" = "9999" ]; then
EGIT_REPO_URI="git://anongit.gentoo.org/proj/${OLD_PN}.git"
inherit git-r3
else
SRC_URI="https://gitweb.gentoo.org/proj/${OLD_PN}.git/snapshot/${OLD_P}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${OLD_P}"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
fi

DESCRIPTION="udev startup scripts for openrc"
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="GPL-2"
SLOT="0"

RESTRICT="test"

RDEPEND=">=virtual/udev-217
!<sys-apps/openrc-0.14"

src_install() {
local -x SYSCONFDIR="${EPREFIX}/etc"
default
}

pkg_postinst() {
# Add udev and udev-trigger to the sysinit runlevel automatically.
for f in udev udev-trigger; do
if [[ -x "${EROOT}/etc/init.d/${f}" &&
-d "${EROOT}/etc/runlevels/sysinit" &&
! -L "${EROOT}/etc/runlevels/sysinit/${f}" ]]; then
ln -snf "${EPREFIX}/etc/init.d/${f}" "${EROOT}/etc/runlevels/sysinit/${f}"
ewarn "Adding ${f} to the sysinit runlevel"
fi
done

if ! has_version "sys-fs/eudev[rule-generator]" && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qs 'boot\|default\|sysinit'; then
ewarn "The udev-postmount service has been removed because the reasons for"
ewarn "its existance have been removed upstream."
ewarn "Please remove it from your runlevels."
fi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
OLD_PN=udev-gentoo-scripts
OLD_P=${OLD_PN}-${PV}

if [ "${PV}" = "9999" ]; then
EGIT_REPO_URI="https://anongit.gentoo.org/proj/${OLD_PN}.git"
inherit git-r3
else
SRC_URI="https://gitweb.gentoo.org/proj/${OLD_PN}.git/snapshot/${OLD_P}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${OLD_P}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi

DESCRIPTION="udev startup scripts for openrc"
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="GPL-2"
SLOT="0"

RESTRICT="test"

RDEPEND=">=virtual/udev-217
!<sys-apps/openrc-0.14"

src_install() {
local -x SYSCONFDIR="${EPREFIX}/etc"
default
}

pkg_postinst() {
# Add udev and udev-trigger to the sysinit runlevel automatically.
for f in udev udev-trigger; do
if [[ -x "${EROOT}/etc/init.d/${f}" &&
-d "${EROOT}/etc/runlevels/sysinit" &&
! -L "${EROOT}/etc/runlevels/sysinit/${f}" ]]; then
ln -snf "${EPREFIX}/etc/init.d/${f}" "${EROOT}/etc/runlevels/sysinit/${f}"
ewarn "Adding ${f} to the sysinit runlevel"
fi
done

if ! has_version "sys-fs/eudev[rule-generator]" && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qs 'boot\|default\|sysinit'; then
ewarn "The udev-postmount service has been removed because the reasons for"
ewarn "its existance have been removed upstream."
ewarn "Please remove it from your runlevels."
fi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
OLD_PN=udev-gentoo-scripts
OLD_P=${OLD_PN}-${PV}

if [ "${PV}" = "9999" ]; then
EGIT_REPO_URI="https://anongit.gentoo.org/proj/${OLD_PN}.git"
inherit git-r3
else
SRC_URI="https://gitweb.gentoo.org/proj/${OLD_PN}.git/snapshot/${OLD_P}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${OLD_P}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi

DESCRIPTION="udev startup scripts for openrc"
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="GPL-2"
SLOT="0"

RESTRICT="test"

RDEPEND=">=virtual/udev-217
!<sys-apps/openrc-0.14"

src_install() {
local -x SYSCONFDIR="${EPREFIX}/etc"
default
}

pkg_postinst() {
# Add udev and udev-trigger to the sysinit runlevel automatically.
for f in udev udev-trigger; do
if [[ -x "${EROOT}/etc/init.d/${f}" &&
-d "${EROOT}/etc/runlevels/sysinit" &&
! -L "${EROOT}/etc/runlevels/sysinit/${f}" ]]; then
ln -snf "${EPREFIX}/etc/init.d/${f}" "${EROOT}/etc/runlevels/sysinit/${f}"
ewarn "Adding ${f} to the sysinit runlevel"
fi
done

if ! has_version "sys-fs/eudev[rule-generator]" && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qs 'boot\|default\|sysinit'; then
ewarn "The udev-postmount service has been removed because the reasons for"
ewarn "its existance have been removed upstream."
ewarn "Please remove it from your runlevels."
fi
}
8 changes: 8 additions & 0 deletions files/zfs/3510.2.8/overlay/sys-fs/zfs-kmod/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DIST zfs-2.1.11.tar.gz 35100716 BLAKE2B 991ac2347bcd452812e247358e2c44a04a88e700d25878b5b95f86939e6114e1205e7afabfd2a1ea9220947876511374d7224aa587d3d66184838d705f71a89a SHA512 335a543644d2dbba919213a28cc5922bf6a118fc19069db84562ce056449a2d6ca4ba827e54f304ab7d9be22260aa9b255134f1b12e2bc98890f757f35e48bd7
DIST zfs-2.1.11.tar.gz.asc 836 BLAKE2B 0b904d8e1de2dd08a377efc94e32862192d6b9ccb8628af058a71b3ea51f5e483e0cf527906cd222fe9b41b28ca0b30b0efa07d97c480e5546f6e2bed8cbcb01 SHA512 7329e62012ba64288345d8959611de82502ef1da4020e215462fbb2ed209413ec8638d211a31dd6e70be71c998f1da1d8a0d19e5df1f2778782ebb988c94aa41
DIST zfs-2.1.12.tar.gz 35155013 BLAKE2B 652780e6bf7b63f45909110726d53795fada034f6044c8393fa3980e30217ada6931e3c2bb57210719e3c78c16f973f69287b7e2b475601f4ce12d701d9d96ae SHA512 f48493a21883e441cda705fb085353bed033f1620a1d0f93069c345c76cf2c0759a2e6f7a80c47c9398e9878abfe1d90d931fe5ceaf2588770a71491a434631e
DIST zfs-2.1.12.tar.gz.asc 836 BLAKE2B 9215e732981a82254115cd17ec3c9810d4e9e5d5f7bb848778848f911478fc2e4bdbfc563e9835a2e876c26d9e0e8755724a0995baf9ad24e9265123e10cfddf SHA512 69c8b618947fd966eba0bba1c7326ddd463861f051a6cf1d06e23bd6d840fe7503f02adec2c3cbb203fa7b1cced51500f3689c224b653d13d227edd51b5a44f6
DIST zfs-2.1.9.tar.gz 35106538 BLAKE2B d7553cc162687531b254089e29e2e15e2eb6b362cecd8e70c24bbb5dbffbde82036ad2d416f4caeceaa324bee8a2e59d9e3cd8a3bf55a2e3c0718c7af9562812 SHA512 a3c410abe911be7d3d66af8ad7023a810eb4ae3284001e544c3a34275eb17a4916a7c094936a2628a590007c007eea84673efa9f3201fd9f24c499fd5ed3ed75
DIST zfs-2.1.9.tar.gz.asc 836 BLAKE2B 1e76525eab338398dd6ff7539ea4e7d18847d0f40e9093d813ec93fce5fa4c16e09f91c0805ba01a29190f673d131f85442c13035166d6f2d007a7e42dc15486 SHA512 35e1213fcac0458e1243355beba021dfefef455df2b341fbc4b10047f9ed4747df84e319d10ffe4bbcd572fbf014019e0dec200eb4e7d3c116fb805369182cb0
DIST zfs-2.2.0-rc3.tar.gz 33666688 BLAKE2B 37c47bcbf34d9238f42bbc80e2b0712a9e64a48196a390e30cfc02a510e0a8c28da5aa52eb3963a2363d2d23881628cadad13e2121cf54a0582cfc7d55685313 SHA512 d82991e6ff63910b38aa0d9b79fce19d1deb79a214adca4bec3fd468077674ef1de264b6f5b0acf9dc0418ce1ed4c9e98d1ad4596274a1769061ae20e017fb92
DIST zfs-2.2.0-rc3.tar.gz.asc 195 BLAKE2B cbbced9255a3b6a5ec0190806b73e62533600975dad073b82532fb1e488bf81b8d056c7a4f59b9e212a9825ec4900d6f2e2c0141b3d4d58577fe36d9bc3c15b9 SHA512 45424815e39b33107805da737ecfcb95c761ab774143e72449dacfe98a851ddf52c7cb08a587548159305b4c4fe51a0fb9cfbf30fdadf093518eb4c8ce49e12c
Loading

0 comments on commit f3fad3a

Please sign in to comment.