Contents of /smage/trunk/core/grub/grub-2.00-r14.smage2
Parent Directory | Revision Log
Revision 9421 -
(show annotations)
(download)
Tue Apr 4 08:32:42 2017 UTC (7 years ago) by niro
File size: 6890 byte(s)
Tue Apr 4 08:32:42 2017 UTC (7 years ago) by niro
File size: 6890 byte(s)
-support modules without symbol table which happens if built with binutils-2.27 and above
1 | # $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}-binutils-2.27-support-modules-without-symbol-table.patch |
53 | mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch |
54 | mirror://${PNAME}/${PNAME}-${PVER}-alx-add-includedir-function.patch |
55 | mirror://${PNAME}/${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch |
56 | mirror://${PNAME}/${PNAME}-${PVER}-busybox-linux-install.patch |
57 | mirror://${PNAME}/${PNAME}-${PVER}-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch |
58 | ) |
59 | |
60 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
61 | |
62 | # grub doesn't like CFLAG optimation, |
63 | # and do you really want that at your bootloader ?? |
64 | unset CFLAGS |
65 | unset CXXFLAGS |
66 | |
67 | src_prepare() |
68 | { |
69 | munpack ${SRCFILE} || die |
70 | cd ${SRCDIR} |
71 | |
72 | # use /etc/conf.d/grub instead of /etc/default/grub |
73 | mpatch ${PNAME}-${PVER}-confd.patch || die |
74 | # cosmetic fixes |
75 | mpatch ${PNAME}-${PVER}-cosmetic.patch || die |
76 | # fix ftbfs with newer glibc (>= 2.16) |
77 | mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die |
78 | # fix ftbfs with newer freetype (>= 2.5) |
79 | mpatch ${PNAME}-${PVER}-freetype25.patch || die |
80 | # fix ftbfs with newer gcc (>= 6.1) |
81 | mpatch ${PNAME}-${PVER}-gcc6-grub-core-gettext-gettext.c-main_context-secondary_c.patch || die |
82 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set |
83 | mpatch ${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch |
84 | # support modules without symbol table, which happens if built with binutils-2.27 and above |
85 | # see: https://lists.gnu.org/archive/html/grub-devel/2016-02/msg00014.html |
86 | # and: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1620678 |
87 | mpatch ${PNAME}-${PVER}-binutils-2.27-support-modules-without-symbol-table.patch || die |
88 | # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs |
89 | mpatch ${PNAME}-${PVER}-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die |
90 | |
91 | # fixes some issues with busybox |
92 | mpatch ${PNAME}-${PVER}-busybox.patch || die |
93 | mpatch ${PNAME}-${PVER}-busybox-linux-install.patch || die |
94 | |
95 | # add includedir() function to grub-mkconfig_lib |
96 | # includedir() includes all grub configuration snippets of given directory |
97 | mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die |
98 | mpatch ${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch || die |
99 | } |
100 | |
101 | src_compile() |
102 | { |
103 | cd ${SRCDIR} |
104 | |
105 | mconfigure --disable-efiemu --disable-werror --disable-nls || die |
106 | mmake || die |
107 | } |
108 | |
109 | alx_generic_src_install() |
110 | { |
111 | cd ${SRCDIR} |
112 | |
113 | mmake DESTDIR=${BINDIR} install || die |
114 | |
115 | # not required by pretty name patch anymore |
116 | # set distribution |
117 | #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die |
118 | |
119 | # install only grub dir, no default config |
120 | minstalldir /boot/grub || die |
121 | |
122 | # remove debugging related files |
123 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die |
124 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die |
125 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die |
126 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die |
127 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die |
128 | |
129 | # docs |
130 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
131 | |
132 | # setup a proper grub default conf |
133 | minstalldir /etc/conf.d || die |
134 | mcinjectfile grub.confd /etc/conf.d/grub || die |
135 | # minstalldir /etc/conf.d/grub.d || die |
136 | # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die |
137 | |
138 | # # use custom creation scripts and delete the provided ones |
139 | # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT} |
140 | # local i |
141 | # for i in ${BINDIR}/etc/grub.d/10_linux \ |
142 | # ${BINDIR}/etc/grub.d/20_linux_xen \ |
143 | # ${BINDIR}/etc/grub.d/30_os-prober \ |
144 | # ${BINDIR}/etc/grub.d/40_custom \ |
145 | # ${BINDIR}/etc/grub.d/41_custom \ |
146 | # ${BINDIR}/etc/grub.d/README |
147 | # do |
148 | # if [[ -f ${i} ]] |
149 | # then |
150 | # rm ${i} || die |
151 | # fi |
152 | # done |
153 | # mcinjectexec 05_alx_header /etc/grub.d/ || die |
154 | # mcinjectexec 10_alx /etc/grub.d/ || die |
155 | |
156 | # only keep 10_linux script |
157 | for i in ${BINDIR}/etc/grub.d/20_linux_xen \ |
158 | ${BINDIR}/etc/grub.d/30_os-prober \ |
159 | ${BINDIR}/etc/grub.d/40_custom \ |
160 | ${BINDIR}/etc/grub.d/41_custom \ |
161 | ${BINDIR}/etc/grub.d/README |
162 | do |
163 | if [[ -f ${i} ]] |
164 | then |
165 | rm ${i} || die |
166 | fi |
167 | done |
168 | } |
169 | |
170 | preinstall_grub() |
171 | { |
172 | mount /boot &> /dev/null |
173 | |
174 | add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d |
175 | } |
176 | |
177 | postinstall_grub() |
178 | { |
179 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
180 | |
181 | # creates some essential links |
182 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
183 | |
184 | # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now |
185 | local i |
186 | for i in 30_alx_hwdetect 40_alx_reset 10-alx |
187 | do |
188 | if [ -f ${MROOT}/etc/grub/${i} ] |
189 | then |
190 | rm ${MROOT}/etc/grub/${i} |
191 | fi |
192 | done |
193 | if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ] |
194 | then |
195 | rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx |
196 | fi |
197 | |
198 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
199 | then |
200 | # create a device.map |
201 | if [[ ! -f /boot/grub/device.map ]] |
202 | then |
203 | grub-mkdevicemap |
204 | fi |
205 | |
206 | # needed by grub-mkconfig on the first run |
207 | if [[ ! -f /boot/grub/video.lst ]] |
208 | then |
209 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
210 | fi |
211 | |
212 | # update grub.cfg |
213 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg |
214 | |
215 | # install bootloader to disk |
216 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
217 | local bootdisk |
218 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
219 | |
220 | # Generate core.img, but don't let it be installed in boot sector |
221 | grub-install --no-floppy "${bootdisk}" |
222 | fi |
223 | } |