Draklive

From Mandriva Community Wiki

Jump to: navigation, search

A live distribution mastering tool

Contents


[edit] Introduction

draklive builds a live distribution according to a configuration file, creates a master image, and optionally installs it on a device.

[edit] Why a new live mastering tool?

[edit] Mandriva Move

The Move1/Move2 technology is quite deprecated now, it was about loading writable files in RAM, and using dnotify to monitor file modifications and copy the modified files on the USB key.

It required a specific boot process, and a complex mastering process.

It is better replaced by something like unionfs, which allows transparent filesystem overlay (and makes possible file removal).

[edit] mklivecd

mklivecd already allows to create live distributions, but it is not easy to keep it in sync with the latest hardware or technical updates. mklivecd needs it's own long initrd script (linuxrc), as well as a new rc.sysinit file. It makes the boot very complicated, and it's not easy to maintain all these three programs (linuxrc, rc.sysinit, mklivecd) together.

[edit] linux-live / Slax

The linux-live scripts are quite similar, but they also require some additional library in the initrd, and they don't provide a good hardware drivers list in their initrd.

[edit] Advantages

draklive's philosophy is to keep the live distribution as close as possible to a normal Mandriva Linux distribution. All specific live tweaks are done in a very tiny initrd script. Since this one is generated on the fly, it is very small, and gets quite easy to debug.

The list of drivers included in the initrd is adjusted during the live distribution creation, according to the medium type. draklive uses the DrakX libraries to have an up-to-date drivers list.

Once the initrd script is done booting, the root device will be used transparently by the distribution, without any additional tricks.

Hardware detection is done with harddrake, providing a reliable integration.

[edit] Features

  • live CD
  • live distribution on USB key
  • easy to test over NFS
  • uses the Mandriva installer to create the live system
  • fully read-write live system (using unionfs)
  • automatic hardware configuration (using harddrake)
  • generic code structure to make new technical choices quickly usable

[edit] Quickstart

[edit] Requirements

The following packages must be installed on your system: either xorg-x11-xnest or xorg-x11-xephyr , squashfs-tools, syslinux, mkisofs, rsync and mtools

[edit] Getting the tool and config files

svn co http://svn.mandriva.com/svn/soft/draklive/trunk draklive
svn co http://svn.mandriva.com/svn/config/One/trunk live-config
cd live-config

Then, edit the repository address (and other local settings) in config/settings.cfg.

[edit] Building a live CD or live USB

../draklive/draklive --clean --all

See the output of draklive --help for more details.

[edit] Recording a live USB

../draklive/draklive --record --device /dev/sdb1

[edit] Configuration

[edit] Example

  {
    system => {
        root => '/chroot/live/2007.0',
        repository => '/mnt/BIG/dis/2007.0/i586',
        auto_install => 'config/auto_inst.cfg.pl',
        rpmsrate => 'config/rpmsrate',
        vga_mode => 788,
    },
    media => {
        storage => 'cdrom',
    },
    mount => $predefined{mounts}{volatile_squash_union},
  };

[edit] Example: Creating a bootable cdrom for old computers which cannot boot from the USB key

Modify the file config/live.cfg media hash as follows:

media => { storage => 'usb', boot => 'cdrom' },

And then run the command:

draklive --config config/live.cfg --boot-only --boot --master

This will create the iso file: /your_workdir/images/boot.iso (your_workdir is /var/lib/draklive by default)

[edit] Exhaustive description

The configuration file should contain a hash of settings. Some settings have to be filled in the top-level, others have to be grouped in sub-hashes.

[edit] system sub-hash

This hash describes the installed distribution.

  • root: path of the installed disitribution
  • repository: path to the installer repository
  • auto_install: installer auto_install.cfg.pl file
  • patch_install: installer patch file (actually defcfg file)
  • postInstall: commands to be run (using bash -c after all the additional_media/rpm/patches steps are done)
  • install_env: hash reference of variables that should be passed to install (they will be usable in the auto_install.cfg.pl as well)
  • additional_modules: array reference of .ko modules to be copied and loaded in the initrd
  • rpmsrate: local rpmsrate path (useful to add/modify/remove packages rate)
  • patches: array reference of patches to be applied directly in system root
  • rpms: array reference of rpms to be installed after installation
  • vga_mode: graphical mode which the live distribution should use,
  • splash: set to no if you don't want to use a splash (default is yes)
  • kernel: default kernel release (optional)

[edit] media sub-hash

This hash describes which medium access should be used.

  • storage: medium type (cdrom or usb)

Optional fields:

  • boot: boot medium type to be used with --boot-only option, if any (cdrom or usb)

Or customised settings:

  • $custom{media}{nfs}->(module name, live system IP address, NFS source)

[edit] extra_media sub-array

This array should contain all extra media (see media sub-hash description) that the live system should support. This allows to make live systems using different boot types, using the copy wizard. For example, if the default media is of the cdrom type, and the extra media array contains a media using the usb type, the running live CD will allow to duplicate itself to both USB keys and CDs.

[edit] mount sub-hash

This hash describes how the live components have to be mounted together.

Some basic setups are predefined:

  • $predefined{mounts}{simple_union} : use the media contents as raw root, and mount it with a tmpfs using unionfs, to get a RW system
  • $predefined{mounts}{volatile_squash_union} : compress the distribution in a distrib.sqfs file, uses a tmpfs, and mounts them together using unionfs
  • $predefined{mounts}{squash_union} : compress the distribution in a distrib.sqfs file, a system.loop ext2 read-writable loopback file, and mounts them together using unionfs
  • $predefined{mounts}{multi_squash_union} : compress the distribution in a distrib.sqfs file, optionally uses a read-only system.sqfs "patch", a tmpfs, and mounts them together using unionfs

Or build your own mount type:

  • TODO

[edit] top-level settings

Live settings:

  • post: array of commands to be run at end of initrd
  • copy_initrd: copy the initrd to this location at the end of the initrd step (e.g. to /var/lib/tftpboot/live.rdz)
  • debug: include some debug tools in initrd (busybox, strace, ping) and run a debug shell at beginning of initrd

Directory settings (all optional):

  • workdir: draklive working directory (defaults to /tmp/draklive)
  • mnt: temporary mount point for draklive

[edit] References

[edit] draklive tools and One configuration files

[edit] Other live tools

[edit] Overlay filesystems

[edit] UnionFS

[edit] Other

Personal tools
In other languages