public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/4] kernel-install.eclass: Install logic for dist-kernels
@ 2020-01-04 21:24 Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build " Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michał Górny @ 2020-01-04 21:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Introduce a new eclass that contains common logic needed to test
and install distribution kernels.  This is the eclass common both
to kernels built from source and installed from binary packages.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/kernel-install.eclass | 309 +++++++++++++++++++++++++++++++++++
 1 file changed, 309 insertions(+)
 create mode 100644 eclass/kernel-install.eclass

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
new file mode 100644
index 000000000000..f64e01976a7b
--- /dev/null
+++ b/eclass/kernel-install.eclass
@@ -0,0 +1,309 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: kernel-install.eclass
+# @MAINTAINER:
+# Distribution Kernel Project <dist-kernel@gentoo.org>
+# @AUTHOR:
+# Michał Górny <mgorny@gentoo.org>
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Installation mechanics for Distribution Kernels
+# @DESCRIPTION:
+# This eclass provides the logic needed to test and install different
+# kinds of Distribution Kernel packages, including both kernels built
+# from source and distributed as binaries.  The eclass relies on the
+# ebuild installing a subset of built kernel tree into
+# /usr/src/linux-${PV} containing the kernel image in its standard
+# location and System.map.
+#
+# The eclass exports src_test, pkg_postinst and pkg_postrm.
+# Additionally, the inherited mount-boot eclass exports pkg_pretend.
+# It also stubs out pkg_preinst and pkg_prerm defined by mount-boot.
+
+if [[ ! ${_KERNEL_INSTALL_ECLASS} ]]; then
+
+case "${EAPI:-0}" in
+	0|1|2|3|4|5|6)
+		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+		;;
+	7)
+		;;
+	*)
+		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+		;;
+esac
+
+inherit mount-boot
+
+TCL_VER=10.1
+SRC_URI+="
+	test? (
+		amd64? (
+			https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-amd64.qcow2
+		)
+		x86? (
+				https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-x86.qcow2
+		)
+	)"
+
+SLOT="${PV}"
+IUSE="+initramfs test"
+RESTRICT+=" !test? ( test ) test? ( userpriv )"
+
+# install-DEPEND actually
+# note: we need installkernel with initramfs support!
+RDEPEND="
+	|| (
+		sys-kernel/installkernel-gentoo
+		sys-kernel/installkernel-systemd-boot
+	)
+	initramfs? ( >=sys-kernel/dracut-049-r3 )"
+BDEPEND="
+	test? (
+		dev-tcltk/expect
+		sys-kernel/dracut
+		amd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] )
+		x86? ( app-emulation/qemu[qemu_softmmu_targets_i386] )
+	)"
+
+# @FUNCTION: kernel-install_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.
+kernel-install_build_initramfs() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments"
+	local output=${1}
+	local version=${2}
+
+	ebegin "Building initramfs via dracut"
+	dracut --force "${output}" "${version}"
+	eend ${?} || die "Building initramfs failed"
+}
+
+# @FUNCTION: kernel-install_get_image_path
+# @DESCRIPTION:
+# Get relative kernel image path specific to the current ${ARCH}.
+kernel-install_get_image_path() {
+	case ${ARCH} in
+		amd64|x86)
+			echo arch/x86/boot/bzImage
+			;;
+		*)
+			die "${FUNCNAME}: unsupported ARCH=${ARCH}"
+			;;
+	esac
+}
+
+# @FUNCTION: kernel-install_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.
+kernel-install_install_kernel() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments"
+	local version=${1}
+	local image=${2}
+	local map=${3}
+
+	ebegin "Installing the kernel via installkernel"
+	# note: .config is taken relatively to System.map;
+	# initrd relatively to bzImage
+	installkernel "${version}" "${image}" "${map}"
+	eend ${?} || die "Installing the kernel failed"
+}
+
+# @FUNCTION: kernel-install_update_symlink
+# @USAGE: <target> <version>
+# @DESCRIPTION:
+# Update the kernel source symlink at <target> (full path) with a link
+# to <target>-<version> if it's either missing or pointing out to
+# an older version of this package.
+kernel-install_update_symlink() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments"
+	local target=${1}
+	local version=${2}
+
+	if [[ ! -e ${target} ]]; then
+		ebegin "Creating ${target} symlink"
+		ln -f -n -s "${target##*/}-${version}" "${target}"
+		eend ${?}
+	else
+		local symlink_target=$(readlink "${target}")
+		local symlink_ver=${symlink_target#${target##*/}-}
+		if [[ ${symlink_target} == ${target##*/}-* && \
+				-z ${symlink_ver//[0-9.]/} ]]
+		then
+			local symlink_pkg=${CATEGORY}/${PN}-${symlink_ver}
+			# if the current target is either being replaced, or still
+			# installed (probably depclean candidate), update the symlink
+			if has "${symlink_ver}" ${REPLACING_VERSIONS} ||
+					has_version -r "~${symlink_pkg}"
+			then
+				ebegin "Updating ${target} symlink"
+				ln -f -n -s "${target##*/}-${version}" "${target}"
+				eend ${?}
+			fi
+		fi
+	fi
+}
+
+# @FUNCTION: kernel-install_get_qemu_arch
+# @DESCRIPTION:
+# Get appropriate qemu suffix for the current ${ARCH}.
+kernel-install_get_qemu_arch() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	case ${ARCH} in
+		amd64)
+			echo x86_64
+			;;
+		x86)
+			echo i386
+			;;
+		*)
+			die "${FUNCNAME}: unsupported ARCH=${ARCH}"
+			;;
+	esac
+}
+
+# @FUNCTION: kernel-install_test
+# @USAGE: <version> <image> <modules>
+# @DESCRIPTION:
+# Test that the kernel can successfully boot a minimal system image
+# in qemu.  <version> is the kernel version, <image> path to the image,
+# <modules> path to module tree.
+kernel-install_src_test() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments"
+	local version=${1}
+	local image=${2}
+	local modules=${3}
+
+	local qemu_arch=$(kernel-install_get_qemu_arch)
+
+	dracut \
+		--conf /dev/null \
+		--confdir /dev/null \
+		--no-hostonly \
+		--kmoddir "${modules}" \
+		"${T}/initrd" "${version}" || die
+	# get a read-write copy of the disk image
+	cp "${DISTDIR}/tinycorelinux-${TCL_VER}-${ARCH}.qcow2" \
+		"${T}/fs.qcow2" || die
+
+	cd "${T}" || die
+	cat > run.sh <<-EOF || die
+		#!/bin/sh
+		exec qemu-system-${qemu_arch} \
+			-m 256M \
+			-display none \
+			-no-reboot \
+			-kernel '${image}' \
+			-initrd '${T}/initrd' \
+			-serial mon:stdio \
+			-hda '${T}/fs.qcow2' \
+			-append 'root=/dev/sda console=ttyS0,115200n8'
+	EOF
+	chmod +x run.sh || die
+	# TODO: initramfs does not let core finish starting on some systems,
+	# figure out how to make it better at that
+	expect - <<-EOF || die "Booting kernel failed"
+		set timeout 900
+		spawn ./run.sh
+		expect {
+			"Kernel panic" {
+				send_error "\n* Kernel panic"
+				exit 1
+			}
+			"Entering emergency mode" {
+				send_error "\n* Initramfs failed to start the system"
+				exit 1
+			}
+			"Core 10.1" {
+				send_error "\n* Booted successfully"
+				exit 0
+			}
+			timeout {
+				send_error "\n* Kernel boot timed out"
+				exit 2
+			}
+		}
+	EOF
+}
+
+# @FUNCTION: kernel-install_src_test
+# @DESCRIPTION:
+# Boilerplate function to remind people to call the tests.
+kernel-install_src_test() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	die "Please redefine src_test() and call kernel-install_test()."
+}
+
+# @FUNCTION: kernel-install_pkg_preinst
+# @DESCRIPTION:
+# Stub out mount-boot.eclass.
+kernel-install_pkg_preinst() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	# (no-op)
+}
+
+# @FUNCTION: kernel-install_pkg_postinst
+# @DESCRIPTION:
+# Build an initramfs for the kernel, install it and update
+# the /usr/src/linux symlink.
+kernel-install_pkg_postinst() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	if [[ -z ${ROOT} ]]; then
+		mount-boot_pkg_preinst
+
+		if use initramfs; then
+			# putting it alongside kernel image as 'initrd' makes
+			# kernel-install happier
+			kernel-install_build_initramfs \
+				"${EROOT}/usr/src/linux-${PV}/initrd" "${PV}"
+		fi
+
+		kernel-install_install_kernel "${PV}" \
+			"${EROOT}/usr/src/linux-${PV}/$(kernel-install_get_image_path)" \
+			"${EROOT}/usr/src/linux-${PV}/System.map"
+	fi
+
+	kernel-install_update_symlink "${EROOT}/usr/src/linux" "${PV}"
+}
+
+# @FUNCTION: kernel-install_pkg_prerm
+# @DESCRIPTION:
+# Stub out mount-boot.eclass.
+kernel-install_pkg_prerm() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	# (no-op)
+}
+
+# @FUNCTION: kernel-install_pkg_postrm
+# @DESCRIPTION:
+# No-op at the moment.  Will be used to remove obsolete kernels
+# in the future.
+kernel-install_pkg_postrm() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	# (no-op at the moment)
+}
+
+_KERNEL_INSTALL_ECLASS=1
+fi
+
+EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build logic for dist-kernels
  2020-01-04 21:24 [gentoo-dev] [PATCH 1/4] kernel-install.eclass: Install logic for dist-kernels Michał Górny
