summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/bootconfig')
-rw-r--r--dev-util/bootconfig/Manifest1
-rw-r--r--dev-util/bootconfig/bootconfig-5.18.ebuild108
-rw-r--r--dev-util/bootconfig/files/bootconfig-5.18-cflags.patch22
-rw-r--r--dev-util/bootconfig/metadata.xml13
4 files changed, 144 insertions, 0 deletions
diff --git a/dev-util/bootconfig/Manifest b/dev-util/bootconfig/Manifest
new file mode 100644
index 000000000000..907336dcebdf
--- /dev/null
+++ b/dev-util/bootconfig/Manifest
@@ -0,0 +1 @@
+DIST linux-5.18.tar.xz 129790264 BLAKE2B e2745a69eb70169e90505a9318a3993046eab3020496eecde7d8352ecda0eb71a25b21becf7ce93fc593507dce7d1cd61b94ddcdf82b3094d79c0d3d48508eeb SHA512 dbbc9d1395898a498fa4947fceda1781344fa5d360240f753810daa4fa88e519833e2186c4e582a8f1836e6413e9e85f6563c7770523b704e8702d67622f98b5
diff --git a/dev-util/bootconfig/bootconfig-5.18.ebuild b/dev-util/bootconfig/bootconfig-5.18.ebuild
new file mode 100644
index 000000000000..3db6300cf029
--- /dev/null
+++ b/dev-util/bootconfig/bootconfig-5.18.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit estack linux-info
+
+DESCRIPTION="Bootconfig tools for kernel command line to support key-value"
+HOMEPAGE="https://kernel.org/"
+
+LINUX_V="${PV:0:1}.x"
+if [[ ${PV} == *_rc* ]] ; then
+ LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
+ PATCH_VERSION=$(ver_cut 1-3)
+ LINUX_PATCH=patch-${PV//_/-}.xz
+ SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
+ https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
+elif [[ ${PV} == *.*.* ]] ; then
+ # stable-release series
+ LINUX_VER=$(ver_cut 1-2)
+ LINUX_PATCH=patch-${PV}.xz
+ SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
+else
+ LINUX_VER=${PV}
+ SRC_URI=""
+fi
+
+LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
+SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~riscv"
+IUSE="examples"
+
+BDEPEND="
+ ${LINUX_PATCH+dev-util/patchutils}
+"
+
+RDEPEND=""
+
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-5.10
+"
+
+S_K="${WORKDIR}/linux-${LINUX_VER}"
+S="${S_K}/tools/bootconfig"
+
+CONFIG_CHECK="~BOOT_CONFIG"
+
+PATCHES=( "${FILESDIR}"/${P}-cflags.patch )
+
+src_unpack() {
+ local paths=(
+ tools/arch tools/build tools/include tools/lib tools/bootconfig tools/scripts
+ scripts include lib "arch/*/lib"
+ )
+
+ # We expect the tar implementation to support the -j option (both
+ # GNU tar and libarchive's tar support that).
+ echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
+ tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
+ "${paths[@]/#/linux-${LINUX_VER}/}" || die
+
+ if [[ -n ${LINUX_PATCH} ]] ; then
+ eshopts_push -o noglob
+ ebegin "Filtering partial source patch"
+ filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
+ > ${P}.patch
+ eend $? || die "filterdiff failed"
+ eshopts_pop
+ fi
+
+ local a
+ for a in ${A}; do
+ [[ ${a} == ${LINUX_SOURCES} ]] && continue
+ [[ ${a} == ${LINUX_PATCH} ]] && continue
+ unpack ${a}
+ done
+}
+
+src_prepare() {
+ default
+ if [[ -n ${LINUX_PATCH} ]] ; then
+ pushd "${S_K}" >/dev/null || die
+ eapply "${WORKDIR}"/${P}.patch
+ popd || die
+ fi
+}
+
+src_compile() {
+ emake bootconfig
+}
+
+src_test() {
+ :
+}
+
+src_install() {
+ dobin bootconfig
+
+ if use examples; then
+ dodoc -r scripts
+
+ docinto examples
+ dodoc -r samples/*
+ fi
+}
diff --git a/dev-util/bootconfig/files/bootconfig-5.18-cflags.patch b/dev-util/bootconfig/files/bootconfig-5.18-cflags.patch
new file mode 100644
index 000000000000..8ce106275a24
--- /dev/null
+++ b/dev-util/bootconfig/files/bootconfig-5.18-cflags.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index 566c3e0..aa65fd7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,7 +10,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
+ endif
+
+ LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
+-CFLAGS = -Wall -g -I$(CURDIR)/include
++CFLAGS += -Wall -I$(CURDIR)/include
+
+ ALL_TARGETS := bootconfig
+ ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
+@@ -18,7 +18,7 @@ ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
+ all: $(ALL_PROGRAMS) test
+
+ $(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC)
+- $(CC) $(filter %.c,$^) $(CFLAGS) -o $@
++ $(CC) $(filter %.c,$^) $(CFLAGS) $(LDFLAGS) -o $@
+
+ test: $(ALL_PROGRAMS) test-bootconfig.sh
+ ./test-bootconfig.sh $(OUTPUT)
diff --git a/dev-util/bootconfig/metadata.xml b/dev-util/bootconfig/metadata.xml
new file mode 100644
index 000000000000..f52468ed9ff1
--- /dev/null
+++ b/dev-util/bootconfig/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>dlan@gentoo.org</email>
+ <name>Yixun Lan</name>
+ </maintainer>
+ <longdescription>
+ The boot configuration expands the current kernel command line to support
+ additional key-value data when booting the kernel in an efficient way.
+ This allows administrators to pass a structured-Key config file.
+ </longdescription>
+</pkgmetadata>