make jffs2 module provide o.rootfs, conditionally
it's enabled if config.rootfsType == "jffs2"
This commit is contained in:
parent
63a89f7d0d
commit
42725f56f9
5 changed files with 33 additions and 6 deletions
|
@ -25,6 +25,10 @@ in {
|
||||||
type = types.attrsOf type_service;
|
type = types.attrsOf type_service;
|
||||||
};
|
};
|
||||||
filesystem = mkOption { type = types.anything; };
|
filesystem = mkOption { type = types.anything; };
|
||||||
|
rootfsType = mkOption {
|
||||||
|
default = "squashfs";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
kernel = {
|
kernel = {
|
||||||
src = mkOption { type = types.package; } ;
|
src = mkOption { type = types.package; } ;
|
||||||
extraPatchPhase = mkOption {
|
extraPatchPhase = mkOption {
|
||||||
|
@ -107,7 +111,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
boot.commandLine = [
|
boot.commandLine = [
|
||||||
"console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 rootfstype=squashfs"
|
"console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8"
|
||||||
|
"rootfstype=${config.rootfsType}"
|
||||||
"fw_devlink=off"
|
"fw_devlink=off"
|
||||||
];
|
];
|
||||||
users.root = {
|
users.root = {
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
{
|
{
|
||||||
config
|
config
|
||||||
, pkgs
|
, pkgs
|
||||||
|
, lib
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) closureInfo;
|
inherit (pkgs) closureInfo;
|
||||||
|
inherit (lib) mkIf;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./initramfs.nix
|
./initramfs.nix
|
||||||
];
|
];
|
||||||
config = {
|
config = mkIf (config.rootfsType == "jffs2") {
|
||||||
kernel.config.JFFS2_FS = "y";
|
kernel.config.JFFS2_FS = "y";
|
||||||
boot.initramfs.enable = true;
|
boot.initramfs.enable = true;
|
||||||
outputs = rec {
|
outputs = rec {
|
||||||
systemConfiguration =
|
systemConfiguration =
|
||||||
pkgs.pkgsBuildBuild.systemconfig config.filesystem.contents;
|
pkgs.pkgsBuildBuild.systemconfig config.filesystem.contents;
|
||||||
jffs2fs =
|
rootfs =
|
||||||
let
|
let
|
||||||
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
||||||
endian = if pkgs.stdenv.isBigEndian
|
endian = if pkgs.stdenv.isBigEndian
|
||||||
|
@ -38,7 +40,7 @@ in
|
||||||
pkgs.runCommand "jffs2boot" {} ''
|
pkgs.runCommand "jffs2boot" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
ln -s ${o.jffs2fs} rootfs
|
ln -s ${o.rootfs} rootfs
|
||||||
ln -s ${o.kernel} vmlinux
|
ln -s ${o.kernel} vmlinux
|
||||||
ln -s ${o.manifest} manifest
|
ln -s ${o.manifest} manifest
|
||||||
ln -s ${o.initramfs} initramfs
|
ln -s ${o.initramfs} initramfs
|
||||||
|
|
|
@ -9,6 +9,9 @@ let
|
||||||
inherit (pkgs) liminix callPackage writeText;
|
inherit (pkgs) liminix callPackage writeText;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./squashfs.nix
|
||||||
|
];
|
||||||
options = {
|
options = {
|
||||||
outputs = mkOption {
|
outputs = mkOption {
|
||||||
type = types.attrsOf types.package;
|
type = types.attrsOf types.package;
|
||||||
|
@ -17,7 +20,6 @@ in
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
outputs = rec {
|
outputs = rec {
|
||||||
rootfs = liminix.builders.squashfs config.filesystem.contents;
|
|
||||||
tftpd = pkgs.buildPackages.tufted;
|
tftpd = pkgs.buildPackages.tufted;
|
||||||
kernel = liminix.builders.kernel.override {
|
kernel = liminix.builders.kernel.override {
|
||||||
inherit (config.kernel) config src extraPatchPhase;
|
inherit (config.kernel) config src extraPatchPhase;
|
||||||
|
@ -38,7 +40,7 @@ in
|
||||||
vmroot = pkgs.runCommand "qemu" {} ''
|
vmroot = pkgs.runCommand "qemu" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
ln -s ${rootfs} rootfs
|
ln -s ${config.outputs.rootfs} rootfs
|
||||||
ln -s ${kernel} vmlinux
|
ln -s ${kernel} vmlinux
|
||||||
ln -s ${manifest} manifest
|
ln -s ${manifest} manifest
|
||||||
ln -s ${kernel.headers} build
|
ln -s ${kernel.headers} build
|
||||||
|
|
17
modules/squashfs.nix
Normal file
17
modules/squashfs.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
config
|
||||||
|
, pkgs
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (pkgs) liminix;
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = mkIf (config.rootfsType == "squashfs") {
|
||||||
|
outputs = rec {
|
||||||
|
rootfs = liminix.builders.squashfs config.filesystem.contents;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,4 +4,5 @@
|
||||||
../../vanilla-configuration.nix
|
../../vanilla-configuration.nix
|
||||||
../../modules/jffs2.nix
|
../../modules/jffs2.nix
|
||||||
];
|
];
|
||||||
|
config.rootfsType = "jffs2";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue