Annotation of /smage/trunk/core/grub/grub-2.00-r14.smage2
Parent Directory | Revision Log
Revision 9422 -
(hide annotations)
(download)
Tue Apr 4 08:48:35 2017 UTC (7 years, 2 months ago) by niro
File size: 6767 byte(s)
Tue Apr 4 08:48:35 2017 UTC (7 years, 2 months ago) by niro
File size: 6767 byte(s)
-do not strip any binaries to circumvent the no symbol table issue
1 | niro | 9421 | # $Id$ |
2 | |||
3 | PNAME="grub" | ||
4 | PVER="2.00" | ||
5 | PBUILD="r14" | ||
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 | niro | 9422 | # do not strip any symbols with binutils-2.27 and above |
67 | # which results in modules without symbol table | ||
68 | # see: https://lists.gnu.org/archive/html/grub-devel/2016-02/msg00014.html | ||
69 | # and: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1620678 | ||
70 | # patches are for 2.02 only | ||
71 | msetfeature "!strip" | ||
72 | |||
73 | niro | 9421 | src_prepare() |
74 | { | ||
75 | munpack ${SRCFILE} || die | ||
76 | cd ${SRCDIR} | ||
77 | |||
78 | # use /etc/conf.d/grub instead of /etc/default/grub | ||
79 | mpatch ${PNAME}-${PVER}-confd.patch || die | ||
80 | # cosmetic fixes | ||
81 | mpatch ${PNAME}-${PVER}-cosmetic.patch || die | ||
82 | # fix ftbfs with newer glibc (>= 2.16) | ||
83 | mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die | ||
84 | # fix ftbfs with newer freetype (>= 2.5) | ||
85 | mpatch ${PNAME}-${PVER}-freetype25.patch || die | ||
86 | # fix ftbfs with newer gcc (>= 6.1) | ||
87 | mpatch ${PNAME}-${PVER}-gcc6-grub-core-gettext-gettext.c-main_context-secondary_c.patch || die | ||
88 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set | ||
89 | mpatch ${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch | ||
90 | # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs | ||
91 | mpatch ${PNAME}-${PVER}-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die | ||
92 | |||
93 | # fixes some issues with busybox | ||
94 | mpatch ${PNAME}-${PVER}-busybox.patch || die | ||
95 | mpatch ${PNAME}-${PVER}-busybox-linux-install.patch || die | ||
96 | |||
97 | # add includedir() function to grub-mkconfig_lib | ||
98 | # includedir() includes all grub configuration snippets of given directory | ||
99 | mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die | ||
100 | mpatch ${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch || die | ||
101 | } | ||
102 | |||
103 | src_compile() | ||
104 | { | ||
105 | cd ${SRCDIR} | ||
106 | |||
107 | mconfigure --disable-efiemu --disable-werror --disable-nls || die | ||
108 | mmake || die | ||
109 | } | ||
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 | grub-mkdevicemap | ||
206 | fi | ||
207 | |||
208 | # needed by grub-mkconfig on the first run | ||
209 | if [[ ! -f /boot/grub/video.lst ]] | ||
210 | then | ||
211 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst | ||
212 | fi | ||
213 | |||
214 | # update grub.cfg | ||
215 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg | ||
216 | |||
217 | # install bootloader to disk | ||
218 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" | ||
219 | local bootdisk | ||
220 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" | ||
221 | |||
222 | # Generate core.img, but don't let it be installed in boot sector | ||
223 | grub-install --no-floppy "${bootdisk}" | ||
224 | fi | ||
225 | } |