summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/system/boot/stage-2-init.sh4
-rw-r--r--modules/system/boot/stage-2.nix36
2 files changed, 31 insertions, 9 deletions
diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh
index 79836b7d9a8..6035f43d3ad 100644
--- a/modules/system/boot/stage-2-init.sh
+++ b/modules/system/boot/stage-2-init.sh
@@ -82,9 +82,9 @@ done
 mkdir -m 0755 -p /sys 
 mount -t sysfs none /sys
 mkdir -m 0755 -p /dev
-mount -t tmpfs -o "mode=0755" none /dev
+mount -t tmpfs -o "mode=0755,size=@devSize@" none /dev
 mkdir -m 0777 /dev/shm
-mount -t tmpfs -o "rw,nosuid,nodev" tmpfs /dev/shm
+mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm
 mkdir -m 0755 -p /dev/pts
 mount -t devpts -o mode=0600,gid=@ttyGid@ none /dev/pts 
 [ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # uml doesn't have usb by default
diff --git a/modules/system/boot/stage-2.nix b/modules/system/boot/stage-2.nix
index 2e5e2e524dd..fc510dcbaea 100644
--- a/modules/system/boot/stage-2.nix
+++ b/modules/system/boot/stage-2.nix
@@ -4,13 +4,34 @@ let
 
   options = {
 
-    boot.postBootCommands = pkgs.lib.mkOption {
-      default = "";
-      example = "rm -f /var/log/messages";
-      merge = pkgs.lib.mergeStringOption;
-      description = ''
-        Shell commands to be executed just before Upstart is started.
-      '';
+    boot = {
+      postBootCommands = pkgs.lib.mkOption {
+        default = "";
+        example = "rm -f /var/log/messages";
+        merge = pkgs.lib.mergeStringOption;
+        description = ''
+          Shell commands to be executed just before Upstart is started.
+        '';
+      };
+
+      devSize = pkgs.lib.mkOption {
+        default = "50%";
+        example = "32m";
+        description = ''
+          Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option,
+          for the accepted syntax.
+        '';
+      };
+
+      devShmSize = pkgs.lib.mkOption {
+        default = "50%";
+        example = "256m";
+        description = ''
+          Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option,
+          for the accepted syntax.
+        '';
+      };
+
     };
 
   };
@@ -23,6 +44,7 @@ let
     src = ./stage-2-init.sh;
     isExecutable = true;
     inherit kernel activateConfiguration;
+    inherit (config.boot) devSize devShmSize;
     ttyGid = config.ids.gids.tty;
     upstart = config.system.build.upstart;
     path =