+ (initrd menu-entry-initrd ; file name of the initrd as a gexp
+ (default #f))
+ (multiboot-kernel menu-entry-multiboot-kernel
+ (default #f))
+ (multiboot-arguments menu-entry-multiboot-arguments
+ (default '())) ; list of string-valued gexps
+ (multiboot-modules menu-entry-multiboot-modules
+ (default '()))) ; list of multiboot commands, where
+ ; a command is a list of <string>
+
+(define (menu-entry->sexp entry)
+ "Return ENTRY serialized as an sexp."
+ (match entry
+ (($ <menu-entry> label device mount-point linux linux-arguments initrd #f
+ ())
+ `(menu-entry (version 0)
+ (label ,label)
+ (device ,device)
+ (device-mount-point ,mount-point)
+ (linux ,linux)
+ (linux-arguments ,linux-arguments)
+ (initrd ,initrd)))
+ (($ <menu-entry> label device mount-point #f () #f
+ multiboot-kernel multiboot-arguments multiboot-modules)
+ `(menu-entry (version 0)
+ (label ,label)
+ (device ,device)
+ (device-mount-point ,mount-point)
+ (multiboot-kernel ,multiboot-kernel)
+ (multiboot-arguments ,multiboot-arguments)
+ (multiboot-modules ,multiboot-modules)))))
+
+(define (sexp->menu-entry sexp)
+ "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
+record."
+ (match sexp
+ (('menu-entry ('version 0)
+ ('label label) ('device device)
+ ('device-mount-point mount-point)
+ ('linux linux) ('linux-arguments linux-arguments)
+ ('initrd initrd) _ ...)
+ (menu-entry
+ (label label)
+ (device device)
+ (device-mount-point mount-point)
+ (linux linux)
+ (linux-arguments linux-arguments)
+ (initrd initrd)))
+ (('menu-entry ('version 0)
+ ('label label) ('device device)
+ ('device-mount-point mount-point)
+ ('multiboot-kernel multiboot-kernel)
+ ('multiboot-arguments multiboot-arguments)
+ ('multiboot-modules multiboot-modules) _ ...)
+ (menu-entry
+ (label label)
+ (device device)
+ (device-mount-point mount-point)
+ (multiboot-kernel multiboot-kernel)
+ (multiboot-arguments multiboot-arguments)
+ (multiboot-modules multiboot-modules)))))