summaryrefslogtreecommitdiff
path: root/ipxe.spec
blob: 20956b32a744cc130366fe01c35491471338571d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
%global formats rom
%global qemuroms 10222000 10ec8029 8086100e 10ec8139 1af41000 80861209 808610d3 15ad07b0
%global buildarches x86_64
%global debug_package %{nil}
%global enable_i386 0

Name:                ipxe
Version:             1.21.1
Release:             5
Summary:             A network boot loader
Epoch:               1
License:             GPLv2 with additional permissions and BSD
URL:                 http://ipxe.org/
Source0:             https://github.com/ipxe/ipxe/archive/v%{version}.tar.gz
Patch0001:           0001-build-customize-configuration.patch
Patch0002:           0002-Use-spec-compliant-timeouts.patch
Patch0003:           0003-librm-Use-explicit-operand-size-when-pushing-a-label.patch

Patch6000:           backport-avoid-infinite-loop-on-allocation-failure-in.patch
Patch6001:           backport-ensure-that-pci_read_config-initialises-all-fields.patch
Patch6002:           backport-do-not-clear-current-working-url-when-executing-embedded-image.patch
Patch6003:           backport-retain-original-encodings-for-path-query-and-fragment-fields.patch
Patch6004:           backport-allow-for-relative-uris-that-include-colons-within-the-path.patch

%ifarch %{buildarches}
BuildRequires:       perl-interpreter perl-Getopt-Long syslinux mtools genisoimage edk2-devel
BuildRequires:       xz-devel gcc binutils-devel
Obsoletes: gpxe <= 1.0.1

%package bootimgs
Summary: Network boot loader images in bootable USB, CD, floppy and GRUB formats
BuildArch: noarch
Obsoletes: gpxe-bootimgs <= 1.0.1

%package roms
Summary: Network boot loader roms in .rom format
Requires: %{name}-roms-qemu = %{epoch}:%{version}-%{release}
BuildArch: noarch
Obsoletes: gpxe-roms <= 1.0.1

%package roms-qemu
Summary: Network boot loader roms supported by QEMU, .rom format
BuildArch: noarch
Obsoletes: gpxe-roms-qemu <= 1.0.1

%description bootimgs
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 boot images in USB, CD, floppy, and PXE
UNDI formats.

%description roms
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 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
DNS, HTTP, iSCSI, etc.

This package contains the iPXE ROMs for devices emulated by QEMU, in
.rom format.
%endif

%description
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.

%prep
%setup -q -n %{name}-%{version}
%autopatch -p1


%build
%ifarch %{buildarches}
cd src

rm -rf drivers/net/ath/ath9k

make_ipxe() {
    make %{?_smp_mflags} \
        NO_WERROR=1 V=1 \
        GITVERSION=%{hash} \
        "$@"
}

make_ipxe bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi bin-x86_64-linux/tests.linux \
          %if 0%{?enable i386}
          bin-i386-linux/tests.linux
          %endif

make_ipxe ISOLINUX_BIN=/usr/share/syslinux/isolinux.bin \
    bin/undionly.kpxe bin/ipxe.{dsk,iso,usb,lkrn} \
    allroms

mkdir bin-combined
for rom in %{qemuroms}; do
  make_ipxe CONFIG=qemu bin/${rom}.rom
%if 0%{?enable_i386}
  make_ipxe CONFIG=qemu bin-i386-efi/${rom}.efidrv
%endif
  make_ipxe CONFIG=qemu bin-x86_64-efi/${rom}.efidrv
  vid="0x${rom%%????}"
  did="0x${rom#????}"
  EfiRom -f "$vid" -i "$did" --pci23 \
         -b  bin/${rom}.rom \
%if 0%{?enable_i386}
         -ec bin-i386-efi/${rom}.efidrv \
%endif
         -ec bin-x86_64-efi/${rom}.efidrv \
         -o  bin-combined/${rom}.rom
  EfiRom -d  bin-combined/${rom}.rom
  truncate -s \>256K bin-combined/${rom}.rom
  test $(stat -c '%s' bin-combined/${rom}.rom) -le $((256 * 1024))
done

%endif

