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