Compare commits
5 Commits
6c8b2bbb83
...
c6c41e331e
Author | SHA1 | Date |
---|---|---|
Daniel Barlow | c6c41e331e | |
Daniel Barlow | b878d6481a | |
Daniel Barlow | 601bb289ee | |
Daniel Barlow | 876bd7d8ce | |
Daniel Barlow | 39c338d710 |
|
@ -0,0 +1,20 @@
|
||||||
|
A brief guide to backward-incompatible changes
|
||||||
|
that are likely to break configurations or workflows
|
||||||
|
|
||||||
|
2023-12-10
|
||||||
|
|
||||||
|
* configurations (usually) need no longer import modules from
|
||||||
|
modules/outputs because devices are expected to do this instead. This
|
||||||
|
change is because the outputs that make sense in any given context are
|
||||||
|
usually a property of the device being installed onto.
|
||||||
|
|
||||||
|
2023-12-11
|
||||||
|
|
||||||
|
* rename outputs.flashimage to outputs.mtdimage (and also diskimage to
|
||||||
|
mbrimage). This change is made in the expectation that "fooimage" is
|
||||||
|
the name of an outputs that gloms together other filesystem-like
|
||||||
|
outputs with some kind of partition table - so we might in future have
|
||||||
|
gptimage or lvmimage or ubimage.
|
||||||
|
|
||||||
|
|
||||||
|
|
37
THOUGHTS.txt
37
THOUGHTS.txt
|
@ -3418,3 +3418,40 @@ device tree" (or alternatively, "we need a static dtb, platform doesn't
|
||||||
provide it").
|
provide it").
|
||||||
|
|
||||||
config.boot.platformProvidesDeviceTree
|
config.boot.platformProvidesDeviceTree
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Monday
|
||||||
|
|
||||||
|
so where are we? we've removed the need for every hardware device to
|
||||||
|
be able to build flashimage, because not every hw device (looking at you,
|
||||||
|
bellkin/turris) works like that.
|
||||||
|
|
||||||
|
for the belkin we can have imports = [ modules/outputs/ubimage ]
|
||||||
|
and extlinux enabled
|
||||||
|
|
||||||
|
for the nwa from Raito we'd like to have imports = [ modules/outputs/ubimage ]
|
||||||
|
but the bootloader is mtd partition-based (or ubi volume? check?) -
|
||||||
|
so ubimage needs to know how to do that
|
||||||
|
|
||||||
|
perhaps we need an output for "smash together a kernel and a
|
||||||
|
filesystem image that does not also contain a kernel, and don't
|
||||||
|
put a partition table on the front"
|
||||||
|
|
||||||
|
diskimage {
|
||||||
|
partitionType = "mtd" ; # or "mbr" or maybe "gpt"
|
||||||
|
partitions = [ o.uimage o.rootfs ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for the turris we need to check but proceeding on the assumption
|
||||||
|
it wants a tarball with extlinux enabled
|
||||||
|
|
||||||
|
https://docs.turris.cz/geek/schnapps/schnapps/#export-and-import
|
||||||
|
https://wiki.turris.cz/en/howto/omnia_booting_from_external_storage
|
||||||
|
|
||||||
|
if we adopt this as our installation format then we are not
|
||||||
|
reformatting the flash and will keep the btrfs that the device
|
||||||
|
was shipped with.
|
||||||
|
|
17
ci.nix
17
ci.nix
|
@ -8,21 +8,20 @@ let
|
||||||
pkgs = (import nixpkgs {});
|
pkgs = (import nixpkgs {});
|
||||||
borderVmConf = ./bordervm.conf-example.nix;
|
borderVmConf = ./bordervm.conf-example.nix;
|
||||||
inherit (pkgs.lib.attrsets) genAttrs;
|
inherit (pkgs.lib.attrsets) genAttrs;
|
||||||
devices = {
|
devices = [
|
||||||
virt = [ "qemu" "qemu-aarch64" "qemu-armv7l" ];
|
"gl-ar750" "gl-mt300n-v2" "gl-mt300a"
|
||||||
hw = [ "gl-ar750" "gl-mt300n-v2" "gl-mt300a" ];
|
"qemu" "qemu-aarch64" "qemu-armv7l"
|
||||||
};
|
];
|
||||||
vanilla = ./vanilla-configuration.nix;
|
vanilla = ./vanilla-configuration.nix;
|
||||||
for-device = cfg: name:
|
for-device = name:
|
||||||
(import liminix {
|
(import liminix {
|
||||||
inherit nixpkgs borderVmConf;
|
inherit nixpkgs borderVmConf;
|
||||||
device = import (liminix + "/devices/${name}");
|
device = import (liminix + "/devices/${name}");
|
||||||
liminix-config = cfg;
|
liminix-config = vanilla;
|
||||||
}).outputs.default;
|
}).outputs.default;
|
||||||
tests = import ./tests/ci.nix;
|
tests = import ./tests/ci.nix;
|
||||||
jobs =
|
jobs =
|
||||||
(genAttrs devices.hw (name: for-device ./vanilla-configuration-hw.nix name)) //
|
(genAttrs devices for-device) //
|
||||||
(genAttrs devices.virt (name: for-device vanilla name)) //
|
|
||||||
tests //
|
tests //
|
||||||
{
|
{
|
||||||
buildEnv = (import liminix {
|
buildEnv = (import liminix {
|
||||||
|
@ -41,7 +40,7 @@ let
|
||||||
}).outputs.optionsJson;
|
}).outputs.optionsJson;
|
||||||
installers = map (f: "system.outputs.${f}") [
|
installers = map (f: "system.outputs.${f}") [
|
||||||
"vmroot"
|
"vmroot"
|
||||||
"flashimage"
|
"mtdimage"
|
||||||
"ubimage"
|
"ubimage"
|
||||||
];
|
];
|
||||||
inherit (pkgs.lib) concatStringsSep;
|
inherit (pkgs.lib) concatStringsSep;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
As with many GL.iNet devices, the stock vendor firmware
|
As with many GL.iNet devices, the stock vendor firmware
|
||||||
is a fork of OpenWrt, meaning that the binary created by
|
is a fork of OpenWrt, meaning that the binary created by
|
||||||
:ref:`system-outputs-flashimage` can be flashed using the
|
:ref:`system-outputs-mtdimage` can be flashed using the
|
||||||
vendor web UI or the U-Boot emergency "unbrick" routine.
|
vendor web UI or the U-Boot emergency "unbrick" routine.
|
||||||
|
|
||||||
For flashing from an existing Liminix system (we believe that) it
|
For flashing from an existing Liminix system (we believe that) it
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
../../modules/network
|
../../modules/network
|
||||||
../../modules/arch/mipseb.nix
|
../../modules/arch/mipseb.nix
|
||||||
../../modules/outputs/tftpboot.nix
|
../../modules/outputs/tftpboot.nix
|
||||||
../../modules/outputs/flashimage.nix
|
../../modules/outputs/mtdimage.nix
|
||||||
../../modules/outputs/jffs2.nix
|
../../modules/outputs/jffs2.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
FEATURE_DD_IBS_OBS = "y"; # ath10k_cal_data needs skip_bytes,fullblock
|
FEATURE_DD_IBS_OBS = "y"; # ath10k_cal_data needs skip_bytes,fullblock
|
||||||
};
|
};
|
||||||
hardware = {
|
hardware = {
|
||||||
defaultOutput = "flashimage";
|
defaultOutput = "mtdimage";
|
||||||
loadAddress = lim.parseInt "0x80060000";
|
loadAddress = lim.parseInt "0x80060000";
|
||||||
entryPoint = lim.parseInt "0x80060000";
|
entryPoint = lim.parseInt "0x80060000";
|
||||||
flash = {
|
flash = {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
============
|
============
|
||||||
|
|
||||||
The stock vendor firmware is a fork of OpenWrt, meaning that the
|
The stock vendor firmware is a fork of OpenWrt, meaning that the
|
||||||
binary created by :ref:`system-outputs-flashimage` can be flashed
|
binary created by :ref:`system-outputs-mtdimage` can be flashed
|
||||||
using the vendor web UI or the U-Boot emergency "unbrick" routine.
|
using the vendor web UI or the U-Boot emergency "unbrick" routine.
|
||||||
|
|
||||||
For flashing from an existing Liminix system (we think) it
|
For flashing from an existing Liminix system (we think) it
|
||||||
|
@ -55,11 +55,11 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../modules/arch/mipsel.nix
|
../../modules/arch/mipsel.nix
|
||||||
../../modules/outputs/tftpboot.nix
|
../../modules/outputs/tftpboot.nix
|
||||||
../../modules/outputs/flashimage.nix
|
../../modules/outputs/mtdimage.nix
|
||||||
../../modules/outputs/jffs2.nix
|
../../modules/outputs/jffs2.nix
|
||||||
];
|
];
|
||||||
hardware = {
|
hardware = {
|
||||||
defaultOutput = "flashimage";
|
defaultOutput = "mtdimage";
|
||||||
loadAddress = lim.parseInt "0x80000000";
|
loadAddress = lim.parseInt "0x80000000";
|
||||||
entryPoint = lim.parseInt "0x80000000";
|
entryPoint = lim.parseInt "0x80000000";
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
============
|
============
|
||||||
|
|
||||||
The stock vendor firmware is a fork of OpenWrt, meaning that the
|
The stock vendor firmware is a fork of OpenWrt, meaning that the
|
||||||
binary created by :ref:`system-outputs-flashimage` can be flashed
|
binary created by :ref:`system-outputs-mtdimage` can be flashed
|
||||||
using the vendor web UI or the U-Boot emergency "unbrick" routine.
|
using the vendor web UI or the U-Boot emergency "unbrick" routine.
|
||||||
|
|
||||||
For flashing from an existing Liminix system (we think) it
|
For flashing from an existing Liminix system (we think) it
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../modules/arch/mipsel.nix
|
../../modules/arch/mipsel.nix
|
||||||
../../modules/outputs/tftpboot.nix
|
../../modules/outputs/tftpboot.nix
|
||||||
../../modules/outputs/flashimage.nix
|
../../modules/outputs/mtdimage.nix
|
||||||
../../modules/outputs/jffs2.nix
|
../../modules/outputs/jffs2.nix
|
||||||
];
|
];
|
||||||
filesystem = dir {
|
filesystem = dir {
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
hardware = {
|
hardware = {
|
||||||
defaultOutput = "flashimage";
|
defaultOutput = "mtdimage";
|
||||||
loadAddress = lim.parseInt "0x80000000";
|
loadAddress = lim.parseInt "0x80000000";
|
||||||
entryPoint = lim.parseInt "0x80000000";
|
entryPoint = lim.parseInt "0x80000000";
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../modules/arch/arm.nix
|
../../modules/arch/arm.nix
|
||||||
../modules/outputs/tftpboot.nix
|
../modules/outputs/tftpboot.nix
|
||||||
../modules/outputs/diskimage.nix
|
../modules/outputs/mbrimage.nix
|
||||||
../modules/outputs/extlinux.nix
|
../modules/outputs/extlinux.nix
|
||||||
../modules/outputs/ext4fs.nix
|
../modules/outputs/ext4fs.nix
|
||||||
];
|
];
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
klibBuild = config.system.outputs.kernel.modulesupport;
|
klibBuild = config.system.outputs.kernel.modulesupport;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
defaultOutput = "flashimage";
|
defaultOutput = "mtdimage";
|
||||||
loadAddress = lim.parseInt "0x00008000";
|
loadAddress = lim.parseInt "0x00008000";
|
||||||
entryPoint = lim.parseInt "0x00008000";
|
entryPoint = lim.parseInt "0x00008000";
|
||||||
rootDevice = "/dev/mtdblock0";
|
rootDevice = "/dev/mtdblock0";
|
||||||
|
|
|
@ -180,7 +180,7 @@ Now add the device and server IP addresses to your configuration:
|
||||||
};
|
};
|
||||||
|
|
||||||
and then build the derivation for ``outputs.default`` or
|
and then build the derivation for ``outputs.default`` or
|
||||||
``outputs.flashimage`` (for which it will be an alias on any device
|
``outputs.mtdimage`` (for which it will be an alias on any device
|
||||||
where this is applicable). You should find it has created
|
where this is applicable). You should find it has created
|
||||||
|
|
||||||
* :file:`result/firmware.bin` which is the file you are going to flash
|
* :file:`result/firmware.bin` which is the file you are going to flash
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
./outputs.nix
|
./outputs.nix
|
||||||
./outputs/vmroot.nix
|
./outputs/vmroot.nix
|
||||||
./outputs/ubimage.nix
|
./outputs/ubimage.nix
|
||||||
./outputs/flashimage.nix
|
./outputs/mtdimage.nix
|
||||||
./ppp
|
./ppp
|
||||||
./ramdisk.nix
|
./ramdisk.nix
|
||||||
./squashfs.nix
|
./squashfs.nix
|
||||||
|
|
|
@ -32,7 +32,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
defaultOutput = mkOption {
|
defaultOutput = mkOption {
|
||||||
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"flashimage\" or \"vmroot\"";
|
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
|
||||||
type = types.nonEmptyStr;
|
type = types.nonEmptyStr;
|
||||||
};
|
};
|
||||||
ram = {
|
ram = {
|
||||||
|
|
|
@ -9,12 +9,11 @@ let
|
||||||
o = config.system.outputs;
|
o = config.system.outputs;
|
||||||
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
||||||
in {
|
in {
|
||||||
# imports = [ ./flashimage.nix ];
|
|
||||||
options.system.outputs = {
|
options.system.outputs = {
|
||||||
diskimage = mkOption {
|
mbrimage = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
description = ''
|
description = ''
|
||||||
diskimage
|
mbrimage
|
||||||
*********
|
*********
|
||||||
|
|
||||||
This creates a disk image file with a partition table containing
|
This creates a disk image file with a partition table containing
|
||||||
|
@ -26,10 +25,10 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
system.outputs = {
|
system.outputs = {
|
||||||
diskimage =
|
mbrimage =
|
||||||
let
|
let
|
||||||
o = config.system.outputs;
|
o = config.system.outputs;
|
||||||
in pkgs.runCommand "diskimage" {
|
in pkgs.runCommand "mbrimage" {
|
||||||
depsBuildBuild = [ pkgs.pkgsBuildBuild.util-linux ];
|
depsBuildBuild = [ pkgs.pkgsBuildBuild.util-linux ];
|
||||||
} ''
|
} ''
|
||||||
# leave 4 sectors at start for partition table
|
# leave 4 sectors at start for partition table
|
||||||
|
@ -40,10 +39,10 @@ in {
|
||||||
vmdisk = pkgs.runCommand "vmdisk" {} ''
|
vmdisk = pkgs.runCommand "vmdisk" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
ln -s ${o.diskimage} ./diskimage
|
ln -s ${o.mbrimage} ./mbrimage
|
||||||
cat > run.sh <<EOF
|
cat > run.sh <<EOF
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${pkgs.stdenv.hostPlatform.qemuArch} --u-boot ${pkgs.ubootQemuArm}/u-boot.bin --phram-address 0x${phram_address} --disk-image ${o.diskimage} /dev/null /dev/null
|
${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${pkgs.stdenv.hostPlatform.qemuArch} --u-boot ${pkgs.ubootQemuArm}/u-boot.bin --phram-address 0x${phram_address} --disk-image ${o.mbrimage} /dev/null /dev/null
|
||||||
EOF
|
EOF
|
||||||
chmod +x run.sh
|
chmod +x run.sh
|
||||||
'';
|
'';
|
|
@ -11,7 +11,7 @@ in {
|
||||||
options.system.outputs = {
|
options.system.outputs = {
|
||||||
firmware = mkOption {
|
firmware = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
internal = true; # component of flashimage
|
internal = true; # component of mtdimage
|
||||||
description = ''
|
description = ''
|
||||||
Binary image (combining kernel, FDT, rootfs, initramfs
|
Binary image (combining kernel, FDT, rootfs, initramfs
|
||||||
if needed, etc) for the target device.
|
if needed, etc) for the target device.
|
||||||
|
@ -19,16 +19,16 @@ in {
|
||||||
};
|
};
|
||||||
flash-scr = mkOption {
|
flash-scr = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
internal = true; # component of flashimage
|
internal = true; # component of mtdimage
|
||||||
description = ''
|
description = ''
|
||||||
Copy-pastable U-Boot commands to TFTP download the
|
Copy-pastable U-Boot commands to TFTP download the
|
||||||
image and write it to flash
|
image and write it to flash
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
flashimage = mkOption {
|
mtdimage = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
description = ''
|
description = ''
|
||||||
flashimage
|
mtdimage
|
||||||
**********
|
**********
|
||||||
|
|
||||||
This creates an image called :file:`firmware.bin` suitable for
|
This creates an image called :file:`firmware.bin` suitable for
|
||||||
|
@ -80,10 +80,10 @@ in {
|
||||||
dd if=${o.uimage} of=$out bs=${bs} conv=sync
|
dd if=${o.uimage} of=$out bs=${bs} conv=sync
|
||||||
dd if=${o.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
dd if=${o.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
||||||
'';
|
'';
|
||||||
flashimage =
|
mtdimage =
|
||||||
let o = config.system.outputs; in
|
let o = config.system.outputs; in
|
||||||
# could use trivial-builders.linkFarmFromDrvs here?
|
# could use trivial-builders.linkFarmFromDrvs here?
|
||||||
pkgs.runCommand "flashimage" {} ''
|
pkgs.runCommand "mtdimage" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
ln -s ${o.firmware} firmware.bin
|
ln -s ${o.firmware} firmware.bin
|
|
@ -1,6 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./vanilla-configuration.nix
|
|
||||||
];
|
|
||||||
}
|
|
Loading…
Reference in New Issue