From 2f2a9aca4b4e5199b1196bbee0ba81237d09f4be Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Tue, 20 Dec 2022 15:24:25 +0100 Subject: gnu: Add ipxe-qemu. * gnu/packages/bootloaders.scm (ipxe-qemu): New variable. --- gnu/packages/bootloaders.scm | 58 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 3c96453e5c..b968ecd441 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2015, 2018 Mark H Weaver ;;; Copyright © 2015 Leo Famulari ;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen -;;; Copyright © 2016, 2017, 2018, 2021 Marius Bakke +;;; Copyright © 2016-2018, 2021-2022 Marius Bakke ;;; Copyright © 2016, 2017 Danny Milosavljevic ;;; Copyright © 2016, 2017 David Craven ;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner @@ -1532,3 +1532,59 @@ existing PXE ROM on your network card, or you can chainload into iPXE to obtain the features of iPXE without the hassle of reflashing.") (license license:gpl2+)))) +(define-public ipxe-qemu + (package/inherit ipxe + (name "ipxe-qemu") + (native-inputs + (modify-inputs (package-native-inputs ipxe) + (prepend edk2-tools))) + (arguments + (let ((roms + ;; Alist of ROM -> (VID . DID) entries. This list and below + ;; build steps are taken from QEMUs roms/Makefile. + '(("e1000" . ("8086" . "100e")) + ("e1000e" . ("8086" . "10d3")) + ("eepro100" . ("8086" . "1209")) + ("ne2k_pci" . ("1050" . "0940")) + ("pcnet" . ("1022" . "2000")) + ("rtl8139" . ("10ec" . "8139")) + ("virtio" . ("1af4" . "1000")) + ("vmxnet3" . ("15ad" . "07b0"))))) + (substitute-keyword-arguments (package-arguments ipxe) + ((#:modules modules) + `((ice-9 match) ,@modules)) + ((#:make-flags flags) + #~(append (delete "everything" #$flags) + '("CONFIG=qemu") + (map (match-lambda + ((_ . (vid . did)) + (string-append "bin/" vid did ".rom"))) + '#$roms) + (map (match-lambda + ((_ . (vid . did)) + (string-append "bin-efi/" + vid did ".efidrv"))) + '#$roms))) + ((#:phases phases) + #~(modify-phases #$phases + (replace 'install + (lambda _ + (let ((firmware (string-append #$output "/share/firmware"))) + (mkdir-p firmware) + (for-each + (match-lambda + ((name . (vid . did)) + (let ((rom (string-append "bin/" vid did ".rom"))) + (copy-file rom + (string-append firmware + "/pxe-" name ".rom")) + (invoke "EfiRom" + "-b" rom + "-l" "0x02" + "-f" (string-append "0x" vid) + "-i" (string-append "0x" did) + "-ec" (string-append "bin-efi/" + vid did ".efidrv") + "-o" (string-append firmware + "/efi-" name ".rom"))))) + '#$roms))))))))))) -- cgit v1.2.3