Magellan Linux

Annotation of /smage/trunk/core/grub/grub-2.04-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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