Annotation of /branches/magellan-next/core/grub/grub-0.97-r19.smage2
Parent Directory | Revision Log
Revision 7853 -
(hide annotations)
(download)
Wed Jun 1 22:19:11 2011 UTC (13 years ago) by niro
File size: 5597 byte(s)
Wed Jun 1 22:19:11 2011 UTC (13 years ago) by niro
File size: 5597 byte(s)
-apply kvm-vda patch
1 | niro | 7614 | # $Id$ |
2 | |||
3 | PNAME="grub" | ||
4 | PVER="0.97" | ||
5 | PBUILD="r19" | ||
6 | |||
7 | PCATEGORIE="sys-apps" | ||
8 | STATE="unstable" | ||
9 | |||
10 | DESCRIPTION="GNU GRUB boot loader." | ||
11 | HOMEPAGE="http://www.gnu.org/software/grub/" | ||
12 | |||
13 | DEPEND=">= sys-libs/ncurses-5.9" | ||
14 | |||
15 | SDEPEND=">= sys-dev/automake-4 | ||
16 | >= sys-dev/autoconf-5" | ||
17 | |||
18 | SRCFILE="${PNAME}-${PVER}.tar.gz" | ||
19 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" | ||
20 | |||
21 | sminclude mtools | ||
22 | |||
23 | SRC_URI=( | ||
24 | ftp://alpha.gnu.org/gnu/${PNAME}/${SRCFILE} | ||
25 | mirror://${PNAME}/${SRCFILE} | ||
26 | mirror://${PNAME}/${PNAME}-${PVER}-splash.patch | ||
27 | mirror://${PNAME}/${PNAME}-${PVER}-pic.patch | ||
28 | mirror://${PNAME}/${PNAME}-${PVER}-initrdmax.patch | ||
29 | mirror://${PNAME}/${PNAME}-${PVER}-nxstack.patch | ||
30 | mirror://${PNAME}/${PNAME}-${PVER}-unsigned-addresses.patch | ||
31 | mirror://${PNAME}/${PNAME}-${PVER}-ext4-4.patch | ||
32 | mirror://${PNAME}/${PNAME}-${PVER}-virtio-blk-support-2.patch | ||
33 | mirror://${PNAME}/${PNAME}-${PVER}-gpt.patch | ||
34 | mirror://${PNAME}/${PNAME}-${PVER}-i2o.patch | ||
35 | mirror://${PNAME}/${PNAME}-${PVER}-intelmac.patch | ||
36 | mirror://${PNAME}/${PNAME}-${PVER}-more-raid.patch | ||
37 | mirror://${PNAME}/${PNAME}-${PVER}-special-devices.patch | ||
38 | mirror://${PNAME}/${PNAME}-${PVER}-inode-size.patch | ||
39 | mirror://${PNAME}/${PNAME}-${PVER}-kvm-vda-2.patch | ||
40 | mirror://${PNAME}/${PNAME}-${PVER}-netboot-pic.patch | ||
41 | mirror://${PNAME}/${PNAME}-${PVER}-netboot-compile-fixes.patch | ||
42 | ) | ||
43 | |||
44 | # get only 0.xx versions! | ||
45 | UP2DATE="updatecmd ftp://alpha.gnu.org/gnu/${PNAME} | grep -- -0.[0-9].* | lasttarball gz" | ||
46 | |||
47 | # grub doesn't like CFLAG optimation, | ||
48 | # and do you really want that at your bootloader ?? | ||
49 | unset CFLAGS | ||
50 | unset CXXFLAGS | ||
51 | |||
52 | src_prepare() | ||
53 | { | ||
54 | munpack ${SRCFILE} || die | ||
55 | cd ${SRCDIR} | ||
56 | |||
57 | # splash support | ||
58 | mpatch ${PNAME}-${PVER}-splash.patch || die | ||
59 | |||
60 | # fix pic issues | ||
61 | mpatch ${PNAME}-${PVER}-pic.patch || die | ||
62 | |||
63 | # do not check initrdmax -> we are using more than 4mb | ||
64 | mpatch ${PNAME}-${PVER}-initrdmax.patch || die | ||
65 | |||
66 | # fix nx issues on x86_64 | ||
67 | mpatch ${PNAME}-${PVER}-nxstack.patch || die | ||
68 | |||
69 | # fix issues on systems with more than 2gb of ram | ||
70 | mpatch ${PNAME}-${PVER}-unsigned-addresses.patch || die | ||
71 | |||
72 | # support booting from ext4 filesystems | ||
73 | mpatch ${PNAME}-${PVER}-ext4-4.patch || die | ||
74 | |||
75 | # handle virtio_blk device names in grub-install | ||
76 | mpatch ${PNAME}-${PVER}-virtio-blk-support-2.patch || die | ||
77 | |||
78 | # support gpt partition tables | ||
79 | mpatch ${PNAME}-${PVER}-gpt.patch || die | ||
80 | |||
81 | # support I2O disks | ||
82 | mpatch ${PNAME}-${PVER}-i2o.patch || die | ||
83 | |||
84 | # support Intel Macs (gateA20) | ||
85 | mpatch ${PNAME}-${PVER}-intelmac.patch || die | ||
86 | |||
87 | # support cciss and other raid devices | ||
88 | mpatch ${PNAME}-${PVER}-more-raid.patch || die | ||
89 | |||
90 | # support dev/{ida,cciss,ataraid,rd} devices names | ||
91 | mpatch ${PNAME}-${PVER}-special-devices.patch || die | ||
92 | |||
93 | # support bigger inode sizes (dynamic/V2 inodes) | ||
94 | mpatch ${PNAME}-${PVER}-inode-size.patch || die | ||
95 | |||
96 | niro | 7853 | mpatch ${PNAME}-${PVER}-kvm-vda-2.patch || die |
97 | |||
98 | niro | 7614 | # fix pic issues with the net drivers |
99 | niro | 7851 | # mpatch ${PNAME}-${PVER}-netboot-pic.patch || die |
100 | niro | 7614 | |
101 | # fix compilation issues | ||
102 | niro | 7851 | # mpatch ${PNAME}-${PVER}-netboot-compile-fixes.patch || die |
103 | niro | 7614 | |
104 | # rebuild makefiles | ||
105 | autoreconf --install --force || die | ||
106 | } | ||
107 | |||
108 | src_compile() | ||
109 | { | ||
110 | cd ${SRCDIR} | ||
111 | |||
112 | # fixes compilation on x86_64; grub cannot build natively on 64bit | ||
113 | # building a static grub, with -m32 in this case | ||
114 | if [[ ${ARCH} = x86_64 ]] | ||
115 | then | ||
116 | export CC="gcc -m32" | ||
117 | export LDFLAGS="-static" | ||
118 | fi | ||
119 | |||
120 | niro | 7851 | # # build netboot grub first |
121 | # mconfigure \ | ||
122 | # --enable-diskless \ | ||
123 | # --enable-3c503 \ | ||
124 | # --enable-3c507 \ | ||
125 | # --enable-3c509 \ | ||
126 | # --enable-3c529 \ | ||
127 | # --enable-3c595 \ | ||
128 | # --enable-3c590x \ | ||
129 | # --enable-cs89x0 \ | ||
130 | # --enable-davicom \ | ||
131 | # --enable-depca \ | ||
132 | # --enable-eepro \ | ||
133 | # --enable-eepro100 \ | ||
134 | # --enable-epic100 \ | ||
135 | # --enable-exos205 \ | ||
136 | # --enable-ni5210 \ | ||
137 | # --enable-lance \ | ||
138 | # --enable-ne2100 \ | ||
139 | # --enable-ni5010 \ | ||
140 | # --enable-ni6510 \ | ||
141 | # --enable-natsemi \ | ||
142 | # --enable-ne \ | ||
143 | # --enable-ns8390 \ | ||
144 | # --enable-wd \ | ||
145 | # --enable-otulip \ | ||
146 | # --enable-rtl8139 \ | ||
147 | # --enable-sis900 \ | ||
148 | # --enable-sk-g16 \ | ||
149 | # --enable-smc9000 \ | ||
150 | # --enable-tiara \ | ||
151 | # --enable-tulip \ | ||
152 | # --enable-via-rhine \ | ||
153 | # --enable-w89c840\ | ||
154 | # || die | ||
155 | # | ||
156 | # mmake w89c840_o_CFLAGS="-O" || die | ||
157 | # mv stage2/nbgrub ${SRCDIR}/ || die | ||
158 | # mv stage2/pxegrub ${SRCDIR}/ || die | ||
159 | # mv stage2/stage2 stage2/stage2.netboot || die | ||
160 | # | ||
161 | # # clean up sources | ||
162 | # make clean || die | ||
163 | niro | 7614 | |
164 | # build the normal grub | ||
165 | niro | 7852 | mconfigure --disable-auto-linux-mem-opt || die |
166 | niro | 7614 | mmake || die |
167 | } | ||
168 | |||
169 | src_install() | ||
170 | { | ||
171 | cd ${SRCDIR} | ||
172 | |||
173 | # needed directories | ||
174 | minstalldir /boot/grub || die | ||
175 | |||
176 | mmake DESTDIR=${BINDIR} install || die | ||
177 | |||
178 | local archhost | ||
179 | case ${ARCH} in | ||
180 | i486) archhost="${CHOST/-linux-gnu/}" | ||
181 | archhost="${archhost/i486/i386}" | ||
182 | ;; | ||
183 | *) archhost="${CHOST/-linux-gnu/}" ;; | ||
184 | esac | ||
185 | |||
186 | niro | 7851 | # # install netboot grub |
187 | # minstallexec nbgrub /usr/$(mlibdir)/grub/${archhost}/ || die | ||
188 | # minstallexec pxegrub /usr/$(mlibdir)/grub/${archhost}/ || die | ||
189 | # minstallexec stage2/stage2.netboot /usr/$(mlibdir)/grub/${archhost}/ || die | ||
190 | niro | 7614 | |
191 | # now copying all stage files | ||
192 | for i in ${BINDIR}/usr/$(mlibdir)/grub/${archhost}/* | ||
193 | do | ||
194 | [ -f ${i} ] && cp -p ${i} ${BINDIR}/boot/grub || die ${i} | ||
195 | done | ||
196 | } | ||
197 | |||
198 | preinstall() | ||
199 | { | ||
200 | mount /boot &> /dev/null | ||
201 | } | ||
202 | |||
203 | postinstall() | ||
204 | { | ||
205 | # creates some essential links | ||
206 | if [ ! -e ${MROOT}/boot/boot ] | ||
207 | then | ||
208 | ln -sf . ${MROOT}/boot/boot | ||
209 | fi | ||
210 | |||
211 | if [ ! -e ${MROOT}/boot/grub/menu.lst ] | ||
212 | then | ||
213 | ln -sf /boot/grub/grub.conf ${MROOT}/boot/grub/menu.lst | ||
214 | fi | ||
215 | |||
216 | # creates example grub.conf | ||
217 | if [ ! -e ${MROOT}/boot/grub/grub.conf.example ] | ||
218 | then | ||
219 | cat > ${MROOT}/boot/grub/grub.conf.example << "EOF" | ||
220 | default 0 | ||
221 | timeout 30 | ||
222 | |||
223 | title Magellan-Linux | ||
224 | root (hd0,0) | ||
225 | kernel (hd0,0)/boot/bzImage root=/dev/hda1 | ||
226 | EOF | ||
227 | fi | ||
228 | |||
229 | # update grub | ||
230 | grub --batch --device-map=/boot/grub/device.map </boot/grub/grub.conf >&/dev/null; | ||
231 | } |