From 1f23e164ad4acf7a7e8e54394b2f82498d6be240 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Sep 27 2022 12:32:35 +0000 Subject: import ipxe-20181214-9.git133f4c47.el8 --- diff --git a/SOURCES/0001-arm-Provide-dummy-implementation-for-in-out-s-b-w-l.patch b/SOURCES/0001-arm-Provide-dummy-implementation-for-in-out-s-b-w-l.patch new file mode 100644 index 0000000..972114b --- /dev/null +++ b/SOURCES/0001-arm-Provide-dummy-implementation-for-in-out-s-b-w-l.patch @@ -0,0 +1,129 @@ +From c2226b3d1a4d9fc1daeb8dc6b9034d1fb46c1308 Mon Sep 17 00:00:00 2001 +From: Michael Brown +Date: Sun, 14 Jul 2019 15:27:01 +0100 +Subject: [PATCH] [arm] Provide dummy implementations for {in,out}[s]{b,w,l} + +It is currently not possible to build the all-drivers iPXE binaries +for ARM, since there is no implementation for inb(), outb(), etc. + +There is no common standard for accessing I/O space on ARM platforms, +and there are almost no ARM-compatible peripherals that actually +require I/O space accesses. + +Provide dummy implementations that behave as though no device is +present (i.e. ignore writes, return all bits high for reads). This is +sufficient to allow the all-drivers binaries to link, and should cause +drivers to behave as though no I/O space peripherals are present in +the system. + +Signed-off-by: Michael Brown +--- + src/arch/arm/include/ipxe/arm_io.h | 77 +++++++++++++++++++++++------- + 1 file changed, 59 insertions(+), 18 deletions(-) + +diff --git a/src/arch/arm/include/ipxe/arm_io.h b/src/arch/arm/include/ipxe/arm_io.h +index f8765af752..105f22bfbf 100644 +--- a/src/arch/arm/include/ipxe/arm_io.h ++++ b/src/arch/arm/include/ipxe/arm_io.h +@@ -43,42 +43,83 @@ IOAPI_INLINE ( arm, bus_to_phys ) ( unsigned long bus_addr ) { + * + */ + +-#define ARM_READX( _api_func, _type, _insn_suffix, _reg_prefix ) \ ++#define ARM_READX( _suffix, _type, _insn_suffix, _reg_prefix ) \ + static inline __always_inline _type \ +-IOAPI_INLINE ( arm, _api_func ) ( volatile _type *io_addr ) { \ ++IOAPI_INLINE ( arm, read ## _suffix ) ( volatile _type *io_addr ) { \ + _type data; \ + __asm__ __volatile__ ( "ldr" _insn_suffix " %" _reg_prefix "0, %1" \ + : "=r" ( data ) : "Qo" ( *io_addr ) ); \ + return data; \ + } + #ifdef __aarch64__ +-ARM_READX ( readb, uint8_t, "b", "w" ); +-ARM_READX ( readw, uint16_t, "h", "w" ); +-ARM_READX ( readl, uint32_t, "", "w" ); +-ARM_READX ( readq, uint64_t, "", "" ); ++ARM_READX ( b, uint8_t, "b", "w" ); ++ARM_READX ( w, uint16_t, "h", "w" ); ++ARM_READX ( l, uint32_t, "", "w" ); ++ARM_READX ( q, uint64_t, "", "" ); + #else +-ARM_READX ( readb, uint8_t, "b", "" ); +-ARM_READX ( readw, uint16_t, "h", "" ); +-ARM_READX ( readl, uint32_t, "", "" ); ++ARM_READX ( b, uint8_t, "b", "" ); ++ARM_READX ( w, uint16_t, "h", "" ); ++ARM_READX ( l, uint32_t, "", "" ); + #endif + +-#define ARM_WRITEX( _api_func, _type, _insn_suffix, _reg_prefix ) \ ++#define ARM_WRITEX( _suffix, _type, _insn_suffix, _reg_prefix ) \ + static inline __always_inline void \ +-IOAPI_INLINE ( arm, _api_func ) ( _type data, volatile _type *io_addr ) { \ ++IOAPI_INLINE ( arm, write ## _suffix ) ( _type data, \ ++ volatile _type *io_addr ) { \ + __asm__ __volatile__ ( "str" _insn_suffix " %" _reg_prefix "0, %1" \ + : : "r" ( data ), "Qo" ( *io_addr ) ); \ + } + #ifdef __aarch64__ +-ARM_WRITEX ( writeb, uint8_t, "b", "w" ); +-ARM_WRITEX ( writew, uint16_t, "h", "w" ); +-ARM_WRITEX ( writel, uint32_t, "", "w" ); +-ARM_WRITEX ( writeq, uint64_t, "", "" ); ++ARM_WRITEX ( b, uint8_t, "b", "w" ); ++ARM_WRITEX ( w, uint16_t, "h", "w" ); ++ARM_WRITEX ( l, uint32_t, "", "w" ); ++ARM_WRITEX ( q, uint64_t, "", "" ); + #else +-ARM_WRITEX ( writeb, uint8_t, "b", "" ); +-ARM_WRITEX ( writew, uint16_t, "h", "" ); +-ARM_WRITEX ( writel, uint32_t, "", "" ); ++ARM_WRITEX ( b, uint8_t, "b", "" ); ++ARM_WRITEX ( w, uint16_t, "h", "" ); ++ARM_WRITEX ( l, uint32_t, "", "" ); + #endif + ++/* ++ * Dummy PIO reads and writes up to 32 bits ++ * ++ * There is no common standard for I/O-space access for ARM, and ++ * non-MMIO peripherals are vanishingly rare. Provide dummy ++ * implementations that will allow code to link and should cause ++ * drivers to simply fail to detect hardware at runtime. ++ * ++ */ ++ ++#define ARM_INX( _suffix, _type ) \ ++static inline __always_inline _type \ ++IOAPI_INLINE ( arm, in ## _suffix ) ( volatile _type *io_addr __unused) { \ ++ return ~( (_type) 0 ); \ ++} \ ++static inline __always_inline void \ ++IOAPI_INLINE ( arm, ins ## _suffix ) ( volatile _type *io_addr __unused, \ ++ _type *data, unsigned int count ) { \ ++ memset ( data, 0xff, count * sizeof ( *data ) ); \ ++} ++ARM_INX ( b, uint8_t ); ++ARM_INX ( w, uint16_t ); ++ARM_INX ( l, uint32_t ); ++ ++#define ARM_OUTX( _suffix, _type ) \ ++static inline __always_inline void \ ++IOAPI_INLINE ( arm, out ## _suffix ) ( _type data __unused, \ ++ volatile _type *io_addr __unused ) { \ ++ /* Do nothing */ \ ++} \ ++static inline __always_inline void \ ++IOAPI_INLINE ( arm, outs ## _suffix ) ( volatile _type *io_addr __unused, \ ++ const _type *data __unused, \ ++ unsigned int count __unused ) { \ ++ /* Do nothing */ \ ++} ++ARM_OUTX ( b, uint8_t ); ++ARM_OUTX ( w, uint16_t ); ++ARM_OUTX ( l, uint32_t ); ++ + /* + * Slow down I/O + * diff --git a/SPECS/ipxe.spec b/SPECS/ipxe.spec index 72671c4..781d721 100644 --- a/SPECS/ipxe.spec +++ b/SPECS/ipxe.spec @@ -1,7 +1,3 @@ -%if 0%{?fedora} -%global cross 1 -%endif - # Resulting binary formats we want from iPXE %global formats rom @@ -17,17 +13,10 @@ # vmxnet3: 0x15ad 0x07b0 %global qemuroms 10222000 10ec8029 8086100e 10ec8139 1af41000 80861209 808610d3 15ad07b0 -# We only build the ROMs if on an x86 build host. The resulting +# We only build the ROMs if on an EFI build host. The resulting # binary RPM will be noarch, so other archs will still be able # to use the binary ROMs. -# -# We do cross-compilation for 32->64-bit, but not for other arches -# because EDK II does not support big-endian hosts. -%if 0%{?cross} -%global buildarches %{ix86} x86_64 -%else -%global buildarches x86_64 -%endif +%global buildarches x86_64 aarch64 # debugging firmwares does not go the same way as a normal program. # moreover, all architectures providing debuginfo for a single noarch @@ -49,7 +38,7 @@ Name: ipxe Version: %{date} -Release: 8.git%{hash}%{?dist} +Release: 9.git%{hash}%{?dist} Summary: A network boot loader Group: System Environment/Base @@ -67,32 +56,35 @@ Patch0003: 0003-Strip-802.1Q-VLAN-0-priority-tags.patch Patch0004: ipxe-vlan-cmds.patch Patch0005: 0001-efi-perform-cable-detection-at-NII-initialization-on-HPE-557SFP.patch Patch0006: ipxe-ping-cmd.patch +Patch0007: 0001-arm-Provide-dummy-implementation-for-in-out-s-b-w-l.patch %ifarch %{buildarches} BuildRequires: perl-interpreter BuildRequires: perl-Getopt-Long -BuildRequires: syslinux BuildRequires: mtools BuildRequires: mkisofs BuildRequires: edk2-tools BuildRequires: xz-devel - BuildRequires: binutils-devel -%if 0%{?cross} -BuildRequires: binutils-x86_64-linux-gnu gcc-x86_64-linux-gnu +%endif +%ifarch x86_64 +BuildRequires: syslinux %endif Obsoletes: gpxe <= 1.0.1 +%ifarch x86_64 %package rhcert Summary: Redhat hwcert custom ipxe image Group: Development/Tools BuildArch: noarch -%package bootimgs -Summary: Network boot loader images in bootable USB, CD, floppy and GRUB formats +%package bootimgs-x86 +Summary: X86 Network boot loader images in bootable USB, CD, floppy and GRUB formats Group: Development/Tools BuildArch: noarch +Provides: %{name}-bootimgs = %{version}-%{release} +Obsoletes: %{name}-bootimgs < 20181214-9.git133f4c47 Obsoletes: gpxe-bootimgs <= 1.0.1 %package roms @@ -111,7 +103,7 @@ Obsoletes: gpxe-roms-qemu <= 1.0.1 %description rhcert Custom ipxe image for use in hardware certification and validation -%description bootimgs +%description bootimgs-x86 iPXE is an open source network bootloader. It provides a direct replacement for proprietary PXE ROMs, with many extra features such as DNS, HTTP, iSCSI, etc. @@ -126,7 +118,6 @@ DNS, HTTP, iSCSI, etc. This package contains the iPXE roms in .rom format. - %description roms-qemu iPXE is an open source network bootloader. It provides a direct replacement for proprietary PXE ROMs, with many extra features such as @@ -136,6 +127,20 @@ This package contains the iPXE ROMs for devices emulated by QEMU, in .rom format. %endif +%ifarch aarch64 +%package bootimgs-aarch64 +Summary: AArch64 Network boot loader images in bootable USB and GRUB formats +Group: Development/Tools +BuildArch: noarch + +%description bootimgs-aarch64 +iPXE is an open source network bootloader. It provides a direct +replacement for proprietary PXE ROMs, with many extra features such as +DNS, HTTP, iSCSI, etc. + +This package contains the iPXE ARM64 boot images in USB and GRUB formats. +%endif + %description iPXE is an open source network bootloader. It provides a direct replacement for proprietary PXE ROMs, with many extra features such as @@ -144,28 +149,28 @@ DNS, HTTP, iSCSI, etc. %prep %setup -q -n %{name}-%{version}-git%{hash} %autopatch -p1 - - -%build -%ifarch %{buildarches} -cd src - +pushd src # ath9k drivers are too big for an Option ROM, and ipxe devs say it doesn't # make sense anyways # http://lists.ipxe.org/pipermail/ipxe-devel/2012-March/001290.html rm -rf drivers/net/ath/ath9k +cp %{SOURCE1} . +popd + + +%build +cd src + make_ipxe() { make %{?_smp_mflags} \ NO_WERROR=1 V=1 \ GITVERSION=%{hash} \ -%if 0%{?cross} - CROSS_COMPILE=x86_64-linux-gnu- \ -%endif "$@" } -cp %{SOURCE1} . +%ifarch x86_64 + make_ipxe bin-x86_64-efi/ipxe.efi EMBED=script.ipxe mv bin-x86_64-efi/ipxe.efi bin-x86_64-efi/ipxe-rhcert.efi @@ -199,8 +204,15 @@ done %endif +%ifarch aarch64 +make_ipxe bin-arm64-efi/snponly.efi +%if 0%{?fedora} +make_ipxe bin-arm64-efi/ipxe.efi +%endif +%endif + %install -%ifarch %{buildarches} +%ifarch x86_64 mkdir -p %{buildroot}/%{_datadir}/%{name}/ mkdir -p %{buildroot}/%{_datadir}/%{name}.efi/ pushd src/bin/ @@ -236,8 +248,16 @@ for rom in %{qemuroms}; do done %endif -%ifarch %{buildarches} -%files bootimgs +%ifarch aarch64 +mkdir -p %{buildroot}/%{_datadir}/%{name}/arm64-efi +cp -a src/bin-arm64-efi/snponly.efi %{buildroot}/%{_datadir}/%{name}/arm64-efi/snponly.efi +%if 0%{?fedora} +cp -a src/bin-arm64-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/arm64-efi/ipxe.efi +%endif +%endif + +%ifarch x86_64 +%files bootimgs-x86 %dir %{_datadir}/%{name} %{_datadir}/%{name}/ipxe.iso %{_datadir}/%{name}/ipxe.usb @@ -263,7 +283,20 @@ done %{_datadir}/%{name}/ipxe-x86_64-rhcert.efi %endif +%ifarch aarch64 +%files bootimgs-aarch64 +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/arm64-efi +%if 0%{?fedora} +%{_datadir}/%{name}/arm64-efi/ipxe.efi +%endif +%{_datadir}/%{name}/arm64-efi/snponly.efi +%endif + %changelog +* Tue Mar 01 2022 Yaakov Selkowitz - 20181214-9.git133f4c47 +- Add ARM 64 EFI artifacts (bz 2059350) + * Fri Feb 19 2021 Jarod Wilson - 20181210-8.git133f4c47 - combine BIOS and EFI roms using utils/catrom.pl [lersek] (bz 1926561)