Annotation of /smage/trunk/core/grub/grub-2.04-r1.smage2
Parent Directory | Revision Log
Revision 14413 -
(hide annotations)
(download)
Mon Jul 13 15:18:48 2020 UTC (3 years, 10 months ago) by niro
File size: 5960 byte(s)
Mon Jul 13 15:18:48 2020 UTC (3 years, 10 months ago) by niro
File size: 5960 byte(s)
-marked disabled
1 | niro | 14268 | # $Id$ |
2 | |||
3 | PNAME="grub" | ||
4 | PVER="2.04" | ||
5 | PBUILD="r1" | ||
6 | |||
7 | niro | 14413 | STATE="disabled" |
8 | niro | 14268 | PCAT="sys-apps" |
9 | |||
10 | DESCRIPTION="GNU GRUB2 boot loader." | ||
11 | HOMEPAGE="http://www.gnu.org/software/grub/" | ||
12 | |||
13 | DEPEND=">= sys-apps/mage-release-1 | ||
14 | >= sys-libs/ncurses-6.2 | ||
15 | >= sys-libs/zlib-1.2 | ||
16 | >= media-libs/freetype-2.9 | ||
17 | >= sys-fs/device-mapper-2.03" | ||
18 | |||
19 | SDEPEND=">= sys-libs/ncurses-dev-6.2 | ||
20 | >= sys-libs/zlib-dev-1.2 | ||
21 | >= media-libs/freetype-dev-2.9" | ||
22 | |||
23 | SRCFILE="${PNAME}-${PVER/_/\~}.tar.gz" | ||
24 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER/_/\~}" | ||
25 | |||
26 | ALX_PKG_KEEP="boot/grub | ||
27 | etc/conf.d | ||
28 | etc/grub.d | ||
29 | usr/sbin/grub-bios-setup | ||
30 | usr/sbin/grub-install | ||
31 | usr/sbin/grub-mkconfig | ||
32 | usr/sbin/grub-probe | ||
33 | usr/sbin/grub-reboot | ||
34 | usr/sbin/grub-set-default | ||
35 | usr/bin/grub-mkimage | ||
36 | usr/bin/grub-editenv | ||
37 | usr/bin/grub-mkrelpath | ||
38 | usr/bin/grub-script-check | ||
39 | usr/share/grub/grub-mkconfig_lib | ||
40 | usr/$(mlibdir)/grub/i386-pc" | ||
41 | sminclude mtools alx-split | ||
42 | |||
43 | # += to add injection files (alx.sminc) | ||
44 | SRC_URI+=( | ||
45 | gnu://${PNAME}/${SRCFILE} | ||
46 | mirror://${PNAME}/${SRCFILE} | ||
47 | niro | 14269 | mirror://${PNAME}/${PNAME}-2.04-confd.patch |
48 | niro | 14268 | mirror://${PNAME}/${PNAME}-2.02-cosmetic.patch |
49 | mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch | ||
50 | mirror://${PNAME}/${PNAME}-2.00-alx-add-includedir-function.patch | ||
51 | niro | 14269 | mirror://${PNAME}/${PNAME}-2.04-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch |
52 | niro | 14268 | ) |
53 | |||
54 | UP2DATE="updatecmd_gnu ${PNAME} gz" | ||
55 | |||
56 | # grub doesn't like CFLAG optimation, | ||
57 | # and do you really want that at your bootloader ?? | ||
58 | unset CFLAGS | ||
59 | unset CXXFLAGS | ||
60 | niro | 14272 | unset CPPFLAGS |
61 | unset LDFLAGS | ||
62 | unset MAKEFLAGS | ||
63 | niro | 14268 | |
64 | src_prepare() | ||
65 | { | ||
66 | munpack ${SRCFILE} || die | ||
67 | cd ${SRCDIR} | ||
68 | |||
69 | # use /etc/conf.d/grub instead of /etc/default/grub | ||
70 | niro | 14269 | mpatch ${PNAME}-2.04-confd.patch || die |
71 | niro | 14268 | # cosmetic fixes |
72 | mpatch ${PNAME}-2.02-cosmetic.patch || die | ||
73 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set | ||
74 | mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch | ||
75 | # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs | ||
76 | niro | 14269 | mpatch ${PNAME}-2.04-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die |
77 | niro | 14268 | |
78 | # add includedir() function to grub-mkconfig_lib | ||
79 | # includedir() includes all grub configuration snippets of given directory | ||
80 | mpatch ${PNAME}-2.00-alx-add-includedir-function.patch || die | ||
81 | } | ||
82 | |||
83 | src_compile() | ||
84 | { | ||
85 | cd ${SRCDIR} | ||
86 | |||
87 | niro | 14272 | local myarch |
88 | local myopts | ||
89 | niro | 14271 | |
90 | niro | 14272 | # no efiemi on x86 |
91 | case ${ARCH} in | ||
92 | x86_64) myopts+=" --enable-efiemu" ;; | ||
93 | i*86) myopts+=" --disable-efiemu" ;; | ||
94 | esac | ||
95 | |||
96 | # disable werror | ||
97 | myopts+=" --disable-werror" | ||
98 | |||
99 | # enable boot time statistics collection | ||
100 | myopts+=" --enable-boot-time" | ||
101 | |||
102 | # alx | ||
103 | myopts+=" --disable-nls" | ||
104 | |||
105 | # bios build, enforce i386 | ||
106 | myarch="i386" | ||
107 | niro | 14275 | mconfigure --with-platform=pc --target="${myarch}" ${myopts} || die |
108 | make || die | ||
109 | niro | 14268 | } |
110 | |||
111 | alx_generic_src_install() | ||
112 | { | ||
113 | cd ${SRCDIR} | ||
114 | |||
115 | mmake DESTDIR=${BINDIR} install || die | ||
116 | |||
117 | # not required by pretty name patch anymore | ||
118 | # set distribution | ||
119 | #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die | ||
120 | |||
121 | # install only grub dir, no default config | ||
122 | minstalldir /boot/grub || die | ||
123 | |||
124 | # remove debugging related files | ||
125 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die | ||
126 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die | ||
127 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die | ||
128 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die | ||
129 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die | ||
130 | |||
131 | # docs | ||
132 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die | ||
133 | |||
134 | # setup a proper grub default conf | ||
135 | minstalldir /etc/conf.d || die | ||
136 | mcinjectfile grub.confd /etc/conf.d/grub || die | ||
137 | # minstalldir /etc/conf.d/grub.d || die | ||
138 | # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die | ||
139 | |||
140 | # # use custom creation scripts and delete the provided ones | ||
141 | # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT} | ||
142 | # local i | ||
143 | # for i in ${BINDIR}/etc/grub.d/10_linux \ | ||
144 | # ${BINDIR}/etc/grub.d/20_linux_xen \ | ||
145 | # ${BINDIR}/etc/grub.d/30_os-prober \ | ||
146 | # ${BINDIR}/etc/grub.d/40_custom \ | ||
147 | # ${BINDIR}/etc/grub.d/41_custom \ | ||
148 | # ${BINDIR}/etc/grub.d/README | ||
149 | # do | ||
150 | # if [[ -f ${i} ]] | ||
151 | # then | ||
152 | # rm ${i} || die | ||
153 | # fi | ||
154 | # done | ||
155 | # mcinjectexec 05_alx_header /etc/grub.d/ || die | ||
156 | # mcinjectexec 10_alx /etc/grub.d/ || die | ||
157 | |||
158 | # only keep 10_linux script | ||
159 | for i in ${BINDIR}/etc/grub.d/20_linux_xen \ | ||
160 | ${BINDIR}/etc/grub.d/30_os-prober \ | ||
161 | ${BINDIR}/etc/grub.d/40_custom \ | ||
162 | ${BINDIR}/etc/grub.d/41_custom \ | ||
163 | ${BINDIR}/etc/grub.d/README | ||
164 | do | ||
165 | if [[ -f ${i} ]] | ||
166 | then | ||
167 | rm ${i} || die | ||
168 | fi | ||
169 | done | ||
170 | } | ||
171 | |||
172 | preinstall_grub() | ||
173 | { | ||
174 | mount /boot &> /dev/null | ||
175 | |||
176 | add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d | ||
177 | } | ||
178 | |||
179 | postinstall_grub() | ||
180 | { | ||
181 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub | ||
182 | |||
183 | # creates some essential links | ||
184 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot | ||
185 | |||
186 | # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now | ||
187 | local i | ||
188 | for i in 30_alx_hwdetect 40_alx_reset 10-alx | ||
189 | do | ||
190 | if [ -f ${MROOT}/etc/grub/${i} ] | ||
191 | then | ||
192 | rm ${MROOT}/etc/grub/${i} | ||
193 | fi | ||
194 | done | ||
195 | if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ] | ||
196 | then | ||
197 | rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx | ||
198 | fi | ||
199 | |||
200 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] | ||
201 | then | ||
202 | # create a device.map | ||
203 | if [[ ! -f /boot/grub/device.map ]] | ||
204 | then | ||
205 | if [[ -x $(type -P grub-mkdevicemap) ]] | ||
206 | then | ||
207 | grub-mkdevicemap | ||
208 | fi | ||
209 | fi | ||
210 | |||
211 | # needed by grub-mkconfig on the first run | ||
212 | if [[ ! -f /boot/grub/video.lst ]] | ||
213 | then | ||
214 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst | ||
215 | fi | ||
216 | |||
217 | # update grub.cfg | ||
218 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg | ||
219 | |||
220 | # install bootloader to disk | ||
221 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" | ||
222 | local bootdisk | ||
223 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" | ||
224 | |||
225 | # Generate core.img, but don't let it be installed in boot sector | ||
226 | grub-install --no-floppy "${bootdisk}" | ||
227 | fi | ||
228 | } |