correct jffs2 endian, remove unused bindings

This commit is contained in:
Daniel Barlow 2023-04-07 09:39:47 +01:00
parent db54c877d6
commit f5156425a2

View file

@ -1,12 +1,10 @@
{ {
config config
, pkgs , pkgs
, lib
, ... , ...
}: }:
let let
inherit (lib) mkOption types concatStringsSep; inherit (pkgs) closureInfo;
inherit (pkgs) liminix callPackage writeText closureInfo;
in in
{ {
imports = [ imports = [
@ -16,21 +14,23 @@ in
kernel.config.JFFS2_FS = "y"; kernel.config.JFFS2_FS = "y";
outputs = rec { outputs = rec {
systemConfiguration = systemConfiguration =
let inherit (pkgs.pkgsBuildBuild) systemconfig; pkgs.pkgsBuildBuild.systemconfig config.filesystem.contents;
in systemconfig config.filesystem.contents;
jffs2fs = jffs2fs =
let let
inherit (pkgs.pkgsBuildBuild) runCommand systemconfig mtdutils; inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
sysconf = systemConfiguration; endian = if pkgs.stdenv.isBigEndian
then "--big-endian" else "--little-endian";
in runCommand "make-jffs2" { in runCommand "make-jffs2" {
depsBuildBuild = [ mtdutils ]; depsBuildBuild = [ mtdutils ];
} '' } ''
mkdir -p $TMPDIR/empty/nix/store/ mkdir -p $TMPDIR/empty/nix/store/
cp ${sysconf}/activate $TMPDIR/empty/activate cp ${systemConfiguration}/activate $TMPDIR/empty/activate
pkgClosure=${closureInfo { rootPaths = [ sysconf ]; }} pkgClosure=${closureInfo {
rootPaths = [ systemConfiguration ];
}}
cp $pkgClosure/registration nix-path-registration cp $pkgClosure/registration nix-path-registration
grafts=$(sed < $pkgClosure/store-paths 's/^\(.*\)$/--graft \1:\1/g') grafts=$(sed < $pkgClosure/store-paths 's/^\(.*\)$/--graft \1:\1/g')
mkfs.jffs2 --pad --big-endian --root $TMPDIR/empty --output $out $grafts --verbose mkfs.jffs2 ${endian} --pad --root $TMPDIR/empty --output $out $grafts
''; '';
jffs2boot = jffs2boot =
let o = config.outputs; in let o = config.outputs; in
@ -42,8 +42,6 @@ in
ln -s ${o.manifest} manifest ln -s ${o.manifest} manifest
ln -s ${o.initramfs} initramfs ln -s ${o.initramfs} initramfs
''; '';
}; };
}; };
} }