From Mageia wiki
Jump to: navigation, search
m (add helpfull links)
(modified helpfull links)
Line 194: Line 194:
  
 
==Helpfull links==
 
==Helpfull links==
https://wiki.mageia.org/en/Draklive
+
* Draklive documentation [https://wiki.mageia.org/en/Draklive]
https://wiki.mageia.org/en/Auto_inst
+
* Auto_inst.cfg.pl manual pages [https://wiki.mageia.org/en/Auto_inst]

Revision as of 09:48, 7 October 2017

[By Martin Whitaker]

Background

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

draklive builds the ISOs in four steps

1. Install

This uses the classic 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-lzma.sqfs'. When you boot a Live system, this gets mounted (read-only) and merged with a RAM disk using the 'unionfs' filesystem. This merging with a RAM disk is what allows changes to be made to a running Live system.

4. Master

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

draklive provides a number of other functions, but none of these are used in creating the Live ISOs.

The Live ISO composition is specified by three configuration files

1. settings

Specified via the --settings command line option (defaults to ./config/settings.cfg). This is a simple 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/live.cfg). This uses perl syntax.

Contains a more detailed specification of the Live ISO makeup. Mostly this is the "tweaks" mentioned above.

3. auto_install

Specified via the $system->{auto_install} setting in the config file (defaults to ./config/auto_inst.cfg.pl). This uses perl syntax.

This is the standard method of driving the classic installer in non-interactive mode. Mostly it is used for package selection. The file format is extensively documented at https://wiki.mageia.org/en/Auto_inst.

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

Building Locally

Although draklive 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 draklive and its dependencies:

      sudo urpmi draklive

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

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

and then in subsequent instructions replace the draklive command by

perl -I../draklive/lib ../draklive/draklive 

(this assumes you check out draklive 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=6-rc
  • change builddir and chroot to somewhere suitable on your local disk
  • builddir currently requires up to 5GB per Live flavour
  • chroot currently requires up to 8.5GB per Live flavour
Note:
Don't enable updates_repository (this enables the testing repositories).

4. In draklive-config, modify ./files/mga_rpms/update_media.sh to change the repository path, e.g.

      bcdmedia=$LOCAL_REPO/distrib/$RELEASE

then update the local repo that will be included on the Live ISO (used for building the proprietary drivers and for installing grub2):

      pushd ./files/mga_rpms
      ./update_media.sh
      popd

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

      sudo draklive --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:

      sudo draklive --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

       --install
       --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: 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:
      ./tools/build_live.sh &

(run in the background in case your ssh connection goes down - the build should keep going)

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_live.sh deletes them from the RAM disk once they have been copied to the rsync directory.

You can of course build individual ISOs, by following the steps in 'Building Locally'.

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/live.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.

Helpfull links

  • Draklive documentation [1]
  • Auto_inst.cfg.pl manual pages [2]