2 Révisions

Auteur SHA1 Message Date
  Yann Weber 3b3f46e68d First version of scripts il y a 4 semaines
  Yann Weber f500ac79fe First version of scripts il y a 4 semaines
2 fichiers modifiés avec 78 ajouts et 1 suppressions
  1. 30
    1
      README
  2. 48
    0
      scripts/checkconfig.sh

+ 30
- 1
README Voir le fichier

@@ -6,17 +6,24 @@ Compile test & install kernel image for vz5's VM.
6 6
 Dependencies :
7 7
 ==============
8 8
 
9
-- virsh
10 9
 - expect
10
+- qemu/kvm
11 11
 - `apt build-dep linux-image-amd64`
12 12
 - `apt install linux-source`
13 13
 
14
+Optionnal dependencies :
15
+------------------------
16
+- virsh
17
+- debvm
18
+
14 19
 Install & config :
15 20
 ==================
16 21
 
17 22
 Copy sample config `cp config.mk.inc config.mk`
18 23
 Edit configuration file to meet your needs `editor config.mk`
19 24
 
25
+Then you will need kernel sources & kernel configuration.
26
+
20 27
 Kernel sources  :
21 28
 -----------------
22 29
 
@@ -45,10 +52,32 @@ git -C kernel-config commit -m 'Initial kernel config'
45 52
 Usage :
46 53
 =======
47 54
 
55
+Get current status with `make`
56
+
48 57
 Compile a kernel `make kernel`
49 58
 
50 59
 Test a kernel on virsh vm `make test`
60
+	If make test is run with root, we will try to start TEST_VM_NAME with virsh
61
+	If make test is run without privileges, a disk image will be built using debvm
62
+	and the tests will be run using qemu.
63
+	NOTE : the user needs access to /dev/kvm (adduser username kvm)
51 64
 
52 65
 Install kernel `make install`
53 66
 
54 67
 Commit tested kernel config `make commit-config`
68
+
69
+Notes :
70
+=======
71
+
72
+All scripts & tests are designed for monolitic kernel without initrd.
73
+
74
+Kernel config should contains :
75
+```
76
+# CONFIG_BLK_DEV_INITRD=n
77
+# CONFIG_MODULES=n
78
+```
79
+
80
+KVM has a documentation about kernel tuning for guest that can be found here :
81
+https://www.linux-kvm.org/page/Tuning_Kernel#Kernel_for_guest_with_paravirtualization
82
+
83
+The script `scripts/checkconfig.sh` check that kernel config fits basic needs.

+ 48
- 0
scripts/checkconfig.sh Voir le fichier

@@ -0,0 +1,48 @@
1
+#!/bin/sh
2
+set -e
3
+
4
+if [ "$#" -lt 1 ]
5
+then
6
+	echo "Usage : $0 configfile" 2>/dev/null
7
+	exit 1
8
+fi
9
+config=$1
10
+err=0
11
+
12
+while read rule
13
+do
14
+	opt="$(echo $rule | cut -d ":" -f 1)"
15
+	comment="$(echo $rule | cut -d ":" -f 2-)"
16
+	#echo "opt='$opt'"
17
+	#echo "comment='$comment'"
18
+	printf "%-40s" "$opt"
19
+	if grep "$opt" "$config" >/dev/null
20
+	then
21
+		echo " [$(tput setaf 2)OK$(tput sgr0)]"
22
+	else
23
+		err=1
24
+		echo "[$(tput setaf 1)FAIL$(tput sgr0)] $comment"
25
+	fi
26
+done << __EOF__
27
+# CONFIG_BLK_DEV_INITRD is not set:Initrd should be disabled
28
+# CONFIG_MODULES is not set:Kernel should be monolitic (without module support)
29
+CONFIG_VIRTIO=y:Needed bu VIRTIO_PCI and VIRTIO_BALOON
30
+CONFIG_VIRTIO_MENU=y:The virtio drivers
31
+CONFIG_VIRTIO_NET=y:The virtio network driver
32
+CONFIG_VIRTIO_BLK=y:The virtio block device driver
33
+CONFIG_VIRTIO_PCI=y:Support for virtio PCI devices
34
+CONFIG_VIRTIO_MMIO:Support for memory mapped virtio driver
35
+CONFIG_VIRTIO_MEM=y:The virtio memory driver
36
+CONFIG_VIRTIO_BALLOON=y:Support for hot memory amount change for KVM guest
37
+CONFIG_VIRTIO_INPUT=y:The virtio input (kbd, mice) driver
38
+CONFIG_VIRTIO_CONSOLE=y:Support for virtio serial console
39
+CONFIG_VIRTIO_VDPA=y:Virtio data path acceleration support
40
+CONFIG_VP_VDPA=y:Bridges virtio PCI to vDPA
41
+CONFIG_PCI_MSI=y:Allows driver to enable Message Signaled Interrupts
42
+CONFIG_KVM_GUEST=y:Optimization for KVM guest
43
+CONFIG_PARAVIRT=y:Optimization for linux guest
44
+CONFIG_MEMORY_HOTPLUG=y:Needed by VIRTIO_BALLOON
45
+CONFIG_MEMORY_HOTREMOVE=y:Needed by VIRTIO_BALLOON
46
+__EOF__
47
+
48
+exit $err

Loading…
Annuler
Enregistrer