%install
%ifarch %{buildarches}
mkdir -p %{buildroot}/%{_datadir}/%{name}/
mkdir -p %{buildroot}/%{_datadir}/%{name}.efi/
pushd src/bin/

cp -a undionly.kpxe ipxe.{iso,usb,dsk,lkrn} %{buildroot}/%{_datadir}/%{name}/

for fmt in %{formats};do
 for img in *.${fmt};do
      if [ -e $img ]; then
   cp -a $img %{buildroot}/%{_datadir}/%{name}/
   echo %{_datadir}/%{name}/$img >> ../../${fmt}.list
  fi
 done
done
popd

cp -a src/bin-i386-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-i386.efi
cp -a src/bin-x86_64-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-x86_64.efi

for fmt in rom ;do
 for rom in %{qemuroms} ; do
  sed -i -e "/\/${rom}.${fmt}/d" ${fmt}.list
  echo %{_datadir}/%{name}/${rom}.${fmt} >> qemu.${fmt}.list
 done
done
for rom in %{qemuroms}; do
  cp src/bin-combined/${rom}.rom %{buildroot}/%{_datadir}/%{name}.efi/
  echo %{_datadir}/%{name}.efi/${rom}.rom >> qemu.rom.list
done
%endif

%check
%ifarch %{buildarches}
cd ~/rpmbuild/BUILD/%{name}-%{version}/src/bin-x86_64-linux/
./tests.linux
%if 0%{?enable_i386}
cd ~/rpmbuild/BUILD/%{name}-%{version}/src/bin-i386-linux/
./tests.linux
%endif
%endif

%ifarch %{buildarches}
%files bootimgs
%defattr(-,root,root)
%license COPYING COPYING.GPLv2 COPYING.UBDL
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/ipxe.iso
%{_datadir}/%{name}/ipxe.usb
%{_datadir}/%{name}/ipxe.dsk
%{_datadir}/%{name}/ipxe.lkrn
%{_datadir}/%{name}/ipxe-i386.efi
%{_datadir}/%{name}/ipxe-x86_64.efi
%{_datadir}/%{name}/undionly.kpxe

%files roms -f rom.list
%defattr(-,root,root)
%license COPYING COPYING.GPLv2 COPYING.UBDL
%dir %{_datadir}/%{name}

%files roms-qemu -f qemu.rom.list
%defattr(-,root,root)
%license COPYING COPYING.GPLv2 COPYING.UBDL
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}.efi
%endif

%changelog
* Fri Mar 15 2024 herengui <herengui@kylinsec.com.cn> - 1:1.21.1-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix errors when compiling with binutils-2.41

* Wed Nov 23 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 1:1.21.1-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:[pci] Ensure that pci_read_config() initialises all fields
       [image] Do not clear current working URI when executing embedded image
       [uri] Retain original encodings for path, query, and fragment fields
       [uri] Allow for relative URIs that include colons within the path

* Sat Mar 26 2022 wangkerong <wangkerong@h-partners.com> - 1.21.1-3
- enable test 

* Wed Jun 09 2021 wangkerong <wangkerong@huawei.com> - 1.21.1-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC: round commmunity patch fix Avoid infinite loop on allocation failure

* Wed Feb 03 2021 gaihuiying <gaihuiying1@huawei.com> - 1.21.1-1
- Type:requirement
- Id:NA
- SUG:NA
- DESC: update ipxe to 1.21.1

* Thu Sep 03 2020 zhouyihang <zhouyihang3@huawei.com> - 1.20.1-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC: add epoch for roms-qemu when required by roms

* Tue Jun 23 2020 zhujunhao <zhujunhao8@huawei.com> - 1.20.1-1
- update to 1.20.1

* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 20190125-5
- Type:bugfix
- Id:NA
- SUG:NA
- DESC: add bootimgs roms roms-qemu subpackages

* Fri Nov 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190125-4
- Type:bugfix
- Id:NA
- SUG:NA
- DESC: fix build error on x86_64

* Sat Oct 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190125-3
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:change the directory of the license files

* Thu Oct 10 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190125-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add requires

* Thu Sep 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190125-1
- Package init