aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2021-12-02-toying-with-virtio/build_kernel.sh
blob: b219b579058035e98d7dd1411fcc78f7bb01fdda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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)