forked from dan/liminix
rename mips-vm as run-liminix-vm
This commit is contained in:
parent
4f29bdd3ed
commit
4389fa15f7
|
@ -54,7 +54,7 @@ in {
|
|||
tufted
|
||||
routeros.routeros
|
||||
routeros.ros-exec-script
|
||||
mips-vm
|
||||
run-liminix-vm
|
||||
borderVm.build.vm
|
||||
go-l2tp
|
||||
min-copy-closure
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
};
|
||||
in {
|
||||
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 =
|
||||
let inherit (config.system.service.network) link;
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
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: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
|
||||
connected to "access" and "world".
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ Now you can try it:
|
|||
|
||||
.. 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
|
||||
the Liminix configuration you just built. It connects the emulated
|
||||
|
|
|
@ -36,7 +36,7 @@ in
|
|||
type = types.package;
|
||||
description = ''
|
||||
Directory containing separate kernel and rootfs image for
|
||||
use with qemu (see mips-vm)
|
||||
use with qemu (see run-liminix-vm)
|
||||
'';
|
||||
};
|
||||
manifest = mkOption {
|
||||
|
|
|
@ -59,7 +59,7 @@ in {
|
|||
systemconfig = callPackage ./systemconfig {};
|
||||
s6-init-bin = callPackage ./s6-init-bin {};
|
||||
s6-rc-database = callPackage ./s6-rc-database {};
|
||||
mips-vm = callPackage ./mips-vm {};
|
||||
run-liminix-vm = callPackage ./run-liminix-vm {};
|
||||
ppp = callPackage ./ppp {};
|
||||
pppoe = callPackage ./pppoe {};
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
, symlinkJoin
|
||||
, lib
|
||||
}: let
|
||||
mips-vm = writeShellScriptBin "mips-vm" ''
|
||||
run-liminix-vm = writeShellScriptBin "run-liminix-vm" ''
|
||||
export PATH="${lib.makeBinPath [qemu]}:$PATH"
|
||||
${builtins.readFile ./mips-vm.sh}
|
||||
${builtins.readFile ./run-liminix-vm.sh}
|
||||
'';
|
||||
connect = writeShellScriptBin "connect-vm" ''
|
||||
export PATH="${lib.makeBinPath [socat]}:$PATH"
|
||||
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1
|
||||
'';
|
||||
in symlinkJoin {
|
||||
name = "mips-vm";
|
||||
paths = [ mips-vm connect ];
|
||||
name = "run-liminix-vm";
|
||||
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"}
|
||||
|
||||
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=$2 of=$rootfs bs=65536 conv=sync,nocreat,notrunc
|
||||
|
|
@ -7,15 +7,15 @@ let img = (import liminix {
|
|||
liminix-config = ./configuration.nix;
|
||||
}).outputs.vmroot;
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
inherit (pkgs.pkgsBuildBuild) routeros mips-vm;
|
||||
inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm;
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
mips-vm
|
||||
run-liminix-vm
|
||||
expect
|
||||
socat
|
||||
] ;
|
||||
} ''
|
||||
mkdir vm
|
||||
mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||
run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||
expect ${./script.expect} >$out
|
||||
''
|
||||
|
|
|
@ -9,11 +9,11 @@ let lmx = (import liminix {
|
|||
rogue = lmx.pkgs.rogue;
|
||||
img = lmx.outputs.vmroot;
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
||||
inherit (pkgs.pkgsBuildBuild) run-liminix-vm;
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
mips-vm
|
||||
run-liminix-vm
|
||||
socat
|
||||
min-copy-closure
|
||||
rogue
|
||||
|
@ -22,7 +22,7 @@ in pkgs.runCommand "check" {
|
|||
. ${../test-helpers.sh}
|
||||
|
||||
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}
|
||||
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
|
||||
$SSH_COMMAND root@localhost echo ready
|
||||
|
|
|
@ -7,7 +7,7 @@ let img = (import liminix {
|
|||
liminix-config = ./configuration.nix;
|
||||
}).outputs.default;
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
inherit (pkgs.pkgsBuildBuild) routeros mips-vm;
|
||||
inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm;
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
python3Packages.scapy
|
||||
|
@ -15,7 +15,7 @@ in pkgs.runCommand "check" {
|
|||
jq
|
||||
socat
|
||||
routeros.routeros
|
||||
mips-vm
|
||||
run-liminix-vm
|
||||
] ;
|
||||
} ''
|
||||
serverstatedir=$(mktemp -d -t routeros-XXXXXX)
|
||||
|
@ -27,7 +27,7 @@ export MPLCONFIGDIR=$(mktemp -d -t routeros-XXXXXX)
|
|||
|
||||
routeros $serverstatedir
|
||||
mkdir vm
|
||||
mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||
run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||
expect ${./getaddress.expect}
|
||||
|
||||
set -o pipefail
|
||||
|
|
|
@ -7,17 +7,17 @@ let img = (import liminix {
|
|||
liminix-config = ./configuration.nix;
|
||||
}).outputs.default;
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
||||
inherit (pkgs.pkgsBuildBuild) run-liminix-vm;
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
mips-vm
|
||||
run-liminix-vm
|
||||
socat
|
||||
] ;
|
||||
} ''
|
||||
. ${../test-helpers.sh}
|
||||
|
||||
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
|
||||
''
|
||||
|
|
Loading…
Reference in New Issue