@ 2020-01-04 21:24 ` Michał Górny
  2020-01-04 23:41   ` Mike Gilbert
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 3/4] sys-kernel/vanilla-kernel: Migrate to kernel-build.eclass Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 4/4] sys-kernel/vanilla-kernel-bin: Migrate to kernel-install.eclass Michał Górny
  2 siblings, 1 reply; 6+ messages in thread
From: Michał Górny @ 2020-01-04 21:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Introduce a new eclass that contains common logic for building
distribution kernels from source.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/kernel-build.eclass | 173 +++++++++++++++++++++++++++++++++++++
 1 file changed, 173 insertions(+)
 create mode 100644 eclass/kernel-build.eclass

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
new file mode 100644
index 000000000000..b5e520b3bed2
--- /dev/null
+++ b/eclass/kernel-build.eclass
@@ -0,0 +1,173 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: kernel-build.eclass
+# @MAINTAINER:
+# Distribution Kernel Project <dist-kernel@gentoo.org>
+# @AUTHOR:
+# Michał Górny <mgorny@gentoo.org>
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Build mechanics for Distribution Kernels
+# @DESCRIPTION:
+# This eclass provides the logic to build a Distribution Kernel from
+# source and install it.  Post-install and test logic is inherited
+# from kernel-install.eclass.
+#
+# The ebuild must take care of unpacking the kernel sources, copying
+# an appropriate .config into them (e.g. in src_prepare()) and setting
+# correct S.  The eclass takes care of respecting savedconfig, building
+# the kernel and installing it along with its modules and subset
+# of sources needed to build external modules.
+
+if [[ ! ${_KERNEL_BUILD_ECLASS} ]]; then
+
+case "${EAPI:-0}" in
+	0|1|2|3|4|5|6)
+		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+		;;
+	7)
+		;;
+	*)
+		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+		;;
+esac
+
+inherit savedconfig toolchain-funcs kernel-install
+
+BDEPEND="
+	sys-devel/bc
+	virtual/libelf"
+
+# @FUNCTION: kernel-build_src_configure
+# @DESCRIPTION:
+# Prepare the toolchain for building the kernel, get the default .config
+# or restore savedconfig, and get build tree configured for modprep.
+kernel-build_src_configure() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	# force ld.bfd if we can find it easily
+	local LD="$(tc-getLD)"
+	if type -P "${LD}.bfd" &>/dev/null; then
+		LD+=.bfd
+	fi
+
+	MAKEARGS=(
+		V=1
+
+		HOSTCC="$(tc-getCC)"
+		HOSTCXX="$(tc-getCXX)"
+		HOSTCFLAGS="${CFLAGS}"
+		HOSTLDFLAGS="${LDFLAGS}"
+
+		AS="$(tc-getAS)"
+		CC="$(tc-getCC)"
+		LD="${LD}"
+		AR="$(tc-getAR)"
+		NM="$(tc-getNM)"
+		STRIP=":"
+		OBJCOPY="$(tc-getOBJCOPY)"
+		OBJDUMP="$(tc-getOBJDUMP)"
+
+		# we need to pass it to override colliding Gentoo envvar
+		ARCH=$(tc-arch-kernel)
+	)
+
+	[[ -f .config ]] || die "Ebuild error: please copy default config into .config"
+	restore_config .config
+
+	mkdir -p "${WORKDIR}"/modprep || die
+	mv .config "${WORKDIR}"/modprep/ || die
+	emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
+	emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare
+	cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die
+}
+
+# @FUNCTION: kernel-build_src_compile
+# @DESCRIPTION:
+# Compile the kernel sources.
+kernel-build_src_compile() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all
+}
+
+# @FUNCTION: kernel-build_src_test
+# @DESCRIPTION:
+# Test the built kernel via qemu.  This just wraps the logic
+# from kernel-install.eclass with the correct paths.
+kernel-build_src_test() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \
+		INSTALL_MOD_PATH="${T}" modules_install
+
+	kernel-install_test "${PV}" \
+		"${WORKDIR}/build/$(kernel-install_get_image_path)" \
+		"${T}/lib/modules/${PV}"
+}
+
+# @FUNCTION: kernel-build_src_install
+# @DESCRIPTION:
+# Install the built kernel along with subset of sources
+# into /usr/src/linux-${PV}.  Install the modules.  Save the config.
+kernel-build_src_install() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	# do not use 'make install' as it behaves differently based
+	# on what kind of installkernel is installed
+	emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \
+		INSTALL_MOD_PATH="${ED}" modules_install
+
+	# note: we're using mv rather than doins to save space and time
+	# install main and arch-specific headers first, and scripts
+	local kern_arch=$(tc-arch-kernel)
+	dodir "/usr/src/linux-${PV}/arch/${kern_arch}"
+	mv include scripts "${ED}/usr/src/linux-${PV}/" || die
+	mv "arch/${kern_arch}/include" \
+		"${ED}/usr/src/linux-${PV}/arch/${kern_arch}/" || die
+
+	# remove everything but Makefile* and Kconfig*
+	find -type f '!' '(' -name 'Makefile*' -o -name 'Kconfig*' ')' \
+		-delete || die
+	find -type l -delete || die
+	cp -p -R * "${ED}/usr/src/linux-${PV}/" || die
+
+	cd "${WORKDIR}" || die
+	# strip out-of-source build stuffs from modprep
+	# and then copy built files as well
+	find modprep -type f '(' \
+			-name Makefile -o \
+			-name '*.[ao]' -o \
+			'(' -name '.*' -a -not -name '.config' ')' \
+		')' -delete || die
+	rm modprep/source || die
+	cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die
+
+	# install the kernel and files needed for module builds
+	insinto "/usr/src/linux-${PV}"
+	doins build/{System.map,Module.symvers}
+	local image_path=$(kernel-install_get_image_path)
+	cp -p "build/${image_path}" "${ED}/usr/src/linux-${PV}/${image_path}" || die
+
+	# strip empty directories
+	find "${D}" -type d -empty -exec rmdir {} + || die
+
+	# fix source tree and build dir symlinks
+	dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/build
+	dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/source
+
+	save_config build/.config
+}
+
+# @FUNCTION: kernel-build_pkg_postinst
+# @DESCRIPTION:
+# Combine postinst from kernel-install and savedconfig eclasses.
+kernel-build_pkg_postinst() {
+	kernel-install_pkg_postinst
+	savedconfig_pkg_postinst
+}
+
+_KERNEL_BUILD_ECLASS=1
+fi
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install pkg_postinst
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH 3/4] sys-kernel/vanilla-kernel: Migrate to kernel-build.eclass
  2020-01-04 21:24 [gentoo-dev] [PATCH 1/4] kernel-install.eclass: Install logic for dist-kernels Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build " Michał Górny
