Magellan Linux

Contents of /smage/trunk/core/grub/grub-2.02_rc2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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