diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-12-28 21:45:53 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-12-29 13:57:25 +0100 |
commit | 7b6bd40db6c1ab8531a8ee40bede229673f42c1f (patch) | |
tree | 4ea0faf18338f7ac184bfb4a9f0a9280e6291804 /sys-kernel | |
parent | sys-kernel/vanilla-kernel-bin: Enable qemu-based testing (diff) | |
download | gentoo-7b6bd40db6c1ab8531a8ee40bede229673f42c1f.tar.gz gentoo-7b6bd40db6c1ab8531a8ee40bede229673f42c1f.tar.bz2 gentoo-7b6bd40db6c1ab8531a8ee40bede229673f42c1f.zip |
sys-kernel/vanilla-kernel: Enable qemu-based testing
Run a quick test whether the built kernel can boot a simple distribution
based on Tiny Core Linux.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-kernel')
-rw-r--r-- | sys-kernel/vanilla-kernel/Manifest | 2 | ||||
-rw-r--r-- | sys-kernel/vanilla-kernel/vanilla-kernel-5.4.6-r1.ebuild | 73 |
2 files changed, 72 insertions, 3 deletions
diff --git a/sys-kernel/vanilla-kernel/Manifest b/sys-kernel/vanilla-kernel/Manifest index 64ab1f46f8c6..a3a71cc7a0de 100644 --- a/sys-kernel/vanilla-kernel/Manifest +++ b/sys-kernel/vanilla-kernel/Manifest @@ -1,3 +1,5 @@ DIST linux-5.4.3-arch1.i686.config 241295 BLAKE2B 795b6286bd1e7dc6aa5c1428e7bf08c204ce6c8cbee57863e9f64f8990790cc4398a7d062b54c89b1b80640f02a40fce028d9397725db0f968e8028b0611a20f SHA512 8c7387ded21c02b9cffee0e6d61a7040c44deae21764f743f7719f0d1c7adf684f6b62a501fe31709787ba741859e55fc3b8a3d3d27e52c09f2d8604212bf0a7 DIST linux-5.4.4.arch1-1.amd64.config 241587 BLAKE2B 71db76bf30a8d7f4dc680399b9f9fbb4236d1938bb86e23eb1ab236a667a959fc1cff788f7e432c43a6173e1bac4e20f3a6c3391d84275d46f1f66bd338bf538 SHA512 34d66658963dbd72fa3e96f2c5d5bccafb781fa14f6ebafe7859953929ba2fbb112f1435ca68cec8389d789cf0efa81d5fc0f5ac6dfa23a704348ab83709e9db DIST linux-5.4.6.tar.xz 109454640 BLAKE2B 8619492fedd4ae489a811561f72285b69deb827bb1db1f65be2a128d3bcbb69bdeec6b73650e1e8f72b18e5016c2df092bc77ee38be756d35f2903ecf0db1687 SHA512 9e1153e80303d6d5016856a25f3757259a3a428bad11208192315088d1f1a09957f5b8e966ab8cb5842ce1a740760f87474066294f8b410e9c44c810838bcdac +DIST tinycorelinux-10.1-amd64.qcow2 16842752 BLAKE2B e013e76503c335739a9623c0901ca791937a0e6b177854535cadec1e2c2cd2df588283ed3128cf652595f32264fbfe5b3bd3a8c97665fd4da344e308535be366 SHA512 c3aeb20ff8769da9211694b7f701907cc7ae7582cdfad2c2fdc008d97ebcbd9dc08245b4e8f8450e1cb304bd705345a11fe79f901a47979fee91443841d55641 +DIST tinycorelinux-10.1-x86.qcow2 14876672 BLAKE2B 3c760eb7438b13261e52ecfaa33a53649ced95f1ab40aae52134b8cdc31a16d7aa0d6a6dd716e268ed148e9d77a10b7c700b141b61d70c82d271ffe88e8e2a3c SHA512 9964538dc42f232a11949f74b61d46422ea5da3bdc253a217119bd0b8a750c40fd2da0b07157067be9ac0226472614f210a1248114df0d331df390979867a895 diff --git a/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.6-r1.ebuild b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.6-r1.ebuild index 62465876eca3..26f4a9a172c3 100644 --- a/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.6-r1.ebuild +++ b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.6-r1.ebuild @@ -6,6 +6,7 @@ EAPI=7 inherit mount-boot savedconfig toolchain-funcs MY_P=linux-${PV} +TCL_VER=10.1 AMD64_CONFIG_VER=5.4.4.arch1-1 AMD64_CONFIG_HASH=f101331956bb37080dce191ca789a5c44fac9e69 I686_CONFIG_VER=5.4.3-arch1 @@ -17,17 +18,24 @@ 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 + test? ( + https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-amd64.qcow2 + ) ) x86? ( https://git.archlinux32.org/packages/plain/core/linux/config.i686?id=${I686_CONFIG_HASH} -> linux-${I686_CONFIG_VER}.i686.config + test? ( + https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-x86.qcow2 + ) )" S=${WORKDIR}/${MY_P} LICENSE="GPL-2" SLOT="${PV}" KEYWORDS="~amd64 ~x86" -IUSE="+initramfs" +IUSE="+initramfs test" +RESTRICT="!test? ( test ) test? ( userpriv )" # install-DEPEND actually # note: we need installkernel with initramfs support! @@ -39,7 +47,13 @@ RDEPEND=" initramfs? ( >=sys-kernel/dracut-049-r2 )" BDEPEND=" sys-devel/bc - virtual/libelf" + virtual/libelf + test? ( + dev-tcltk/expect + sys-kernel/dracut + amd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] ) + x86? ( app-emulation/qemu[qemu_softmmu_targets_i386] ) + )" pkg_pretend() { mount-boot_pkg_pretend @@ -112,7 +126,60 @@ src_compile() { } src_test() { - : + local image_arch=${ARCH} + local kern_arch=x86 + local qemu_arch=$(usex amd64 x86_64 i386) + + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ + INSTALL_MOD_PATH="${T}" modules_install + + dracut \ + --conf /dev/null \ + --confdir /dev/null \ + --no-hostonly \ + --kmoddir "${T}/lib/modules/${PV}" \ + "${T}/initrd" "${PV}" || die + cp "${DISTDIR}/tinycorelinux-${TCL_VER}-${image_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 '${WORKDIR}/build/arch/${kern_arch}/boot/bzImage' \ + -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 to login" + exit 0 + } + timeout { + send_error "\n* Kernel boot timed out" + exit 2 + } + } + EOF } src_install() { |