@ 2020-01-04 21:24 ` Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 4/4] sys-kernel/vanilla-kernel-bin: Migrate to kernel-install.eclass Michał Górny
  2 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2020-01-04 21:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 .../vanilla-kernel-5.4.7-r1.ebuild            | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7-r1.ebuild

diff --git a/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7-r1.ebuild b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7-r1.ebuild
new file mode 100644
index 000000000000..980ee832584f
--- /dev/null
+++ b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit kernel-build
+
+MY_P=linux-${PV}
+AMD64_CONFIG_VER=5.4.7.arch1-1
+AMD64_CONFIG_HASH=ff79453bc0451a9083bdaa02c3901372d61a9982
+I686_CONFIG_VER=5.4.3-arch1
+I686_CONFIG_HASH=076a52d43a08c4b3a3eacd1f2f9a855fb3b62f42
+
+DESCRIPTION="Linux kernel built from vanilla upstream sources"
+HOMEPAGE="https://www.kernel.org/"
+SRC_URI+=" https://cdn.kernel.org/pub/linux/kernel/v5.x/${MY_P}.tar.xz
+	amd64? (
+		https://git.archlinux.org/svntogit/packages.git/plain/trunk/config?h=packages/linux&id=${AMD64_CONFIG_HASH}
+			-> linux-${AMD64_CONFIG_VER}.amd64.config
+	)
+	x86? (
+		https://git.archlinux32.org/packages/plain/core/linux/config.i686?id=${I686_CONFIG_HASH}
+			-> linux-${I686_CONFIG_VER}.i686.config
+	)"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+	!sys-kernel/vanilla-kernel-bin:${SLOT}"
+
+pkg_pretend() {
+	mount-boot_pkg_pretend
+
+	ewarn "This is an experimental package.  The built kernel and/or initramfs"
+	ewarn "may not work at all or fail with your bootloader configuration.  Please"
+	ewarn "make sure to keep a backup kernel available before testing it."
+}
+
+src_prepare() {
+	default
+
+	# prepare the default config
+	case ${ARCH} in
+		amd64)
+			cp "${DISTDIR}"/linux-${AMD64_CONFIG_VER}.amd64.config .config || die
+			;;
+		x86)
+			cp "${DISTDIR}"/linux-${I686_CONFIG_VER}.i686.config .config || die
+			;;
+		*)
+			die "Unsupported arch ${ARCH}"
+			;;
+	esac
+
+	# while Arch config is cool, we don't want gcc plugins as they
+	# break distcc
+	sed -i -e '/GCC_PLUGIN/d' .config || die
+	# module compression prevents us from stripping them post-inst
+	sed -i -e '/MODULE_COMPRESS/d' .config || die
+	# shove our theft under the carpet!
+	sed -i -e '/HOSTNAME/s:archlinux:gentoo:' .config || die
+	# hey, we do support x32
+	sed -i -e '/CONFIG_X86_X32/s:.*:CONFIG_X86_X32=y:' .config || die
+}
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH 4/4] sys-kernel/vanilla-kernel-bin: Migrate to kernel-install.eclass
  2020-01-04 21:24 [gentoo-dev] [PATCH 1/4] kernel-install.eclass: Install logic for dist-kernels Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build " Michał Górny
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 3/4] sys-kernel/vanilla-kernel: Migrate to kernel-build.eclass Michał Górny
@ 2020-01-04 21:24 ` Michał Górny
  2 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2020-01-04 21:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 sys-kernel/vanilla-kernel-bin/Manifest        |  2 +
 .../vanilla-kernel-bin-5.4.7-r1.ebuild        | 52 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.7-r1.ebuild

