File: anonymous.html

package info (click to toggle)
lg-issue108 1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,784 kB
  • ctags: 186
  • sloc: perl: 534; python: 288; xml: 67; sh: 39; makefile: 34; sed: 27
file content (263 lines) | stat: -rw-r--r-- 7,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263

<html>
<head>
<link href="../lg.css" rel="stylesheet" type="text/css" media="screen, projection"  />
<link rel="shortcut icon" href="../favicon.ico" />
<title>GRUB boot diskette for Knoppix LG #108</title>

<style type="text/css" media="screen, projection">
<!--

-->
</style>


</head>

<body>


<img src="../gx/2003/newlogo-blank-200-gold2.jpg" id="logo" alt="Linux Gazette"/>
<p id="fun">...making Linux just a little more fun!</p>


<div class="content articlecontent">

<div id="previousnexttop">
<A HREF="lg_bytes.html" >&lt;-- prev</A> | <A HREF="bilbrey.html" >next --&gt;</A>
</div>



<h1>GRUB boot diskette for Knoppix</h1>
<p id="by"><b>By <A HREF="../authors/anonymous.html">Anonymous</A></b></p>

<p>

<p>
GRUB cannot boot the Knoppix CD if booting from the CD-ROM is disabled.
This is a feature that the GRUB developers should consider adding. See <a
href="../107/anonymous.html">my previous article</a> in the October 2004
Linux Gazette.

<p>
However, GRUB (current version 0.95) can generate a floppy to boot Knoppix
after a full install to hard disk - something LILO may have problems with,
due to its inability to find files, and due to the kernel and initial
RAMdisk growing past diskette size.

<p>
Assume Knoppix is installed to hard disk but that its partition is not
bootable, for whatever reason.  You need a floppy to boot Knoppix, and here
is how to make it with GRUB:


<h3>General case: disk visible to BIOS</h3>

<p>
You can use a simple GRUB diskette that boots to a GRUB command line. From
this command line, you can issue commands to boot your Knoppix on the
non-bootable partition.

<p>
This simple GRUB boot diskette can be prepared with the
<code>grub-floppy</code> script. It is very quick to prepare, but does not
carry a filesystem, so you cannot do much with it. You cannot write to it,
and you will have to type quite a bit after booting to the GRUB prompt.

<p>
A more comfortable solution is given by the script
<code>grub-install</code>, which requires a formatted diskette. A
DOS-formatted diskette will do, and you will be able to modify it from DOS
- quite an advantage. Mount the diskette, e.g., to /floppy, and issue the
command:

<pre>
grub-install --root-directory=/floppy fd0
</pre>

<p>
The script will create /floppy/boot/grub and copy to it the image files
required for booting. Some of them can be deleted, since you do not need
support for half a dozen filesystems.

<p>
Now, the best part of it is that you can write to /floppy/boot/grub a text
file by the name of <code>menu.lst</code>, which is the configuration file
for GRUB.  Here, you put all the instructions you want for booting your
Knoppix, and that's it. (The endline sequence may be DOS-style or
Linux-style.) It boots fairly quickly - or rather, it boots very quickly if
you reduce the timeout to 1 sec and suppress the menu.

<h3>Abnormal case: disk not visible to BIOS</h3>

<p>
Let us now get around to a conjurer trick that looks a bit puzzling.

<p>
The hard disk where Knoppix is installed is not visible to the BIOS. Why
not? Because the disk is explicitly set to 'none' in the BIOS, for some
peculiar reason. Or because the old BIOS cannot see partitions past 8GB.

<p>
Wonder: Linux can boot, see the disk even though it is invisible to the
BIOS, and plant its root on it.

<p>
The preparation of the GRUB diskettes for the trick goes actually the same
way as before, but some additional fiddling is required.

<p>
Let us focus on the case where a DOS-formatted boot diskette has been
prepared with <code>grub-install</code>.

