Compare commits
5 Commits
37caac1d56
...
817c3793d4
Author | SHA1 | Date | |
---|---|---|---|
817c3793d4 | |||
17ce917af8 | |||
bf68127dc4 | |||
db70623bff | |||
0777bb47c0 |
@ -674,7 +674,7 @@ are annoying enough that I might poke at them anyway:
|
|||||||
15a) is bordervm derivation tested?
|
15a) is bordervm derivation tested?
|
||||||
18) gl-mt300a
|
18) gl-mt300a
|
||||||
19) gl-mt300n-v2
|
19) gl-mt300n-v2
|
||||||
|
20) publish the manual using CI
|
||||||
|
|
||||||
12) write secrets holder as a service with outputs
|
12) write secrets holder as a service with outputs
|
||||||
16) writable filesystem (ubifs?)
|
16) writable filesystem (ubifs?)
|
||||||
|
@ -42,6 +42,12 @@
|
|||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
loadAddress = "0x00A00000";
|
loadAddress = "0x00A00000";
|
||||||
};
|
};
|
||||||
|
boot.dts = {
|
||||||
|
src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
||||||
|
includes = [
|
||||||
|
"${openwrt}/target/linux/ath79/dts"
|
||||||
|
];
|
||||||
|
};
|
||||||
kernel = {
|
kernel = {
|
||||||
src = pkgs.pkgsBuildBuild.fetchurl {
|
src = pkgs.pkgsBuildBuild.fetchurl {
|
||||||
name = "linux.tar.gz";
|
name = "linux.tar.gz";
|
||||||
@ -61,12 +67,6 @@
|
|||||||
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
||||||
patches ${openwrt}/target/linux/ath79/patches-5.15/*.patch
|
patches ${openwrt}/target/linux/ath79/patches-5.15/*.patch
|
||||||
'';
|
'';
|
||||||
dts = {
|
|
||||||
src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
|
||||||
includes = [
|
|
||||||
"${openwrt}/target/linux/ath79/dts"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
config = {
|
config = {
|
||||||
MIPS_ELF_APPENDED_DTB = "y";
|
MIPS_ELF_APPENDED_DTB = "y";
|
||||||
OF = "y";
|
OF = "y";
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
loadAddress = "0x00A00000";
|
loadAddress = "0x00A00000";
|
||||||
};
|
};
|
||||||
|
boot.dts = {
|
||||||
|
src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
||||||
|
includes = [
|
||||||
|
"${openwrt}/target/linux/ramips/dts"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
kernel = {
|
kernel = {
|
||||||
src = pkgs.fetchurl {
|
src = pkgs.fetchurl {
|
||||||
@ -49,12 +55,6 @@
|
|||||||
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
||||||
patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch
|
patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch
|
||||||
'';
|
'';
|
||||||
dts = {
|
|
||||||
src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
|
||||||
includes = [
|
|
||||||
"${openwrt}/target/linux/ramips/dts"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
config = {
|
config = {
|
||||||
MIPS_ELF_APPENDED_DTB = "y";
|
MIPS_ELF_APPENDED_DTB = "y";
|
||||||
OF = "y";
|
OF = "y";
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
loadAddress = "0x00A00000";
|
loadAddress = "0x00A00000";
|
||||||
};
|
};
|
||||||
|
boot.dts = {
|
||||||
|
src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
||||||
|
includes = [
|
||||||
|
"${openwrt}/target/linux/ramips/dts"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
kernel = {
|
kernel = {
|
||||||
src = pkgs.fetchurl {
|
src = pkgs.fetchurl {
|
||||||
@ -49,12 +55,6 @@
|
|||||||
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
||||||
patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch
|
patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch
|
||||||
'';
|
'';
|
||||||
dts = {
|
|
||||||
src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
|
||||||
includes = [
|
|
||||||
"${openwrt}/target/linux/ramips/dts"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
config = {
|
config = {
|
||||||
MIPS_ELF_APPENDED_DTB = "y";
|
MIPS_ELF_APPENDED_DTB = "y";
|
||||||
OF = "y";
|
OF = "y";
|
||||||
|
@ -7,11 +7,9 @@ than by building and flashing a new image every time. This manual
|
|||||||
documents various affordances for iteration and experiments.
|
documents various affordances for iteration and experiments.
|
||||||
|
|
||||||
In general, packages and tools that run on the "build" machine are
|
In general, packages and tools that run on the "build" machine are
|
||||||
available in the ``buildEnv`` derivation.
|
available in the ``buildEnv`` derivation and can most easily
|
||||||
|
be added to your environment by running :command:`nix-shell`
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
nix-shell -A buildEnv
|
|
||||||
|
|
||||||
|
|
||||||
Emulated devices
|
Emulated devices
|
||||||
@ -29,19 +27,19 @@ To build it,
|
|||||||
|
|
||||||
nix-build -I liminix-config=path/to/your/configuration.nix --arg device "import ./devices/qemu" -A outputs.default
|
nix-build -I liminix-config=path/to/your/configuration.nix --arg device "import ./devices/qemu" -A outputs.default
|
||||||
|
|
||||||
In a ``buildEnv`` nix-shell, you can use the ``mips-vm`` command
|
In a ``buildEnv`` nix-shell, you can use the :command:`mips-vm` command
|
||||||
to run Qemu with appropriate options. It connects the Liminix
|
to run Qemu with appropriate options. It connects the Liminix
|
||||||
serial console and the `QEMU monitor <https://www.qemu.org/docs/master/system/monitor.html>`_ to stdin/stdout. Use ^P (not ^A) to switch to the monitor.
|
serial console and the `QEMU monitor <https://www.qemu.org/docs/master/system/monitor.html>`_ to stdin/stdout. Use ^P (not ^A) to switch to the monitor.
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
nix-shell -A buildEnv --run "mips-vm result/vmlinux result/squashfs"
|
nix-shell --run "mips-vm result/vmlinux result/squashfs"
|
||||||
|
|
||||||
If you run with ``--background /path/to/some/directory`` as the first
|
If you run with ``--background /path/to/some/directory`` as the first
|
||||||
parameter, it will fork into the background and open Unix sockets in
|
parameter, it will fork into the background and open Unix sockets in
|
||||||
that directory for console and monitor. Use ``connect-vm`` (also in the
|
that directory for console and monitor. Use :command:`connect-vm`
|
||||||
``buildEnv`` environment) to connect to either of these sockets, and ^O
|
(also in the ``buildEnv`` environment) to connect to either of these
|
||||||
to disconnect.
|
sockets, and ^O to disconnect.
|
||||||
|
|
||||||
Networking
|
Networking
|
||||||
==========
|
==========
|
||||||
@ -49,13 +47,13 @@ Networking
|
|||||||
VMs can network with each other using QEMU
|
VMs can network with each other using QEMU
|
||||||
socket networking. We observe these conventions, so that we can run
|
socket networking. We observe these conventions, so that we can run
|
||||||
multiple emulated instances and have them wired up to each other in
|
multiple emulated instances and have them wired up to each other in
|
||||||
the right way
|
the right way:
|
||||||
|
|
||||||
* multicast 230.0.0.1:1234 : access (interconnect between router and "isp")
|
* multicast 230.0.0.1:1234 : access (interconnect between router and "isp")
|
||||||
* multicast 230.0.0.1:1235 : lan
|
* multicast 230.0.0.1:1235 : lan
|
||||||
* multicast 230.0.0.1:1236 : world (the internet)
|
* multicast 230.0.0.1:1236 : world (the internet)
|
||||||
|
|
||||||
A VM started with ``mips-vm`` is connected to "lan" and "access", and
|
A VM started with :command:`mips-vm` is connected to "lan" and "access", and
|
||||||
the emulated border network gateway (see below) runs PPPoE and is
|
the emulated border network gateway (see below) runs PPPoE and is
|
||||||
connected to "access" and "world".
|
connected to "access" and "world".
|
||||||
|
|
||||||
@ -67,11 +65,11 @@ In pkgs/routeros there is a derivation to install and configure
|
|||||||
concentrator connected to the ``access`` and ``world`` networks, so that
|
concentrator connected to the ``access`` and ``world`` networks, so that
|
||||||
Liminix PPPoE client support can be tested without actual hardware.
|
Liminix PPPoE client support can be tested without actual hardware.
|
||||||
|
|
||||||
This is made available as the ``routeros`` command in ``buildEnv``, so you
|
This is made available as the :command:`routeros` command in
|
||||||
can do something like::
|
``buildEnv``, so you can do something like::
|
||||||
|
|
||||||
mkdir ros-sockets
|
mkdir ros-sockets
|
||||||
nix-shell -A buildEnv
|
nix-shell
|
||||||
nix-shell$ routeros ros-sockets
|
nix-shell$ routeros ros-sockets
|
||||||
nix-shell$ connect-vm ./ros-sockets/console
|
nix-shell$ connect-vm ./ros-sockets/console
|
||||||
|
|
||||||
@ -97,15 +95,14 @@ TFTP.
|
|||||||
There is a rudimentary TFTP server bundled with the system which runs
|
There is a rudimentary TFTP server bundled with the system which runs
|
||||||
from the command line, has an allowlist for client connections, and
|
from the command line, has an allowlist for client connections, and
|
||||||
follows symlinks, so you can have your device download images direct
|
follows symlinks, so you can have your device download images direct
|
||||||
from the ``./result`` directory without exposing ``/nix/store/`` to the
|
from the :file:`./result` directory without exposing :file:`/nix/store/` to the
|
||||||
internet or mucking about copying files to ``/tftproot``. If the
|
internet or mucking about copying files to :file:`/tftproot`. If the
|
||||||
permitted device is to be given the IP address 192.168.8.251 you might
|
permitted device is to be given the IP address 192.168.8.251 you might
|
||||||
do something like this:
|
do something like this:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
nix-shell -A buildEnv
|
nix-shell --run "tufted -a 192.168.8.251 result"
|
||||||
--run "tufted -a 192.168.8.251 result"
|
|
||||||
|
|
||||||
and then issue appropriate U-boot commands to download and flash the
|
and then issue appropriate U-boot commands to download and flash the
|
||||||
image.
|
image.
|
||||||
@ -125,9 +122,9 @@ image instead of flashing. In your device configuration add
|
|||||||
};
|
};
|
||||||
|
|
||||||
and then build ``outputs.tftproot``. This creates a file in
|
and then build ``outputs.tftproot``. This creates a file in
|
||||||
``result/`` called ``boot.scr`` containing commands that you can copy
|
``result/`` called ``boot.scr``, which you can copy and paste into
|
||||||
and paste into U-Boot which will transfer the kernel and filesystem
|
U-Boot to transfer the kernel and filesystem over TFTP and boot the
|
||||||
over TFTP and boot the kernel from RAM.
|
kernel from RAM.
|
||||||
|
|
||||||
|
|
||||||
Networking
|
Networking
|
||||||
@ -147,33 +144,39 @@ router from the internet so you can borrow the cable/fibre/DSL.
|
|||||||
* an L2TP service such as https://www.aa.net.uk/broadband/l2tp-service/
|
* an L2TP service such as https://www.aa.net.uk/broadband/l2tp-service/
|
||||||
|
|
||||||
You need to configure the Ethernet card for VFIO passthru, then
|
You need to configure the Ethernet card for VFIO passthru, then
|
||||||
you can execute ``run-border-vm`` in a ``buildEnv`` shell,
|
you can execute :command:`run-border-vm` in a ``buildEnv`` shell,
|
||||||
which starts up QEMU using the NixOS configuration in
|
which starts up QEMU using the NixOS configuration in
|
||||||
``bordervm-configuration.nix``
|
:file:`bordervm-configuration.nix`.
|
||||||
|
|
||||||
In this VM
|
In this VM
|
||||||
|
|
||||||
* your Liminix checkout is mounted under ``/home/liminix/liminix``
|
* your Liminix checkout is mounted under :file:`/home/liminix/liminix`
|
||||||
|
|
||||||
* TFTP is listening on the ethernet device and serving
|
* TFTP is listening on the ethernet device and serving
|
||||||
``/home/liminix/liminix``. The server IP address is 10.0.0.1
|
:file:`/home/liminix/liminix`. The server IP address is 10.0.0.1
|
||||||
|
|
||||||
* a PPPOE-L2TP relay is running on the same ethernet card, which
|
* a PPPOE-L2TP relay is running on the same ethernet card. When the
|
||||||
spawns L2TPv2 Access Concentrator sessions to your specified
|
connected Liminix device makes PPPoE requests, the relay spawns
|
||||||
L2TP LNS when the connected Liminix device makes PPPoE requests.
|
L2TPv2 Access Concentrator sessions to your specified L2TP LNS.
|
||||||
Note that authentication is expected at the PPP layer not the L2TP
|
Note that authentication is expected at the PPP layer not the L2TP
|
||||||
layer, so the same PAP/CHAP credentials provided by your L2TP
|
layer, so the PAP/CHAP credentials provided by your L2TP service can
|
||||||
service can be configured into your test device - bordervm
|
be configured into your test device - bordervm doesn't need to know
|
||||||
doesn't need to know about them.
|
about them.
|
||||||
|
|
||||||
To configure bordervm, you need a file called ``bordervm.conf.nix``
|
To configure bordervm, you need a file called :file:`bordervm.conf.nix`
|
||||||
which you can create by copying and appropriately editing ``bordervm.conf-example.nix``
|
which you can create by copying and appropriately editing :file:`bordervm.conf-example.nix`
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you make changes to the bordervm configuration after executing
|
||||||
|
:command:`run-border-vm`, you need to remove the :file:`border.qcow2` disk
|
||||||
|
image file otherwise the changes won't get picked up.
|
||||||
|
|
||||||
|
|
||||||
Running tests
|
Running tests
|
||||||
*************
|
*************
|
||||||
|
|
||||||
You can run all of the tests by evaluating ``ci.nix``, which is the
|
You can run all of the tests by evaluating :file:`ci.nix`, which is the
|
||||||
input I use in Hydra. Note that it expects Nixpkgs stable `and` unstable
|
input I use in Hydra. Note that it expects Nixpkgs stable `and` unstable
|
||||||
as inputs, because it builds the qemu device against both.
|
as inputs, because it builds the qemu device against both.
|
||||||
|
|
||||||
@ -196,9 +199,13 @@ Diagnosing unexpectedly large images
|
|||||||
Sometimes you can add a package and it causes the image size to balloon
|
Sometimes you can add a package and it causes the image size to balloon
|
||||||
because it has dependencies on other things you didn't know about. Build the
|
because it has dependencies on other things you didn't know about. Build the
|
||||||
``outputs.manifest`` attribute, which is a JSON representation of the
|
``outputs.manifest`` attribute, which is a JSON representation of the
|
||||||
filesystem, and you can run ``nix-store --query`` on it.::
|
filesystem, and you can run :command:`nix-store --query` on it.
|
||||||
|
|
||||||
nix-build -I liminix-config=path/to/your/configuration.nix --arg device "import ./devices/qemu" -A outputs.manifest -o manifest
|
.. code-block:: console
|
||||||
|
|
||||||
|
nix-build -I liminix-config=path/to/your/configuration.nix \
|
||||||
|
--arg device "import ./devices/qemu" -A outputs.manifest \
|
||||||
|
-o manifest
|
||||||
nix-store -q --tree manifest
|
nix-store -q --tree manifest
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,13 +29,6 @@ in {
|
|||||||
default = "true";
|
default = "true";
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
} ;
|
} ;
|
||||||
dts = {
|
|
||||||
src = mkOption { type = types.path; };
|
|
||||||
includes = mkOption {
|
|
||||||
default = [];
|
|
||||||
type = types.listOf types.path;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = mkOption {
|
config = mkOption {
|
||||||
# mostly the values are y n or m, but sometimes
|
# mostly the values are y n or m, but sometimes
|
||||||
# other strings are also used
|
# other strings are also used
|
||||||
@ -48,9 +41,18 @@ in {
|
|||||||
users = mkOption {
|
users = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
};
|
};
|
||||||
boot.commandLine = mkOption {
|
boot = {
|
||||||
type = types.listOf types.nonEmptyStr;
|
dts = {
|
||||||
default = [];
|
src = mkOption { type = types.path; };
|
||||||
|
includes = mkOption {
|
||||||
|
default = [];
|
||||||
|
type = types.listOf types.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
commandLine = mkOption {
|
||||||
|
type = types.listOf types.nonEmptyStr;
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
device.defaultOutput = mkOption {
|
device.defaultOutput = mkOption {
|
||||||
type = types.nonEmptyStr;
|
type = types.nonEmptyStr;
|
||||||
|
@ -23,8 +23,8 @@ in
|
|||||||
inherit (config.kernel) config src extraPatchPhase;
|
inherit (config.kernel) config src extraPatchPhase;
|
||||||
};
|
};
|
||||||
dtb = (callPackage ../kernel/dtb.nix {}) {
|
dtb = (callPackage ../kernel/dtb.nix {}) {
|
||||||
dts = config.kernel.dts.src;
|
dts = config.boot.dts.src;
|
||||||
includes = config.kernel.dts.includes ++ [
|
includes = config.boot.dts.includes ++ [
|
||||||
"${kernel.headers}/include"
|
"${kernel.headers}/include"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -5,4 +5,9 @@ let
|
|||||||
liminix-config = ./vanilla-configuration.nix;
|
liminix-config = ./vanilla-configuration.nix;
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
});
|
});
|
||||||
in liminix
|
in liminix.buildEnv.overrideAttrs (o: {
|
||||||
|
nativeBuildInputs = o.nativeBuildInputs ++ [ (import nixpkgs {}).sphinx ] ;
|
||||||
|
shellHook = ''
|
||||||
|
publish(){ make -C doc html && rsync -azv doc/_build/html/ myhtic.telent.net:/var/www/blogs/www.liminix.org/_site/doc; }
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user