diff --git a/sys-kernel/vanilla-kernel-bin/Manifest b/sys-kernel/vanilla-kernel-bin/Manifest
index ec54297a6eee..6d408165e261 100644
--- a/sys-kernel/vanilla-kernel-bin/Manifest
+++ b/sys-kernel/vanilla-kernel-bin/Manifest
@@ -2,3 +2,5 @@ DIST tinycorelinux-10.1-amd64.qcow2 16842752 BLAKE2B e013e76503c335739a9623c0901
 DIST tinycorelinux-10.1-x86.qcow2 14876672 BLAKE2B 3c760eb7438b13261e52ecfaa33a53649ced95f1ab40aae52134b8cdc31a16d7aa0d6a6dd716e268ed148e9d77a10b7c700b141b61d70c82d271ffe88e8e2a3c SHA512 9964538dc42f232a11949f74b61d46422ea5da3bdc253a217119bd0b8a750c40fd2da0b07157067be9ac0226472614f210a1248114df0d331df390979867a895
 DIST vanilla-kernel-5.4.7-1.amd64.xpak 67980060 BLAKE2B 6bff3c16edc33dc65eedc55290d83cd26bf23bcf70addff39f43ba0d2fe9a678bc8bd2ba259802c95032132dce14e6866f15c30d66c4be23d82b88fa7e33d2f1 SHA512 edad0f70a46d2398702beeed442a84818d9d34cbd057372ad1175e7c2d944d59f6c5dbe2731658ed4c74eb66ffc3dd542b2589b1e776095c457b6347872d3dc4
 DIST vanilla-kernel-5.4.7-1.x86.xpak 59512079 BLAKE2B be8b611d164cb0e17fc9232eebdd642ea3e7926acf0c8628dde6bfe4de9d5600fca8f33aeba039bffce574926d7f1dff5bfa9910ed42553fa168e6104207fa13 SHA512 9d2a59824f7ce0cd01ea5aced3a95c4e2ac44ca4ad82cf5997987f9b0df730650cb8c8c5a83476084e427af345ad4d5515eb996dd2db5d5c7fa21c0eb1d8871e
+DIST vanilla-kernel-5.4.7-r1-1.amd64.xpak 67962241 BLAKE2B 4ed062c5fc7b2fc1c711a2deb642cfc14bb5dfe87df04bd4b512ab5aac3b9b1c3c1cfcae1cf36feeac27aa99b5ca1c89c51ce4ac79f8925ef8f7b4d68d0c629b SHA512 322eced9f6e3a8d671598baeb406761c52de7bd82d6844fefd748e2a72d94e5cee77298d0381dd8a9ababafd5cb6b6b24c809b959b2c40c6eb64c7b9ee74941a
+DIST vanilla-kernel-5.4.7-r1-1.x86.xpak 59493734 BLAKE2B 1788b96ea680bd53186a1982498d1ede762a0e9b60f995bc5ee8d8f116435765b5a6264badb714e99ac7201161762cca34418d57c8755e8ec36154869f954594 SHA512 0f09758840d88c170fd387165476ae293f5a7701d0ec0cd508d920196a580bc263b9cb3a93ab2afacf97761f6161c5e4bbc86cdc0a4f4e0c9ea0724e435866c9
diff --git a/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.7-r1.ebuild b/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.7-r1.ebuild
new file mode 100644
index 000000000000..39dfe68a2ff9
--- /dev/null
+++ b/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.7-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit kernel-install
+
+MY_P=${PF/-bin/}-1
+DESCRIPTION="Pre-built vanilla Linux kernel"
+HOMEPAGE="https://www.kernel.org/"
+SRC_URI="
+	amd64? (
+		https://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/vanilla-kernel/${MY_P}.xpak
+			-> ${MY_P}.amd64.xpak
+	)
+	x86? (
+		https://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/vanilla-kernel/${MY_P}.xpak
+			-> ${MY_P}.x86.xpak
+	)"
+S=${WORKDIR}
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+	!sys-kernel/vanilla-kernel:${SLOT}"
+
+QA_PREBUILT='*'
+
+pkg_pretend() {
+	mount-boot_pkg_pretend
+
+	ewarn "This is an experimental package.  The built kernel and/or initramfs"
+	ewarn "may not work at all or fail with your bootloader configuration.  Please"
+	ewarn "make sure to keep a backup kernel available before testing it."
+}
+
+src_unpack() {
+	ebegin "Unpacking ${MY_P}.${ARCH}.xpak"
+	tar -x < <(xz -c -d --single-stream "${DISTDIR}/${MY_P}.${ARCH}.xpak")
+	eend ${?} || die "Unpacking ${MY_P} failed"
+}
+
+src_test() {
+	kernel-install_test "${PV}" \
+		"${WORKDIR}/usr/src/linux-${PV}/$(kernel-install_get_image_path)" \
+		"lib/modules/${PV}"
+}
+
+src_install() {
+	mv * "${ED}" || die
+}
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build logic for dist-kernels
  2020-01-04 21:24 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build " Michał Górny
