Difference between revisions of "Remastering the Install ISO"

From ArchWiki
Jump to: navigation, search
(Create a new ISO: Correct inaccurate info. Typos. Minor rewording.)
(Clarified isohybrid and remastering by xorriso)
Line 74: Line 74:
 
{{Note|The ISO label must remain the same as the original label (in this case {{ic|ARCH_201209}}) for the image to boot successfully.}}
 
{{Note|The ISO label must remain the same as the original label (in this case {{ic|ARCH_201209}}) for the image to boot successfully.}}
  
To obtain an isohybrid image after genisoimage, treat your .iso file with something like [http://www.syslinux.org/wiki/index.php/Isohybrid isohybrid], included in {{pkg|syslinux}}.
+
The resulting ISO image will boot only from CD, DVD or BD. For booting from USB stick or hard disk, it needs the [http://www.syslinux.org/wiki/index.php/Isohybrid isohybrid] feature.
 
+
This can be achieved by postprocessing the ISO by program isohybrid included in {{pkg|syslinux}}.
An alternative to genisoimage is to use the method from mkarchiso, which is:
+
Officially, the version of installed SYSLINUX has to be the same as the version of /isolinux/isolinux.bin in the ISO. It is not known whether really incompatible version combinations exist.
  
 +
An alternative to genisoimage plus isohybrid can be derived from the xorriso run of mkarchiso.
 +
 +
$ iso_label="ARCH_201209"
 
  $ xorriso -as mkisofs \
 
  $ xorriso -as mkisofs \
         -iso-level 3 \  
+
         -iso-level 3 \
 
         -full-iso9660-filenames \
 
         -full-iso9660-filenames \
 
         -volid "${iso_label}" \
 
         -volid "${iso_label}" \
        -appid "${iso_application}" \
 
        -publisher "${iso_publisher}" \
 
        -preparer "prepared by mkarchiso" \
 
 
         -eltorito-boot isolinux/isolinux.bin \
 
         -eltorito-boot isolinux/isolinux.bin \
 
         -eltorito-catalog isolinux/boot.cat \
 
         -eltorito-catalog isolinux/boot.cat \
 
         -no-emul-boot -boot-load-size 4 -boot-info-table \
 
         -no-emul-boot -boot-load-size 4 -boot-info-table \
         -isohybrid-mbr ${work_dir}/archiso_cust/isolinux/isohdpfx.bin \
+
         -isohybrid-mbr ~/customiso/isolinux/isohdpfx.bin \
         -output arch-custom.iso \
+
         -output arch-custom.iso \  
         ${custom_archiso_dir}/
+
         ~/customiso
 +
 
 +
Option -isohybrid-mbr needs an MBR template file. Most probably there is already such a file /isolinux/isohdpfx.bin in the original ISO, which matches the SYSLINUX version used in the ISO.
 +
Only if this file is missing in the copied ISO content, it has to be cut out of the original ISO image file, before above xorriso run is performed:
 +
 
 +
$ dd if=/path/to/archISO bs=512 count=1 of=~/customiso/isolinux/isohdpfx.bin
 +
 
 +
If the original ISO supports bootability via EFI, this can be activated in the new ISO by inserting the following options between the lines "-isohybrid-mbr ..." and "-output ...":
 +
 
 +
        -eltorito-alt-boot \
 +
        -e EFI/archiso/efiboot.img \
 +
        -no-emul-boot -isohybrid-gpt-basdat \
  
If you have requirements such as EFI, study the mkarchiso code, it's all there and pretty straight-forward.
+
The file /EFI/archiso/efiboot.img is a FAT filesystem image file. If it is missing in the original ISO, then there was no EFI support in that ISO.
  
 
The newly created ISO image {{Ic|arch-custom.iso}} is found in the home directory. You can write the ISO image to a USB stick as explained in [[USB Installation Media]]. Alternatively you can burn the ISO image on a CD or DVD with your preferred software. On Arch, that is covered in [[Optical disc drive#Burning]].
 
The newly created ISO image {{Ic|arch-custom.iso}} is found in the home directory. You can write the ISO image to a USB stick as explained in [[USB Installation Media]]. Alternatively you can burn the ISO image on a CD or DVD with your preferred software. On Arch, that is covered in [[Optical disc drive#Burning]].

Revision as of 13:44, 4 October 2014

Remastering the official Arch Linux install ISO image is not necessary for most applications. However, it may be desirable in some cases.

  • Basic hardware is not supported by the core install. (rare)
  • Installation on a non-internet capable machine.
  • Deployment of Arch Linux on many similar machines, requiring the same installation procedure.

As these ISOs are bootable, they can also be used for system rescue, testing, project demos, and more.

Archiso

It is often preferable to rebuild the installation ISO with Archiso, instead of remastering an existing ISO.

Manually

To remaster the Arch Linux ISO, you will need a copy of the original ISO image. Download it from the download page

Now, create a new directory to mount the ISO:

# mkdir /mnt/archiso

Mount the ISO to this directory (due to the nature of ISOs, the result is read-only):

# mount -t iso9660 -o loop /path/to/archISO /mnt/archiso

Copy the contents to another directory, where they can be edited:

$ cp -a /mnt/archiso ~/customiso

Customization

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Edit the contents of ~/customiso as needed. Some helpful hints:

  • The kernels (IDE and scsi) that are booted by the cd are found at isolinux/vmlinuz and isolinux/vmlinuz_scsi. When using a custom kernel, preferably use the configuration from existing kernels and edit them accordingly. This can be done with scripts/extract-ikconfig from any kernel source tree.
  • Kernel sources, as well as default Arch kernel configs, which are used if a user chooses to build a kernel at install time are located at arch/
  • The given filesystem in the installation environment is at airootfs.sfs. To edit this, copy it to another location:
$ cp airootfs.sfs ~

Extract the sqfs image from the file (squashfs-tools is needed for this)

$ unsquashfs airootfs.sfs

This will generate a new folder called squashfs-root with a file called airootfs.img in it. This file contains a ext2 filesystem. Mount this filesystem to make changes to it.

# mkdir /mnt/rootfs
# mount ~/squashfs-root/airootfs.img /mnt/rootfs

You can do a chroot into this folder to be able to install new software in the image using pacman.

$ arch-chroot /mnt/rootfs
Note: If the arch-chroot script is not available in your system (e.g, when remastering arch-based distros), mount the api file systems and copy over your DNS details. See Chroot#Using_plain_chroot.

When done, exit from the chroot, unmount the rootfs and create the new squashfs image:

# exit
# umount /mnt/rootfs
$ mksquashfs squashfs-root airootfs.sfs

You will probably have to delete the old airootfs.sfs, as otherwise mksquashfs will try to append and give all kinds of problems. You'll now have a new airootfs.sfs, which you can copy back to your ISO, replacing the old one:

$ cp airootfs.sfs customiso/airootfs.sfs

Create a new ISO

Create a new ISO image with genisoimage, which is part of cdrkit.

$ genisoimage -l -r -J -V "ARCH_201209" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -o ~/arch-custom.iso ~/customiso
Note: The ISO label must remain the same as the original label (in this case ARCH_201209) for the image to boot successfully.

The resulting ISO image will boot only from CD, DVD or BD. For booting from USB stick or hard disk, it needs the isohybrid feature. This can be achieved by postprocessing the ISO by program isohybrid included in syslinux. Officially, the version of installed SYSLINUX has to be the same as the version of /isolinux/isolinux.bin in the ISO. It is not known whether really incompatible version combinations exist.

An alternative to genisoimage plus isohybrid can be derived from the xorriso run of mkarchiso.

$ iso_label="ARCH_201209"
$ xorriso -as mkisofs \
       -iso-level 3 \  
       -full-iso9660-filenames \
       -volid "${iso_label}" \
       -eltorito-boot isolinux/isolinux.bin \
       -eltorito-catalog isolinux/boot.cat \
       -no-emul-boot -boot-load-size 4 -boot-info-table \
       -isohybrid-mbr ~/customiso/isolinux/isohdpfx.bin \
       -output arch-custom.iso \ 
       ~/customiso

Option -isohybrid-mbr needs an MBR template file. Most probably there is already such a file /isolinux/isohdpfx.bin in the original ISO, which matches the SYSLINUX version used in the ISO. Only if this file is missing in the copied ISO content, it has to be cut out of the original ISO image file, before above xorriso run is performed:

$ dd if=/path/to/archISO bs=512 count=1 of=~/customiso/isolinux/isohdpfx.bin

If the original ISO supports bootability via EFI, this can be activated in the new ISO by inserting the following options between the lines "-isohybrid-mbr ..." and "-output ...":

       -eltorito-alt-boot \
       -e EFI/archiso/efiboot.img \
       -no-emul-boot -isohybrid-gpt-basdat \

The file /EFI/archiso/efiboot.img is a FAT filesystem image file. If it is missing in the original ISO, then there was no EFI support in that ISO.

The newly created ISO image arch-custom.iso is found in the home directory. You can write the ISO image to a USB stick as explained in USB Installation Media. Alternatively you can burn the ISO image on a CD or DVD with your preferred software. On Arch, that is covered in Optical disc drive#Burning.

larch

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

Note:
  • As of version 2.6.39, the vanilla kernel no longer supports aufs, making a custom kernel a necessity.
  • There is an AUFS version of the arch kernel in AUR - linux-aufs_friendly, 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