vm: Pass the host's /dev/urandom to the guest at /dev/hwrng.

* gnu/build/vm.scm (load-in-linux-vm): Use QEMU's virtio-rng-pci.
* gnu/system/vm.scm (common-qemu-options): Likewise.
This commit is contained in:
Leo Famulari 2017-12-02 20:17:45 -05:00
parent 87dbb634a9
commit 2ca712bdba
No known key found for this signature in database
GPG Key ID: 2646FA30BACA7F08
2 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org> ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name> ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; ;;;
@ -139,6 +139,8 @@ the #:references-graphs parameter of 'derivation'."
(unless (zero? (unless (zero?
(apply system* qemu "-nographic" "-no-reboot" (apply system* qemu "-nographic" "-no-reboot"
"-m" (number->string memory-size) "-m" (number->string memory-size)
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng"
"-virtfs" "-virtfs"
(string-append "local,id=store_dev,path=" (string-append "local,id=store_dev,path="
(%store-directory) (%store-directory)

View File

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org> ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name> ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; ;;;
@ -666,6 +666,8 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
"-no-reboot" "-no-reboot"
"-net nic,model=virtio" "-net nic,model=virtio"
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng"
#$@(map virtfs-option shared-fs) #$@(map virtfs-option shared-fs)
"-vga std" "-vga std"