nixfmt-rfc-style
There is nothing in this commit except for the changes made by nix-shell -p nixfmt-rfc-style --run "nixfmt ." If this has mucked up your open branches then sorry about that. You can probably nixfmt them to match before merging
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep;
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
concatStringsSep
|
||||
;
|
||||
inherit (pkgs.pseudofile) dir symlink;
|
||||
cfg = config.boot.loader.extlinux;
|
||||
o = config.system.outputs;
|
||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||
wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.boot.loader.extlinux.enable = mkEnableOption "extlinux";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
system.outputs.bootfiles = pkgs.runCommand "extlinux" {} ''
|
||||
system.outputs.bootfiles = pkgs.runCommand "extlinux" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
${if wantsDtb then "cp ${o.dtb} dtb" else "true"}
|
||||
|
@@ -1,21 +1,28 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep;
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
concatStringsSep
|
||||
;
|
||||
inherit (pkgs.pseudofile) dir symlink;
|
||||
cfg = config.boot.loader.fit;
|
||||
o = config.system.outputs;
|
||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||
wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.boot.loader.fit.enable = mkEnableOption "FIT in /boot";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
system.outputs.bootfiles = pkgs.runCommand "boot-fit" {} ''
|
||||
system.outputs.bootfiles = pkgs.runCommand "boot-fit" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
cp ${o.uimage} fit
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
@@ -21,17 +21,20 @@ in
|
||||
rootfs =
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) runCommand e2fsprogs;
|
||||
in runCommand "mkfs.btrfs" {
|
||||
depsBuildBuild = [ e2fsprogs ];
|
||||
} ''
|
||||
tree=${o.bootablerootdir}
|
||||
size=$(du -s --apparent-size --block-size 1024 $tree |cut -f1)
|
||||
# add 25% for filesystem overhead
|
||||
size=$(( 5 * $size / 4))
|
||||
dd if=/dev/zero of=$out bs=1024 count=$size
|
||||
echo "not implemented" ; exit 1
|
||||
# mke2fs -t ext4 -j -d $tree $out
|
||||
'';
|
||||
in
|
||||
runCommand "mkfs.btrfs"
|
||||
{
|
||||
depsBuildBuild = [ e2fsprogs ];
|
||||
}
|
||||
''
|
||||
tree=${o.bootablerootdir}
|
||||
size=$(du -s --apparent-size --block-size 1024 $tree |cut -f1)
|
||||
# add 25% for filesystem overhead
|
||||
size=$(( 5 * $size / 4))
|
||||
dd if=/dev/zero of=$out bs=1024 count=$size
|
||||
echo "not implemented" ; exit 1
|
||||
# mke2fs -t ext4 -j -d $tree $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
@@ -23,16 +23,19 @@ in
|
||||
rootfs =
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) runCommand e2fsprogs;
|
||||
in runCommand "mkfs.ext4" {
|
||||
depsBuildBuild = [ e2fsprogs ];
|
||||
} ''
|
||||
tree=${o.bootablerootdir}
|
||||
size=$(du -s --apparent-size --block-size 1024 $tree |cut -f1)
|
||||
# add 25% for filesystem overhead
|
||||
size=$(( 5 * $size / 4))
|
||||
dd if=/dev/zero of=$out bs=1024 count=$size
|
||||
mke2fs -t ext4 -j -d $tree $out
|
||||
'';
|
||||
in
|
||||
runCommand "mkfs.ext4"
|
||||
{
|
||||
depsBuildBuild = [ e2fsprogs ];
|
||||
}
|
||||
''
|
||||
tree=${o.bootablerootdir}
|
||||
size=$(du -s --apparent-size --block-size 1024 $tree |cut -f1)
|
||||
# add 25% for filesystem overhead
|
||||
size=$(( 5 * $size / 4))
|
||||
dd if=/dev/zero of=$out bs=1024 count=$size
|
||||
mke2fs -t ext4 -j -d $tree $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,11 +1,16 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
inherit (pkgs) runCommand;
|
||||
in
|
||||
{
|
||||
@@ -29,13 +34,15 @@ in
|
||||
kernel.config = {
|
||||
BLK_DEV_INITRD = "y";
|
||||
INITRAMFS_SOURCE = builtins.toJSON "${config.system.outputs.initramfs}";
|
||||
# INITRAMFS_COMPRESSION_LZO = "y";
|
||||
# INITRAMFS_COMPRESSION_LZO = "y";
|
||||
};
|
||||
|
||||
system.outputs = {
|
||||
initramfs =
|
||||
let inherit (pkgs.pkgsBuildBuild) gen_init_cpio;
|
||||
in runCommand "initramfs.cpio" {} ''
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) gen_init_cpio;
|
||||
in
|
||||
runCommand "initramfs.cpio" { } ''
|
||||
cat << SPECIALS | ${gen_init_cpio}/bin/gen_init_cpio /dev/stdin > $out
|
||||
dir /proc 0755 0 0
|
||||
dir /dev 0755 0 0
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
@@ -27,14 +27,16 @@ in
|
||||
rootfs =
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
||||
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 )
|
||||
'';
|
||||
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 )
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,14 +1,15 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
o = config.system.outputs;
|
||||
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.system.outputs = {
|
||||
mbrimage = mkOption {
|
||||
type = types.package;
|
||||
@@ -20,7 +21,7 @@ in {
|
||||
the contents of ``outputs.rootfs`` as its only partition.
|
||||
'';
|
||||
};
|
||||
vmdisk = mkOption { type = types.package; };
|
||||
vmdisk = mkOption { type = types.package; };
|
||||
};
|
||||
|
||||
config = {
|
||||
@@ -28,15 +29,18 @@ in {
|
||||
mbrimage =
|
||||
let
|
||||
o = config.system.outputs;
|
||||
in pkgs.runCommand "mbrimage" {
|
||||
depsBuildBuild = [ pkgs.pkgsBuildBuild.util-linux ];
|
||||
} ''
|
||||
# leave 4 sectors at start for partition table
|
||||
# and alignment to 2048 bytes (does that help?)
|
||||
dd if=${o.rootfs} of=$out bs=512 seek=4 conv=sync
|
||||
echo '4,-,L,*' | sfdisk $out
|
||||
'';
|
||||
vmdisk = pkgs.runCommand "vmdisk" {} ''
|
||||
in
|
||||
pkgs.runCommand "mbrimage"
|
||||
{
|
||||
depsBuildBuild = [ pkgs.pkgsBuildBuild.util-linux ];
|
||||
}
|
||||
''
|
||||
# leave 4 sectors at start for partition table
|
||||
# and alignment to 2048 bytes (does that help?)
|
||||
dd if=${o.rootfs} of=$out bs=512 seek=4 conv=sync
|
||||
echo '4,-,L,*' | sfdisk $out
|
||||
'';
|
||||
vmdisk = pkgs.runCommand "vmdisk" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${o.mbrimage} ./mbrimage
|
||||
|
@@ -1,17 +1,18 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types concatStringsSep;
|
||||
inherit (config.boot) tftp;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.system.outputs = {
|
||||
firmware = mkOption {
|
||||
type = types.package;
|
||||
internal = true; # component of mtdimage
|
||||
internal = true; # component of mtdimage
|
||||
description = ''
|
||||
Binary image (combining kernel, FDT, rootfs, initramfs
|
||||
if needed, etc) for the target device.
|
||||
@@ -19,7 +20,7 @@ in {
|
||||
};
|
||||
flash-scr = mkOption {
|
||||
type = types.package;
|
||||
internal = true; # component of mtdimage
|
||||
internal = true; # component of mtdimage
|
||||
description = ''
|
||||
Copy-pastable U-Boot commands to TFTP download the
|
||||
image and write it to flash
|
||||
@@ -60,13 +61,15 @@ in {
|
||||
|
||||
config = {
|
||||
kernel = {
|
||||
config = {
|
||||
# this needs to be conditional on "not qemu"
|
||||
MTD_SPLIT_UIMAGE_FW = "y";
|
||||
} // lib.optionalAttrs (pkgs.stdenv.isMips) {
|
||||
# https://stackoverflow.com/questions/26466470/can-the-logical-erase-block-size-of-an-mtd-device-be-increased
|
||||
MTD_SPI_NOR_USE_4K_SECTORS = "n";
|
||||
};
|
||||
config =
|
||||
{
|
||||
# this needs to be conditional on "not qemu"
|
||||
MTD_SPLIT_UIMAGE_FW = "y";
|
||||
}
|
||||
// lib.optionalAttrs (pkgs.stdenv.isMips) {
|
||||
# https://stackoverflow.com/questions/26466470/can-the-logical-erase-block-size-of-an-mtd-device-be-increased
|
||||
MTD_SPI_NOR_USE_4K_SECTORS = "n";
|
||||
};
|
||||
};
|
||||
|
||||
programs.busybox.applets = [
|
||||
@@ -78,14 +81,17 @@ in {
|
||||
let
|
||||
o = config.system.outputs;
|
||||
bs = toString config.hardware.flash.eraseBlockSize;
|
||||
in pkgs.runCommand "firmware" {} ''
|
||||
in
|
||||
pkgs.runCommand "firmware" { } ''
|
||||
dd if=${o.uimage} of=$out bs=${bs} conv=sync
|
||||
dd if=${o.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
||||
'';
|
||||
mtdimage =
|
||||
let o = config.system.outputs; in
|
||||
let
|
||||
o = config.system.outputs;
|
||||
in
|
||||
# could use trivial-builders.linkFarmFromDrvs here?
|
||||
pkgs.runCommand "mtdimage" {} ''
|
||||
pkgs.runCommand "mtdimage" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${o.firmware} firmware.bin
|
||||
@@ -96,24 +102,24 @@ in {
|
||||
ln -s ${o.uimage} uimage
|
||||
ln -s ${o.dtb} dtb
|
||||
ln -s ${o.flash-scr} flash.scr
|
||||
'';
|
||||
'';
|
||||
|
||||
flash-scr =
|
||||
let
|
||||
inherit (pkgs.lib.trivial) toHexString;
|
||||
inherit (config.hardware) flash;
|
||||
in
|
||||
pkgs.buildPackages.runCommand "" {} ''
|
||||
imageSize=$(stat -L -c %s ${config.system.outputs.firmware})
|
||||
cat > $out << EOF
|
||||
setenv serverip ${tftp.serverip}
|
||||
setenv ipaddr ${tftp.ipaddr}
|
||||
tftp 0x${toHexString tftp.loadAddress} result/firmware.bin
|
||||
erase 0x${toHexString flash.address} +0x${toHexString flash.size}
|
||||
cp.b 0x${toHexString tftp.loadAddress} 0x${toHexString flash.address} \''${filesize}
|
||||
echo command line was ${builtins.toJSON (concatStringsSep " " config.boot.commandLine)}
|
||||
EOF
|
||||
'';
|
||||
pkgs.buildPackages.runCommand "" { } ''
|
||||
imageSize=$(stat -L -c %s ${config.system.outputs.firmware})
|
||||
cat > $out << EOF
|
||||
setenv serverip ${tftp.serverip}
|
||||
setenv ipaddr ${tftp.ipaddr}
|
||||
tftp 0x${toHexString tftp.loadAddress} result/firmware.bin
|
||||
erase 0x${toHexString flash.address} +0x${toHexString flash.size}
|
||||
cp.b 0x${toHexString tftp.loadAddress} 0x${toHexString flash.address} \''${filesize}
|
||||
echo command line was ${builtins.toJSON (concatStringsSep " " config.boot.commandLine)}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -10,8 +10,7 @@ let
|
||||
in
|
||||
{
|
||||
config = mkIf (config.rootfsType == "squashfs") {
|
||||
system.outputs.rootfs =
|
||||
liminix.builders.squashfs config.filesystem.contents;
|
||||
system.outputs.rootfs = liminix.builders.squashfs config.filesystem.contents;
|
||||
kernel.config = {
|
||||
SQUASHFS = "y";
|
||||
SQUASHFS_XZ = "y";
|
||||
|
@@ -1,11 +1,16 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
inherit (pkgs) runCommand;
|
||||
in
|
||||
{
|
||||
@@ -22,7 +27,6 @@ in
|
||||
};
|
||||
};
|
||||
config = {
|
||||
system.outputs.systemConfiguration =
|
||||
pkgs.systemconfig config.filesystem.contents;
|
||||
system.outputs.systemConfiguration = pkgs.systemconfig config.filesystem.contents;
|
||||
};
|
||||
}
|
||||
|
@@ -1,15 +1,16 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types concatStringsSep;
|
||||
cfg = config.boot.tftp;
|
||||
hw = config.hardware;
|
||||
arch = pkgs.stdenv.hostPlatform.linuxArch;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [ ../ramdisk.nix ];
|
||||
options.boot.tftp = {
|
||||
freeSpaceBytes = mkOption {
|
||||
@@ -17,7 +18,10 @@ in {
|
||||
default = 0;
|
||||
};
|
||||
kernelFormat = mkOption {
|
||||
type = types.enum [ "zimage" "uimage" ];
|
||||
type = types.enum [
|
||||
"zimage"
|
||||
"uimage"
|
||||
];
|
||||
default = "uimage";
|
||||
};
|
||||
compressRoot = mkOption {
|
||||
@@ -61,14 +65,22 @@ in {
|
||||
assert config.rootfsType != "ubifs";
|
||||
let
|
||||
o = config.system.outputs;
|
||||
image = let choices = {
|
||||
uimage = o.uimage;
|
||||
zimage = o.kernel.zImage;
|
||||
}; in choices.${cfg.kernelFormat};
|
||||
bootCommand = let choices = {
|
||||
uimage = "bootm";
|
||||
zimage = "bootz";
|
||||
}; in choices.${cfg.kernelFormat};
|
||||
image =
|
||||
let
|
||||
choices = {
|
||||
uimage = o.uimage;
|
||||
zimage = o.kernel.zImage;
|
||||
};
|
||||
in
|
||||
choices.${cfg.kernelFormat};
|
||||
bootCommand =
|
||||
let
|
||||
choices = {
|
||||
uimage = "bootm";
|
||||
zimage = "bootz";
|
||||
};
|
||||
in
|
||||
choices.${cfg.kernelFormat};
|
||||
|
||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||
objcopy = "${pkgs.stdenv.cc.bintools.targetPrefix}objcopy";
|
||||
@@ -77,7 +89,16 @@ in {
|
||||
rm -f vmlinux.bin.lzma ; lzma -k -z vmlinux.bin
|
||||
'';
|
||||
in
|
||||
pkgs.runCommand "tftpboot" { nativeBuildInputs = with pkgs.pkgsBuildBuild; [ lzma dtc pkgs.stdenv.cc ubootTools ]; } ''
|
||||
pkgs.runCommand "tftpboot"
|
||||
{
|
||||
nativeBuildInputs = with pkgs.pkgsBuildBuild; [
|
||||
lzma
|
||||
dtc
|
||||
pkgs.stdenv.cc
|
||||
ubootTools
|
||||
];
|
||||
}
|
||||
''
|
||||
mkdir $out
|
||||
cd $out
|
||||
binsize() { local s=$(stat -L -c %s $1); echo $(($s + 0x1000 &(~0xfff))); }
|
||||
@@ -97,17 +118,19 @@ in {
|
||||
# end of the kernel is free
|
||||
|
||||
dtbStart=$(($rootfsStart + $rootfsSize))
|
||||
${if cfg.compressRoot
|
||||
then ''
|
||||
lzma -z9cv ${o.rootfs} > rootfs.lz
|
||||
rootfsLzStart=$dtbStart
|
||||
rootfsLzSize=$(binsize rootfs.lz)
|
||||
dtbStart=$(($dtbStart + $rootfsLzSize))
|
||||
''
|
||||
else ''
|
||||
ln -s ${o.rootfs} rootfs
|
||||
''
|
||||
}
|
||||
${
|
||||
if cfg.compressRoot then
|
||||
''
|
||||
lzma -z9cv ${o.rootfs} > rootfs.lz
|
||||
rootfsLzStart=$dtbStart
|
||||
rootfsLzSize=$(binsize rootfs.lz)
|
||||
dtbStart=$(($dtbStart + $rootfsLzSize))
|
||||
''
|
||||
else
|
||||
''
|
||||
ln -s ${o.rootfs} rootfs
|
||||
''
|
||||
}
|
||||
|
||||
cat ${o.dtb} > dtb
|
||||
address_cells=$(fdtget dtb / '#address-cells')
|
||||
@@ -128,37 +151,40 @@ in {
|
||||
|
||||
dtbSize=$(binsize ./dtb )
|
||||
|
||||
${if cfg.appendDTB then ''
|
||||
imageStart=$dtbStart
|
||||
# re-package image with updated dtb
|
||||
cat ${o.kernel} > vmlinux.elf
|
||||
${objcopy} --update-section .appended_dtb=dtb vmlinux.elf
|
||||
${stripAndZip}
|
||||
mkimage -A ${arch} -O linux -T kernel -C lzma -a $(hex ${toString hw.loadAddress}) -e $(hex ${toString hw.entryPoint}) -n '${lib.toUpper arch} Liminix Linux tftpboot' -d vmlinux.bin.lzma image
|
||||
# dtc -I dtb -O dts -o /dev/stdout dtb | grep -A10 chosen ; exit 1
|
||||
tftpcmd="tftpboot $(hex $imageStart) result/image "
|
||||
bootcmd="bootm $(hex $imageStart)"
|
||||
'' else ''
|
||||
imageStart=$(($dtbStart + $dtbSize))
|
||||
tftpcmd="tftpboot $(hex $imageStart) result/image; tftpboot $(hex $dtbStart) result/dtb "
|
||||
ln -s ${image} image
|
||||
bootcmd="${bootCommand} $(hex $imageStart) - $(hex $dtbStart)"
|
||||
''}
|
||||
${
|
||||
if cfg.appendDTB then
|
||||
''
|
||||
imageStart=$dtbStart
|
||||
# re-package image with updated dtb
|
||||
cat ${o.kernel} > vmlinux.elf
|
||||
${objcopy} --update-section .appended_dtb=dtb vmlinux.elf
|
||||
${stripAndZip}
|
||||
mkimage -A ${arch} -O linux -T kernel -C lzma -a $(hex ${toString hw.loadAddress}) -e $(hex ${toString hw.entryPoint}) -n '${lib.toUpper arch} Liminix Linux tftpboot' -d vmlinux.bin.lzma image
|
||||
# dtc -I dtb -O dts -o /dev/stdout dtb | grep -A10 chosen ; exit 1
|
||||
tftpcmd="tftpboot $(hex $imageStart) result/image "
|
||||
bootcmd="bootm $(hex $imageStart)"
|
||||
''
|
||||
else
|
||||
''
|
||||
imageStart=$(($dtbStart + $dtbSize))
|
||||
tftpcmd="tftpboot $(hex $imageStart) result/image; tftpboot $(hex $dtbStart) result/dtb "
|
||||
ln -s ${image} image
|
||||
bootcmd="${bootCommand} $(hex $imageStart) - $(hex $dtbStart)"
|
||||
''
|
||||
}
|
||||
|
||||
cat > boot.scr << EOF
|
||||
setenv serverip ${cfg.serverip}
|
||||
setenv ipaddr ${cfg.ipaddr}
|
||||
${
|
||||
if cfg.compressRoot
|
||||
then "tftpboot $(hex $rootfsLzStart) result/rootfs.lz"
|
||||
else "tftpboot $(hex $rootfsStart) result/rootfs"
|
||||
if cfg.compressRoot then
|
||||
"tftpboot $(hex $rootfsLzStart) result/rootfs.lz"
|
||||
else
|
||||
"tftpboot $(hex $rootfsStart) result/rootfs"
|
||||
}; $tftpcmd
|
||||
${if cfg.compressRoot
|
||||
then "lzmadec $(hex $rootfsLzStart) $(hex $rootfsStart); "
|
||||
else ""
|
||||
} $bootcmd
|
||||
${if cfg.compressRoot then "lzmadec $(hex $rootfsLzStart) $(hex $rootfsStart); " else ""} $bootcmd
|
||||
EOF
|
||||
'';
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
|
@@ -1,14 +1,15 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
o = config.system.outputs;
|
||||
cfg = config.tplink-safeloader;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.tplink-safeloader = {
|
||||
board = mkOption {
|
||||
type = types.str;
|
||||
@@ -53,9 +54,10 @@ in {
|
||||
config = {
|
||||
system.outputs = rec {
|
||||
tplink-safeloader =
|
||||
pkgs.runCommand "tplink" { nativeBuildInputs = with pkgs.pkgsBuildBuild; [ firmware-utils ]; } ''
|
||||
tplink-safeloader -B "${cfg.board}" -k "${o.uimage}" -r "${o.rootfs}" -o $out
|
||||
'';
|
||||
pkgs.runCommand "tplink" { nativeBuildInputs = with pkgs.pkgsBuildBuild; [ firmware-utils ]; }
|
||||
''
|
||||
tplink-safeloader -B "${cfg.board}" -k "${o.uimage}" -r "${o.rootfs}" -o $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
@@ -15,7 +15,7 @@ in
|
||||
|
||||
config = mkIf (config.rootfsType == "ubifs") {
|
||||
kernel.config = {
|
||||
MTD_UBI="y";
|
||||
MTD_UBI = "y";
|
||||
UBIFS_FS = "y";
|
||||
UBIFS_FS_SECURITY = "n";
|
||||
};
|
||||
@@ -25,13 +25,16 @@ in
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
||||
cfg = config.hardware.ubi;
|
||||
in runCommand "mkfs.ubifs" {
|
||||
depsBuildBuild = [ mtdutils ];
|
||||
} ''
|
||||
mkdir tmp
|
||||
tree=${o.bootablerootdir}
|
||||
mkfs.ubifs -x favor_lzo -c ${cfg.maxLEBcount} -m ${cfg.minIOSize} -e ${cfg.logicalEraseBlockSize} -y -r $tree --output $out --squash-uids -o $out
|
||||
'';
|
||||
in
|
||||
runCommand "mkfs.ubifs"
|
||||
{
|
||||
depsBuildBuild = [ mtdutils ];
|
||||
}
|
||||
''
|
||||
mkdir tmp
|
||||
tree=${o.bootablerootdir}
|
||||
mkfs.ubifs -x favor_lzo -c ${cfg.maxLEBcount} -m ${cfg.minIOSize} -e ${cfg.logicalEraseBlockSize} -y -r $tree --output $out --squash-uids -o $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
@@ -13,108 +13,111 @@ let
|
||||
setenv loadaddr ${lib.toHexString cfg.loadAddress}
|
||||
tftpboot $loadaddr result/rootfs
|
||||
ubi write $loadaddr liminix $filesize
|
||||
'';
|
||||
in {
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.system.outputs = {
|
||||
ubimage = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
ubimage
|
||||
*******
|
||||
ubimage
|
||||
*******
|
||||
|
||||
This output provides a UBIFS filesystem image and a small U-Boot script
|
||||
to make the manual installation process very slightly simpler. You will
|
||||
need a serial connection and a network connection to a TFTP server
|
||||
containing the filesystem image it creates.
|
||||
This output provides a UBIFS filesystem image and a small U-Boot script
|
||||
to make the manual installation process very slightly simpler. You will
|
||||
need a serial connection and a network connection to a TFTP server
|
||||
containing the filesystem image it creates.
|
||||
|
||||
.. warning:: These steps were tested on a Belkin RT3200 (also known as
|
||||
Linksys E8450). Other devices may be set up differently,
|
||||
so use them as inspiration and don't just paste them
|
||||
blindly.
|
||||
.. warning:: These steps were tested on a Belkin RT3200 (also known as
|
||||
Linksys E8450). Other devices may be set up differently,
|
||||
so use them as inspiration and don't just paste them
|
||||
blindly.
|
||||
|
||||
1) determine which MTD device is being used for UBI, and the partition name:
|
||||
1) determine which MTD device is being used for UBI, and the partition name:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> ubi part
|
||||
Device 0: ubi0, MTD partition ubi
|
||||
uboot> ubi part
|
||||
Device 0: ubi0, MTD partition ubi
|
||||
|
||||
In this case the important value is ``ubi0``
|
||||
In this case the important value is ``ubi0``
|
||||
|
||||
2) list the available volumes and create a new one on which to install Liminix
|
||||
2) list the available volumes and create a new one on which to install Liminix
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> ubi info l
|
||||
[ copious output scrolls past ]
|
||||
uboot> ubi info l
|
||||
[ copious output scrolls past ]
|
||||
|
||||
Expect there to be existing volumes and for some or all of them to be
|
||||
important. Unless you know what you're doing, don't remove anything
|
||||
whose name suggests it's related to uboot, or any kind of backup or
|
||||
recovery partition. To see how much space is free:
|
||||
Expect there to be existing volumes and for some or all of them to be
|
||||
important. Unless you know what you're doing, don't remove anything
|
||||
whose name suggests it's related to uboot, or any kind of backup or
|
||||
recovery partition. To see how much space is free:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> ubi info
|
||||
[ ... ]
|
||||
UBI: available PEBs: 823
|
||||
uboot> ubi info
|
||||
[ ... ]
|
||||
UBI: available PEBs: 823
|
||||
|
||||
Now we can make our new root volume
|
||||
Now we can make our new root volume
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> ubi create liminix -
|
||||
uboot> ubi create liminix -
|
||||
|
||||
3) transfer the root filesystem from the build system and write it to
|
||||
the new volume. Paste the contents of :file:`result/flash.scr` one line at a time
|
||||
into U-Boot:
|
||||
3) transfer the root filesystem from the build system and write it to
|
||||
the new volume. Paste the contents of :file:`result/flash.scr` one line at a time
|
||||
into U-Boot:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> setenv serverip 10.0.0.1
|
||||
uboot> setenv ipaddr 10.0.0.8
|
||||
uboot> setenv loadaddr 4007FF28
|
||||
uboot> tftpboot $loadaddr result/rootfs
|
||||
uboot> ubi write $loadaddr liminix $filesize
|
||||
uboot> setenv serverip 10.0.0.1
|
||||
uboot> setenv ipaddr 10.0.0.8
|
||||
uboot> setenv loadaddr 4007FF28
|
||||
uboot> tftpboot $loadaddr result/rootfs
|
||||
uboot> ubi write $loadaddr liminix $filesize
|
||||
|
||||
Now we have the root filesystem installed on the device. You
|
||||
can even mount it and poke around using :command:`ubifsmount ubi0:liminix; ubifsls /`
|
||||
Now we have the root filesystem installed on the device. You
|
||||
can even mount it and poke around using :command:`ubifsmount ubi0:liminix; ubifsls /`
|
||||
|
||||
4) optional: before you configure the device to boot into Liminix
|
||||
automatically, you can try booting it by hand to see if it works:
|
||||
4) optional: before you configure the device to boot into Liminix
|
||||
automatically, you can try booting it by hand to see if it works:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> ubifsmount ubi0:liminix
|
||||
uboot> ubifsload ''${loadaddr} boot/fit
|
||||
uboot> bootm ''${loadaddr}
|
||||
uboot> ubifsmount ubi0:liminix
|
||||
uboot> ubifsload ''${loadaddr} boot/fit
|
||||
uboot> bootm ''${loadaddr}
|
||||
|
||||
Once you've done this and you're happy with it, reset the device to
|
||||
return to U-Boot.
|
||||
Once you've done this and you're happy with it, reset the device to
|
||||
return to U-Boot.
|
||||
|
||||
5) Instructions for configuring autoboot are likely to be very
|
||||
device-dependent and you should consult the Liminix documentation for
|
||||
your device. (If you're bringing up a new device, some detective work
|
||||
may be needed. Try running `printenv` and trace through the flow of
|
||||
execution from (probably) :command:`$bootcmd` and look for a suitable
|
||||
variable to change)
|
||||
5) Instructions for configuring autoboot are likely to be very
|
||||
device-dependent and you should consult the Liminix documentation for
|
||||
your device. (If you're bringing up a new device, some detective work
|
||||
may be needed. Try running `printenv` and trace through the flow of
|
||||
execution from (probably) :command:`$bootcmd` and look for a suitable
|
||||
variable to change)
|
||||
|
||||
6) Now you can reboot the device into Liminix
|
||||
6) Now you can reboot the device into Liminix
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
uboot> reset
|
||||
uboot> reset
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config.system.outputs.ubimage =
|
||||
assert config.rootfsType == "ubifs";
|
||||
let o = config.system.outputs; in
|
||||
pkgs.runCommand "ubimage" {} ''
|
||||
let
|
||||
o = config.system.outputs;
|
||||
in
|
||||
pkgs.runCommand "ubimage" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${o.rootfs} rootfs
|
||||
ln -s ${instructions} flash.scr
|
||||
'';
|
||||
'';
|
||||
}
|
||||
|
@@ -1,93 +1,112 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types concatStringsSep optionalString;
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkOption
|
||||
types
|
||||
concatStringsSep
|
||||
optionalString
|
||||
;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./initramfs.nix
|
||||
./ubifs.nix
|
||||
];
|
||||
{
|
||||
imports = [
|
||||
./initramfs.nix
|
||||
./ubifs.nix
|
||||
];
|
||||
|
||||
options.hardware.ubi = {
|
||||
minIOSize = mkOption { type = types.str; };
|
||||
eraseBlockSize = mkOption { type = types.str; }; # LEB
|
||||
maxLEBcount = mkOption { type = types.str; }; # LEB
|
||||
};
|
||||
options.system.outputs.ubivolume = mkOption {
|
||||
type = types.package;
|
||||
options.hardware.ubi = {
|
||||
minIOSize = mkOption { type = types.str; };
|
||||
eraseBlockSize = mkOption { type = types.str; }; # LEB
|
||||
maxLEBcount = mkOption { type = types.str; }; # LEB
|
||||
};
|
||||
options.system.outputs.ubivolume = mkOption {
|
||||
type = types.package;
|
||||
};
|
||||
|
||||
config = mkIf (config.rootfsType == "ubifs") {
|
||||
kernel.config = {
|
||||
MTD_UBI = "y";
|
||||
|
||||
UBIFS_FS = "y";
|
||||
UBIFS_FS_SECURITY = "n";
|
||||
};
|
||||
boot.initramfs.enable = true;
|
||||
|
||||
config = mkIf (config.rootfsType == "ubifs") {
|
||||
kernel.config = {
|
||||
MTD_UBI="y";
|
||||
|
||||
UBIFS_FS = "y";
|
||||
UBIFS_FS_SECURITY = "n";
|
||||
};
|
||||
boot.initramfs.enable = true;
|
||||
|
||||
system.outputs.ubivolume =
|
||||
system.outputs.ubivolume =
|
||||
let
|
||||
inherit (pkgs.pkgsBuildBuild) runCommand;
|
||||
ubiVolume = ({ name, volumeId, image, flags ? [] }:
|
||||
''
|
||||
[${name}]
|
||||
mode=ubi
|
||||
vol_id=${toString volumeId}
|
||||
vol_type=dynamic
|
||||
vol_name=${name}
|
||||
vol_alignment=1
|
||||
${optionalString (image != null) ''
|
||||
image=${image}
|
||||
''}
|
||||
${optionalString (image == null) ''
|
||||
vol_size=1MiB
|
||||
''}
|
||||
${optionalString (flags != []) ''
|
||||
vol_flags=${concatStringsSep "," flags}
|
||||
''}
|
||||
'');
|
||||
ubiVolume = (
|
||||
{
|
||||
name,
|
||||
volumeId,
|
||||
image,
|
||||
flags ? [ ],
|
||||
}:
|
||||
''
|
||||
[${name}]
|
||||
mode=ubi
|
||||
vol_id=${toString volumeId}
|
||||
vol_type=dynamic
|
||||
vol_name=${name}
|
||||
vol_alignment=1
|
||||
${optionalString (image != null) ''
|
||||
image=${image}
|
||||
''}
|
||||
${optionalString (image == null) ''
|
||||
vol_size=1MiB
|
||||
''}
|
||||
${optionalString (flags != [ ]) ''
|
||||
vol_flags=${concatStringsSep "," flags}
|
||||
''}
|
||||
''
|
||||
);
|
||||
|
||||
ubiImage = (volumes:
|
||||
let
|
||||
ubinizeConfig = pkgs.writeText "ubinize.conf" (concatStringsSep "\n" volumes);
|
||||
inherit (pkgs.pkgsBuildBuild) mtdutils;
|
||||
in
|
||||
runCommand "ubinize" {
|
||||
depsBuildBuild = [ mtdutils ];
|
||||
# block size := 128kb
|
||||
# page size := 2048
|
||||
# ubninize opts := -E 5
|
||||
} ''
|
||||
ubinize -Q "$SOURCE_DATE_EPOCH" -o $out \
|
||||
-p ${config.hardware.ubi.physicalEraseBlockSize} -m ${config.hardware.ubi.minIOSize} \
|
||||
-e ${config.hardware.ubi.logicalEraseBlockSize} \
|
||||
${ubinizeConfig}
|
||||
'');
|
||||
ubiImage = (
|
||||
volumes:
|
||||
let
|
||||
ubinizeConfig = pkgs.writeText "ubinize.conf" (concatStringsSep "\n" volumes);
|
||||
inherit (pkgs.pkgsBuildBuild) mtdutils;
|
||||
in
|
||||
runCommand "ubinize"
|
||||
{
|
||||
depsBuildBuild = [ mtdutils ];
|
||||
# block size := 128kb
|
||||
# page size := 2048
|
||||
# ubninize opts := -E 5
|
||||
}
|
||||
''
|
||||
ubinize -Q "$SOURCE_DATE_EPOCH" -o $out \
|
||||
-p ${config.hardware.ubi.physicalEraseBlockSize} -m ${config.hardware.ubi.minIOSize} \
|
||||
-e ${config.hardware.ubi.logicalEraseBlockSize} \
|
||||
${ubinizeConfig}
|
||||
''
|
||||
);
|
||||
|
||||
ubiDisk = ({ initramfs }:
|
||||
let
|
||||
initramfsUbi = ubiVolume {
|
||||
name = "rootfs";
|
||||
volumeId = 0;
|
||||
image = initramfs;
|
||||
flags = [ "autoresize" ];
|
||||
};
|
||||
in
|
||||
ubiDisk = (
|
||||
{ initramfs }:
|
||||
let
|
||||
initramfsUbi = ubiVolume {
|
||||
name = "rootfs";
|
||||
volumeId = 0;
|
||||
image = initramfs;
|
||||
flags = [ "autoresize" ];
|
||||
};
|
||||
in
|
||||
ubiImage [
|
||||
initramfsUbi
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
disk = ubiDisk {
|
||||
initramfs = config.system.outputs.rootfs; # ???
|
||||
};
|
||||
|
||||
in
|
||||
disk;
|
||||
disk;
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
@@ -25,13 +25,12 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
config.system.outputs.updater =
|
||||
runCommand "buildUpdater" { } ''
|
||||
mkdir -p $out/bin $out/etc
|
||||
cp ${o.kernel.config} $out/etc/kconfig
|
||||
substitute ${./update.sh} $out/bin/update.sh \
|
||||
--subst-var-by toplevel ${o.systemConfiguration} \
|
||||
--subst-var-by min_copy_closure ${min-copy-closure}
|
||||
chmod +x $out/bin/update.sh
|
||||
'';
|
||||
config.system.outputs.updater = runCommand "buildUpdater" { } ''
|
||||
mkdir -p $out/bin $out/etc
|
||||
cp ${o.kernel.config} $out/etc/kconfig
|
||||
substitute ${./update.sh} $out/bin/update.sh \
|
||||
--subst-var-by toplevel ${o.systemConfiguration} \
|
||||
--subst-var-by min_copy_closure ${min-copy-closure}
|
||||
chmod +x $out/bin/update.sh
|
||||
'';
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types concatStringsSep;
|
||||
@@ -49,12 +49,15 @@ in
|
||||
let
|
||||
inherit (config.system.outputs) rootfs kernel manifest;
|
||||
cmdline = builtins.toJSON (concatStringsSep " " config.boot.commandLine);
|
||||
makeBootableImage = pkgs.runCommandCC "objcopy" {}
|
||||
(if pkgs.stdenv.hostPlatform.isAarch
|
||||
then "${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -R .comment -S ${kernel} $out"
|
||||
else "cp ${kernel} $out");
|
||||
makeBootableImage = pkgs.runCommandCC "objcopy" { } (
|
||||
if pkgs.stdenv.hostPlatform.isAarch then
|
||||
"${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -R .comment -S ${kernel} $out"
|
||||
else
|
||||
"cp ${kernel} $out"
|
||||
);
|
||||
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
||||
in pkgs.runCommand "vmroot" {} ''
|
||||
in
|
||||
pkgs.runCommand "vmroot" { } ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${rootfs} rootfs
|
||||
@@ -67,7 +70,7 @@ in
|
||||
${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --command-line ${cmdline} --arch ${pkgs.stdenv.hostPlatform.qemuArch} --phram-address 0x${phram_address} \$* ${makeBootableImage} ${config.system.outputs.rootfs}
|
||||
EOF
|
||||
chmod +x run.sh
|
||||
'';
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,25 +1,26 @@
|
||||
{
|
||||
config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
models = "6b e1 6f e1 ff ff ff ff ff ff";
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.system.outputs = {
|
||||
zyxel-nwa-fit = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
zyxel-nwa-fit
|
||||
*************
|
||||
zyxel-nwa-fit
|
||||
*************
|
||||
|
||||
This output provides a FIT image for Zyxel NWA series
|
||||
containing a kernel image and an UBIFS rootfs.
|
||||
This output provides a FIT image for Zyxel NWA series
|
||||
containing a kernel image and an UBIFS rootfs.
|
||||
|
||||
It can usually be used as a factory image to install Liminix
|
||||
on a system with pre-existing firmware and OS.
|
||||
It can usually be used as a factory image to install Liminix
|
||||
on a system with pre-existing firmware and OS.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@@ -34,38 +35,43 @@ on a system with pre-existing firmware and OS.
|
||||
let
|
||||
o = config.system.outputs;
|
||||
# 8129kb padding.
|
||||
paddedKernel = pkgs.runCommand "padded-kernel" {} ''
|
||||
paddedKernel = pkgs.runCommand "padded-kernel" { } ''
|
||||
cp --no-preserve=mode ${o.uimage} $out
|
||||
dd if=/dev/zero of=$out bs=1 count=1 seek=8388607
|
||||
'';
|
||||
firmwareImage = pkgs.runCommand "firmware-image" {} ''
|
||||
firmwareImage = pkgs.runCommand "firmware-image" { } ''
|
||||
cat ${paddedKernel} ${o.ubivolume} > $out
|
||||
'';
|
||||
dts = pkgs.writeText "image.its" ''
|
||||
/dts-v1/;
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "Zyxel FIT (Flattened Image Tree)";
|
||||
compat-models = [${models}];
|
||||
#address-cells = <1>;
|
||||
/ {
|
||||
description = "Zyxel FIT (Flattened Image Tree)";
|
||||
compat-models = [${models}];
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
firmware {
|
||||
data = /incbin/("${firmwareImage}");
|
||||
type = "firmware";
|
||||
compression = "none";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
images {
|
||||
firmware {
|
||||
data = /incbin/("${firmwareImage}");
|
||||
type = "firmware";
|
||||
compression = "none";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
'';
|
||||
'';
|
||||
in
|
||||
pkgs.runCommand "zyxel-nwa-fit-${config.boot.imageType}" {
|
||||
nativeBuildInputs = [ pkgs.pkgsBuildBuild.ubootTools pkgs.pkgsBuildBuild.dtc ];
|
||||
} ''
|
||||
mkimage -f ${dts} $out
|
||||
'';
|
||||
pkgs.runCommand "zyxel-nwa-fit-${config.boot.imageType}"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.pkgsBuildBuild.ubootTools
|
||||
pkgs.pkgsBuildBuild.dtc
|
||||
];
|
||||
}
|
||||
''
|
||||
mkimage -f ${dts} $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user