liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (2385B)


      1 # This "device" generates images that can be used with the QEMU
      2 # emulator. The default output is a directory containing separate
      3 # kernel (uncompressed vmlinux) and initrd (squashfs) images
      4 {
      5   system = {
      6     crossSystem = {
      7       config = "mips-unknown-linux-musl";
      8       gcc = {
      9         abi = "32";
     10         arch = "mips32"; # maybe mips_24kc-
     11       };
     12     };
     13   };
     14 
     15   description = ''
     16     == QEMU MIPS
     17 
     18     This target produces an image for QEMU, the "generic and open source
     19     machine emulator and virtualizer".
     20 
     21     MIPS QEMU emulates a "Malta" board, which was an ATX form factor
     22     evaluation board made by MIPS Technologies, but mostly in Liminix we use
     23     paravirtualized devices (Virtio) instead of emulating hardware.
     24 
     25     Building an image for QEMU results in a `+result/+` directory containing
     26     `+run.sh+` `+vmlinux+`, and `+rootfs+` files. To invoke the emulator,
     27     run `+run.sh+`.
     28 
     29     The configuration includes two emulated "hardware" ethernet devices and
     30     the kernel `+mac80211_hwsim+` module to provide an emulated wlan device.
     31     To read more about how to connect to this network, refer to
     32     `+qemu-networking+` in the Development manual.
     33 
     34   '';
     35   module =
     36     {
     37       config,
     38       lib,
     39       lim,
     40       ...
     41     }:
     42     {
     43       imports = [
     44         ../../modules/arch/mipseb.nix
     45         ../families/qemu.nix
     46       ];
     47       kernel = {
     48         config = {
     49           MIPS_MALTA = "y";
     50           CPU_MIPS32_R2 = "y";
     51 
     52           POWER_RESET = "y";
     53           POWER_RESET_SYSCON = "y";
     54 
     55           SERIAL_8250 = "y";
     56           SERIAL_8250_CONSOLE = "y";
     57         };
     58       };
     59       hardware =
     60         # from arch/mips/mti-malta/Platform:load-$(CONFIG_MIPS_MALTA)  += 0xffffffff80100000
     61         let
     62           addr = lim.parseInt "0x80100000";
     63         in
     64         {
     65           loadAddress = addr;
     66           entryPoint = addr;
     67 
     68           # Unlike the arm qemu targets, we need a static dts when
     69           # running u-boot-using tests, qemu dumpdtb command doesn't
     70           # work for this board. I am not at all sure this dts is
     71           # *correct* but it does at least boot
     72           dts = lib.mkForce {
     73             src = "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/mti/malta.dts";
     74             includePaths = [
     75               "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/"
     76             ];
     77           };
     78 
     79         };
     80     };
     81 }