From aff26601891d33146a19a900129f7d455269fc2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 17 Nov 2017 19:15:00 +0100 Subject: Add virt use for linux --- sys-kernel/linux/files/config_prepare.sh | 24 ++++++++++++--- sys-kernel/linux/files/overlay.config | 7 ----- sys-kernel/linux/files/virt.config | 52 ++++++++++++++++++++++++++++++++ sys-kernel/linux/linux-4.13.13-r1.ebuild | 4 +-- 4 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 sys-kernel/linux/files/virt.config (limited to 'sys-kernel/linux') diff --git a/sys-kernel/linux/files/config_prepare.sh b/sys-kernel/linux/files/config_prepare.sh index 0d3409f..f4ae6d4 100755 --- a/sys-kernel/linux/files/config_prepare.sh +++ b/sys-kernel/linux/files/config_prepare.sh @@ -3,8 +3,24 @@ set -e B="$(dirname $0)" -# First just deploy arch linux configuration (ah yes I stole it) -cp "$B"/arch.config .config +BASE=arch.config +OVERLAY=overlay.config + +if [ "$1" = "virt" ]; then + BASE= + OVERLAY=virt.config +fi +################################################################################# + +# First just deploy base configuration (provided or just kernel default) +if [ -n "$BASE" ]; then + cp "$B/$BASE" .config +else + make defconfig +fi + +# We are done if no overlay is specified +[ -n "$OVERLAY" ] || exit 0 # And now apply changes from overlay.config while read L; do @@ -15,7 +31,7 @@ while read L; do sed -i "#^$OPTION#d" .config # Put config echo "$L" >> .config -done < "$B/overlay.config" +done < "$B/$OVERLAY" # As next step run olddefconfig (note: stderr contains some output about overrided # options so I am ignoring it) @@ -39,6 +55,6 @@ while read L; do echo -e "\e[1;31mN:\e[0m$L" fi fi -done < "$B/overlay.config" +done < "$B/$OVERLAY" exit $EC diff --git a/sys-kernel/linux/files/overlay.config b/sys-kernel/linux/files/overlay.config index 1dde514..8e93b4a 100644 --- a/sys-kernel/linux/files/overlay.config +++ b/sys-kernel/linux/files/overlay.config @@ -69,10 +69,3 @@ CONFIG_BINFMT_SCRIPT=y # Options enabled just to make previous options enabled CONFIG_LEDS_CLASS=y - -# For virtual -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_MMIO=y -CONFIG_VIRTIO_BLK=y -CONFIG_VIRTIO_NET=y -CONFIG_SCSI_VIRTIO=y diff --git a/sys-kernel/linux/files/virt.config b/sys-kernel/linux/files/virt.config new file mode 100644 index 0000000..a0cee7c --- /dev/null +++ b/sys-kernel/linux/files/virt.config @@ -0,0 +1,52 @@ +# No logo +CONFIG_LOGO=n +CONFIG_LOCALVERSION="virt" +# Compile BTRFS in kernel +CONFIG_BTRFS_FS=y + +# Enable guest configurations +CONFIG_HYPERVISOR_GUEST=y +CONFIG_PARAVIRT=y +CONFIG_PARAVIRT_SPINLOCKS=y +CONFIG_KVM_GUEST=y + +# VirtIO drivers +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_INPUT=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_NET=y +CONFIG_SCSI_LOWLEVEL=y +CONFIG_SCSI_VIRTIO=y + +# Wireguard +CONFIG_NET_FOU=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_NF_CONNTRACK=y +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y +CONFIG_CRYPTO_PCRYPT=y + +# Build configuration into the kernel but as module +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y + +# Chromium requires user namespace sandbox? +CONFIG_USER_NS=y + +## Gentoo specific just to be sure +# Udev +CONFIG_DEVTMPFS=y +CONFIG_TMPFS=y +CONFIG_UNIX=y +CONFIG_MMU=y +CONFIG_SHMEM=y +# Portage +CONFIG_CGROUPS=y +CONFIG_NAMESPACES=y +CONFIG_IPC_NS=y +CONFIG_NET_NS=y +CONFIG_SYSVIPC=y +# OpenRC +CONFIG_BINFMT_SCRIPT=y diff --git a/sys-kernel/linux/linux-4.13.13-r1.ebuild b/sys-kernel/linux/linux-4.13.13-r1.ebuild index 7bfb86d..dfa5f0a 100644 --- a/sys-kernel/linux/linux-4.13.13-r1.ebuild +++ b/sys-kernel/linux/linux-4.13.13-r1.ebuild @@ -14,7 +14,7 @@ S="${WORKDIR}/linux-stable-${VER}" LICENSE="GPLv2" SLOT="${PV}" KEYWORDS="amd64 ~x86" -IUSE="" +IUSE="virt" DEPEND="sys-devel/bc" RDEPEND="sys-boot/myinitramfs" @@ -23,7 +23,7 @@ src_configure() { # Fix ARCH variable [ "$ARCH" = "amd64" ] && ARCH="x86" - "${FILESDIR}"/config_prepare.sh || die "Configuration application failed" + "${FILESDIR}"/config_prepare.sh $(usev virt) || die "Configuration application failed" } src_install() { -- cgit v1.2.3