<p>
First, you copy your Linux kernel (name it vmlinuz) to a hard disk visible
to the BIOS, e.g., the first hard disk, first partition, which GRUB call
(hd0,0).

<p>
Second, you must guess the proper Linux designation for the Knoppix
partition, when Linux is running. Remember that Linux calls the SCSI disks
/dev/sda, dev/sdb, etc., and the IDE disks /dev/hda, /dev/hdb, etc. The
partitions are then appended to them as numbers, e.g., /dev/hda1,
/dev/hda2, etc. It can get complex, depending on the devices you have in
your PC. In any event, you must find the proper designation for the Knoppix
partition, since it is invisible to the BIOS and GRUB. Assume for the sake
of an example that the correct Linux designation is /dev/hdb1.

<p>
Now, write <code>menu.lst</code> to the floppy, directory
<tt>/boot/grub</tt>, as follows:

<pre class="code">
# start of menu.lst
# GRUB boot for Knoppix 3.6/kernel 2.6.7
# Knoppix is installed to hdb1
# hdb1 is not bootable, indeed not seen by BIOS

# By default, boot the first entry
default 0

# Boot after 1 second, no menu
hiddenmenu
timeout 1

# first and unique entry
title knoppix36267
kernel (hd0,0)/vmlinuz root=/dev/hdb1

# Should an initial RAMdisk be required,
# the last line would be, for instance:
# kernel (hd0,0)/vmlinuz root=/dev/hdb1 initrd=/initrd/ird.gz
# end of menu.lst
</pre>

<p>
We are not finished yet. GRUB has on the floppy an auto-generated file
device.map, listing all devices known to it. In this abnormal case, it is a
good idea to check the map file; it may need revision by hand. Indeed, it
must include that device unknown to the BIOS but destined to carry the
root. Note that the map file is simply a translation between GRUB device
names and Linux device names.

<p>
That's it. Boot the GRUB diskette and it will pull vmlinuz from your first
hard disk: vmlinuz will run and will recognize and use the partition
<tt>/dev/hdb1</tt> even though <tt>/dev/hdb</tt> is unknown to the BIOS.

<p>
Can anyone explain it? If the kernel can see partitions invisible to the
BIOS, why can't GRUB?  GRUB has in the boot sector a tiny program called
<code>stage1</code> that does nothing but trigger <code>stage2</code>.
Since <code>stage2</code> is more than 100K, shouldn't it be able to detect
available devices the same way the kernel does?


</p>


<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- ============================================================= -->
<!-- *** BEGIN bio *** -->
<hr>

<!--
<p>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png" class="bio">
<em>
</em>
<br CLEAR="all">

-->
<!-- *** END bio *** -->

<!-- ============================================================= -->


<!-- *** END author bio *** -->

<div id="articlefooter">

<p>
Copyright &copy; 2004, Anonymous. Released under the
<a href="http://linuxgazette.net/copying.html">Open Publication license</a>
</p>

<p>
Published in Issue 108 of Linux Gazette, November 2004
</p>

</div>


<div id="previousnextbottom">
<A HREF="lg_bytes.html" >&lt;-- prev</A> | <A HREF="bilbrey.html" >next --&gt;</A>
</div>


</div>






<div id="navigation">

<a href="../index.html">Home</a>
<a href="../faq/index.html">FAQ</a>
<a href="../lg_index.html">Site Map</a>
<a href="../mirrors.html">Mirrors</a>
<a href="../mirrors.html">Translations</a>
<a href="../search.html">Search</a>
<a href="../archives.html">Archives</a>
<a href="../authors/index.html">Authors</a>
<a href="../contact.html">Contact Us</a>

</div>



<div id="breadcrumbs">

<a href="../index.html">Home</a> &gt; 
<a href="index.html">November 2004 (#108)</a> &gt; 
Article

</div>





<img src="../gx/2003/sit3-shine.7-2.gif" id="tux" alt="Tux"/>




</body>
</html>