From Mageia wiki
Jump to: navigation, search

[By Martin Whitaker]

Background

The tool used to create the Mageia Live ISOs is draklive2. This is packaged and available to be installed on Mageia 7 and above. The latest version is in cauldron and has been back-ported to infra6, to allow its use on the Mageia build servers.

The draklive2 documentation describes how a user can build a custom live ISO. These notes describe how the official Mageia Live ISOs are built. Refer to the full documentation for more detail.

draklive2 builds the ISOs in four steps

1. Root

This uses the classical installer to install a standard Mageia system into a dummy root file system and then performs any post-install "tweaks" specified by user. The only significant difference to a standard install is that it installs support for all hardware (rather than detecting what is required for the target machine), and (optionally) installs support for all locales.

2. Boot

This creates the initrd and installs the bootloader in the dummy file system. It also prepares the additional files needed for booting a hybrid ISO (i.e. booting either from a real DVD or from a USB stick).

3. Loop

This compresses the dummy file system into a 'squashfs' file system image. This gets stored on the final ISO in the file 'loopbacks/distrib.sqfs'. When you boot a Live system, this gets mounted (read-only) and merged with a RAM disk using the 'overlayfs' filesystem. This merging with a RAM disk is what allows changes to be made to a running Live system. On a USB stick, if the user creates an extra partition in the remaining space, formatted with a suitable filesystem (e.g. ext4) and labelled 'mgalive-persist', that partition will be used instead of a RAM disk, allowing changes to be persistent.

4. Master

This builds the final ISO image from the files created in the Boot and Loop steps.

The Live ISO composition is specified by two configuration files

1. settings

Specified via the --settings command line option (defaults to ./config/settings.cfg). This is a simple shell variable text file.

Contains the most basic settings: DE, arch, region(s), path to repository, path to build dir, etc. Most can be overridden by the --define command line option, which saves editing the file when generating the different flavours of Live ISO.

2. config

Specified via the --config command line option (defaults to ./config/build.cfg). This uses perl syntax.

Contains a more detailed specification of the Live ISO makeup, including package selection and all the "tweaks" mentioned above.

Any other files used to create the Live ISOs will be referenced in one of the above files.

Building Locally

Although draklive2 can be configured to use a remote repository, if you are going to do this more than once it is advisable to create a local mirror. I do this by:

  MIRROR=rsync://rsync.mirrorservice.org/mageia.org/pub/mageia
  LOCAL_REPO=<path to big disk partition>/mageia
  RELEASE=cauldron
  rsync -avuH --delete $MIRROR/distrib/$RELEASE/i586   $LOCAL_REPO/distrib/$RELEASE/
  rsync -avuH --delete $MIRROR/distrib/$RELEASE/x86_64 $LOCAL_REPO/distrib/$RELEASE/

Be warned that these take a considerable amount of disk space - currently 71GB for cauldron/i586 and 73GB for cauldron/x86_64. If you only want to build for one arch, you only need to mirror that arch.

Now follow the following steps:

1. Install the drakiso package and its dependencies:

      sudo urpmi drakiso

If you want to make any changes to the draklive2 tool itself, you can instead get the source code by

git clone git://git.mageia.org/software/build-system/drakiso/

and then in subsequent instructions replace the draklive2 command by

perl -I../drakiso/lib ../drakiso/draklive2

(this assumes you check out drakiso in the same directory as draklive-config).

2. Clone the draklive-config repository and cd into the checked out copy:

      git clone git://git.mageia.org/software/build-system/draklive-config
      cd draklive-config

3. In draklive-config, modify ./config/settings.cfg to:

  • change the repository path, e.g.
          repository=$LOCAL_REPO/distrib/$RELEASE
  • change the version number, e.g.
          version=7-beta1
  • change workdir to somewhere suitable on your local disk (currently requires 12-13GB per Live flavour)

4. In draklive-config, extract the bootloader files from the repository:

      ./update_bootloader_files.sh

5. In draklive-config, run all four draklive2 stages:

      draklive2 --all --define desktop=$DESKTOP --define arch=$ARCH

where $DESKTOP can be one of

  • GNOME
  • Plasma
  • Xfce

and $ARCH can be one of

  • i586
  • x86_64

If you just want to build the default DE/arch specified by ./config/settings.cfg, then use:

      draklive2 --all

When rebuilding you just repeat step 5 (and step 4 if you have updated your local mirror). You can start from scratch by adding the option '--clean'. Alternatively you can just rerun some of the steps by replacing '--all' with one or more of

       --root
       --boot
       --loop
       --master

This is useful when testing bug fixes - you can change individual files in the dummy file system and then just rerun the --loop and --master steps. The steps will be run in the correct order, regardless of which order you write them.

NOTE: draklive2 will use the 'sudo' command to execute any actions that require root privileges. If you don't wish to install/use 'sudo', you can instead run draklive2 as root.

NOTE: As an alternative to changing the paths in the configuration files, you can create soft links in your local file system to mimic the paths used on the Mageia server. This makes things easier when you want to commit other changes to the git repository.

Building on the Mageia Server

You will need a sysadmin to create you a login account on the build server (currently 'rabbit') and add you to the mga-users, mga-packagers, and mga-iso_makers groups. You will also need to have set up ssh as described in https://wiki.mageia.org/en/Packagers_ssh

You connect to the server via ssh, e.g.

  ssh my_mageia_id@rabbit.mageia.org

This gives you a command prompt on the server.

To build a full set of Live ISOs, follow the following steps:

  • Clone the draklive-config repository and cd into the checked out copy:
      git clone git://git.mageia.org/software/build-system/draklive-config
      cd draklive-config
  • Execute the build script:
      ./build_all.sh

The ISOs are built on a RAM disk (/home/draklive/var_data) and then copied to the rsync directory (/home/bcd//home/bcd/public_html/isos/trial-builds/) from where you can download them onto your local machine using your preferred rsync tool (e.g. mageiasync). Because there isn't enough space on the RAM disk for all four builds, build_all.sh deletes them from the RAM disk once they have been copied to the rsync directory.

You can also build individual ISOs, using the build_one.sh script.

Because the dummy file system has the same file access permissions as a real system, you have limited access to it. This makes it hard to debug problems on the Mageia server, as the install logs are stored in /root/drakx on the dummy file system, and can only be read by root. I generally debug problems by building locally, but if the problems only occur on the Mageia server, I add some commands in the postInstall section in ./config/build.cfg to make the logs readable. Just remember to undo that before releasing the ISOs!

The local repository on the build server is in /home/bcd/build_bcd/pieces. It is manually sync'd with the master repository by:

  sudo -u bcd /home/bcd/sync_pieces.sh

This repository is also used for building the classic ISOs, so co-ordinate this with the other ISO builders. It is vital for all ISO builds that the local repository doesn't change during the build process.