/[gentoo]/xml/htdocs/doc/en/liveusb.xml
Gentoo

Contents of /xml/htdocs/doc/en/liveusb.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download) (as text)
Sun Nov 5 04:02:25 2006 UTC (7 years, 11 months ago) by nightmorph
Branch: MAIN
Changes since 1.10: +42 -1 lines
File MIME type: application/xml
added 2006.1 fix-in-the-works; should be evaluated. commented fixes and explanation only, **no content change**

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.10 2006/09/18 10:51:48 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="henrik@brixandersen.dk">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.6</version>
22 <date>2006-09-18</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 <warn>
153 This guide is designed only to be used with Gentoo 2006.0. Do not attempt to
154 use a 2006.1 CD or newer; you will end up with an unbootable USB disk.
155 </warn>
156
157 <p>
158 Download the <path>install-x86-minimal-2006.0.iso</path> file from your
159 local Gentoo Linux <uri link="/main/en/where.xml">mirror</uri> site and mount
160 the ISO image on <path>/mnt/cdrom/</path> as shown below:
161 </p>
162
163 <pre caption="Mounting the Gentoo Linux Installation CD ISO image">
164 <comment>(Create the /mnt/cdrom/ mount point if needed)</comment>
165 # <i>mkdir -p /mnt/cdrom</i>
166 # <i>mount -o loop,ro -t iso9660 install-x86-minimal-2006.0.iso /mnt/cdrom/</i>
167 </pre>
168
169 <note>
170 If you receive a <e>Could not find any loop device</e> error message when
171 mounting the iso, you need to enable the <c>Loopback device support</c> option
172 in your kernel configuration.
173 </note>
174
175 </body>
176 </section>
177 <section>
178 <title>Mounting the LiveUSB</title>
179 <body>
180
181 <p>
182 Mount the newly formatted USB flash drive on <path>/mnt/usb/</path> as shown
183 below:
184 </p>
185
186 <pre caption="Mounting the USB flash drive">
187 <comment>(Create the /mnt/usb/ mount point if needed)</comment>
188 # <i>mkdir -p /mnt/usb</i>
189 # <i>mount -t vfat /dev/sda1 /mnt/usb/</i>
190 </pre>
191
192 </body>
193 </section>
194 <section>
195 <title>Copying the files</title>
196 <body>
197
198 <p>
199 Copy the files from the Gentoo Linux Installation CD to the LiveUSB. The files
200 need to be reordered a bit as we will be using the <c>syslinux</c> bootloader
201 instead of <c>isolinux</c>:
202 </p>
203
204 <pre caption="Copying the files">
205 # <i>cp -r /mnt/cdrom/* /mnt/usb/</i>
206 # <i>mv /mnt/usb/isolinux/* /mnt/usb/</i>
207 # <i>mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg</i>
208 # <i>rm -rf /mnt/usb/isolinux*</i>
209
210 <comment>(The memtest86 kernel needs to be renamed for loading it via syslinux)</comment>
211 # <i>mv /mnt/usb/memtest86 /mnt/usb/memtest</i>
212 </pre>
213
214 <p>
215 You can now unmount the ISO image:
216 </p>
217
218 <pre caption="Unmounting the ISO image">
219 # <i>umount /mnt/cdrom/</i>
220 </pre>
221
222 </body>
223 </section>
224 <section>
225 <title>Adjusting the bootloader configuration</title>
226 <body>
227
228 <p>
229 Adjust the syslinux configuration file using <c>sed</c> as shown below. The
230 <c>dobladecenter</c> parameter will introduce some extra delays before
231 attempting to mount the filesystem. This is needed to allow the USB
232 flash drive to settle upon detection.
233 </p>
234
235 <pre caption="Adjusting the boot parameters">
236 # <i>sed -i \
237 -e "s:cdroot:cdroot dobladecenter:" \
238 -e "s:kernel memtest86:kernel memtest:" \
239 /mnt/usb/syslinux.cfg</i>
240 </pre>
241
242 <note>
243 Consider adding <c>docache</c> to the boot parameters. This will allow running
244 <c>umount /mnt/cdrom/</c> after booting so that you can unplug the USB flash
245 drive. Do not enable this unless the target computer has at least 128MB RAM.
246 </note>
247
248 <!--
249 (2006.1 workaround) posted by nightmorph
250
251 Background:
252 After some lengthy discussion with Robin Johnson (robbat2) on IRC, it turns out
253 that the reason why 2006.1 fails to work with this guide is because inside the
254 initramfs, it specifies -t iso9660..but usb flash isn't this filetype, it's
255 vfat. 2006.0 was much better and just specified mount -t auto. so the thing is
256 to install an ~arch version of genkernel (3.4.4, still ~arch as of 2006-11-04)
257 and reconfigure syslinux.config to point at the renamed files.
258
259 Obviously, unmasking an ~arch version is never desirable in documentation, so we
260 need some more alternatives...since 3.4.4 was only created at the end of
261 october; not likely to go stable all that soon.
262
263 Procedure:
264 After adjusting the parameters, and before the disk is unmounted/bootloader
265 installed, the following must be done for ~arch genkernel. Please replace (dash)
266 with an actual - , since the damned xmllint throws a "comment not terminated"
267 error.
268
269 # echo "sys-kernel/genkernel" &gt;&gt; /etc/portage/package.keywords
270 # genkernel (dash)(dash)bootdir=/mnt/usb (dash)(dash)install all
271 (not sure if syslinux has been installed previously yet)
272 # nano -w syslinux.cfg
273 (Edit it to point at the new filenames installed by genkernel)
274 (might be worth renaming to the ones normally used by syslinux, as
275 if the kernel name is too long, "vfat might bite")
276
277 (might need to re-run syslinux as specified below to pick up the new names,
278 though maybe this renaming step should be in the section below?)
279 # syslinux /dev/sda1
280
281 TODO:
282 - if/when this document changes, brix requested some time ago that he be renamed
283 "Original Author" and be moved to the bottom of the credits list.
284 - if/when this fix goes in, robbat2 deserves credit: this is his solution after
285 all, and it works.
286
287 -->
288
289 </body>
290 </section>
291 </chapter>
292 <chapter>
293 <title>Installing a bootloader</title>
294 <section>
295 <title>Unmounting the drive</title>
296 <body>
297
298 <p>
299 Make sure you unmount the USB flash drive before installing the bootloader:
300 </p>
301
302 <pre caption="Unmounting the USB flash drive">
303 # <i>umount /mnt/usb/</i>
304 </pre>
305
306 </body>
307 </section>
308 <section>
309 <title>Installing syslinux</title>
310 <body>
311
312 <p>
313 Finally install the <c>syslinux</c> bootloader on the USB flash drive:
314 </p>
315
316 <pre caption="Running syslinux">
317 # <i>syslinux /dev/sda1</i>
318 </pre>
319
320 <impo>
321 You will need to rerun <c>syslinux /dev/sda1</c> each time you modify the
322 <path>syslinux.cfg</path> file for the configuration changes to take affect.
323 </impo>
324
325 </body>
326 </section>
327 </chapter>
328 <chapter>
329 <title>Using the LiveUSB</title>
330 <section>
331 <title>Booting</title>
332 <body>
333
334 <p>
335 Insert the USB flash drive and turn on the computer, making sure the BIOS is
336 set to boot from USB. If all goes well you should be presented with a standard
337 syslinux prompt.
338 </p>
339
340 <p>
341 You should be able to follow the generic installation instructions found in the
342 <uri link="/doc/en/handbook/">Gentoo Handbook</uri> from here on.
343 </p>
344
345 </body>
346 </section>
347 </chapter>
348 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20