Compare commits
5 Commits
32c13c46bb
...
9c894bdabf
Author | SHA1 | Date |
---|---|---|
Daniel Barlow | 9c894bdabf | |
Daniel Barlow | a962f18369 | |
Daniel Barlow | 9a29a042e8 | |
Daniel Barlow | 46926a94db | |
Daniel Barlow | ab0631c555 |
|
@ -33,7 +33,7 @@
|
|||
in {
|
||||
defaultOutput = "vmroot";
|
||||
rootDevice = "/dev/mtdblock0";
|
||||
dts.src = null;
|
||||
dts.src = pkgs.lib.mkDefault null;
|
||||
flash.eraseBlockSize = 65536;
|
||||
networkInterfaces =
|
||||
let inherit (config.system.service.network) link;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
in the Development manual.
|
||||
|
||||
'';
|
||||
module = {pkgs, config, lim, ... }: {
|
||||
module = {pkgs, config, lib, lim, ... }: {
|
||||
imports = [
|
||||
../../modules/arch/mipseb.nix
|
||||
../families/qemu.nix
|
||||
|
@ -50,5 +50,24 @@
|
|||
SERIAL_8250_CONSOLE= "y";
|
||||
};
|
||||
};
|
||||
hardware =
|
||||
# from arch/mips/mti-malta/Platform:load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
|
||||
let addr = lim.parseInt "0x80100000";
|
||||
in {
|
||||
loadAddress = addr;
|
||||
entryPoint = addr;
|
||||
|
||||
# Unlike the arm qemu targets, we need a static dts when
|
||||
# running u-boot-using tests, qemu dumpdtb command doesn't
|
||||
# work for this board. I am not at all sure this dts is
|
||||
# *correct* but it does at least boot
|
||||
dts = lib.mkForce {
|
||||
src = "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/mti/malta.dts";
|
||||
includes = [
|
||||
"${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/"
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
28
overlay.nix
28
overlay.nix
|
@ -224,6 +224,34 @@ extraPkgs // {
|
|||
'';
|
||||
};
|
||||
|
||||
ubootQemuMips = final.buildUBoot {
|
||||
defconfig = "malta_defconfig";
|
||||
extraMeta.platforms = ["mips-linux"];
|
||||
filesToInstall = ["u-boot.bin"];
|
||||
# define the prompt to be the same as arm{32,64} so
|
||||
# we can use the same expect script for both
|
||||
extraPatches = [ ./pkgs/u-boot/0002-virtio-init-for-malta.patch ];
|
||||
extraConfig = ''
|
||||
CONFIG_SYS_PROMPT="=> "
|
||||
CONFIG_VIRTIO=y
|
||||
CONFIG_AUTOBOOT=y
|
||||
CONFIG_DM_PCI=y
|
||||
CONFIG_VIRTIO_PCI=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
CONFIG_QFW_MMIO=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_LZMA=y
|
||||
CONFIG_CMD_LZMADEC=y
|
||||
CONFIG_SYS_BOOTM_LEN=0x1000000
|
||||
CONFIG_SYS_MALLOC_LEN=0x400000
|
||||
CONFIG_MIPS_BOOT_FDT=y
|
||||
CONFIG_OF_LIBFDT=y
|
||||
CONFIG_OF_STDOUT_VIA_ALIAS=y
|
||||
'';
|
||||
};
|
||||
|
||||
# gnufdisk = prev.gnufdisk.override {
|
||||
# guile = null;
|
||||
# };
|
||||
|
|
|
@ -51,6 +51,7 @@ stdenv.mkDerivation rec {
|
|||
patches = [
|
||||
./cmdline-cookie.patch
|
||||
./phram-allow-cached-mappings.patch
|
||||
./mips-malta-fdt-from-bootloader.patch
|
||||
];
|
||||
|
||||
# this is here to work around what I think is a bug in nixpkgs
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
|
||||
index 21cb3ac1237b..f11409ae9583 100644
|
||||
--- a/arch/mips/mti-malta/malta-setup.c
|
||||
+++ b/arch/mips/mti-malta/malta-setup.c
|
||||
@@ -192,7 +192,12 @@ static void __init bonito_quirks_setup(void)
|
||||
|
||||
void __init *plat_get_fdt(void)
|
||||
{
|
||||
- return (void *)__dtb_start;
|
||||
+ void *r=0;
|
||||
+ if(fw_arg0 == -2)
|
||||
+ r = (void *) KSEG1ADDR(fw_arg1);
|
||||
+ else
|
||||
+ r = (void *) __dtb_start;
|
||||
+ return r;
|
||||
}
|
||||
|
||||
void __init plat_mem_setup(void)
|
|
@ -36,20 +36,36 @@
|
|||
(match args
|
||||
["--background" dir & rest] (assoc (parse-args rest) :background dir)
|
||||
["--u-boot" bin & rest]
|
||||
(assoc (parse-args rest) :u-boot (pad-file bin (* 64 1024) "\xff"))
|
||||
(assoc (parse-args rest) :u-boot bin)
|
||||
["--disk-image" image & rest ] (assoc (parse-args rest)
|
||||
:disk-image (pad-file image 1024))
|
||||
["--arch" arch & rest] (assoc (parse-args rest) :arch arch)
|
||||
["--phram-address" addr & rest] (assoc (parse-args rest) :phram-address addr)
|
||||
["--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)
|
||||
[kernel rootfsimg]
|
||||
{ :kernel kernel :rootfs (pad-file rootfsimg (* 16 1024)) }
|
||||
))
|
||||
|
||||
(fn pad-u-boot [options]
|
||||
(if options.u-boot
|
||||
(let [size (.
|
||||
{
|
||||
:mips (* 4 1024)
|
||||
:aarch64 (* 64 1024)
|
||||
:arm (* 64 1024)
|
||||
}
|
||||
options.arch)]
|
||||
(assoc options
|
||||
:u-boot
|
||||
(pad-file options.u-boot size "\xff")))
|
||||
options))
|
||||
|
||||
(local options
|
||||
(assert
|
||||
(merge { :arch "mips" } (parse-args arg))
|
||||
(pad-u-boot
|
||||
(merge { :arch "mips" } (parse-args arg)))
|
||||
(.. "Usage: " (. arg 0) " blah bah")))
|
||||
|
||||
(fn background [dir]
|
||||
|
@ -61,9 +77,11 @@
|
|||
"-serial" (.. "unix:" sock ",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"
|
||||
])
|
||||
|
||||
|
@ -95,18 +113,21 @@
|
|||
(local exec-args
|
||||
(-> []
|
||||
(appendm (. bin options.arch))
|
||||
(appendm ["-m" "272"
|
||||
"-echr" "16"
|
||||
"-device"
|
||||
(.. "loader,file=" options.rootfs ",addr=" options.phram-address)
|
||||
])
|
||||
(appendm ["-echr" "16"])
|
||||
(appendm (if options.phram-address
|
||||
[
|
||||
"-m" "272"
|
||||
"-device"
|
||||
(.. "loader,file=" options.rootfs ",addr=" options.phram-address)
|
||||
]
|
||||
["-m" "256"]))
|
||||
(appendm
|
||||
(if options.background
|
||||
(background options.background)
|
||||
["-serial" "mon:stdio"]))
|
||||
(appendm (bootable (or options.command-line "")
|
||||
options.u-boot options.disk-image))
|
||||
(appendm (access-net))
|
||||
(appendm (access-net options.wan))
|
||||
(appendm (local-net options.lan))
|
||||
(appendm ["-display" "none"])))
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c
|
||||
index 9853a0ba82..d95e332d6d 100644
|
||||
--- a/board/imgtec/malta/malta.c
|
||||
+++ b/board/imgtec/malta/malta.c
|
||||
@@ -169,7 +169,9 @@ int board_early_init_f(void)
|
||||
int misc_init_r(void)
|
||||
{
|
||||
rtc_reset();
|
||||
-
|
||||
+#if IS_ENABLED(CONFIG_VIRTIO)
|
||||
+ virtio_init();
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -18,9 +18,17 @@ in {
|
|||
../../modules/outputs/tftpboot.nix
|
||||
];
|
||||
config = {
|
||||
hardware.dts.src = lib.mkForce dts;
|
||||
# use extracted dts if it was null in the device
|
||||
# definition, use actual dts if provided
|
||||
hardware.dts.src = lib.mkOverride 500 dts;
|
||||
boot.tftp = {
|
||||
loadAddress = lim.parseInt "0x44000000";
|
||||
loadAddress =
|
||||
let offsets = {
|
||||
mips = "0x88000000";
|
||||
arm = "0x44000000";
|
||||
aarch64 = "0x44000000";
|
||||
};
|
||||
in lim.parseInt offsets.${pkgs.stdenv.hostPlatform.qemuArch} ;
|
||||
serverip = "10.0.2.2";
|
||||
ipaddr = "10.0.2.15";
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
set timeout 30
|
||||
|
||||
spawn socat unix-connect:vm/console -
|
||||
expect "stop autoboot"
|
||||
send "\r"
|
||||
expect "=>"
|
||||
send "setenv ethact eth1\r"
|
||||
expect {
|
||||
"stop autoboot" { send "\r" }
|
||||
"=>" { send "\r" }
|
||||
}
|
||||
set fh [open "result/boot.scr"]
|
||||
while {[gets $fh line] >= 0} {
|
||||
expect "=>"
|
||||
|
|
|
@ -9,7 +9,6 @@ let derivation = (import liminix {
|
|||
img = derivation.outputs.tftpboot;
|
||||
uboot = derivation.pkgs.${ubootName};
|
||||
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
|
||||
phram = 240 * 1024 * 1024;
|
||||
in pkgsBuild.runCommand "check" {
|
||||
nativeBuildInputs = with pkgsBuild; [
|
||||
expect
|
||||
|
@ -24,14 +23,14 @@ run-liminix-vm \
|
|||
--background ./vm \
|
||||
--u-boot ${uboot}/u-boot.bin \
|
||||
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
|
||||
--phram-address $(printf "0x%x" ${toString phram} ) \
|
||||
--lan "user,tftp=`pwd`" \
|
||||
--wan "user,tftp=`pwd`" \
|
||||
--disk-image result/rootfs \
|
||||
result/uimage result/rootfs
|
||||
|
||||
expect ${./script.expect} 2>&1 |tee $out
|
||||
'';
|
||||
in {
|
||||
arm = check "qemu-armv7l" "ubootQemuArm";
|
||||
aarch64 = check "qemu-aarch64" "ubootQemuAarch64";
|
||||
arm = check "qemu-armv7l" "ubootQemuArm";
|
||||
mips = check "qemu" "ubootQemuMips";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue