gnu: vm: 'qemu-image' populates /dev on the target root file system.

* gnu/system/vm.scm (qemu-image): Use (guix build linux-initrd).  Remove
  'mknod' calls; use 'make-essential-device-nodes' to populate /dev on
  the target image.
* gnu/packages/linux-initrd.scm (qemu-initrd): When /root/dev exists,
  don't call 'make-essential-device-nodes'.
This commit is contained in:
Ludovic Courtès 2013-09-04 23:21:37 +02:00
parent e911470857
commit 7c1d8146a7
2 changed files with 11 additions and 9 deletions

View File

@ -284,8 +284,9 @@ the Linux kernel.")
(mkdir "/root/xchg") (mkdir "/root/xchg")
(mkdir-p "/root/nix/store") (mkdir-p "/root/nix/store")
(mkdir "/root/dev") (unless (file-exists? "/root/dev")
(make-essential-device-nodes #:root "/root/dev") (mkdir "/root/dev")
(make-essential-device-nodes #:root "/root"))
;; Mount the host's store and exchange directory. ;; Mount the host's store and exchange directory.
(mount-qemu-smb-share "/store" "/root/nix/store") (mount-qemu-smb-share "/store" "/root/nix/store")

View File

@ -210,7 +210,8 @@ process."
`(let () `(let ()
(use-modules (ice-9 rdelim) (use-modules (ice-9 rdelim)
(srfi srfi-1) (srfi srfi-1)
(guix build utils)) (guix build utils)
(guix build linux-initrd))
(let ((parted (string-append (assoc-ref %build-inputs "parted") (let ((parted (string-append (assoc-ref %build-inputs "parted")
"/sbin/parted")) "/sbin/parted"))
@ -223,9 +224,7 @@ process."
(initrd (string-append (assoc-ref %build-inputs "initrd") (initrd (string-append (assoc-ref %build-inputs "initrd")
"/initrd")) "/initrd"))
(linux (string-append (assoc-ref %build-inputs "linux") (linux (string-append (assoc-ref %build-inputs "linux")
"/bzImage")) "/bzImage")))
(makedev (lambda (major minor)
(+ (* major 256) minor))))
(define (read-reference-graph port) (define (read-reference-graph port)
;; Return a list of store paths from the reference graph at PORT. ;; Return a list of store paths from the reference graph at PORT.
@ -265,7 +264,6 @@ process."
(assoc-ref %build-inputs "gawk") "/bin")) (assoc-ref %build-inputs "gawk") "/bin"))
(display "creating partition table...\n") (display "creating partition table...\n")
(mknod "/dev/vda" 'block-special #o644 (makedev 8 0))
(and (zero? (system* parted "/dev/vda" "mklabel" "msdos" (and (zero? (system* parted "/dev/vda" "mklabel" "msdos"
"mkpart" "primary" "ext2" "1MiB" "mkpart" "primary" "ext2" "1MiB"
,(format #f "~aB" ,(format #f "~aB"
@ -273,7 +271,6 @@ process."
(* 5 (expt 2 20)))))) (* 5 (expt 2 20))))))
(begin (begin
(display "creating ext3 partition...\n") (display "creating ext3 partition...\n")
(mknod "/dev/vda1" 'block-special #o644 (makedev 8 1))
(and (zero? (system* mkfs "-F" "/dev/vda1")) (and (zero? (system* mkfs "-F" "/dev/vda1"))
(begin (begin
(display "mounting partition...\n") (display "mounting partition...\n")
@ -291,6 +288,9 @@ process."
thing))) thing)))
(things-to-copy)) (things-to-copy))
;; Populate /dev.
(make-essential-device-nodes #:root "/fs")
(call-with-output-file "/fs/boot/grub/grub.cfg" (call-with-output-file "/fs/boot/grub/grub.cfg"
(lambda (p) (lambda (p)
(format p " (format p "
@ -335,7 +335,8 @@ menuentry \"Boot-to-Guile! (GNU System technology preview)\" {
#:make-disk-image? #t #:make-disk-image? #t
#:disk-image-size disk-image-size #:disk-image-size disk-image-size
#:references-graphs (map input->name+derivation inputs-to-copy) #:references-graphs (map input->name+derivation inputs-to-copy)
#:modules '((guix build utils)))) #:modules '((guix build utils)
(guix build linux-initrd))))
;;; ;;;