@ 2020-01-04 23:41   ` Mike Gilbert
  2020-01-05  6:04     ` Michał Górny
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Gilbert @ 2020-01-04 23:41 UTC (permalink / raw
  To: Gentoo Dev

On Sat, Jan 4, 2020 at 4:24 PM Michał Górny <mgorny@gentoo.org> wrote:
> +# @FUNCTION: kernel-build_src_configure
> +# @DESCRIPTION:
> +# Prepare the toolchain for building the kernel, get the default .config
> +# or restore savedconfig, and get build tree configured for modprep.
> +kernel-build_src_configure() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
> +       # force ld.bfd if we can find it easily
> +       local LD="$(tc-getLD)"
> +       if type -P "${LD}.bfd" &>/dev/null; then
> +               LD+=.bfd
> +       fi
> +
> +       MAKEARGS=(
> +               V=1
> +
> +               HOSTCC="$(tc-getCC)"
> +               HOSTCXX="$(tc-getCXX)"
> +               HOSTCFLAGS="${CFLAGS}"
> +               HOSTLDFLAGS="${LDFLAGS}"

I think the HOST variables should reference the CBUILD toolchain. Example below.

# Sets BUILD_CFLAGS and BUILD_LDFLAGS if not set in make.conf.
tc-export_build_env

HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build logic for dist-kernels
  2020-01-04 23:41   ` Mike Gilbert
@ 2020-01-05  6:04     ` Michał Górny
  0 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2020-01-05  6:04 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Sat, 2020-01-04 at 18:41 -0500, Mike Gilbert wrote:
> On Sat, Jan 4, 2020 at 4:24 PM Michał Górny <mgorny@gentoo.org> wrote:
> > +# @FUNCTION: kernel-build_src_configure
> > +# @DESCRIPTION:
> > +# Prepare the toolchain for building the kernel, get the default .config
> > +# or restore savedconfig, and get build tree configured for modprep.
> > +kernel-build_src_configure() {
> > +       debug-print-function ${FUNCNAME} "${@}"
> > +
> > +       # force ld.bfd if we can find it easily
> > +       local LD="$(tc-getLD)"
> > +       if type -P "${LD}.bfd" &>/dev/null; then
> > +               LD+=.bfd
> > +       fi
> > +
> > +       MAKEARGS=(
> > +               V=1
> > +
> > +               HOSTCC="$(tc-getCC)"
> > +               HOSTCXX="$(tc-getCXX)"
> > +               HOSTCFLAGS="${CFLAGS}"
> > +               HOSTLDFLAGS="${LDFLAGS}"
> 
> I think the HOST variables should reference the CBUILD toolchain. Example below.
> 
> # Sets BUILD_CFLAGS and BUILD_LDFLAGS if not set in make.conf.
> tc-export_build_env
> 
> HOSTCC="$(tc-getBUILD_CC)"
> HOSTCXX="$(tc-getBUILD_CXX)"
> HOSTCFLAGS="${BUILD_CFLAGS}"
> HOSTLDFLAGS="${BUILD_LDFLAGS}"
> 

Yeah, I was supposed to fix this and I've forgotten.  Thanks for doing
the work for me ;-).

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-05  6:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-04 21:24 [gentoo-dev] [PATCH 1/4] kernel-install.eclass: Install logic for dist-kernels Michał Górny
2020-01-04 21:24 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: Build " Michał Górny
2020-01-04 23:41   ` Mike Gilbert
2020-01-05  6:04     ` Michał Górny
2020-01-04 21:24 ` [gentoo-dev] [PATCH 3/4] sys-kernel/vanilla-kernel: Migrate to kernel-build.eclass Michał Górny
2020-01-04 21:24 ` [gentoo-dev] [PATCH 4/4] sys-kernel/vanilla-kernel-bin: Migrate to kernel-install.eclass Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox