From 801c947113e074e46bfbcf3c316dce8910e7a656 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 26 Sep 2026 21:38:38 +0100 Subject: [PATCH] kvm-support: add a package for KVM device handling /dev/kvm comes out 0600 root:root, so a hypervisor runs as root. Add a kvm-support package which allocates the kvm group and puts the node into it. KVM is built into the kernel where it exists, so no module carries a dependency on the package; userspace depends on it. Signed-off-by: Daniel Golle --- package/system/hardware-support/Makefile | 16 ++++++++++++++++ .../system/hardware-support/files/50-kvm.json | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 package/system/hardware-support/files/50-kvm.json diff --git a/package/system/hardware-support/Makefile b/package/system/hardware-support/Makefile index 2a75bd45fbe..de52475af46 100644 --- a/package/system/hardware-support/Makefile +++ b/package/system/hardware-support/Makefile @@ -110,6 +110,21 @@ define Package/dvb-support/install $(call InstallFragment,$(1),45-dvb.json) endef +define Package/kvm-support + $(call Package/hardware-support/Default) + TITLE:=KVM device support + USERID:=:kvm=34 +endef + +define Package/kvm-support/description + Feature gate for hardware virtualisation. Allocates the kvm group and + installs the hotplug rule which puts /dev/kvm into it. +endef + +define Package/kvm-support/install + $(call InstallFragment,$(1),50-kvm.json) +endef + define Build/Prepare endef @@ -124,3 +139,4 @@ $(eval $(call BuildPackage,video-support)) $(eval $(call BuildPackage,accel-support)) $(eval $(call BuildPackage,input-support)) $(eval $(call BuildPackage,dvb-support)) +$(eval $(call BuildPackage,kvm-support)) diff --git a/package/system/hardware-support/files/50-kvm.json b/package/system/hardware-support/files/50-kvm.json new file mode 100644 index 00000000000..0da03cd7c36 --- /dev/null +++ b/package/system/hardware-support/files/50-kvm.json @@ -0,0 +1,6 @@ +[ + [ "if", + [ "eq", "DEVNAME", "kvm" ], + [ "makedev", "/dev/%DEVNAME%", "0660", "kvm" ] + ] +]