aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2021-12-02-toying-with-virtio/build_kernel.sh
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2021-12-04 18:30:54 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2021-12-04 18:30:54 +0100
commit6059b8d8c6085426fce1a6e638af069750c9dd54 (patch)
tree747ef72fda3b32405f90084d8f00f9d2d6163b07 /content/2021-12-02-toying-with-virtio/build_kernel.sh
parentc8a1ac71ce7e5c0183840513fb7bd2d642ca887e (diff)
downloadblog-6059b8d8c6085426fce1a6e638af069750c9dd54.tar.gz
blog-6059b8d8c6085426fce1a6e638af069750c9dd54.zip
added virtio post
Diffstat (limited to 'content/2021-12-02-toying-with-virtio/build_kernel.sh')
-rwxr-xr-xcontent/2021-12-02-toying-with-virtio/build_kernel.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/content/2021-12-02-toying-with-virtio/build_kernel.sh b/content/2021-12-02-toying-with-virtio/build_kernel.sh
new file mode 100755
index 0000000..b219b57
--- /dev/null
+++ b/content/2021-12-02-toying-with-virtio/build_kernel.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+set -e
+
+LINUX=linux-5.15.6
+
+test -f $LINUX.tar.xz || wget -nc https://cdn.kernel.org/pub/linux/kernel/v5.x/$LINUX.tar.xz
+test -d $LINUX || tar xf $LINUX.tar.xz
+
+cd $LINUX
+
+cat <<EOF > kernel_fragment.config
+# 64bit kernel.
+CONFIG_64BIT=y
+# Enable support for cpio compressed initramfs (gzip).
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_RD_GZIP=y
+# Support for ELF and #! binary format.
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SCRIPT=y
+# Enable devtmpfs (can automatically populate /dev).
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# Enable tty & console.
+CONFIG_TTY=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# Enable proc & sys pseudo fs.
+CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
+
+# Enable support for virtio pci.
+CONFIG_PCI=y
+CONFIG_VIRTIO_MENU=y
+CONFIG_VIRTIO_PCI=y
+
+# Enable virtio console driver.
+CONFIG_VIRTIO_CONSOLE=y
+
+# Enable support for block devices.
+CONFIG_BLK_DEV=y
+
+# Enable virtio blk driver.
+CONFIG_VIRTIO_BLK=y
+
+# Enable support for ext2 filesystems.
+CONFIG_EXT2_FS=y
+
+# Enable general networking support.
+CONFIG_NET=y
+
+# Enable support for TCP/IP.
+CONFIG_INET=y
+
+# Enable support for network devices.
+CONFIG_NETDEVICES=y
+
+# Enable networking core drivers.
+CONFIG_NET_CORE=y
+
+# Enable virtio net driver.
+CONFIG_VIRTIO_NET=y
+EOF
+
+make tinyconfig
+./scripts/kconfig/merge_config.sh -n ./kernel_fragment.config
+make -j$(nproc)