~ruther/guix-local

fc4bc4b6debecf9acc7e86ecb519c03b5b598bc4 — Ludovic Courtès 12 years ago 83b9e6a
gnu: linux-initrd: Properly distinguish between /dev/sda* and /dev/vda*.

* guix/build/linux-initrd.scm (make-essential-device-nodes): Rename
  devices with major = 8 to /dev/sda*.  Make /dev/vda* devices.
* gnu/system/vm.scm (qemu-image): Change '/dev/vda' to '/dev/sda'.
* gnu/system.scm (operating-system-derivation): Likewise.
3 files changed, 14 insertions(+), 9 deletions(-)

M gnu/system.scm
M gnu/system/vm.scm
M guix/build/linux-initrd.scm
M gnu/system.scm => gnu/system.scm +1 -1
@@ 330,7 330,7 @@ alias ll='ls -l'
                                   (package-full-name kernel)
                                   " (technology preview)"))
                           (linux kernel)
                           (linux-arguments `("--root=/dev/vda1"
                           (linux-arguments `("--root=/dev/sda1"
                                              ,(string-append "--load=" boot)))
                           (initrd initrd-file))))
       (grub.cfg (grub-configuration-file entries))

M gnu/system/vm.scm => gnu/system/vm.scm +4 -4
@@ 294,18 294,18 @@ such as /etc files."
                                (assoc-ref %build-inputs "gawk") "/bin"))

         (display "creating partition table...\n")
         (and (zero? (system* parted "/dev/vda" "mklabel" "msdos"
         (and (zero? (system* parted "/dev/sda" "mklabel" "msdos"
                              "mkpart" "primary" "ext2" "1MiB"
                              ,(format #f "~aB"
                                       (- disk-image-size
                                          (* 5 (expt 2 20))))))
              (begin
                (display "creating ext3 partition...\n")
                (and (zero? (system* mkfs "-F" "/dev/vda1"))
                (and (zero? (system* mkfs "-F" "/dev/sda1"))
                     (let ((store (string-append "/fs" ,%store-directory)))
                       (display "mounting partition...\n")
                       (mkdir "/fs")
                       (mount "/dev/vda1" "/fs" "ext3")
                       (mount "/dev/sda1" "/fs" "ext3")
                       (mkdir-p "/fs/boot/grub")
                       (symlink grub.cfg "/fs/boot/grub/grub.cfg")



@@ 379,7 379,7 @@ such as /etc files."
                       (and (zero?
                             (system* grub "--no-floppy"
                                      "--boot-directory" "/fs/boot"
                                      "/dev/vda"))
                                      "/dev/sda"))
                            (zero? (system* umount "/fs"))
                            (reboot))))))))
    #:system system

M guix/build/linux-initrd.scm => guix/build/linux-initrd.scm +9 -4
@@ 81,10 81,15 @@
  (unless (file-exists? (scope "dev"))
    (mkdir (scope "dev")))

  ;; Make the device nodes for QEMU's hard disk and partitions.
  (mknod (scope "dev/vda") 'block-special #o644 (device-number 8 0))
  (mknod (scope "dev/vda1") 'block-special #o644 (device-number 8 1))
  (mknod (scope "dev/vda2") 'block-special #o644 (device-number 8 2))
  ;; Make the device nodes for SCSI disks.
  (mknod (scope "dev/sda") 'block-special #o644 (device-number 8 0))
  (mknod (scope "dev/sda1") 'block-special #o644 (device-number 8 1))
  (mknod (scope "dev/sda2") 'block-special #o644 (device-number 8 2))

  ;; The virtio (para-virtualized) block devices, as supported by QEMU/KVM.
  (mknod (scope "dev/vda") 'block-special #o644 (device-number 252 0))
  (mknod (scope "dev/vda1") 'block-special #o644 (device-number 252 1))
  (mknod (scope "dev/vda2") 'block-special #o644 (device-number 252 2))

  ;; TTYs.
  (mknod (scope "dev/tty") 'char-special #o600