Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: A tiny titillating taste of grub2
Date: Sun, 09 Jan 2011 21:23:39
Message-Id: 4D2A249D.5070906@gmail.com
In Reply to: [gentoo-user] Re: A tiny titillating taste of grub2 by walt
1 walt wrote:
2 > On 01/09/2011 04:10 AM, Alan McKinnon wrote:
3 >> Apparently, though unproven, at 02:44 on Sunday 09 January 2011, Dale
4 >> did
5 >> opine thusly:
6 >>
7 >>> I have not tried grub2 yet but I did fine these:
8 >>>
9 >>> https://help.ubuntu.com/community/Grub2
10 >>> http://en.gentoo-wiki.com/wiki/Grub2
11 >>> http://grub.enbug.org/grub.cfg
12 >
13 > Thanks Dale, the ubuntu link may be what I need.
14 >
15 >> I don't quite agree with Volker's viewpoint but don't totally
16 >> disagree with
17 >> him either. grub2 has a whole whack of bloat all of it's own.
18 >
19 > Indeed it does, except for grub.info, which is not nearly complete.
20 >
21 >> Methinks a modular build system is in order here. Why should I build
22 >> support
23 >> for sparc when I know for a fact I'm building an x86 installer?
24 >
25 > Here is how I do that manually, FWIW. (I've not run the grub2 install
26 > scripts
27 > because I haven't read them yet, which makes me nervous in a boot
28 > loader :)
29 >
30 > $cd ~/src #in my home directory, so I don't need root
31 > $tar -xvzf /usr/portage/distfiles/grub-1.98.tar.gz
32 > $cd grub-1.98
33 > $./configure --prefix=$HOME --disable-werror
34 > $make all install
35 >
36 > At this point grub2 has merely saved some files in your home
37 > directory, it
38 > has *not* messed with your boot sector or touched legacy grub in any way.
39 >
40 > $ls ~/bin/grub*
41 > /home/wa1ter/bin/grub-bin2h /home/wa1ter/bin/grub-mkisofs
42 > /home/wa1ter/bin/grub-editenv /home/wa1ter/bin/grub-mkpasswd-pbkdf2
43 > /home/wa1ter/bin/grub-fstest /home/wa1ter/bin/grub-mkrelpath
44 > /home/wa1ter/bin/grub-mkelfimage /home/wa1ter/bin/grub-mkrescue
45 > /home/wa1ter/bin/grub-mkfont /home/wa1ter/bin/grub-script-check
46 > /home/wa1ter/bin/grub-mkimage
47 >
48 > $ls ~/lib/grub/i386-pc/
49 > acpi.mod font.mod linux16.mod reboot.mod
50 > affs.mod fs.lst lnxboot.img reiserfs.mod
51 > afs.mod fshelp.mod loadenv.mod relocator.mod
52 > <dozens more grub2 modules snipped for brevity>
53 >
54 > That's where the bloat comes from, as you pointed out. There are tons
55 > of those *.mod files you won't need, so the trick is to compile a list
56 > of them you *do* need, and then feed the list to grub-mkimage as
57 > described
58 > below.
59 >
60 > NOTE: I can't recall exactly why but the ata* modules conflict with some
61 > other modules, so *don't use them* unless you know what you are doing.
62 >
63 > Create a list of all grub2 modules:
64 >
65 > $ls ~/lib/grub/i386pc/*.mod > /tmp/modlist
66 >
67 > Now edit that file and delete any modules you know you don't need, e.g.
68 > I deleted reiserfs.mod and ntfs.mod and the raid*.mod because I don't
69 > use those items. Don't touch anything you don't clearly recognize, but
70 > *do* delete ata.mod and ata_pthru.mod.
71 >
72 > Now it's time to build the grub2 binary executable:
73 >
74 > $~/bin/grub-mkimage -o /tmp/grub2bin `cat /tmp/modlist`
75 >
76 > Your file grub2bin is actually formatted as a tiny pseudo kernel, which
77 > your legacy grub can boot using the usual grub sytax:
78 >
79 > title try grub2
80 > root (hdX,X)
81 > kernel /tmp/grub2bin (or wherever else you want to put it. NOTE: so far
82 > I've done nothing requiring root privileges :)
83 >
84 > That menu item will start a grub2 running so you can experiment with
85 > it all you want, but still use legacy grub to boot as you always do.
86 > (You won't yet have a menu file for grub2, so you will see only the
87 > usual grub command prompt instead of a menu.)
88 >
89 > The grub2 shell is a bit different, so you might want to type "set" to
90 > see what variables you can change, "ls" to see your disks, and of course
91 > hit the tab key when you don't know what else to type.
92 >
93 > Type "help search" for the real excitement.
94 >
95 > A few more grub2 differences: the 'linux' command replaces 'kernel' to
96 > load your (linux) kernel. 'multiboot' is used to load any true multiboot
97 > kernel e.g. NetBSD. Not sure, but I think you still need to chainload
98 > the Windows booter -- sadly, I can't test it anymore :D
99 >
100 > One problem I encountered on my old amd32 machine is that I had to remove
101 > the USB-related grub2 modules or grub2 would crash while probing for
102 > disks.
103 > The newer amd64 machine works fine with the USB stuff included. Dunno
104 > why.
105 >
106 > NOTE: if grub2 names your disks (ataN,N) instead of (hdN,N) that means
107 > you are using the ata* grub2 modules -- I haven't figured out how to make
108 > that configuration work yet.
109 >
110
111 This sounds about as complicated as lilo. Is this going to end up like
112 hal? You know, so complicated that no one can use the thing and they
113 have to start over again?
114
115 Dale
116
117 :-) :-)

Replies

Subject Author
[gentoo-user] Re: A tiny titillating taste of grub2 walt <w41ter@×××××.com>