liminix

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

default.nix (1823B)


      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   module = {pkgs, config, ... }: {
     16     kernel = {
     17       src = pkgs.pkgsBuildBuild.fetchurl {
     18         name = "linux.tar.gz";
     19         url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.71.tar.gz";
     20         hash = "sha256-yhO2cXIeIgUxkSZf/4aAsF11uxyh+UUZu6D1h92vCD8=";
     21       };
     22       config = {
     23         MIPS_MALTA= "y";
     24         CPU_LITTLE_ENDIAN= "n";
     25         CPU_BIG_ENDIAN= "y";
     26         CPU_MIPS32_R2= "y";
     27 
     28         MTD = "y";
     29         MTD_BLOCK2MTD = "y";
     30         MTD_BLKDEVS = "y";
     31         MTD_BLOCK = "y";
     32 
     33         SQUASHFS = "y";
     34         SQUASHFS_XZ = "y";
     35 
     36         VIRTIO_MENU = "y";
     37         PCI = "y";
     38         VIRTIO_PCI = "y";
     39         BLOCK = "y";
     40         VIRTIO_BLK = "y";
     41         NETDEVICES = "y";
     42         VIRTIO_NET = "y";
     43 
     44         SERIAL_8250= "y";
     45         SERIAL_8250_CONSOLE= "y";
     46       };
     47     };
     48     hardware =
     49       let
     50         mac80211 =  pkgs.mac80211.override {
     51           drivers = ["mac80211_hwsim"];
     52           klibBuild = config.system.outputs.kernel.modulesupport;
     53         };
     54         inherit (pkgs.liminix.networking) interface;
     55       in {
     56         defaultOutput = "vmroot";
     57         flash.eraseBlockSize = "65536"; # c.f. pkgs/mips-vm/mips-vm.sh
     58         networkInterfaces = {
     59           lan = interface { device = "eth0"; };
     60           wan = interface { device = "eth1"; };
     61 
     62           wlan_24 = interface {
     63             device = "wlan0";
     64             dependencies = [ mac80211 ];
     65           };
     66         };
     67       };
     68 
     69   };
     70 }