2023-11-12 17:55:15 +01:00
|
|
|
# This "device" generates images that can be used with the QEMU
|
|
|
|
# emulator. The default output is a directory containing separate
|
|
|
|
# kernel (uncompressed vmlinux) and initrd (squashfs) images
|
|
|
|
{
|
2022-09-20 17:09:44 +02:00
|
|
|
system = {
|
|
|
|
crossSystem = {
|
|
|
|
config = "mips-unknown-linux-musl";
|
|
|
|
gcc = {
|
|
|
|
abi = "32";
|
|
|
|
arch = "mips32"; # maybe mips_24kc-
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-10-15 19:55:33 +02:00
|
|
|
|
2023-09-28 13:17:30 +02:00
|
|
|
description = ''
|
2023-11-10 22:17:20 +01:00
|
|
|
QEMU MIPS
|
|
|
|
*********
|
2023-09-28 13:17:30 +02:00
|
|
|
|
2023-11-10 22:17:20 +01:00
|
|
|
This target produces an image for
|
2023-09-28 13:17:30 +02:00
|
|
|
QEMU, the "generic and open source machine emulator and
|
|
|
|
virtualizer".
|
|
|
|
|
|
|
|
MIPS QEMU emulates a "Malta" board, which was an ATX form factor
|
|
|
|
evaluation board made by MIPS Technologies, but mostly in Liminix
|
|
|
|
we use paravirtualized devices (Virtio) instead of emulating
|
2023-11-10 22:17:20 +01:00
|
|
|
hardware.
|
2023-09-28 13:17:30 +02:00
|
|
|
|
|
|
|
Building an image for QEMU results in a :file:`result/` directory
|
2023-11-10 22:17:20 +01:00
|
|
|
containing ``run.sh`` ``vmlinux``, and ``rootfs`` files. To invoke
|
|
|
|
the emulator, run ``run.sh``.
|
2023-09-28 13:17:30 +02:00
|
|
|
|
|
|
|
The configuration includes two emulated "hardware" ethernet
|
|
|
|
devices and the kernel :code:`mac80211_hwsim` module to
|
|
|
|
provide an emulated wlan device. To read more about how
|
|
|
|
to connect to this network, refer to :ref:`qemu-networking`
|
|
|
|
in the Development manual.
|
|
|
|
|
|
|
|
'';
|
2023-12-21 20:17:14 +01:00
|
|
|
module = {pkgs, config, lib, lim, ... }: {
|
2023-12-09 17:42:45 +01:00
|
|
|
imports = [
|
|
|
|
../../modules/arch/mipseb.nix
|
|
|
|
../families/qemu.nix
|
|
|
|
];
|
2023-02-10 18:54:33 +01:00
|
|
|
kernel = {
|
|
|
|
config = {
|
|
|
|
MIPS_MALTA= "y";
|
|
|
|
CPU_MIPS32_R2= "y";
|
2022-09-21 00:04:08 +02:00
|
|
|
|
2023-12-26 22:58:18 +01:00
|
|
|
POWER_RESET = "y";
|
|
|
|
POWER_RESET_SYSCON = "y";
|
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
SERIAL_8250= "y";
|
|
|
|
SERIAL_8250_CONSOLE= "y";
|
|
|
|
};
|
2022-09-20 19:54:27 +02:00
|
|
|
};
|
2023-12-21 20:17:14 +01:00
|
|
|
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/"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2022-09-20 19:54:27 +02:00
|
|
|
};
|
2022-09-20 17:09:44 +02:00
|
|
|
}
|