Skip to content

Commit

Permalink
build-support/vm: Use devtmpfs, not static device nodes
Browse files Browse the repository at this point in the history
In 2017, there is no reason to create a static /dev.
  • Loading branch information
dezgeg committed Dec 12, 2017
1 parent 2d4fdc1 commit 0d27df2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
2 changes: 0 additions & 2 deletions nixos/lib/make-disk-image.nix
Expand Up @@ -150,8 +150,6 @@ in pkgs.vmTools.runInLinuxVM (
}
''
${if partitioned then ''
. /sys/class/block/vda1/uevent
mknod /dev/vda1 b $MAJOR $MINOR
rootDisk=/dev/vda1
'' else ''
rootDisk=/dev/vda
Expand Down
22 changes: 1 addition & 21 deletions pkgs/build-support/vm/default.nix
Expand Up @@ -60,21 +60,6 @@ rec {
''; # */


createDeviceNodes = dev:
''
mknod -m 666 ${dev}/null c 1 3
mknod -m 666 ${dev}/zero c 1 5
mknod -m 666 ${dev}/full c 1 7
mknod -m 666 ${dev}/random c 1 8
mknod -m 666 ${dev}/urandom c 1 9
mknod -m 666 ${dev}/tty c 5 0
mknod -m 666 ${dev}/ttyS0 c 4 64
mknod ${dev}/rtc c 254 0
. /sys/class/block/${hd}/uevent
mknod ${dev}/${hd} b $MAJOR $MINOR
'';


stage1Init = writeScript "vm-run-stage1" ''
#! ${initrdUtils}/bin/ash -e
Expand Down Expand Up @@ -109,8 +94,7 @@ rec {
insmod $i
done
mount -t tmpfs none /dev
${createDeviceNodes "/dev"}
mount -t devtmpfs devtmpfs /dev
ifconfig lo up
Expand Down Expand Up @@ -302,7 +286,6 @@ rec {
touch /mnt/.debug
mkdir /mnt/proc /mnt/dev /mnt/sys
${createDeviceNodes "/mnt/dev"}
'';


Expand Down Expand Up @@ -353,7 +336,6 @@ rec {
${kmod}/bin/modprobe iso9660
${kmod}/bin/modprobe ufs
${kmod}/bin/modprobe cramfs
mknod /dev/loop0 b 7 0
mkdir -p $out
mkdir -p tmp
Expand All @@ -377,8 +359,6 @@ rec {
${kmod}/bin/modprobe mtdblock
${kmod}/bin/modprobe jffs2
${kmod}/bin/modprobe zlib
mknod /dev/mtd0 c 90 0
mknod /dev/mtdblock0 b 31 0
mkdir -p $out
mkdir -p tmp
Expand Down

1 comment on commit 0d27df2

@Ma27
Copy link
Member

@Ma27 Ma27 commented on 0d27df2 Dec 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems as this broke the creation of libvirtd images using NixOps: NixOS/nixops#826

Please sign in to comment.