Gentoo Archives: gentoo-commits

From: "Richard Yao (ryao)" <ryao@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/grub: grub-0.97-r11.ebuild ChangeLog
Date: Tue, 29 May 2012 09:48:17
Message-Id: 20120529094800.2E8472004B@flycatcher.gentoo.org
1 ryao 12/05/29 09:48:00
2
3 Modified: ChangeLog
4 Added: grub-0.97-r11.ebuild
5 Log:
6 Add xarthisius' patch for bug #360513 to GRUB 0.97 patchset, reviewed by myself and jdhore, approved by Chainsaw in IRC
7
8 (Portage version: 2.1.10.49/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.204 sys-boot/grub/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.204&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.204&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?r1=1.203&r2=1.204
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v
20 retrieving revision 1.203
21 retrieving revision 1.204
22 diff -u -r1.203 -r1.204
23 --- ChangeLog 18 May 2012 15:01:23 -0000 1.203
24 +++ ChangeLog 29 May 2012 09:48:00 -0000 1.204
25 @@ -1,6 +1,12 @@
26 # ChangeLog for sys-boot/grub
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.203 2012/05/18 15:01:23 josejx Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.204 2012/05/29 09:48:00 ryao Exp $
30 +
31 +*grub-0.97-r11 (29 May 2012)
32 +
33 + 29 May 2012; Richard Yao <ryao@g.o> +grub-0.97-r11.ebuild:
34 + Add xarthisius' patch for bug #360513 to GRUB 0.97 patchset, reviewed by
35 + myself and jdhore, approved by Chainsaw in IRC
36
37 18 May 2012; Joseph Jezak <josejx@g.o> grub-1.99-r2.ebuild,
38 grub-2.00_beta5.ebuild, grub-9999.ebuild:
39
40
41
42 1.1 sys-boot/grub/grub-0.97-r11.ebuild
43
44 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-0.97-r11.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-0.97-r11.ebuild?rev=1.1&content-type=text/plain
46
47 Index: grub-0.97-r11.ebuild
48 ===================================================================
49 # Copyright 1999-2012 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r11.ebuild,v 1.1 2012/05/29 09:48:00 ryao Exp $
52
53 # XXX: we need to review menu.lst vs grub.conf handling. We've been converting
54 # all systems to grub.conf (and symlinking menu.lst to grub.conf), but
55 # we never updated any of the source code (it still all wants menu.lst),
56 # and there is no indication that upstream is making the transition.
57
58 # If you need to roll a new grub-static distfile, here is how.
59 # - Robin H. Johnson <robbat2@g.o> - 29 Nov 2010
60 # USE='static -ncurses -netboot -custom-cflags' \
61 # GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
62 # grub-${PVR}.ebuild package && \
63 # cp -f ${PKGDIR}/${CAT}/${PF}.tbz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
64
65 inherit mount-boot eutils flag-o-matic toolchain-funcs autotools linux-info pax-utils
66
67 PATCHVER="1.12" # Should match the revision ideally
68 DESCRIPTION="GNU GRUB Legacy boot loader"
69 HOMEPAGE="http://www.gnu.org/software/grub/"
70 SRC_URI="mirror://gentoo/${P}.tar.gz
71 mirror://gnu-alpha/${PN}/${P}.tar.gz
72 mirror://gentoo/splash.xpm.gz
73 mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
74
75 LICENSE="GPL-2"
76 SLOT="0"
77 KEYWORDS="~amd64 ~x86 ~x86-fbsd"
78 IUSE="custom-cflags ncurses netboot static"
79
80 RDEPEND="ncurses? (
81 >=sys-libs/ncurses-5.2-r5
82 amd64? ( app-emulation/emul-linux-x86-baselibs )
83 )"
84 DEPEND="${RDEPEND}"
85
86 pkg_setup() {
87 local arch="$(tc-arch)"
88 case ${arch} in
89 amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
90 esac
91 }
92
93 src_unpack() {
94 unpack ${A}
95 cd "${S}"
96
97 # patch breaks booting for some people #111885
98 rm "${WORKDIR}"/patch/400_*reiser4*
99
100 # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
101 # discovered in bug 160801. We can change this, however, using larger values
102 # for this variable means that Grub needs more memory to run and boot. For a
103 # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
104 # value in make.conf, it is possible to make kernels ~16Mb in size, but it
105 # needs the kitchen sink built-in.
106 local t="custom"
107 if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
108 case $(tc-arch) in
109 amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
110 x86) GRUB_MAX_KERNEL_SIZE=5 ;;
111 esac
112 t="default"
113 fi
114 einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
115
116 sed -i \
117 -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
118 "${S}"/grub/asmstub.c \
119 || die "Failed to hack memory size"
120
121 if [[ -n ${PATCHVER} ]] ; then
122 EPATCH_SUFFIX="patch"
123 epatch "${WORKDIR}"/patch
124 eautoreconf
125 fi
126 }
127
128 src_compile() {
129 filter-flags -fPIE #168834
130
131 use amd64 && multilib_toolchain_setup x86
132
133 unset BLOCK_SIZE #73499
134
135 ### i686-specific code in the boot loader is a bad idea; disabling to ensure
136 ### at least some compatibility if the hard drive is moved to an older or
137 ### incompatible system.
138
139 # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
140 # but the objcopy's (faulty) test fails if -fstack-protector is default.
141 # create a cache telling configure that objcopy is ok, and add -C to econf
142 # to make use of the cache.
143 #
144 # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
145 # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
146 # -fno-stack-protector detected by configure, removed from netboot's emake.
147 use custom-cflags || unset CFLAGS
148
149 export grub_cv_prog_objcopy_absolute=yes #79734
150 use static && append-ldflags -static
151
152 # Per bug 216625, the emul packages do not provide .a libs for performing
153 # suitable static linking
154 if use amd64 && use static ; then
155 if [ -z "${GRUB_STATIC_PACKAGE_BUILDING}" ]; then
156 die "You must use the grub-static package if you want a static Grub on amd64!"
157 else
158 eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
159 eerror "is specifically intended for building the tarballs for the"
160 eerror "grub-static package via USE='static -ncurses'."
161 eerror "All bets are now off."
162 ebeep 10
163 fi
164 fi
165
166 # build the net-bootable grub first, but only if "netboot" is set
167 if use netboot ; then
168 econf \
169 --libdir=/lib \
170 --datadir=/usr/lib/grub \
171 --exec-prefix=/ \
172 --disable-auto-linux-mem-opt \
173 --enable-diskless \
174 --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
175 --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
176 --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
177 --enable-{tulip,via-rhine,w89c840} || die "netboot econf failed"
178
179 emake w89c840_o_CFLAGS="-O" || die "making netboot stuff"
180
181 mv -f stage2/{nbgrub,pxegrub} "${S}"/
182 mv -f stage2/stage2 stage2/stage2.netboot
183
184 make clean || die "make clean failed"
185 fi
186
187 # Now build the regular grub
188 # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
189 econf \
190 --libdir=/lib \
191 --datadir=/usr/lib/grub \
192 --exec-prefix=/ \
193 --disable-auto-linux-mem-opt \
194 $(use_with ncurses curses) \
195 || die "econf failed"
196
197 # sanity check due to common failure
198 use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
199
200 emake || die "making regular stuff"
201 }
202
203 src_test() {
204 # non-default block size also give false pass/fails.
205 unset BLOCK_SIZE
206 make check || die "make check failed"
207 }
208
209 src_install() {
210 emake DESTDIR="${D}" install || die
211 if use netboot ; then
212 exeinto /usr/lib/grub/${CHOST}
213 doexe nbgrub pxegrub stage2/stage2.netboot || die "netboot install"
214 fi
215
216 # bug 330745
217 pax-mark -m "${D}"/sbin/grub
218
219 dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
220 newdoc docs/menu.lst grub.conf.sample
221 dodoc "${FILESDIR}"/grub.conf.gentoo
222 prepalldocs
223
224 [ -n "${GRUB_STATIC_PACKAGE_BUILDING}" ] && \
225 mv \
226 "${D}"/usr/share/doc/${PF} \
227 "${D}"/usr/share/doc/grub-static-${PF/grub-}
228
229 insinto /usr/share/grub
230 doins "${DISTDIR}"/splash.xpm.gz
231 }
232
233 setup_boot_dir() {
234 local boot_dir=$1
235 local dir=${boot_dir}
236
237 mkdir -p "${dir}"
238 [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
239 dir="${dir}/grub"
240 if [[ ! -e ${dir} ]] ; then
241 mkdir "${dir}" || die "${dir} does not exist!"
242 fi
243
244 # change menu.lst to grub.conf
245 if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
246 mv -f "${dir}"/menu.lst "${dir}"/grub.conf
247 ewarn
248 ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
249 ewarn
250 fi
251
252 if [[ ! -e ${dir}/menu.lst ]]; then
253 einfo "Linking from new grub.conf name to menu.lst"
254 ln -snf grub.conf "${dir}"/menu.lst
255 fi
256
257 if [[ -e ${dir}/stage2 ]] ; then
258 mv "${dir}"/stage2{,.old}
259 ewarn "*** IMPORTANT NOTE: you must run grub and install"
260 ewarn "the new version's stage1 to your MBR. Until you do,"
261 ewarn "stage1 and stage2 will still be the old version, but"
262 ewarn "later stages will be the new version, which could"
263 ewarn "cause problems such as an unbootable system."
264 ewarn "This means you must use either grub-install or perform"
265 ewarn "root/setup manually! For more help, see the handbook:"
266 ewarn "http://www.gentoo.org/doc/en/handbook/handbook-${ARCH}.xml?part=1&chap=10#grub-install-auto"
267 ebeep
268 fi
269
270 einfo "Copying files from /lib/grub, /usr/lib/grub and /usr/share/grub to ${dir}"
271 for x in \
272 "${ROOT}"/lib*/grub/*/* \
273 "${ROOT}"/usr/lib*/grub/*/* \
274 "${ROOT}"/usr/share/grub/* ; do
275 [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
276 done
277
278 if [[ ! -e ${dir}/grub.conf ]] ; then
279 s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
280 [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
281 [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
282 [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
283 fi
284
285 # Per bug 218599, we support grub.conf.install for users that want to run a
286 # specific set of Grub setup commands rather than the default ones.
287 grub_config=${dir}/grub.conf.install
288 [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
289 if [[ -e ${grub_config} ]] ; then
290 egrep \
291 -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
292 "${grub_config}" | \
293 /sbin/grub --batch \
294 --device-map="${dir}"/device.map \
295 > /dev/null
296 fi
297
298 # the grub default commands silently piss themselves if
299 # the default file does not exist ahead of time
300 if [[ ! -e ${dir}/default ]] ; then
301 grub-set-default --root-directory="${boot_dir}" default
302 fi
303 einfo "Grub has been installed to ${boot_dir} successfully."
304 }
305
306 pkg_postinst() {
307 mount-boot_mount_boot_partition
308
309 if [[ -n ${DONT_MOUNT_BOOT} ]]; then
310 elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
311 elog "the following instructions for your /boot!"
312 elog "Neglecting to do so may cause your system to fail to boot!"
313 elog
314 else
315 setup_boot_dir "${ROOT}"/boot
316 # Trailing output because if this is run from pkg_postinst, it gets mixed into
317 # the other output.
318 einfo ""
319 fi
320 elog "To interactively install grub files to another device such as a USB"
321 elog "stick, just run the following and specify the directory as prompted:"
322 elog " emerge --config =${PF}"
323 elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
324 elog "grub where to install in a non-interactive way."
325
326 # needs to be after we call setup_boot_dir
327 mount-boot_pkg_postinst
328 }
329
330 pkg_config() {
331 local dir
332 if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
333 einfo "Enter the directory where you want to setup grub:"
334 read dir
335 else
336 dir="${GRUB_ALT_INSTALLDIR}"
337 fi
338 setup_boot_dir "${dir}"
339 }