summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-12-26 07:28:19 +0200
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2016-02-01 10:46:17 +0200
commit4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2 (patch)
tree0475c22cd7f8fe91a566c27e78c95985ea9b05e4 /nixos
parentb6621196e07429ed416ff426cc1e398cfc70a5d6 (diff)
downloadnixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar.gz
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar.bz2
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar.lz
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar.xz
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.tar.zst
nixlib-4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2.zip
sd-image.nix: Move the /boot partition up to 8M
Reportedly some ARM boards need some boot code at the start of a SD card
that could be larger than a megabyte. Change it to 8M, and while at it
reduce the /boot size such that the root partition should now start on a
128M boundary (the flash on SD cards really don't like non-aligned
writes these days).
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/cd-dvd/sd-image.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/installer/cd-dvd/sd-image.nix b/nixos/modules/installer/cd-dvd/sd-image.nix
index 12b4f3045614..9eba542d8c91 100644
--- a/nixos/modules/installer/cd-dvd/sd-image.nix
+++ b/nixos/modules/installer/cd-dvd/sd-image.nix
@@ -30,7 +30,7 @@ in
 
     bootSize = mkOption {
       type = types.int;
-      default = 128;
+      default = 120;
       description = ''
         Size of the /boot partition, in megabytes.
       '';
@@ -66,10 +66,10 @@ in
       buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ];
 
       buildCommand = ''
-        # Create the image file sized to fit /boot and /, plus 4M of slack
+        # Create the image file sized to fit /boot and /, plus 20M of slack
         rootSizeBlocks=$(du -B 512 --apparent-size ${rootfsImage} | awk '{ print $1 }')
         bootSizeBlocks=$((${toString config.sdImage.bootSize} * 1024 * 1024 / 512))
-        imageSize=$((rootSizeBlocks * 512 + bootSizeBlocks * 512 + 4096 * 1024))
+        imageSize=$((rootSizeBlocks * 512 + bootSizeBlocks * 512 + 20 * 1024 * 1024))
         truncate -s $imageSize $out
 
         # type=b is 'W95 FAT32', type=83 is 'Linux'.
@@ -77,8 +77,8 @@ in
             label: dos
             label-id: 0x2178694e
 
-            start=1M, size=$bootSizeBlocks, type=b, bootable
-            type=83
+            start=8M, size=$bootSizeBlocks, type=b, bootable
+            start=${toString (8 + config.sdImage.bootSize)}M, type=83
         EOF
 
         # Copy the rootfs into the SD image