liminix

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

default.nix (2308B)


      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 = {pkgs, config, lib, lim, ... }: {
     40     imports = [
     41       ../../modules/arch/mipseb.nix
     42       ../families/qemu.nix
     43     ];
     44     kernel = {
     45       config = {
     46         MIPS_MALTA= "y";
     47         CPU_MIPS32_R2= "y";
     48 
     49         POWER_RESET = "y";
     50         POWER_RESET_SYSCON = "y";
     51 
     52         SERIAL_8250= "y";
     53         SERIAL_8250_CONSOLE= "y";
     54       };
     55     };
     56     hardware =
     57       # from arch/mips/mti-malta/Platform:load-$(CONFIG_MIPS_MALTA)  += 0xffffffff80100000
     58       let addr = lim.parseInt "0x80100000";
     59       in {
     60         loadAddress = addr;
     61         entryPoint = addr;
     62 
     63         # Unlike the arm qemu targets, we need a static dts when
     64         # running u-boot-using tests, qemu dumpdtb command doesn't
     65         # work for this board. I am not at all sure this dts is
     66         # *correct* but it does at least boot
     67         dts = lib.mkForce {
     68           src = "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/mti/malta.dts";
     69           includes =  [
     70             "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/"
     71           ];
     72         };
     73 
     74       };
     75   };
     76 }