gnu: linux-initrd: Recognize 9p file systems.
* gnu/system/linux-initrd.scm (qemu-initrd)[virtio-9p-modules]: New variable. [linux-modules]: Append VIRTIO-9P-MODULES when a 9p file system is in MOUNTS. * guix/build/linux-initrd.scm (mount-qemu-9p): New procedure. (boot-system): Recognize '9p' in MOUNTS, and use 'mount-qemu-9p'.
This commit is contained in:
		
							parent
							
								
									217b862f0e
								
							
						
					
					
						commit
						4919d68432
					
				
					 2 changed files with 28 additions and 5 deletions
				
			
		|  | @ -207,11 +207,20 @@ exception and backtrace!)." | ||||||
|     ;; Modules needed to mount CIFS file systems. |     ;; Modules needed to mount CIFS file systems. | ||||||
|     '("md4.ko" "ecb.ko" "cifs.ko")) |     '("md4.ko" "ecb.ko" "cifs.ko")) | ||||||
| 
 | 
 | ||||||
|  |   (define virtio-9p-modules | ||||||
|  |     ;; Modules for the 9p paravirtualized file system. | ||||||
|  |     '("9pnet.ko" "9p.ko" "9pnet_virtio.ko")) | ||||||
|  | 
 | ||||||
|   (define linux-modules |   (define linux-modules | ||||||
|     ;; Modules added to the initrd and loaded from the initrd. |     ;; Modules added to the initrd and loaded from the initrd. | ||||||
|     (if (assoc-ref mounts 'cifs) |     `("virtio.ko" "virtio_ring.ko" "virtio_pci.ko" | ||||||
|         cifs-modules |       "virtio_balloon.ko" "virtio_blk.ko" "virtio_net.ko" | ||||||
|         '())) |       ,@(if (assoc-ref mounts 'cifs) | ||||||
|  |             cifs-modules | ||||||
|  |             '()) | ||||||
|  |       ,@(if (assoc-ref mounts '9p) | ||||||
|  |             virtio-9p-modules | ||||||
|  |             '()))) | ||||||
| 
 | 
 | ||||||
|   (expression->initrd |   (expression->initrd | ||||||
|    `(begin |    `(begin | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ | ||||||
|             make-essential-device-nodes |             make-essential-device-nodes | ||||||
|             configure-qemu-networking |             configure-qemu-networking | ||||||
|             mount-qemu-smb-share |             mount-qemu-smb-share | ||||||
|  |             mount-qemu-9p | ||||||
|             bind-mount |             bind-mount | ||||||
|             load-linux-module* |             load-linux-module* | ||||||
|             device-number |             device-number | ||||||
|  | @ -145,6 +146,17 @@ Vanilla QEMU's `-smb' option just exports a /qemu share, whereas our | ||||||
|     (mount (string-append "//" server share) mount-point "cifs" 0 |     (mount (string-append "//" server share) mount-point "cifs" 0 | ||||||
|            (string->pointer "guest,sec=none")))) |            (string->pointer "guest,sec=none")))) | ||||||
| 
 | 
 | ||||||
|  | (define (mount-qemu-9p source mount-point) | ||||||
|  |   "Mount QEMU's 9p file system from SOURCE at MOUNT-POINT. | ||||||
|  | 
 | ||||||
|  | This uses the 'virtio' transport, which requires the various virtio Linux | ||||||
|  | modules to be loaded." | ||||||
|  | 
 | ||||||
|  |   (format #t "mounting QEMU's 9p share '~a'...\n" source) | ||||||
|  |   (let ((server "10.0.2.4")) | ||||||
|  |     (mount source mount-point "9p" 0 | ||||||
|  |            (string->pointer "trans=virtio")))) | ||||||
|  | 
 | ||||||
| (define (bind-mount source target) | (define (bind-mount source target) | ||||||
|   "Bind-mount SOURCE at TARGET." |   "Bind-mount SOURCE at TARGET." | ||||||
|   (define MS_BIND 4096)                           ; from libc's <sys/mount.h> |   (define MS_BIND 4096)                           ; from libc's <sys/mount.h> | ||||||
|  | @ -242,8 +254,10 @@ the new root." | ||||||
|                 (let ((target (string-append "/root/" target))) |                 (let ((target (string-append "/root/" target))) | ||||||
|                   (mkdir-p target) |                   (mkdir-p target) | ||||||
|                   (mount-qemu-smb-share source target))) |                   (mount-qemu-smb-share source target))) | ||||||
|                ;; TODO: Add 9p. |                (('9p source target) | ||||||
|                ) |                 (let ((target (string-append "/root/" target))) | ||||||
|  |                   (mkdir-p target) | ||||||
|  |                   (mount-qemu-9p source target)))) | ||||||
|               mounts) |               mounts) | ||||||
| 
 | 
 | ||||||
|     (when guile-modules-in-chroot? |     (when guile-modules-in-chroot? | ||||||
|  |  | ||||||
		Reference in a new issue