vm: Factorize common QEMU options.
* gnu/system/vm.scm (common-qemu-options): New procedure. (system-qemu-image/shared-store-script): Use it.
This commit is contained in:
		
							parent
							
								
									263d05be8d
								
							
						
					
					
						commit
						3c1f0e3b99
					
				
					 1 changed files with 15 additions and 11 deletions
				
			
		| 
						 | 
					@ -391,6 +391,17 @@ with the host."
 | 
				
			||||||
                #:register-closures? #f
 | 
					                #:register-closures? #f
 | 
				
			||||||
                #:copy-inputs? #f)))
 | 
					                #:copy-inputs? #f)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define* (common-qemu-options image)
 | 
				
			||||||
 | 
					  "Return the a string-value gexp with the common QEMU options to boot IMAGE."
 | 
				
			||||||
 | 
					#~(string-append
 | 
				
			||||||
 | 
					     " -enable-kvm -no-reboot -net nic,model=virtio \
 | 
				
			||||||
 | 
					  -virtfs local,path=" #$(%store-prefix) ",security_model=none,mount_tag=store \
 | 
				
			||||||
 | 
					  -net user \
 | 
				
			||||||
 | 
					  -serial stdio \
 | 
				
			||||||
 | 
					  -drive file=" #$image
 | 
				
			||||||
 | 
					  ",if=virtio,cache=writeback,werror=report,readonly \
 | 
				
			||||||
 | 
					  -m 256\n"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (system-qemu-image/shared-store-script
 | 
					(define* (system-qemu-image/shared-store-script
 | 
				
			||||||
          os
 | 
					          os
 | 
				
			||||||
          #:key
 | 
					          #:key
 | 
				
			||||||
| 
						 | 
					@ -408,18 +419,11 @@ OS that shares its store with the host."
 | 
				
			||||||
            (display
 | 
					            (display
 | 
				
			||||||
             (string-append "#!" #$bash "/bin/sh
 | 
					             (string-append "#!" #$bash "/bin/sh
 | 
				
			||||||
exec " #$qemu "/bin/" #$(qemu-command (%current-system))
 | 
					exec " #$qemu "/bin/" #$(qemu-command (%current-system))
 | 
				
			||||||
" -enable-kvm -no-reboot -net nic,model=virtio \
 | 
					" -kernel " #$(operating-system-kernel os) "/bzImage \
 | 
				
			||||||
  -virtfs local,path=" #$(%store-prefix) ",security_model=none,mount_tag=store \
 | 
					 | 
				
			||||||
  -net user \
 | 
					 | 
				
			||||||
  -kernel " #$(operating-system-kernel os) "/bzImage \
 | 
					 | 
				
			||||||
  -initrd " #$os-drv "/initrd \
 | 
					  -initrd " #$os-drv "/initrd \
 | 
				
			||||||
-append \"" #$(if graphic? "" "console=ttyS0 ")
 | 
					  -append \"" #$(if graphic? "" "console=ttyS0 ")
 | 
				
			||||||
  "--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1\" \
 | 
					  "--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1\" "
 | 
				
			||||||
  -serial stdio \
 | 
					  #$(common-qemu-options image))
 | 
				
			||||||
  -drive file=" #$image
 | 
					 | 
				
			||||||
  ",if=virtio,cache=writeback,werror=report,readonly \
 | 
					 | 
				
			||||||
  -m 256
 | 
					 | 
				
			||||||
\n")
 | 
					 | 
				
			||||||
             port)
 | 
					             port)
 | 
				
			||||||
            (chmod port #o555))))
 | 
					            (chmod port #o555))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue