logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

ipxe-1.21.1_p20230601-r1.ebuild (3260B)


  1. # Copyright 1999-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit savedconfig toolchain-funcs
  5. # for 1.21.1_p20230601
  6. COMMIT_SHA1="4fa4052c7ebb59e4d4aa396f1563c89118623ec7"
  7. DESCRIPTION="Open source network boot (PXE) firmware"
  8. HOMEPAGE="https://ipxe.org/"
  9. SRC_URI="https://github.com/${PN}/${PN}/archive/${COMMIT_SHA1}.tar.gz -> ${P}.gh.tar.gz"
  10. S="${WORKDIR}/${PN}-${COMMIT_SHA1}/src"
  11. LICENSE="GPL-2"
  12. SLOT="0"
  13. KEYWORDS="~amd64 ~x86"
  14. IUSE="efi efi64 ipv6 iso lkrn +qemu undi usb vmware"
  15. BDEPEND="
  16. app-arch/xz-utils
  17. dev-lang/perl
  18. qemu? ( efi64? ( sys-firmware/edk2-tools ) )
  19. iso? (
  20. app-cdr/cdrtools
  21. sys-boot/syslinux
  22. )
  23. "
  24. src_configure() {
  25. cat > config/local/general.h <<-EOF || die
  26. #undef BANNER_TIMEOUT
  27. #define BANNER_TIMEOUT 0
  28. EOF
  29. if use ipv6; then
  30. cat >> config/local/general.h <<-EOF || die
  31. #define NET_PROTO_IPV6
  32. EOF
  33. fi
  34. if use vmware; then
  35. cat >> config/local/general.h <<-EOF || die
  36. #define VMWARE_SETTINGS
  37. #define CONSOLE_VMWARE
  38. EOF
  39. fi
  40. restore_config config/local/general.h
  41. tc-ld-disable-gold
  42. }
  43. ipxemake() {
  44. # Q='' makes the build verbose since that's what everyone loves now
  45. emake Q='' \
  46. CC="$(tc-getCC)" \
  47. LD="$(tc-getLD)" \
  48. AS="$(tc-getAS)" \
  49. AR="$(tc-getAR)" \
  50. NM="$(tc-getNM)" \
  51. OBJCOPY="$(tc-getOBJCOPY)" \
  52. RANLIB="$(tc-getRANLIB)" \
  53. OBJDUMP="$(tc-getOBJDUMP)" \
  54. HOST_CC="$(tc-getBUILD_CC)" \
  55. "$@"
  56. }
  57. src_compile() {
  58. # (name, VID, DID) taken from qemu roms/Makefile
  59. local qemuroms=(
  60. 'e1000 8086 100e'
  61. 'e1000e 8086 10d3'
  62. 'eepro100 8086 1209'
  63. 'ne2k_pci 1050 0940'
  64. 'pcnet 1022 2000'
  65. 'rtl8139 10ec 8139'
  66. 'virtio 1af4 1000'
  67. 'vmxnet3 15ad 07b0'
  68. )
  69. export NO_WERROR=1
  70. if use qemu; then
  71. for rom in "${qemuroms[@]}"; do
  72. IFS=' ' read name vid did <<< "${rom}"
  73. ipxemake CONFIG=qemu bin/"${vid}${did}".rom
  74. if use efi64; then
  75. ipxemake CONFIG=qemu bin-x86_64-efi/"${vid}${did}".efidrv
  76. EfiRom -f "0x${vid}" -i "0x${did}" -l 0x02 \
  77. -b "bin/${vid}${did}.rom" \
  78. -ec "bin-x86_64-efi/${vid}${did}.efidrv" \
  79. -o "bin/efi-${name}.rom" || die
  80. fi
  81. done
  82. fi
  83. if use vmware; then
  84. ipxemake bin/8086100f.mrom # e1000
  85. ipxemake bin/808610d3.mrom # e1000e
  86. ipxemake bin/10222000.mrom # vlance
  87. ipxemake bin/15ad07b0.rom # vmxnet3
  88. fi
  89. use efi && ipxemake PLATFORM=efi BIN=bin-i386-efi bin-i386-efi/ipxe.efi
  90. use efi64 && ipxemake PLATFORM=efi BIN=bin-x86_64-efi bin-x86_64-efi/ipxe.efi
  91. use iso && ipxemake bin/ipxe.iso
  92. use undi && ipxemake bin/undionly.kpxe
  93. use usb && ipxemake bin/ipxe.usb
  94. use lkrn && ipxemake bin/ipxe.lkrn
  95. }
  96. src_install() {
  97. insinto /usr/share/ipxe/
  98. if use qemu || use vmware; then
  99. doins bin/*.rom
  100. fi
  101. use vmware && doins bin/*.mrom
  102. use efi && newins bin-i386-efi/ipxe.efi ipxe-i386.efi
  103. use efi64 && newins bin-x86_64-efi/ipxe.efi ipxe-x86_64.efi
  104. # Add a symlink for backwards compatiblity, in case both variants are
  105. # enabled the x86_64 bit variant takes presedence.
  106. use efi && dosym ipxe-i386.efi /usr/share/ipxe/ipxe.efi
  107. use efi64 && dosym ipxe-x86_64.efi /usr/share/ipxe/ipxe.efi
  108. use iso && doins bin/*.iso
  109. use undi && doins bin/*.kpxe
  110. use usb && doins bin/*.usb
  111. use lkrn && doins bin/*.lkrn
  112. save_config config/local/general.h
  113. }