1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-11 09:04:01 +03:00

image-builder: Adds makeExt4

This commit is contained in:
Samuel Dionne-Riel 2019-08-29 18:16:39 -04:00
parent a37d109515
commit 554ead277a
6 changed files with 45 additions and 0 deletions

View File

@ -10,6 +10,7 @@ lib.makeScope newScope (self:
# All known supported filesystems for image generation.
# Use stand-alone (outside of a disk image) is supported.
fileSystem = rec {
makeExt4 = callPackage ./makeExt4.nix {};
makeFAT32 = callPackage ./makeFAT32.nix {};
# Specialization of `makeFAT32` with (1) filesystemType showing as ESP,
# and (2) the name defaults to ESP.

View File

@ -0,0 +1,38 @@
{ makeFilesystem, libfaketime, size
, e2fsprogs, make_ext4fs, lkl
}:
/* */ let scope = { "fileSystem.makeExt4" =
{ partitionID, ... } @ args:
makeFilesystem (args // {
filesystemType = "ext4";
minimumSize = size.MiB 5;
nativeBuildInputs = [
e2fsprogs
make_ext4fs
libfaketime
];
filesystemPhase = ''
:
'';
copyPhase = ''
faketime "1970-01-01 00:00:00" \
make_ext4fs \
-L $partName \
-l $size \
-U $partitionID \
"$img" \
.
'';
checkPhase = ''
EXT2FS_NO_MTAB_OK=yes fsck.ext4 -n -f $img
'';
})
/* */ ;}; in scope."fileSystem.makeExt4"

View File

@ -9,6 +9,7 @@ let
IDs = {
FAT32 = "0123456789ABCDEF";
ESP = "0123456789ABCDEF";
Ext4 = "44444444-4444-4444-1324-123456789098";
};
in

View File

@ -1,11 +1,13 @@
hashes = {
"ESP.img" => "225b07ed075c8e088f973f1002382b07df1e6ca62e43049e9cb7b20534bee796",
"FAT32.img" => "e4146b21ed3ea287a5a86e7910d678bf056b40374c4f1533191e21b8ce6d48c9",
"Ext4.img" => "8182df3038f43cdf2aba6f3980d9fa794affab0f040f9c07450ebbf0d3d8c2ad",
}
filetypes = {
"ESP.img" => 'DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors 20480 (volumes <=32 MB), Media descriptor 0xf8, sectors/track 32, heads 64, FAT (32 bit), sectors/FAT 158, serial number 0x89abcdef, label: "ESP "',
"FAT32.img" => 'DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors 20480 (volumes <=32 MB), Media descriptor 0xf8, sectors/track 32, heads 64, FAT (32 bit), sectors/FAT 158, serial number 0x89abcdef, label: "FAT32 "',
"Ext4.img" => 'Linux rev 1.0 ext4 filesystem data, UUID=44444444-4444-4444-1324-123456789098, volume name "Ext4" (extents) (large files)'
}
# By globbing on the output, we can validate all built images are verified.

View File

@ -9,6 +9,7 @@ let
IDs = {
FAT32 = "0123456789ABCDEF";
ESP = "0123456789ABCDEF";
Ext4 = "44444444-4444-4444-1324-123456789098";
};
in

View File

@ -1,11 +1,13 @@
hashes = {
"ESP.img" => "9b53acc0332e4b143e31203dc0df02de929c3bcff9b36799c651f1c8d5eaca4c",
"FAT32.img" => "9b76804f3624566664132134d28208fce005bfe5d3dad3da9d91814f7ca2286f",
"Ext4.img" => "abcf53929fc3271965c7a8c93f45a3bf6144a3b8a371d26fca2e5e0b3eac1f8e",
}
filetypes = {
"ESP.img" => 'DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors 1000 (volumes <=32 MB), Media descriptor 0xf8, sectors/track 32, heads 64, FAT (32 bit), sectors/FAT 8, serial number 0x89abcdef, label: "ESP "',
"FAT32.img" => 'DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors 1000 (volumes <=32 MB), Media descriptor 0xf8, sectors/track 32, heads 64, FAT (32 bit), sectors/FAT 8, serial number 0x89abcdef, label: "FAT32 "',
"Ext4.img" => 'Linux rev 1.0 ext4 filesystem data, UUID=44444444-4444-4444-1324-123456789098, volume name "Ext4" (extents) (large files)'
}
# By globbing on the output, we can validate all built images are verified.