forked from DGNum/liminix
rename mips-vm as run-liminix-vm
This commit is contained in:
parent
4f29bdd3ed
commit
4389fa15f7
12 changed files with 25 additions and 25 deletions
|
@ -54,7 +54,7 @@ in {
|
||||||
tufted
|
tufted
|
||||||
routeros.routeros
|
routeros.routeros
|
||||||
routeros.ros-exec-script
|
routeros.ros-exec-script
|
||||||
mips-vm
|
run-liminix-vm
|
||||||
borderVm.build.vm
|
borderVm.build.vm
|
||||||
go-l2tp
|
go-l2tp
|
||||||
min-copy-closure
|
min-copy-closure
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
defaultOutput = "vmroot";
|
defaultOutput = "vmroot";
|
||||||
flash.eraseBlockSize = "65536"; # c.f. pkgs/mips-vm/mips-vm.sh
|
flash.eraseBlockSize = "65536"; # c.f. pkgs/run-liminix-vm/run-liminix-vm.sh
|
||||||
networkInterfaces =
|
networkInterfaces =
|
||||||
let inherit (config.system.service.network) link;
|
let inherit (config.system.service.network) link;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -27,13 +27,13 @@ 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 :command:`mips-vm` command
|
In a ``buildEnv`` nix-shell, you can use the :command:`run-liminix-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 --run "mips-vm result/vmlinux result/squashfs"
|
nix-shell --run "run-liminix-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
|
||||||
|
@ -53,7 +53,7 @@ the right way:
|
||||||
* 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 :command:`mips-vm` is connected to "lan" and "access", and
|
A VM started with :command:`run-liminix-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".
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ Now you can try it:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
nix-shell --run "mips-vm ./result/vmlinux ./result/rootfs"
|
nix-shell --run "run-liminix-vm ./result/vmlinux ./result/rootfs"
|
||||||
|
|
||||||
This starts the Qemu emulator with a bunch of useful options, to run
|
This starts the Qemu emulator with a bunch of useful options, to run
|
||||||
the Liminix configuration you just built. It connects the emulated
|
the Liminix configuration you just built. It connects the emulated
|
||||||
|
|
|
@ -36,7 +36,7 @@ in
|
||||||
type = types.package;
|
type = types.package;
|
||||||
description = ''
|
description = ''
|
||||||
Directory containing separate kernel and rootfs image for
|
Directory containing separate kernel and rootfs image for
|
||||||
use with qemu (see mips-vm)
|
use with qemu (see run-liminix-vm)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
manifest = mkOption {
|
manifest = mkOption {
|
||||||
|
|
|
@ -59,7 +59,7 @@ in {
|
||||||
systemconfig = callPackage ./systemconfig {};
|
systemconfig = callPackage ./systemconfig {};
|
||||||
s6-init-bin = callPackage ./s6-init-bin {};
|
s6-init-bin = callPackage ./s6-init-bin {};
|
||||||
s6-rc-database = callPackage ./s6-rc-database {};
|
s6-rc-database = callPackage ./s6-rc-database {};
|
||||||
mips-vm = callPackage ./mips-vm {};
|
run-liminix-vm = callPackage ./run-liminix-vm {};
|
||||||
ppp = callPackage ./ppp {};
|
ppp = callPackage ./ppp {};
|
||||||
pppoe = callPackage ./pppoe {};
|
pppoe = callPackage ./pppoe {};
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
, symlinkJoin
|
, symlinkJoin
|
||||||
, lib
|
, lib
|
||||||
}: let
|
}: let
|
||||||
mips-vm = writeShellScriptBin "mips-vm" ''
|
run-liminix-vm = writeShellScriptBin "run-liminix-vm" ''
|
||||||
export PATH="${lib.makeBinPath [qemu]}:$PATH"
|
export PATH="${lib.makeBinPath [qemu]}:$PATH"
|
||||||
${builtins.readFile ./mips-vm.sh}
|
${builtins.readFile ./run-liminix-vm.sh}
|
||||||
'';
|
'';
|
||||||
connect = writeShellScriptBin "connect-vm" ''
|
connect = writeShellScriptBin "connect-vm" ''
|
||||||
export PATH="${lib.makeBinPath [socat]}:$PATH"
|
export PATH="${lib.makeBinPath [socat]}:$PATH"
|
||||||
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1
|
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1
|
||||||
'';
|
'';
|
||||||
in symlinkJoin {
|
in symlinkJoin {
|
||||||
name = "mips-vm";
|
name = "run-liminix-vm";
|
||||||
paths = [ mips-vm connect ];
|
paths = [ run-liminix-vm connect ];
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ test -n "$2" || usage
|
||||||
|
|
||||||
lan=${LAN-"socket,mcast=230.0.0.1:1235,localaddr=127.0.0.1"}
|
lan=${LAN-"socket,mcast=230.0.0.1:1235,localaddr=127.0.0.1"}
|
||||||
|
|
||||||
rootfs=$(mktemp mips-vm-fs-XXXXXX)
|
rootfs=$(mktemp run-liminix-vm-fs-XXXXXX)
|
||||||
dd if=/dev/zero of=$rootfs bs=1M count=16 conv=sync
|
dd if=/dev/zero of=$rootfs bs=1M count=16 conv=sync
|
||||||
dd if=$2 of=$rootfs bs=65536 conv=sync,nocreat,notrunc
|
dd if=$2 of=$rootfs bs=65536 conv=sync,nocreat,notrunc
|
||||||
|
|
|
@ -7,15 +7,15 @@ let img = (import liminix {
|
||||||
liminix-config = ./configuration.nix;
|
liminix-config = ./configuration.nix;
|
||||||
}).outputs.vmroot;
|
}).outputs.vmroot;
|
||||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
inherit (pkgs.pkgsBuildBuild) routeros mips-vm;
|
inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm;
|
||||||
in pkgs.runCommand "check" {
|
in pkgs.runCommand "check" {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
mips-vm
|
run-liminix-vm
|
||||||
expect
|
expect
|
||||||
socat
|
socat
|
||||||
] ;
|
] ;
|
||||||
} ''
|
} ''
|
||||||
mkdir vm
|
mkdir vm
|
||||||
mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||||
expect ${./script.expect} >$out
|
expect ${./script.expect} >$out
|
||||||
''
|
''
|
||||||
|
|
|
@ -9,11 +9,11 @@ let lmx = (import liminix {
|
||||||
rogue = lmx.pkgs.rogue;
|
rogue = lmx.pkgs.rogue;
|
||||||
img = lmx.outputs.vmroot;
|
img = lmx.outputs.vmroot;
|
||||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
inherit (pkgs.pkgsBuildBuild) run-liminix-vm;
|
||||||
in pkgs.runCommand "check" {
|
in pkgs.runCommand "check" {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
expect
|
expect
|
||||||
mips-vm
|
run-liminix-vm
|
||||||
socat
|
socat
|
||||||
min-copy-closure
|
min-copy-closure
|
||||||
rogue
|
rogue
|
||||||
|
@ -22,7 +22,7 @@ in pkgs.runCommand "check" {
|
||||||
. ${../test-helpers.sh}
|
. ${../test-helpers.sh}
|
||||||
|
|
||||||
mkdir vm
|
mkdir vm
|
||||||
LAN=user,hostfwd=tcp::2022-:22 mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
LAN=user,hostfwd=tcp::2022-:22 run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||||
expect ${./wait-until-ready.expect}
|
expect ${./wait-until-ready.expect}
|
||||||
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
|
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
|
||||||
$SSH_COMMAND root@localhost echo ready
|
$SSH_COMMAND root@localhost echo ready
|
||||||
|
|
|
@ -7,7 +7,7 @@ let img = (import liminix {
|
||||||
liminix-config = ./configuration.nix;
|
liminix-config = ./configuration.nix;
|
||||||
}).outputs.default;
|
}).outputs.default;
|
||||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
inherit (pkgs.pkgsBuildBuild) routeros mips-vm;
|
inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm;
|
||||||
in pkgs.runCommand "check" {
|
in pkgs.runCommand "check" {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
python3Packages.scapy
|
python3Packages.scapy
|
||||||
|
@ -15,7 +15,7 @@ in pkgs.runCommand "check" {
|
||||||
jq
|
jq
|
||||||
socat
|
socat
|
||||||
routeros.routeros
|
routeros.routeros
|
||||||
mips-vm
|
run-liminix-vm
|
||||||
] ;
|
] ;
|
||||||
} ''
|
} ''
|
||||||
serverstatedir=$(mktemp -d -t routeros-XXXXXX)
|
serverstatedir=$(mktemp -d -t routeros-XXXXXX)
|
||||||
|
@ -27,7 +27,7 @@ export MPLCONFIGDIR=$(mktemp -d -t routeros-XXXXXX)
|
||||||
|
|
||||||
routeros $serverstatedir
|
routeros $serverstatedir
|
||||||
mkdir vm
|
mkdir vm
|
||||||
mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||||
expect ${./getaddress.expect}
|
expect ${./getaddress.expect}
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -7,17 +7,17 @@ let img = (import liminix {
|
||||||
liminix-config = ./configuration.nix;
|
liminix-config = ./configuration.nix;
|
||||||
}).outputs.default;
|
}).outputs.default;
|
||||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
inherit (pkgs.pkgsBuildBuild) run-liminix-vm;
|
||||||
in pkgs.runCommand "check" {
|
in pkgs.runCommand "check" {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
expect
|
expect
|
||||||
mips-vm
|
run-liminix-vm
|
||||||
socat
|
socat
|
||||||
] ;
|
] ;
|
||||||
} ''
|
} ''
|
||||||
. ${../test-helpers.sh}
|
. ${../test-helpers.sh}
|
||||||
|
|
||||||
mkdir vm
|
mkdir vm
|
||||||
mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||||
expect ${./wait-for-wlan.expect} |tee output && mv output $out
|
expect ${./wait-for-wlan.expect} |tee output && mv output $out
|
||||||
''
|
''
|
||||||
|
|
Loading…
Reference in a new issue