liminix

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

default.nix (2419B)


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