Magellan Linux

Contents of /smage/trunk/core/grub/grub-2.00-r14.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9423 - (show annotations) (download)
Tue Apr 4 09:28:45 2017 UTC (7 years, 2 months ago) by niro
File size: 6458 byte(s)
auto added: ver bump to 2.02_rc2-r1
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}-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 # 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 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 # 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 # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs
85 mpatch ${PNAME}-${PVER}-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die
86
87 # fixes some issues with busybox
88 mpatch ${PNAME}-${PVER}-busybox.patch || die
89 mpatch ${PNAME}-${PVER}-busybox-linux-install.patch || die
90
91 # add includedir() function to grub-mkconfig_lib
92 # includedir() includes all grub configuration snippets of given directory
93 mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die
94 mpatch ${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch || die
95 }
96
97 src_compile()
98 {
99 cd ${SRCDIR}
100
101 mconfigure --disable-efiemu --disable-werror --disable-nls || die
102 mmake || die
103 }
104
105 alx_generic_src_install()
106 {
107 cd ${SRCDIR}
108
109 mmake DESTDIR=${BINDIR} install || die
110
111 # not required by pretty name patch anymore
112 # set distribution
113 #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
114
115 # install only grub dir, no default config
116 minstalldir /boot/grub || die
117
118 # remove debugging related files
119 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
120 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
121 mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
122 mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
123 mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
124
125 # docs
126 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
127
128 # setup a proper grub default conf
129 minstalldir /etc/conf.d || die
130 mcinjectfile grub.confd /etc/conf.d/grub || die
131 # minstalldir /etc/conf.d/grub.d || die
132 # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
133
134 # # use custom creation scripts and delete the provided ones
135 # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
136 # local i
137 # for i in ${BINDIR}/etc/grub.d/10_linux \
138 # ${BINDIR}/etc/grub.d/20_linux_xen \
139 # ${BINDIR}/etc/grub.d/30_os-prober \
140 # ${BINDIR}/etc/grub.d/40_custom \
141 # ${BINDIR}/etc/grub.d/41_custom \
142 # ${BINDIR}/etc/grub.d/README
143 # do
144 # if [[ -f ${i} ]]
145 # then
146 # rm ${i} || die
147 # fi
148 # done
149 # mcinjectexec 05_alx_header /etc/grub.d/ || die
150 # mcinjectexec 10_alx /etc/grub.d/ || die
151
152 # only keep 10_linux script
153 for i in ${BINDIR}/etc/grub.d/20_linux_xen \
154 ${BINDIR}/etc/grub.d/30_os-prober \
155 ${BINDIR}/etc/grub.d/40_custom \
156 ${BINDIR}/etc/grub.d/41_custom \
157 ${BINDIR}/etc/grub.d/README
158 do
159 if [[ -f ${i} ]]
160 then
161 rm ${i} || die
162 fi
163 done
164 }
165
166 preinstall_grub()
167 {
168 mount /boot &> /dev/null
169
170 add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
171 }
172
173 postinstall_grub()
174 {
175 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
176
177 # creates some essential links
178 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
179
180 # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
181 local i
182 for i in 30_alx_hwdetect 40_alx_reset 10-alx
183 do
184 if [ -f ${MROOT}/etc/grub/${i} ]
185 then
186 rm ${MROOT}/etc/grub/${i}
187 fi
188 done
189 if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
190 then
191 rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
192 fi
193
194 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
195 then
196 # create a device.map
197 if [[ ! -f /boot/grub/device.map ]]
198 then
199 grub-mkdevicemap
200 fi
201
202 # needed by grub-mkconfig on the first run
203 if [[ ! -f /boot/grub/video.lst ]]
204 then
205 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
206 fi
207
208 # update grub.cfg
209 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
210
211 # install bootloader to disk
212 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
213 local bootdisk
214 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
215
216 # Generate core.img, but don't let it be installed in boot sector
217 grub-install --no-floppy "${bootdisk}"
218 fi
219 }