Difference between revisions of "Building a Live CD"

From ArchWiki
Jump to: navigation, search
m (use i18n)
(aur -> pkg)
(30 intermediate revisions by 17 users not shown)
Line 1: Line 1:
[[Category:Arch development (English)]]
+
[[Category:Arch development]]
[[Category:General (English)]]
+
[[Category:Live Arch systems]]
[[Category:Live Arch systems (English)]]
+
[[ja:Building a Live CD]]
[[Category:HOWTOs (English)]]
+
[[ru:Building a Live CD]]
{{Template:Out_of_date}}
+
Having a bootable version of Arch Linux running totally off of a CD is useful in many ways. It can be used to rescue your system, test new machines and check if the hardware is Linux compatible, keep an updated installer with the latest packages, make a demo CD to show your projects, and much more.
  
 +
This article will give an overview of some methods available for creating your own Arch Linux-based live media. Please refer to the respective article for detailed information.
  
{{i18n|Building a Live CD}}
+
== Archiso ==
 +
[[Archiso]] is the official tool used to build Arch Linux release images. It strongly follows the KISS principle and is easy to use. If you want to build your own updated Arch Linux live installation images, this tool will get you to your goal quickly, as the Git repository contains the exact profile used to generate these installation images. However, it can also be used for completely customizing your live medium. It relies on an Arch Linux host system.
  
== New instructions ==
+
{{pkg|archiso}}.
Please see [[Archiso]] or [[larch]] for two possible approaches. The methods described in this article are old and likely to break.
+
  
=== Motivation - Why? ===
+
== larch ==
To have a bootable version of Arch Linux running totally off a CD, is useful in many ways. It can be made to rescue your HD system, test new machines / hardware if Linux compatible, keep an updated installer with latest packages, or make a demo CD to show your projects, and much more.
+
[[larch]] aims to provide a more desktop-based approach, and it does not require an Arch Linux host system.
  
== Old instructions (outdated)==
+
{{AUR|larch}}.
=== Before we start - What you'll need ===
+
# To create an iso, format a filesystem, and to resize an image download <code>cdrtools</code> and <code>e2fsprogs</code> packages.
+
# pacman -S cdrtools
+
# pacman -S e2fsprogs
+
# Free hard disk space:
+
* 1 fresh partition to install the distro.
+
* 1 folder in your active partition to copy the distro to be put on the CD.
+
# A CD-RW to test burning various images and a CD burner.
+
# Install CD burning package (if you don't know what package to install, try <code>k3b</code> or you may prefer <code>brasero</code> if you are on GNOME).
+
# pacman -S k3b
+
or
+
# pacman -S brasero
+
  
=== Details ===
+
{{Note|As of version 2.6.39, the vanilla kernel no longer supports aufs, making a custom kernel a necessity.}}
As an example, here we are creating a mini Arch Linux live CD (110MB). It is based on packages installed from Arch Linux's CD installer ver. 0.5.
+
{{Note|There is an AUFS version of the arch kernel in AUR(linkplz), and larch maintains an i686 build, you need not compile anything unless you want 64 bit}}
  
==== Boot with Arch Linux CD installer and install the base packages ====
+
== poison-livecd-creator ==
 +
It is a very simple live CD creator. It uses just a Makefile to build live CD images, and uses pacman to install base and additional packages to the live CD. You can choose your packages and build them into a live CD. Moreover, it uses [[GRUB]] to boot the live CD in order to add more flexibility. This means that it is much easier to make a live USB stick without formating it. For that, you just need to install GRUB into your USB pen drive and copy the files in the ISO to your root directory in the pen drive. It relies on an Arch Linux host system and [[pacman]].
  
When the packages are installed, install the kernel but don't install LILO or Grub. You can also copy your own kernel image (<tt>/boot/vmlinuz</tt>), and related modules (<tt>/lib/modules/2.x.x</tt>) from your active partition. To boot the new install, configure <tt>lilo.conf</tt> or <tt>grub</tt> in your active partition.
+
{{AUR|poison-livecd-creator}}.
  
'''Hint:'''For test purpose, to check for errors in the booting process, in your active partition mount the new partition and edit <tt>/etc/rc.local</tt> with the following lines to pause before login:
+
== Linux-pf ==
 +
It supports aufs among other things, making it an option for live CDs.
  
echo "Press any key to continue..."
+
{{AUR|linux-pf}}.
read KEY
+
  
'''NOTE:''' Don't forget to remove the pause!!
+
{{Note|As of version 2.6.39, the vanilla kernel no longer supports aufs, making a custom kernel a necessity.}}
  
In your active partition, in <tt>/root</tt> make one folder "''mylivecd''" and two sub-folders: "''isolinux''" and "''system''" (any names can be used).
+
== See Also ==
 
