2023-04-04 22:35:49 +00:00
|
|
|
{
|
2025-02-10 21:55:08 +00:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
2023-04-04 22:35:49 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-06-29 21:59:27 +00:00
|
|
|
inherit (lib) mkIf;
|
2023-12-05 17:29:01 +00:00
|
|
|
o = config.system.outputs;
|
2023-04-04 22:35:49 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./initramfs.nix
|
|
|
|
];
|
2023-07-13 18:24:59 +00:00
|
|
|
|
2023-04-10 18:59:09 +00:00
|
|
|
config = mkIf (config.rootfsType == "jffs2") {
|
2023-04-15 16:23:58 +00:00
|
|
|
kernel.config = {
|
|
|
|
JFFS2_FS = "y";
|
|
|
|
JFFS2_LZO = "y";
|
|
|
|
JFFS2_RTIME = "y";
|
|
|
|
JFFS2_COMPRESSION_OPTIONS = "y";
|
|
|
|
JFFS2_ZLIB = "y";
|
|
|
|
JFFS2_CMODE_SIZE = "y";
|
|
|
|
};
|
2023-04-10 18:07:27 +00:00
|
|
|
boot.initramfs.enable = true;
|
2023-12-05 17:29:01 +00:00
|
|
|
system.outputs = {
|
2023-04-10 18:59:09 +00:00
|
|
|
rootfs =
|
2023-04-04 22:35:49 +00:00
|
|
|
let
|
2023-04-07 08:39:47 +00:00
|
|
|
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
2025-02-10 21:55:08 +00:00
|
|
|
endian = if pkgs.stdenv.isBigEndian then "--big-endian" else "--little-endian";
|
|
|
|
in
|
|
|
|
runCommand "make-jffs2"
|
|
|
|
{
|
|
|
|
depsBuildBuild = [ mtdutils ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
tree=${o.bootablerootdir}
|
|
|
|
(cd $tree && mkfs.jffs2 --compression-mode=size ${endian} -e ${toString config.hardware.flash.eraseBlockSize} --enable-compressor=lzo --pad --root . --output $out --squash --faketime )
|
|
|
|
'';
|
2023-04-04 22:35:49 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|