summaryrefslogtreecommitdiffstats
path: root/building_usb.xml.bak
blob: 845e71604ca33349c524f162145ae79ca8e4f019 (plain)
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<sect1 id="building_usb">
  <?dbhtml filename="building.html"?>
  <title>Building the USB live system</title>
  <para>Creating the USB live system is quite easy. Either install your LFS/BLS system on the USB media, if you used a package manager, or copy your system to the USB media:</para>
  <para>Because you're propably running the wanted system now, let's repeat a little part of the LFS book; create the directory structure</para>
  <screen><userinput>mkdir -pv -m 755 $LFSMOUNT/{bin,boot,dev/{pts,shm},etc,home,include,lib,media,mnt,opt,proc,run,sbin,share,srv,sys,usr}
mkdir -pv -m 755 $LFSMOUNT/var/{opt,cache,lib/{misc,locate},local,log,mail,spool} 
install -dv -m 0750 $LFSMOUNT/root
install -dv -m 1777 $LFSMOUNT/tmp $LFSMOUNT/var/tmp
ln -s /run $LFSMOUNT/var/run
ln -s /run/lock $LFSMOUNT/var/lock</userinput></screen>
<para>Make sure you have support for loopback device in your kernel:</para>
<screen><userinput>ls -l /dev | grep loop</userinput></screen>
<para>You should see a few /dev/loopX, where X is a number from 0 to 7. If this is not the case, and the loopback is supported as a kernel module, try to modprobe the module and retry again:</para>
<screen><userinput>modprobe loop
ls -l /dev | grep loop</userinput></screen>

  <para>Udev populates /dev so copying /dev is not possible. Therefore create the basic device nodes:</para>
  <screen><userinput>mknod -m 600 $LFSMOUNT/dev/console c 5 1
mknod -m 666 $LFSMOUNT/dev/null c 1 3
cp -av /dev/loop[0-7] $LFSMOUNT/dev/
mknod $LFSMOUNT/dev/ram0 b 1 0 </userinput></screen>
  <para>Now copy the system:</para>
  <screen><userinput>cp -av /bin /boot /etc /include /lib /opt /sbin /share /srv /usr $LFSMOUNT</userinput></screen>
  <para>Modify mtab and fstab in etc</para>
  <screen><userinput>echo "" > $LFSMOUNT/etc/mtab
echo "# Begin /etc/fstab" > $LFSMOUNT/etc/fstab
echo >> $LFSMOUNT/etc/fstab
echo "# file system   mount-point    type    options           dump  fsck" >> $LFSMOUNT/etc/fstab
echo "#                                                              order" >> $LFSMOUNT/etc/fstab
echo >> $LFSMOUNT/etc/fstab
echo "LABEL=$LFSLIVE  /              ext3    defaults          1     1" >> $LFSMOUNT/etc/fstab
echo "proc            /proc          proc    defaults          0     0" >> $LFSMOUNT/etc/fstab
echo "sysfs           /sys           sysfs   defaults          0     0" >> $LFSMOUNT/etc/fstab
echo "devpts          /dev/pts       devpts  gid=4,mode=620    0     0" >> $LFSMOUNT/etc/fstab
echo "tmpfs           /run           tmpfs   defaults          0     0" >> $LFSMOUNT/etc/fstab
echo >> $LFSMOUNT/etc/fstab
echo "# End /etc/fstab" >> $LFSMOUNT/etc/fstab
</userinput></screen>

  <para>Copy our previous created initrd.gz to /boot of the media.</para>
  <screen><userinput>cp &lt;PATH-TO-INITRD>/initrd.gz $LFSMOUNT/boot</userinput></screen>
  <para></para>
</sect1>