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").
|
||||
|
||||
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 {});
|
||||
borderVmConf = ./bordervm.conf-example.nix;
|
||||
inherit (pkgs.lib.attrsets) genAttrs;
|
||||
devices = {
|
||||
virt = [ "qemu" "qemu-aarch64" "qemu-armv7l" ];
|
||||
hw = [ "gl-ar750" "gl-mt300n-v2" "gl-mt300a" ];
|
||||
};
|
||||
devices = [
|
||||
"gl-ar750" "gl-mt300n-v2" "gl-mt300a"
|
||||
"qemu" "qemu-aarch64" "qemu-armv7l"
|
||||
];
|
||||
vanilla = ./vanilla-configuration.nix;
|
||||
for-device = cfg: name:
|
||||
for-device = name:
|
||||
(import liminix {
|
||||
inherit nixpkgs borderVmConf;
|
||||
device = import (liminix + "/devices/${name}");
|
||||
liminix-config = cfg;
|
||||
liminix-config = vanilla;
|
||||
}).outputs.default;
|
||||
tests = import ./tests/ci.nix;
|
||||
jobs =
|
||||
(genAttrs devices.hw (name: for-device ./vanilla-configuration-hw.nix name)) //
|
||||
(genAttrs devices.virt (name: for-device vanilla name)) //
|
||||
(genAttrs devices for-device) //
|
||||
tests //
|
||||
{
|
||||
buildEnv = (import liminix {
|
||||
|
@ -41,7 +40,7 @@ let
|
|||
}).outputs.optionsJson;
|
||||
installers = map (f: "system.outputs.${f}") [
|
||||
"vmroot"
|
||||
"flashimage"
|
||||
"mtdimage"
|
||||
"ubimage"
|
||||
];
|
||||
inherit (pkgs.lib) concatStringsSep;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
As with many GL.iNet devices, the stock vendor firmware
|
||||
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.
|
||||
|
||||
For flashing from an existing Liminix system (we believe that) it
|
||||
|
@ -97,7 +97,7 @@
|
|||
../../modules/network
|
||||
../../modules/arch/mipseb.nix
|
||||
../../modules/outputs/tftpboot.nix
|
||||
../../modules/outputs/flashimage.nix
|
||||
../../modules/outputs/mtdimage.nix
|
||||
../../modules/outputs/jffs2.nix
|
||||
];
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
|||
FEATURE_DD_IBS_OBS = "y"; # ath10k_cal_data needs skip_bytes,fullblock
|
||||
};
|
||||
hardware = {
|
||||
defaultOutput = "flashimage";
|
||||
defaultOutput = "mtdimage";
|
||||
loadAddress = lim.parseInt "0x80060000";
|
||||
entryPoint = lim.parseInt "0x80060000";
|
||||
flash = {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
============
|
||||
|
||||
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.
|
||||
|
||||
For flashing from an existing Liminix system (we think) it
|
||||
|
@ -55,11 +55,11 @@
|
|||
imports = [
|
||||
../../modules/arch/mipsel.nix
|
||||
../../modules/outputs/tftpboot.nix
|
||||
../../modules/outputs/flashimage.nix
|
||||
../../modules/outputs/mtdimage.nix
|
||||
../../modules/outputs/jffs2.nix
|
||||
];
|
||||
hardware = {
|
||||
defaultOutput = "flashimage";
|
||||
defaultOutput = "mtdimage";
|
||||
loadAddress = lim.parseInt "0x80000000";
|
||||
entryPoint = lim.parseInt "0x80000000";
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
============
|
||||
|
||||
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.
|
||||
|
||||
For flashing from an existing Liminix system (we think) it
|
||||
|
@ -55,7 +55,7 @@
|
|||
imports = [
|
||||
../../modules/arch/mipsel.nix
|
||||
../../modules/outputs/tftpboot.nix
|
||||
../../modules/outputs/flashimage.nix
|
||||
../../modules/outputs/mtdimage.nix
|
||||
../../modules/outputs/jffs2.nix
|
||||
];
|
||||
filesystem = dir {
|
||||
|
@ -66,7 +66,7 @@
|
|||
};
|
||||
};
|
||||
hardware = {
|
||||
defaultOutput = "flashimage";
|
||||
defaultOutput = "mtdimage";
|
||||
loadAddress = lim.parseInt "0x80000000";
|
||||
entryPoint = lim.parseInt "0x80000000";
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
imports = [
|
||||
../../modules/arch/arm.nix
|
||||
../modules/outputs/tftpboot.nix
|
||||
../modules/outputs/diskimage.nix
|
||||
../modules/outputs/mbrimage.nix
|
||||
../modules/outputs/extlinux.nix
|
||||
../modules/outputs/ext4fs.nix
|
||||
];
|
||||
|
@ -128,7 +128,7 @@
|
|||
klibBuild = config.system.outputs.kernel.modulesupport;
|
||||
};
|
||||
in {
|
||||
defaultOutput = "flashimage";
|
||||
defaultOutput = "mtdimage";
|
||||
loadAddress = lim.parseInt "0x00008000";
|
||||
entryPoint = lim.parseInt "0x00008000";
|
||||
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
|
||||
``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
|
||||
|
||||
* :file:`result/firmware.bin` which is the file you are going to flash
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
./outputs.nix
|
||||
./outputs/vmroot.nix
|
||||
./outputs/ubimage.nix
|
||||
./outputs/flashimage.nix
|
||||
./outputs/mtdimage.nix
|
||||
./ppp
|
||||
./ramdisk.nix
|
||||
./squashfs.nix
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
};
|
||||
};
|
||||
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;
|
||||
};
|
||||
ram = {
|
||||
|
|
|
@ -9,12 +9,11 @@ let
|
|||
o = config.system.outputs;
|
||||
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
||||
in {
|
||||
# imports = [ ./flashimage.nix ];
|
||||
options.system.outputs = {
|
||||
diskimage = mkOption {
|
||||
mbrimage = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
diskimage
|
||||
mbrimage
|
||||
*********
|
||||
|
||||
This creates a disk image file with a partition table containing
|
||||
|
@ -26,10 +25,10 @@ in {
|
|||
|
||||
config = {
|
||||
system.outputs = {
|
||||
diskimage =
|
||||
mbrimage =
|
||||
let
|
||||
o = config.system.outputs;
|
||||
in pkgs.runCommand "diskimage" {
|
||||
in pkgs.runCommand "mbrimage" {
|
||||
depsBuildBuild = [ pkgs.pkgsBuildBuild.util-linux ];
|
||||
} ''
|
||||
# leave 4 sectors at start for partition table
|
||||
|
@ -40,10 +39,10 @@ in {
|
|||
vmdisk = pkgs.runCommand "vmdisk" {} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${o.diskimage} ./diskimage
|
||||
ln -s ${o.mbrimage} ./mbrimage
|
||||
cat > run.sh <<EOF
|
||||
#!${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
|
||||
chmod +x run.sh
|
||||
'';
|
|
@ -11,7 +11,7 @@ in {
|
|||
options.system.outputs = {
|
||||
firmware = mkOption {
|
||||
type = types.package;
|
||||
internal = true; # component of flashimage
|
||||
internal = true; # component of mtdimage
|
||||
description = ''
|
||||
Binary image (combining kernel, FDT, rootfs, initramfs
|
||||
if needed, etc) for the target device.
|
||||
|
@ -19,16 +19,16 @@ in {
|
|||
};
|
||||
flash-scr = mkOption {
|
||||
type = types.package;
|
||||
internal = true; # component of flashimage
|
||||
internal = true; # component of mtdimage
|
||||
description = ''
|
||||
Copy-pastable U-Boot commands to TFTP download the
|
||||
image and write it to flash
|
||||
'';
|
||||
};
|
||||
flashimage = mkOption {
|
||||
mtdimage = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
flashimage
|
||||
mtdimage
|
||||
**********
|
||||
|
||||
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.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
||||
'';
|
||||
flashimage =
|
||||
mtdimage =
|
||||
let o = config.system.outputs; in
|
||||
# could use trivial-builders.linkFarmFromDrvs here?
|
||||
pkgs.runCommand "flashimage" {} ''
|
||||
pkgs.runCommand "mtdimage" {} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${o.firmware} firmware.bin
|
|
@ -1,6 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./vanilla-configuration.nix
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue