about summary refs log tree commit diff
path: root/pkgs/applications/virtualization
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/virtualization')
-rw-r--r--pkgs/applications/virtualization/qemu/riscv-initrd.patch98
-rw-r--r--pkgs/applications/virtualization/qemu/riscv.nix2
-rw-r--r--pkgs/applications/virtualization/qemu/statfs-flags.patch31
-rw-r--r--pkgs/applications/virtualization/virt-manager/qt.nix8
4 files changed, 118 insertions, 21 deletions
diff --git a/pkgs/applications/virtualization/qemu/riscv-initrd.patch b/pkgs/applications/virtualization/qemu/riscv-initrd.patch
new file mode 100644
index 000000000000..a7e5b28cfd5e
--- /dev/null
+++ b/pkgs/applications/virtualization/qemu/riscv-initrd.patch
@@ -0,0 +1,98 @@
+From 44b0f612499764dad425d467aadacb01fbd4a920 Mon Sep 17 00:00:00 2001
+From: Shea Levy <shea@shealevy.com>
+Date: Tue, 20 Feb 2018 07:59:43 -0500
+Subject: [PATCH] riscv: Respect the -initrd flag.
+
+Logic for initrd start address borrowed from arm/boot.c
+---
+ hw/riscv/virt.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 46 insertions(+), 3 deletions(-)
+
+diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
+index 46d95b2b79..5c7d191a3f 100644
+--- a/hw/riscv/virt.c
++++ b/hw/riscv/virt.c
+@@ -77,7 +77,35 @@ static uint64_t load_kernel(const char *kernel_filename)
+     return kernel_entry;
+ }
+ 
+-static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
++static hwaddr load_initrd(const char *filename, uint64_t mem_size,
++                          uint64_t kernel_entry, hwaddr *start)
++{
++    int size;
++
++    /* We want to put the initrd far enough into RAM that when the
++     * kernel is uncompressed it will not clobber the initrd. However
++     * on boards without much RAM we must ensure that we still leave
++     * enough room for a decent sized initrd, and on boards with large
++     * amounts of RAM we must avoid the initrd being so far up in RAM
++     * that it is outside lowmem and inaccessible to the kernel.
++     * So for boards with less  than 256MB of RAM we put the initrd
++     * halfway into RAM, and for boards with 256MB of RAM or more we put
++     * the initrd at 128MB.
++     */
++    *start = kernel_entry + MIN(mem_size / 2, 128 * 1024 * 1024);
++
++    size = load_ramdisk(filename, *start, mem_size - *start);
++    if (size == -1) {
++        size = load_image_targphys(filename, *start, mem_size - *start);
++        if (size == -1) {
++          error_report("qemu: could not load ramdisk '%s'", filename);
++          exit(1);
++        }
++    }
++    return *start + size;
++}
++
++static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
+     uint64_t mem_size, const char *cmdline)
+ {
+     void *fdt;
+@@ -233,6 +261,8 @@ static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
+     qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", nodename);
+     qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
+     g_free(nodename);
++
++    return fdt;
+ }
+ 
+ static void riscv_virt_board_init(MachineState *machine)
+@@ -246,6 +276,7 @@ static void riscv_virt_board_init(MachineState *machine)
+     char *plic_hart_config;
+     size_t plic_hart_config_len;
+     int i;
++    void *fdt;
+ 
+     /* Initialize SOC */
+     object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
+@@ -265,7 +296,8 @@ static void riscv_virt_board_init(MachineState *machine)
+         main_mem);
+ 
+     /* create device tree */
+-    create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
++    fdt = create_fdt(s, memmap, machine->ram_size,
++                     machine->kernel_cmdline);
+ 
+     /* boot rom */
+     memory_region_init_ram(boot_rom, NULL, "riscv_virt_board.bootrom",
+@@ -273,7 +305,18 @@ static void riscv_virt_board_init(MachineState *machine)
+     memory_region_add_subregion(system_memory, 0x0, boot_rom);
+ 
+     if (machine->kernel_filename) {
+-        load_kernel(machine->kernel_filename);
++        uint64_t kernel_entry = load_kernel(machine->kernel_filename);
++
++        if (machine->initrd_filename) {
++            hwaddr start;
++            hwaddr end = load_initrd(machine->initrd_filename,
++                                     machine->ram_size, kernel_entry,
++                                     &start);
++            qemu_fdt_setprop_cell(fdt, "/chosen",
++                                  "linux,initrd-start", start);
++            qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
++                                  end);
++        }
+     }
+ 
+     /* reset vector */
diff --git a/pkgs/applications/virtualization/qemu/riscv.nix b/pkgs/applications/virtualization/qemu/riscv.nix
index a900d943dabf..5e234dcb8935 100644
--- a/pkgs/applications/virtualization/qemu/riscv.nix
+++ b/pkgs/applications/virtualization/qemu/riscv.nix
@@ -15,6 +15,8 @@
 in lib.overrideDerivation qemu (orig: {
   name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}";
   inherit src;
+  # https://github.com/riscv/riscv-qemu/pull/109
+  patches = orig.patches ++ [ ./riscv-initrd.patch ];
   configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ];
   postInstall = null;
 })
diff --git a/pkgs/applications/virtualization/qemu/statfs-flags.patch b/pkgs/applications/virtualization/qemu/statfs-flags.patch
index c0f0162aacc9..52a470a2869a 100644
--- a/pkgs/applications/virtualization/qemu/statfs-flags.patch
+++ b/pkgs/applications/virtualization/qemu/statfs-flags.patch
@@ -1,4 +1,4 @@
-commit d3282d2512774dc5027c98930a3852b2b6e8407a
+commit 909fe47c7009aa9a75fe9470c5f8d3dd5b50917a
 Author: Shea Levy <shea@shealevy.com>
 Date:   Sun Feb 18 13:50:11 2018 -0500
 
@@ -59,7 +59,7 @@ index 82b35a6bdf..77481eca2c 100644
              unlock_user_struct(target_stfs, arg2, 1);
          }
 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
-index a35c52a60a..9f90451caf 100644
+index a35c52a60a..64aa49d3c5 100644
 --- a/linux-user/syscall_defs.h
 +++ b/linux-user/syscall_defs.h
 @@ -362,7 +362,14 @@ struct kernel_statfs {
@@ -77,49 +77,46 @@ index a35c52a60a..9f90451caf 100644
  };
  
  struct target_dirent {
-@@ -2223,7 +2230,13 @@ struct target_statfs {
+@@ -2223,7 +2230,12 @@ struct target_statfs {
  	/* Linux specials */
  	target_fsid_t		f_fsid;
  	int32_t			f_namelen;
 +#ifdef HAVE_STATFS_FLAGS
-+	int32_t			f_frsize;
 +	int32_t			f_flags;
-+	int32_t			f_spare[4];
++	int32_t			f_spare[5];
 +#else
  	int32_t			f_spare[6];
 +#endif
  };
  #else
  struct target_statfs {
-@@ -2239,7 +2252,13 @@ struct target_statfs {
+@@ -2239,7 +2251,12 @@ struct target_statfs {
  	/* Linux specials */
  	target_fsid_t		f_fsid;
  	abi_long		f_namelen;
 +#ifdef HAVE_STATFS_FLAGS
-+	abi_long		f_frsize;
 +	abi_long		f_flags;
-+	abi_long		f_spare[4];
++	abi_long		f_spare[5];
 +#else
  	abi_long		f_spare[6];
 +#endif
  };
  #endif
  
-@@ -2255,7 +2274,13 @@ struct target_statfs64 {
+@@ -2255,7 +2272,12 @@ struct target_statfs64 {
  	uint64_t	f_bavail;
  	target_fsid_t	f_fsid;
  	uint32_t	f_namelen;
 +#ifdef HAVE_STATFS_FLAGS
-+	uint32_t	f_frsize;
 +	uint32_t	f_flags;
-+	uint32_t	f_spare[4];
++	uint32_t	f_spare[5];
 +#else
  	uint32_t	f_spare[6];
 +#endif
  };
  #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
         defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
-@@ -2271,7 +2296,12 @@ struct target_statfs {
+@@ -2271,7 +2293,12 @@ struct target_statfs {
  	target_fsid_t f_fsid;
  	abi_long f_namelen;
  	abi_long f_frsize;
@@ -132,7 +129,7 @@ index a35c52a60a..9f90451caf 100644
  };
  
  struct target_statfs64 {
-@@ -2285,7 +2315,12 @@ struct target_statfs64 {
+@@ -2285,7 +2312,12 @@ struct target_statfs64 {
  	target_fsid_t f_fsid;
  	abi_long f_namelen;
  	abi_long f_frsize;
@@ -145,7 +142,7 @@ index a35c52a60a..9f90451caf 100644
  };
  #elif defined(TARGET_S390X)
  struct target_statfs {
-@@ -2299,7 +2334,13 @@ struct target_statfs {
+@@ -2299,7 +2331,13 @@ struct target_statfs {
      kernel_fsid_t f_fsid;
      int32_t  f_namelen;
      int32_t  f_frsize;
@@ -159,7 +156,7 @@ index a35c52a60a..9f90451caf 100644
  };
  
  struct target_statfs64 {
-@@ -2313,7 +2354,12 @@ struct target_statfs64 {
+@@ -2313,7 +2351,12 @@ struct target_statfs64 {
      kernel_fsid_t f_fsid;
      int32_t  f_namelen;
      int32_t  f_frsize;
@@ -172,7 +169,7 @@ index a35c52a60a..9f90451caf 100644
  };
  #else
  struct target_statfs {
-@@ -2327,7 +2373,12 @@ struct target_statfs {
+@@ -2327,7 +2370,12 @@ struct target_statfs {
  	target_fsid_t f_fsid;
  	uint32_t f_namelen;
  	uint32_t f_frsize;
@@ -185,7 +182,7 @@ index a35c52a60a..9f90451caf 100644
  };
  
  struct target_statfs64 {
-@@ -2341,7 +2392,12 @@ struct target_statfs64 {
+@@ -2341,7 +2389,12 @@ struct target_statfs64 {
  	target_fsid_t f_fsid;
          uint32_t f_namelen;
  	uint32_t f_frsize;
diff --git a/pkgs/applications/virtualization/virt-manager/qt.nix b/pkgs/applications/virtualization/virt-manager/qt.nix
index 4c5000f0208c..e723cd02bd05 100644
--- a/pkgs/applications/virtualization/virt-manager/qt.nix
+++ b/pkgs/applications/virtualization/virt-manager/qt.nix
@@ -1,17 +1,17 @@
 { mkDerivation, lib, fetchFromGitHub, cmake, pkgconfig
-, qtbase, qtmultimedia, qtsvg
+, qtbase, qtmultimedia, qtsvg, qttools
 , libvncserver, libvirt, pcre, pixman, qtermwidget, spice_gtk, spice_protocol
 }:
 
 mkDerivation rec {
   name = "virt-manager-qt-${version}";
-  version = "0.48.79";
+  version = "0.52.80";
 
   src = fetchFromGitHub {
     owner  = "F1ash";
     repo   = "qt-virt-manager";
     rev    = "${version}";
-    sha256 = "1mzncca9blc742vb77gyfza0sd1rby3qy5yl4x19nkllid92jn6k";
+    sha256 = "131rs6c90vdf1j40qj7k6s939y8la9ma0q3labxb7ac3r8hvhn6a";
   };
 
   cmakeFlags = [
@@ -24,7 +24,7 @@ mkDerivation rec {
     libvirt libvncserver pcre pixman qtermwidget spice_gtk spice_protocol
   ];
 
-  nativeBuildInputs = [ cmake pkgconfig ];
+  nativeBuildInputs = [ cmake pkgconfig qttools ];
 
   enableParallelBuilding = true;