1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-11-09 16:34:32 +03:00

image-builder: makeFAT32: use block size

In addition, present the sector size as an option.

The sector size is required to set a block size in bytes, so giving the
option to the end-user is probably for the best.

The values here were chosen to keep the builder compatible with the
existing tests.

In addition, the values are quite optimized for smaller filesystem
images, e.g. building a FIRMWARE partition for the Raspberry Pi.
This commit is contained in:
Samuel Dionne-Riel 2019-09-02 16:33:21 -04:00
parent c0001af576
commit e008cb416c

View File

@ -5,11 +5,16 @@
let
inherit (imageBuilder) makeFilesystem;
in
{ partitionID, ... } @ args:
{ partitionID
# These defaults are assuming small~ish FAT32 filesystems are generated.
, blockSize ? 512
, sectorSize ? 512
, ... } @ args:
makeFilesystem (args // {
# FAT32 can be used for ESP. Let's make this obvious.
filesystemType = if args ? filesystemType then args.filesystemType else "FAT32";
inherit blockSize;
minimumSize = imageBuilder.size.KiB 500;
nativeBuildInputs = [
@ -20,6 +25,8 @@ makeFilesystem (args // {
filesystemPhase = ''
faketime -f "1970-01-01 00:00:00" mkfs.vfat \
-s ${toString (blockSize / sectorSize)} \
-S ${toString sectorSize} \
-F 32 \
-i $partitionID \
-n $partName \