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