blob: 3168d3aa0cf711499d61aa7582f2fb9bd0043cfd (
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
|
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=grub
pkgver=2.04
pkgrel=0
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 gettext-dev"
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
grub-xen-host_grub.cfg
alpine-mkconfig.patch
lang-C.UTF-8.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="9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb grub-2.04.tar.xz
f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
84d9694af384336c0846faad968a63b154e2bd957671fa7c0163c36e20fd086a8d5b67ddf5eb983a11a69f65dac52668d0f51537e7cfe9a1ea9bca7aba91f20b alpine-mkconfig.patch
f23702741f2a37c83d0cbf16a000a6229dfd433cd583f3254d523ce35b3668c1db2d8a704a75013e74655ec4f9da5db6b630aa92e3ca5cc47df44cc9e41d1806 lang-C.UTF-8.patch"
|