blob: b222f27b8acdd9a8624ab978c1187f74ded2d237 (
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
260
261
262
263
264
265
|
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=grub
pkgver=2.02
pkgrel=17
pkgdesc="Bootloader with support for Linux, Multiboot and more"
url="https://www.gnu.org/software/grub/"
arch="all !s390x"
license="GPL-3.0-or-later"
depends="mkinitfs"
triggers="grub.trigger=/boot"
depends_dev=""
makedepends="$depends_dev bison flex linux-headers xz-dev lvm2-dev
automake autoconf libtool python3 freetype-dev unifont"
install="$pkgname.post-upgrade"
# strip handled by grub Makefiles, abuild strip breaks xen pv-grub
options="!check !strip" # Cannot test boot loader.
subpackages="$pkgname-dev $pkgname-doc"
# currently grub only builds on x86*, aarch64 and ppc* systems
flavors=""
case "$CARCH" in
x86) flavors="efi bios";;
x86_64) flavors="efi bios xenhost xenhost_pvh";;
aarch64|arm*) flavors="efi";;
mips*) flavors="qemu_mips";;
ppc*) flavors="ieee1275"; makedepends="$makedepends powerpc-utils" ;;
s390x) flavors="emu" ;;
esac
for f in $flavors; do
[ x"$f" = x"xenhost_pvh" ] && continue # xenhost_pvh shipped in the xenhost subpackage
subpackages="$subpackages $pkgname-$f"
done
source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
fix-gcc-no-pie-specs.patch
grub2-accept-empty-module.patch
grub-xen-host_grub.cfg
2.02_beta3-mkconfig-alpine.patch
0008-Fix-packed-not-aligned-error-on-GCC-8.patch
0009-xfs-Accept-filesystem-with-sparse-inodes.patch
x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch
alpine-use-uuid.patch
f2fs-support.patch
alpine-intel-ucode.patch
alpine-xen-initramfs.patch
0001-xen-Add-some-Xen-headers.patch
0002-loader-linux-Support-passing-RSDP-address-via-boot-p.patch
0003-xen-Carve-out-grant-tab-initialization-into-dedicate.patch
0004-xen-Prepare-common-code-for-Xen-PVH-support.patch
0005-xen-Add-some-dummy-headers-for-PVH-mode.patch
0006-xen-Rearrange-xen-init.c-to-prepare-it-for-Xen-PVH-m.patch
0007-xen-Modify-grub_xen_ptr2mfn-for-Xen-PVH.patch
0008-xen-Add-PVH-specific-defines-to-offset.h.patch
0009-xen-Add-basic-hooks-for-PVH-in-current-code.patch
0010-xen-Add-PVH-boot-entry-code.patch
0011-xen-Setup-hypercall-page-for-PVH.patch
0012-xen-Get-memory-map-from-hypervisor-for-PVH.patch
0013-xen-Setup-Xen-specific-data-for-PVH.patch
0014-xen-Init-memory-regions-for-PVH.patch
0015-xen_pvh-Add-build-runes-for-grub-core.patch
0016-grub-module-verifier-Ignore-all_video-for-xen_pvh.patch
0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch
0018-xen_pvh-Support-building-a-standalone-image.patch
0019-xen_pvh-Support-grub-install-for-xen_pvh.patch
0020-xen_pvh-Add-support-to-configure.patch
"
builddir="$srcdir/grub-$pkgver"
prepare() {
default_prepare
PYTHON=python3 ./autogen.sh
}
_build_flavor() {
local flavor="$1"
shift
local _configure="$@"
msg "Building grub for platform $flavor"
mkdir -p "$srcdir"/build-$flavor
cd "$srcdir"/build-$flavor
$builddir/configure \
--build=$CBUILD \
--host=$CHOST \
--target=$CTARGET \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--disable-nls \
--disable-werror \
$_configure
make
}
build() {
local f
for f in $flavors; do
case "$f" in
bios) _build_flavor $f --with-platform=pc;;
efi) _build_flavor $f --with-platform=efi --disable-efiemu;;
xenhost) _build_flavor $f --with-platform=xen;;
xenhost_pvh) _build_flavor $f --with-platform=xen_pvh --target=i386;;
*) _build_flavor $f --with-platform=$f;;
esac
done
}
_install_xen() {
grub_dir=`mktemp -d`
cfg=`mktemp`
grub_memdisk=`mktemp`
mkdir -p $grub_dir/boot/grub
echo 'normal (memdisk)/grub.cfg' > $cfg
sed -e "s/@@PVBOOT_ARCH@@/$CARCH/g" \
$srcdir/grub-xen-host_grub.cfg \
> $grub_dir/grub.cfg
tar -cf - -C $grub_dir grub.cfg > $grub_memdisk
./grub-mkimage \
-O $CARCH-xen \
-c $cfg \
-d ./grub-core ./grub-core/*.mod \
-m $grub_memdisk \
-o $pkgdir/grub-$CARCH-xen.bin
rm -r "$grub_dir"
rm "$cfg" "$grub_memdisk"
}
_install_xenpvh() {
grub_dir=`mktemp -d`
cfg=`mktemp`
grub_memdisk=`mktemp`
mkdir -p $grub_dir/boot/grub
echo 'normal (memdisk)/grub.cfg' > $cfg
sed -e "s/@@PVBOOT_ARCH@@/$CARCH/g" \
$srcdir/grub-xen-host_grub.cfg \
> $grub_dir/grub.cfg
tar -cf - -C $grub_dir grub.cfg > $grub_memdisk
echo "About to run grub-mkimage in: $PWD"
# Note: only i386-xen_pvh supported
./grub-mkimage \
-O i386-xen_pvh \
-c $cfg \
-d ./grub-core ./grub-core/*.mod \
-m $grub_memdisk \
-o $pkgdir/grub-i386-xen_pvh.bin
rm -r "$grub_dir"
rm "$cfg" "$grub_memdisk"
}
_install_flavor() {
local flavor="$1"
cd "$srcdir"/build-$flavor
case $flavor in
xenhost) _install_xen;;
xenhost_pvh) _install_xenpvh;;
*) make DESTDIR="$pkgdir" install-strip;;
esac
}
package() {
# install BIOS & EFI version into the same directory
# and overwrite similar files.
for f in $flavors; do
_install_flavor $f
done
rm -f "$pkgdir"/usr/lib/charset.alias
# remove grub-install warning of missing directory
mkdir -p "$pkgdir"/usr/share/locale
mkdir -p "$pkgdir"/etc/default/
cat >"$pkgdir"/etc/default/grub <<-EOF
GRUB_DISTRIBUTOR="Alpine"
GRUB_TIMEOUT=2
GRUB_DISABLE_SUBMENU=y
GRUB_DISABLE_RECOVERY=true
EOF
}
bios() {
pkgdesc="$pkgdesc (BIOS version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-pc $subpkgdir/usr/lib/grub/
}
efi() {
pkgdesc="$pkgdesc (EFI version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-efi $subpkgdir/usr/lib/grub/
}
xenhost() {
pkgdesc="$pkgdesc (XEN host version)"
mkdir -p $subpkgdir/usr/lib/grub-xen
mv $pkgdir/*-xen.bin $subpkgdir/usr/lib/grub-xen/
# pick up result from xenhost_pvh build as well
mv $pkgdir/*-xen_pvh.bin $subpkgdir/usr/lib/grub-xen/
}
qemu_mips() {
pkgdesc="$pkgdesc (QEMU MIPS version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-qemu_mips $subpkgdir/usr/lib/grub/
}
ieee1275() {
pkgdesc="$pkgdesc (IEEE1275 version)"
depends="$pkgname powerpc-utils"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-ieee1275 $subpkgdir/usr/lib/grub/
}
emu() {
pkgdesc="$pkgdesc (EMU version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-emu $subpkgdir/usr/lib/grub/
}
sha512sums="cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 grub-2.02.tar.xz
f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch
098a1742aef131c85d63b934a9815879b991f2e73030cb90ac4b5dcd07d249fa0dd0a281e52ada0e10f05d59223493bd416eb47543242bf0ba336a0ebc9b2a1a grub2-accept-empty-module.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
065453d336d3c6a2943690faab7d05c09ac307bc360957976a08d88d6a57742dd068a6839bcb31c7dbb703d3ef19ae2f7f44844f1bef2a1a6c19a871544bddb5 2.02_beta3-mkconfig-alpine.patch
088455205f2f397d60e43eab19ed73994880ea1f442661f7975846cceaf2b112d92fd1341119d7dbfad3af2174dfd4d4721f31dead1ac35f4a3cb7c0d92f8a04 0008-Fix-packed-not-aligned-error-on-GCC-8.patch
4723c5dd9fd6e9b6c8677e32e4906c7995d695c7e85e834b1b29eb1d9a024678f8fa75846c7b929d1db9b5911b604c69c1b0379cb3b9adc98d5bb6d6719eb2c4 0009-xfs-Accept-filesystem-with-sparse-inodes.patch
e11f62b5012ecc8abf9d4912db12a263470887671b05ccb4de54981fb3b32a52d4557439a160e69e0654e35a57fdb0afd5fe801709b8037a6ea4a50d8b8455ec x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch
ce788fa909bb89a3ccabbc144bb46226373cf846ffe1f315b0bf8b02403220d95c8fe67baf3c37c4e12cb36f22d70f62bbd2d0c5ff6b7230f05e5964b5c548ac alpine-use-uuid.patch
e4e7716cef9f183810eade57751617595c5d5fac740223a5ac3ed13e2215bbb38781328a3f8da3d4c71dd39ffec55d27d3e55b55c189dce55748e9a8512d4b41 f2fs-support.patch
ef30930acf817cb2d3721c78f89976a706b502419843ecbf938983a2076ee6a812fb914eb8d74014054b356325c0a72ae3f4416c4b22e5e86ebd8200304446d5 alpine-intel-ucode.patch
e683a647757956349c25e3c4e0be8d2e4f78287ba588c497f21942677b207f33a33fa4293cbe71665760dd31b752af02e1353896858cdb2f8d4368116878d5b1 alpine-xen-initramfs.patch
9daf00b36108852a7443ce4b5b1114d2e87cbfc72148b7847508965ff0dfab14b3f56980a0110c82170f5c2b75ef7a337a15398f59a4cb7e6404227499bffd9a 0001-xen-Add-some-Xen-headers.patch
33505273a8525aa4b44acba69f1b7f0dbee144809fb86626879895d44ce7eed889abf442644fc96536b4ebf86ab7c84a982749fc1181976e89e59a5cf7f7944e 0002-loader-linux-Support-passing-RSDP-address-via-boot-p.patch
1e446051930a96078e2b22831f53e939affdcee371e35e45d87efb8bdf02e2eea03247b7636525daf7d9306ec47cd4351e4d74abe357d19658b0b3fc884f9343 0003-xen-Carve-out-grant-tab-initialization-into-dedicate.patch
ceba427cdfc7e4566a0b9ba7ab1f7d52136510938a3789f0bddbabd45f7b3ccdd39e143d2b19a39ceae2348f08a0af92fd8297788828565571ec1a2491c11768 0004-xen-Prepare-common-code-for-Xen-PVH-support.patch
d185926d2e70cfa4d78a929d05932e2603cf9fa728c1afae7119bd26a9d60d9a769a560bab79b65b0733c7861e2907424542352019b3c6edf0a58be367573ba9 0005-xen-Add-some-dummy-headers-for-PVH-mode.patch
501cea14809a88ff11c81a325063b04c4f75efb490b7acaf6ca1435d98d24b3bcd8fd3b0df76a3e7200561c5020d299bb4ffb178f85f3e88bd18ba4ec656260f 0006-xen-Rearrange-xen-init.c-to-prepare-it-for-Xen-PVH-m.patch
8afefbecce41fb67a47c04fc3a068f3fae36f424746bd09298cbf774620dcf8493f366e66cd554c9112bbc18d31a09be5b5f6ed78d422d861873cf03755b7ddd 0007-xen-Modify-grub_xen_ptr2mfn-for-Xen-PVH.patch
e18e0e58ff325f2e50bf1625d4befe42e9e66d271563bbeabe7f0abacd3499b858ff2a827256cf0726f629d8a944a60dcd1d620a5f0823f44613d88f86cd41ed 0008-xen-Add-PVH-specific-defines-to-offset.h.patch
5337a029b5ae11d04a8c821baf15c360f35bf49892ff3c97e1c4b36775e4918feea6188850ecb99275ebf2cd4630ea887007e568a0743661f31663d5b9a4e3dd 0009-xen-Add-basic-hooks-for-PVH-in-current-code.patch
cc84a610e07180d732691163c08fc8de3252a6f23af4ec739ef18192c9bd8cdee60252bebcf2c224ef296f3accc86f9d57dde0f2069536ce1d4c203ab56166e2 0010-xen-Add-PVH-boot-entry-code.patch
0bc6becfd10c2948980e305268906d009729fb0795b9f7ef3a80ae169728461faa2582444cfad40f2c6063dd3a82ee5a030be092cba65833a7ab30feba147e43 0011-xen-Setup-hypercall-page-for-PVH.patch
49e146a955fb41e8dbb8cef9c1d321737d2646d0f4ac686a054a0e70db05879367e0110ee74690cff3357791397f1c86262311335a41fd81de15db722fe0f58d 0012-xen-Get-memory-map-from-hypervisor-for-PVH.patch
47b8572a1778ccf5221a5a0b7880e4f4bd86a03b5716b13444b5e8f7a4059c9b5cd6a01ddd29ca78fe89c0599d7ee018728979bce4771e7ca4420c14f8855dd7 0013-xen-Setup-Xen-specific-data-for-PVH.patch
e7f1311ed679dfd969225af91293a046fced7c046afcaa716f54b8cb18dbbe364d471e6b493d686cf8b63651e7e3a89b8c31ddc7457581117ebacafce3ceaea9 0014-xen-Init-memory-regions-for-PVH.patch
45d14b87a949ce5f1d63ba5cd0048205d94359d23d3f230017b7f6de6e5d25388b2d1af06b8f32fe187adfde2d3ef30e7100e6624f6201cb9d8365bd0a742ddb 0015-xen_pvh-Add-build-runes-for-grub-core.patch
fe7ea6eeab330c0fdfd0b2a858acdff88c68f69d80b9abb21b4c3cd1d18f8717ab7c47729e28857c564c4c1427d9b1ce6b9b93643507717a8f5ec2d99c843c70 0016-grub-module-verifier-Ignore-all_video-for-xen_pvh.patch
3e78cd3cd1c70236d8e9e3a536eb2f887283b5d257f60533d22d093df76c1c3c60e490acae4b738301c87edbac2e27398fce6ddbbeb9b2f193191c76afb9bd8b 0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch
c8a16db1224c9fb4a26ef39fbd8c36bf26ff68d45d88fb4e2530369c5bccadf0208551c34c0d16e9ee4a3102d67edad26a46e7b8388222f530310762246df8ef 0018-xen_pvh-Support-building-a-standalone-image.patch
b00cb9146cadc1f48586dcab31ac4605d9591d860283000accf709a489f136bf5c8fe3351dbefe51f9e27407ca3f1ce5dd7bc2ac64ac826f593183ef5d3a9759 0019-xen_pvh-Support-grub-install-for-xen_pvh.patch
78bc31b69cde95a29b365b43898caf69238c036683a26e5448d66cd48c7a4906d2a9eff065f082c5300b72616d6e63033891fd75d59ce724759dc998d9942a37 0020-xen_pvh-Add-support-to-configure.patch"
|