1 |
<?xml version='1.0' encoding="UTF-8"?> |
2 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/liveusb.xml,v 1.5 2006/02/12 14:54:15 nightmorph Exp $ --> |
4 |
|
5 |
<guide link="/doc/en/liveusb.xml"> |
6 |
<title>Gentoo Linux LiveUSB HOWTO</title> |
7 |
|
8 |
<author title="Author"> |
9 |
<mail link="brix@gentoo.org">Henrik Brix Andersen</mail> |
10 |
</author> |
11 |
|
12 |
<abstract> |
13 |
This HOWTO explains how to create a Gentoo Linux LiveUSB or, in other words, |
14 |
how to emulate a Gentoo Linux Installation CD using an USB flash drive. |
15 |
</abstract> |
16 |
|
17 |
<!-- The content of this document is licensed under the CC-BY-SA license --> |
18 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
19 |
<license/> |
20 |
|
21 |
<version>1.2</version> |
22 |
<date>2006-02-28</date> |
23 |
|
24 |
<chapter> |
25 |
<title>Introduction</title> |
26 |
<section> |
27 |
<title>The LiveUSB</title> |
28 |
<body> |
29 |
|
30 |
<p> |
31 |
This HOWTO explains how to create a <e>Gentoo Linux LiveUSB</e> or, in other |
32 |
words, how to emulate a Gentoo Linux Installation CD using an USB flash drive. |
33 |
This is particularly useful for installing Gentoo Linux on a modern laptop with |
34 |
no CD-ROM drive. |
35 |
</p> |
36 |
|
37 |
<p> |
38 |
Although the instructions found in this document aim at emulating a Gentoo |
39 |
Linux Installation CD using an USB flash drive, they should work for any |
40 |
arbitrary block device as long as you adjust the device names accordingly. |
41 |
</p> |
42 |
|
43 |
</body> |
44 |
</section> |
45 |
<section> |
46 |
<title>Prerequisites</title> |
47 |
<body> |
48 |
|
49 |
<p> |
50 |
In order to use a Gentoo Linux LiveUSB you need the following: |
51 |
</p> |
52 |
|
53 |
<ul> |
54 |
<li>Bootable USB flash drive (at least 64MB)</li> |
55 |
<li> |
56 |
x86 computer with support for booting from USB |
57 |
</li> |
58 |
</ul> |
59 |
|
60 |
<p> |
61 |
You will also need access to the following for creating the LiveUSB: |
62 |
</p> |
63 |
|
64 |
<ul> |
65 |
<li> |
66 |
A computer running Gentoo Linux (or alternatively another Linux |
67 |
distribution) |
68 |
</li> |
69 |
</ul> |
70 |
|
71 |
</body> |
72 |
</section> |
73 |
</chapter> |
74 |
<chapter> |
75 |
<title>Preparing the USB flash drive</title> |
76 |
<section> |
77 |
<title>Partitioning the drive</title> |
78 |
<body> |
79 |
|
80 |
<warn> |
81 |
These instructions will erase all data from the USB flash drive. Make sure to |
82 |
backup your data first. |
83 |
</warn> |
84 |
|
85 |
<impo> |
86 |
This HOWTO assumes that the <path>/dev/sda</path> device node corresponds to |
87 |
your USB flash drive. If you have other SCSI-like devices make sure to use the |
88 |
correct device node. |
89 |
</impo> |
90 |
|
91 |
<p> |
92 |
Create a FAT32 partition on your USB flash drive and mark it bootable using |
93 |
<c>fdisk</c>. An example partitioning scheme can be seen below: |
94 |
</p> |
95 |
|
96 |
<pre caption="Example partitioning scheme"> |
97 |
# <i>fdisk -l /dev/sda</i> |
98 |
|
99 |
Disk /dev/sda: 1048 MB, 1048313856 bytes |
100 |
33 heads, 61 sectors/track, 1017 cylinders |
101 |
Units = cylinders of 2013 * 512 = 1030656 bytes |
102 |
|
103 |
Device Boot Start End Blocks Id System |
104 |
/dev/sda1 * 1 1017 1023580 b W95 FAT32 |
105 |
</pre> |
106 |
|
107 |
</body> |
108 |
</section> |
109 |
<section> |
110 |
<title>Creating the filesystem</title> |
111 |
<body> |
112 |
|
113 |
<p> |
114 |
Create a FAT32 filesystem on the USB flash drive using <c>mkdosfs</c>: |
115 |
</p> |
116 |
|
117 |
<pre caption="Running mkdosfs"> |
118 |
<comment>(Make sure you have sys-fs/dosfstools installed)</comment> |
119 |
# <i>emerge -av sys-fs/dosfstools</i> |
120 |
# <i>mkdosfs -F 32 /dev/sda1</i> |
121 |
mkdosfs 2.11 (12 Mar 2005) |
122 |
</pre> |
123 |
|
124 |
</body> |
125 |
</section> |
126 |
<section> |
127 |
<title>Installing a Master Boot Record</title> |
128 |
<body> |
129 |
|
130 |
<p> |
131 |
Install the precompiled Master Boot Record (MBR) from <c>syslinux</c> on the |
132 |
USB flash drive: |
133 |
</p> |
134 |
|
135 |
<pre caption="Installing a master boot record"> |
136 |
<comment>(Make sure you have sys-boot/syslinux-3.00 or later installed)</comment> |
137 |
# <i>emerge -av '>=sys-boot/syslinux-3*'</i> |
138 |
# <i>dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda</i> |
139 |
0+1 records in |
140 |
0+1 records out |
141 |
</pre> |
142 |
|
143 |
</body> |
144 |
</section> |
145 |
</chapter> |
146 |
<chapter> |
147 |
<title>Copying the files</title> |
148 |
<section> |
149 |
<title>Mounting the Gentoo Linux Installation CD</title> |
150 |
<body> |
151 |
|
152 |
<p> |
153 |
Download the <path>install-x86-minimal-2006.0.iso</path> file from your |
154 |
local Gentoo Linux <uri link="/main/en/where.xml">mirror</uri> site and mount |
155 |
the ISO image on <path>/mnt/cdrom/</path> as shown below: |
156 |
</p> |
157 |
|
158 |
<pre caption="Mounting the Gentoo Linux Installation CD ISO image"> |
159 |
<comment>(Create the /mnt/cdrom/ mount point if needed)</comment> |
160 |
# <i>mkdir -p /mnt/cdrom</i> |
161 |
# <i>mount -o loop,ro -t iso9660 install-x86-minimal-2006.0.iso /mnt/cdrom/</i> |
162 |
</pre> |
163 |
|
164 |
</body> |
165 |
</section> |
166 |
<section> |
167 |
<title>Mounting the LiveUSB</title> |
168 |
<body> |
169 |
|
170 |
<p> |
171 |
Mount the newly formatted USB flash drive on <path>/mnt/usb/</path> as shown |
172 |
below: |
173 |
</p> |
174 |
|
175 |
<pre caption="Mounting the USB flash drive"> |
176 |
<comment>(Create the /mnt/usb/ mount point if needed)</comment> |
177 |
# <i>mkdir -p /mnt/usb</i> |
178 |
# <i>mount -t vfat /dev/sda1 /mnt/usb/</i> |
179 |
</pre> |
180 |
|
181 |
</body> |
182 |
</section> |
183 |
<section> |
184 |
<title>Copying the files</title> |
185 |
<body> |
186 |
|
187 |
<p> |
188 |
Copy the files from the Gentoo Linux Installation CD to the LiveUSB. The files |
189 |
need to be reordered a bit as we will be using the <c>syslinux</c> bootloader |
190 |
instead of <c>isolinux</c>: |
191 |
</p> |
192 |
|
193 |
<pre caption="Copying the files"> |
194 |
# <i>cp -r /mnt/cdrom/* /mnt/usb/</i> |
195 |
# <i>mv /mnt/usb/isolinux/* /mnt/usb/</i> |
196 |
# <i>mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg</i> |
197 |
# <i>rm -rf /mnt/usb/isolinux*</i> |
198 |
|
199 |
<comment>(The memtest86 kernel needs to be renamed for loading it via syslinux)</comment> |
200 |
# <i>mv /mnt/usb/memtest86 /mnt/usb/memtest</i> |
201 |
</pre> |
202 |
|
203 |
<p> |
204 |
You can now unmount the ISO image: |
205 |
</p> |
206 |
|
207 |
<pre caption="Unmounting the ISO image"> |
208 |
# <i>umount /mnt/cdrom/</i> |
209 |
</pre> |
210 |
|
211 |
</body> |
212 |
</section> |
213 |
<section> |
214 |
<title>Adjusting the bootloader configuration</title> |
215 |
<body> |
216 |
|
217 |
<p> |
218 |
Adjust the syslinux configuration file using <c>sed</c> as shown below. The |
219 |
<c>dobladecenter</c> parameter will introduce some extra delays before |
220 |
attempting to mount the filesystem. This is needed to allow the USB |
221 |
flash drive to settle upon detection. |
222 |
</p> |
223 |
|
224 |
<pre caption="Adjusting the boot parameters"> |
225 |
# <i>sed -i \ |
226 |
-e "s:cdroot:cdroot dobladecenter:" \ |
227 |
-e "s:kernel memtest86:kernel memtest:" \ |
228 |
/mnt/usb/syslinux.cfg</i> |
229 |
</pre> |
230 |
|
231 |
<note> |
232 |
Consider adding <c>docache</c> to the boot parameters. This will allow running |
233 |
<c>umount /mnt/cdrom/</c> after booting so that you can unplug the USB flash |
234 |
drive. Do not enable this unless the target computer has at least 128MB RAM. |
235 |
</note> |
236 |
|
237 |
</body> |
238 |
</section> |
239 |
</chapter> |
240 |
<chapter> |
241 |
<title>Installing a bootloader</title> |
242 |
<section> |
243 |
<title>Unmounting the drive</title> |
244 |
<body> |
245 |
|
246 |
<p> |
247 |
Make sure you unmount the USB flash drive before installing the bootloader: |
248 |
</p> |
249 |
|
250 |
<pre caption="Unmounting the USB flash drive"> |
251 |
# <i>umount /mnt/usb/</i> |
252 |
</pre> |
253 |
|
254 |
</body> |
255 |
</section> |
256 |
<section> |
257 |
<title>Installing syslinux</title> |
258 |
<body> |
259 |
|
260 |
<p> |
261 |
Finally install the <c>syslinux</c> bootloader on the USB flash drive: |
262 |
</p> |
263 |
|
264 |
<pre caption="Running syslinux"> |
265 |
# <i>syslinux /dev/sda1</i> |
266 |
</pre> |
267 |
|
268 |
<impo> |
269 |
You will need to rerun <c>syslinux /dev/sda1</c> each time you modify the |
270 |
<path>syslinux.cfg</path> file for the configuration changes to take affect. |
271 |
</impo> |
272 |
|
273 |
</body> |
274 |
</section> |
275 |
</chapter> |
276 |
<chapter> |
277 |
<title>Using the LiveUSB</title> |
278 |
<section> |
279 |
<title>Booting</title> |
280 |
<body> |
281 |
|
282 |
<p> |
283 |
Insert the USB flash drive and turn on the computer, making sure the BIOS is |
284 |
set to boot from USB. If all goes well you should be presented with a standard |
285 |
syslinux prompt. |
286 |
</p> |
287 |
|
288 |
<p> |
289 |
You should be able to follow the generic installation instructions found in the |
290 |
<uri link="/doc/en/handbook/">Gentoo Handbook</uri> from here on. |
291 |
</p> |
292 |
|
293 |
</body> |
294 |
</section> |
295 |
</chapter> |
296 |
</guide> |