+
* [http://www.linux-live.org/ Linux Live Kit]
# cd /root
+
# mkdir mylivecd
+
# cd mylivecd
+
# mkdir isolinux
+
# mkdir system
+
 
+
==== Install isolinux. Copy it from an existing live CD.====
+
 
+
# Download "''isolinux.bin''" and "''boot.cat''" to <tt>/root/mylivecd/isolinux/</tt> :
+
http://amlug.bliss-solutions.org/live-cd/distfiles/0.5.1/isolinux/
+
# Create boot message "''boot.msg''" (text file) and include a short description about the live CD. Save the file in <tt>/root/mylivecd/isolinux/</tt>. Copy this text to <tt>boot.msg</tt>:
+
This is a Live CD test ver. 0.1.
+
F1 - boot message
+
F2 - package list
+
 
+
  Press Enter
+
# Create "''isolinux.cfg''" (text file) and include the following text. Save the file in <tt>/root/mylivecd/isolinux/</tt>
+
prompt 1
+
timeout 0
+
display boot.msg
+
F1 boot.msg
+
F2 package.txt
+
default vmlinuz initrd=miniroot.gz init=/sbin/init ramdisk_size=100000 load_ramdisk=1 prompt_ramdisk=0 vga=788 root=/dev/ram0
+
 
+
==== Build one miniroot image ====
+
Miniroot is loaded in RAM during booting and operates same as in HD. Use Ext2 filesystem.
+
 
+
'''NOTE:''' Miniroot setup depends on <tt>/etc/inittab</tt>, <tt>/etc/rc.sysinit</tt>, <tt>/etc/rc.multi</tt>, and <tt>/etc/rc.shutdown</tt>. Before building the miniroot image, study these files and plan how they can be modified whenever is needed. In <tt>/sbin</tt> the following files are required: <br>
+
http://amlug.bliss-solutions.org/live-cd/distfiles/0.5.1/miniroot/init/sbin/
+
 
+
# Create "''miniroot''" (text file) in <tt>/root/mylivecd</tt> with Ext2 filesystem. The image size depends how much stuff you plan to include. In this sample we will make the image 15.8MB but its recommended to make the image as small as possible. When you are ready, mount the image in <tt>/mnt/xxx</tt> (here we mount in <tt>/mnt/image</tt>).
+
# cd /root/mylivecd
+
# touch miniroot
+
# mkfs.ext2 miniroot 15840 (press "y" for each question)
+
# mkdir /mnt/image
+
# mount -t auto -o loop miniroot /mnt/image
+
# rm -R /mnt/image/lost+found
+
'''NOTE:''' If you want to resize, run the following codes (e.g. to 11.5MB):
+
# e2fsck -f miniroot (press "y" for /lost+found not found.  Create<y>?)
+
# resize2fs miniroot 11520
+
# Mount the new partition (e.g. <tt>/dev/hda3</tt>). Copy the below folders and files from the new partition to <tt>/mnt/image</tt> (use <tt>cp -Ra</tt> to maintain the file permissions).
+
# mkdir /mnt/tmp
+
# mount /dev/hda3 /mnt/tmp
+
# cp -Ra /mnt/tmp/bin /mnt/image/
+
# cp -Ra /mnt/tmp/etc /mnt/image/
+
# cp -Ra /mnt/tmp/sbin /mnt/image/
+
# cp -Ra /mnt/tmp/tmp /mnt/image/
+
# cp -Ra /mnt/tmp/var /mnt/image/
+
# Copy <tt>/usr</tt> and <tt>/lib/modules/2.x.x/</tt>, <tt>/lib/modules/evms/</tt>, <tt>/lib/modules/security/</tt> to <tt>/root/mylivecd/system/</tt> :
+
# cp -Ra /mnt/tmp/usr /root/mylivecd/system/
+
# cp -Ra /mnt/tmp/opt /root/mylivecd/system/
+
# mkdir /root/mylivecd/system/lib
+
# cp -Ra /mnt/tmp/lib/modules /root/mylivecd/system/lib/
+
# cp -Ra /mnt/tmp/lib/evms /root/mylivecd/system/lib/
+
# cp -Ra /mnt/tmp/lib/security /root/mylivecd/system/lib/
+
'''NOTE''': If <tt>/bin</tt> and <tt>/sbin</tt> are too big you may consider using busybox:
+
http://www.busybox.net/
+
'''OR''' temporary folders, which will be removed or renamed at the boot by codes in <tt>/rc.sysinit</tt>. Here is an example:
+
http://amlug.bliss-solutions.org/live-cd/distfiles/0.5.1/miniroot/init/sbin/rc.sysinit
+
# Create the following folders in <tt>/mnt/image</tt> and copy <tt>/mnt/tmp/lib</tt> files to  <tt>/mnt/image/lib/</tt> (don't copy  <tt>/mnt/tmp/lib/module</tt>, <tt>~/lib/evms</tt> and <tt>~/lib/security)</tt>:
+
# cd /mnt/image
+
# mkdir dev
+
# mkdir home
+
# mkdir lib
+
# mkdir mnt/cdrom
+
# mkdir mnt/floppy
+
# mkdir root
+
# mkdir proc
+
# mkdir lib/modules
+
# cd /mnt/tmp/lib/
+
# cp -a l* /mnt/image/lib/
+
#With the folders <tt>/usr</tt> and <tt>/opt</tt> create links in <tt>/mnt/image/</tt>. Also link the <tt>/system/lib/modules/2.x.x/</tt>. Copy kernel image to <tt>/root/mylivecd/isolinux/</tt>:
+
# cd /mnt/image
+
# ln -sf /mnt/cdrom/system/usr usr
+
# ln -sf /mnt/cdrom/system/opt opt
+
# cd /mnt/image/lib/modules/
+
# ln -sf /mnt/cdrom/system/lib/modules/2.4.22 2.4.22
+
# cd /mnt/image/lib/
+
# ln -sf /mnt/cdrom/system/lib/evms evms
+
# ln -sf /mnt/cdrom/system/lib/security security
+
# cp /mnt/tmp/boot/vmlinuz /root/mylivecd/isolinux/
+
# Edit <tt>/mnt/image/etc/fstab as shown here:</tt>
+
/dev/root      /      ext2    defaults 0 0
+
none          /proc  proc    defaults 0 0
+
/dev/floppy/0          /mnt/floppy  auto      user,rw,noauto,unhide    0      0
+
/dev/cdroms/cdrom0    /mnt/cdrom  iso9660  ro,user,noauto,unhide  0      0
+
# Add the following line in <tt>rc.sysinit</tt> (after  line: <tt>stat_busy "Mounting Local Filesystems"</tt>) in <tt>/mnt/image/etc/</tt>. This enables reading files from the CD's /system folder.
+
/bin/mount /dev/cdroms/cdrom0 /mnt/cdrom -o ro -t iso9660
+
# Compress the miniroot and move miniroot.gz to /root/mylivecd/isoliux/
+
# cd /root/mylivecd/
+
# umount /mnt/image
+
# gzip -c miniroot >> miniroot.gz
+
# mv miniroot.gz isolinux/
+
# Before compiling iso, move the <tt>/root/mylivecd/miniroot</tt> to a safe place. Make  a temporary folder to put the iso image (not within <tt>/mylivecd</tt>). Run the following code (don't miss the "." at the end of line):
+
# cd /root/mylivecd
+
# mkdir /root/isotmp
+
# Make the ISO:
+
mkisofs -o /root/isotmp/test-livecd-0.1.iso -R -V "Test 0.1" \
+
-T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
+
-boot-load-size 4 -boot-info-table -A "Test Live CD 0.1" .
+
 
+
==== Conclusion ====
+
We hope this document gets you started. Any comments or addition, please either edit the content or post reply (requires to register). Good luck!
+
 
+
------
+
 
+
=== Additional Info:===
+
 
+
Codes, content of AMLUG Live CD, and how to compress:
+
http://www.amlug.net/new-projects/forum/index.php?showforum=23
+
 
+
How other distros build live CDs:
+
http://www.babytux.org/articles/howto/how2livecd.php
+
----
+

Revision as of 07:34, 26 February 2013

Having a bootable version of Arch Linux running totally off of a CD is useful in many ways. It can be used to rescue your system, test new machines and check if the hardware is Linux compatible, keep an updated installer with the latest packages, make a demo CD to show your projects, and much more.

This article will give an overview of some methods available for creating your own Arch Linux-based live media. Please refer to the respective article for detailed information.

Archiso

Archiso is the official tool used to build Arch Linux release images. It strongly follows the KISS principle and is easy to use. If you want to build your own updated Arch Linux live installation images, this tool will get you to your goal quickly, as the Git repository contains the exact profile used to generate these installation images. However, it can also be used for completely customizing your live medium. It relies on an Arch Linux host system.

archiso.

larch

larch aims to provide a more desktop-based approach, and it does not require an Arch Linux host system.

larchAUR.

Note: As of version 2.6.39, the vanilla kernel no longer supports aufs, making a custom kernel a necessity.
Note: There is an AUFS version of the arch kernel in AUR(linkplz), and larch maintains an i686 build, you need not compile anything unless you want 64 bit

poison-livecd-creator

It is a very simple live CD creator. It uses just a Makefile to build live CD images, and uses pacman to install base and additional packages to the live CD. You can choose your packages and build them into a live CD. Moreover, it uses GRUB to boot the live CD in order to add more flexibility. This means that it is much easier to make a live USB stick without formating it. For that, you just need to install GRUB into your USB pen drive and copy the files in the ISO to your root directory in the pen drive. It relies on an Arch Linux host system and pacman.

poison-livecd-creatorAUR.

Linux-pf

It supports aufs among other things, making it an option for live CDs.

linux-pfAUR.

Note: As of version 2.6.39, the vanilla kernel no longer supports aufs, making a custom kernel a necessity.

See Also