fix tftpboot test on boards without autoboot, swap wan/lan

This is for MIPS.  I spent a while investigating why the second virtio
net device doesn't function in qemu mips malta u-boot, but with no
success. Use the first one instead.
pull/2/head
Daniel Barlow 2023-12-21 10:47:08 +00:00
parent 46926a94db
commit 9a29a042e8
3 changed files with 11 additions and 8 deletions

View File

@ -42,6 +42,7 @@
["--arch" arch & rest] (assoc (parse-args rest) :arch arch) ["--arch" arch & rest] (assoc (parse-args rest) :arch arch)
["--phram-address" addr & rest] (assoc (parse-args rest) :phram-address addr) ["--phram-address" addr & rest] (assoc (parse-args rest) :phram-address addr)
["--lan" spec & rest] (assoc (parse-args rest) :lan spec) ["--lan" spec & rest] (assoc (parse-args rest) :lan spec)
["--wan" spec & rest] (assoc (parse-args rest) :wan spec)
["--command-line" cmd & rest] (assoc (parse-args rest) :command-line cmd) ["--command-line" cmd & rest] (assoc (parse-args rest) :command-line cmd)
[kernel rootfsimg] [kernel rootfsimg]
{ :kernel kernel :rootfs (pad-file rootfsimg (* 16 1024)) } { :kernel kernel :rootfs (pad-file rootfsimg (* 16 1024)) }
@ -76,9 +77,11 @@
"-serial" (.. "unix:" sock ",server,nowait") "-serial" (.. "unix:" sock ",server,nowait")
"-monitor" (.. "unix:" monitor ",server,nowait")])) "-monitor" (.. "unix:" monitor ",server,nowait")]))
(fn access-net [] (fn access-net [override]
[ [
"-netdev" "socket,id=access,mcast=230.0.0.1:1234,localaddr=127.0.0.1" "-netdev" (.. (or override
"socket,mcast=230.0.0.1:1234,localaddr=127.0.0.1")
",id=access")
"-device" "virtio-net,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:21:02" "-device" "virtio-net,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:21:02"
]) ])
@ -121,7 +124,7 @@
["-serial" "mon:stdio"])) ["-serial" "mon:stdio"]))
(appendm (bootable (or options.command-line "") (appendm (bootable (or options.command-line "")
options.u-boot options.disk-image)) options.u-boot options.disk-image))
(appendm (access-net)) (appendm (access-net options.wan))
(appendm (local-net options.lan)) (appendm (local-net options.lan))
(appendm ["-display" "none"]))) (appendm ["-display" "none"])))

View File

@ -1,10 +1,10 @@
set timeout 30 set timeout 30
spawn socat unix-connect:vm/console - spawn socat unix-connect:vm/console -
expect "stop autoboot" expect {
send "\r" "stop autoboot" { send "\r" }
expect "=>" "=>" { send "\r" }
send "setenv ethact eth1\r" }
set fh [open "result/boot.scr"] set fh [open "result/boot.scr"]
while {[gets $fh line] >= 0} { while {[gets $fh line] >= 0} {
expect "=>" expect "=>"

View File

@ -23,7 +23,7 @@ run-liminix-vm \
--background ./vm \ --background ./vm \
--u-boot ${uboot}/u-boot.bin \ --u-boot ${uboot}/u-boot.bin \
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \ --arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
--lan "user,tftp=`pwd`" \ --wan "user,tftp=`pwd`" \
--disk-image result/rootfs \ --disk-image result/rootfs \
result/uimage result/rootfs result/uimage result/rootfs