HOWTO use MKCD the Mandriva Linux Disc maker

Antoine Ginies (aginies _at_ mandriva.com)

2006

Revision History
Revision 0.322/02/2006ag
re-read/adjustement by Warly (thx for all remarks)
Revision 0.202/2006ag
first release


1. HOWTO use MKCD

Goal of this document is to learn how to use MKCD. It's just an example of how i use it to create IGGI ISO. I use MKCD-4.1.7 and keep in mind that MKCD configuration can change between release (before 4.1.X release).

external links to MKCD found at qa.mandriva.com :

IMPORTANT NOTE: This doc is written in docbook, cause i am not a fan of WIKI and i wrote various documentation in docbook format. So if you want to contribute or convert it to a wiki, you're welcome, but i will not write it in WIKI format, and don't bother me about this.

2. Needed directories

In your home directory you can create various directories, to store ISO, configuration files, log etc... this is not a require, because path to store data only depends on mkcd configuration file. We only create those directory to "organise" MKCD configuration. Note: build and iso directories are created by MKCD if they don't exist.

  • input : configuration files

  • log : all logs

  • pieces : RPM repositery, extra files, path to installer (gi)

  • build : path to store CDROM, ISO will be built from there

  • iso : generated ISO

2.1. input directory

In this directory we create a sub-directory with the name of our projet. Why ? because if i want to store various configurations for other project, i just have to put them in their own folder. Lets create the iggi directory, and in this directory an x86 directory, an iggi.conf file (the main MKCD's configuration file) and the public key key of the RPMS. In iggi/x86/ directory we store files that are lists of wanted RPM and SRPMS.

2.1.1. iggi.conf : MKCD main configuration file

The main configuration file of MKCD is a bit stranger at first look, but in fact it's very easy to modify it.

iggi

VERSION=iggi

list 1 -k input/iggi/pubkey_main input/iggi/x86/main
rpmlist -b pieces/iggi/x86/main pieces/iggi/x86/main_updates pieces/iggi/x86/main_backport

list 10 -k input/iggi/pubkey_main input/iggi/x86/rpmcluster
rpmlist -b pieces/iggi/x86/rpmcluster

list 20 -k input/iggi/pubkey_main input/iggi/x86/contrib
rpmlist -b pieces/iggi/x86/contrib

list 30 -k input/iggi/pubkey_main input/iggi/x86/cdcom
rpmlist -b pieces/iggi/x86/cdcom

list 40 -k input/iggi/pubkey_main input/iggi/x86/modules
rpmlist -b pieces/iggi/x86/modules

list 50 -k input/iggi/pubkey_main input/iggi/x86/firmwares
rpmlist -b pieces/iggi/x86/firmwares

list 60 -k input/iggi/pubkey_main input/iggi/x86/dkms
rpmlist -b pieces/iggi/x86/dkms pieces/iggi/x86/main

list 70 -k input/iggi/pubkey_main input/iggi/x86/wm
rpmlist -b pieces/iggi/x86/main

##############################
## 2 CD version
##############################

disc 1 700m iggi_cd1 "(X86_32)" "Iggi CD1" -v "4" -p Mandriva
dir main media/main
dir rpmcluster media/rpmcluster
dir contrib media/contrib
generic --synthesis main 1
generic --synthesis rpmcluster 10
generic --synthesis contrib 20

installation --version iggi --branch cooker --arch i586 --nosrcfit \
--synthesis -l fr,en -t iggi -i pieces/install/iggi/x86/ \
-d 1/main 1/rpmcluster 1/contrib 2/main 2/cdcom 2/modules 2/firmwares 2/dkms 2/wm \
-r pieces/install/iggi/x86/media/media_info/rpmsrate

boot --udf --isolinux -b isolinux/isolinux.bin \
-f --first pieces/install/iggi/x86/isolinux \
-f --dest install/images pieces/install/iggi/x86/install/images

disc 2 700m iggi_cd2 "(X86_32)" "Iggi CD2" -v "4" -p Mandriva
dir cdcom media/cdcom
dir modules media/modules
dir firmwares media/firmwares
dir dkms media/dkms
dir main media/main2
dir wm media/wm
generic --synthesis main 1
generic --synthesis cdcom 30
generic --synthesis modules 40
generic --synthesis firmwares 50
generic --synthesis dkms 60
generic --synthesis wm 70

######################
## mini-cd
######################

disc 3 700m iggi_mini-cd1 "(X86_32)" "Iggi mini-CD1" -v "4" -p Mandriva
dir main media/main
dir rpmcluster media/rpmcluster
dir contrib media/contrib
generic --synthesis main 1
generic --synthesis rpmcluster 10
generic --synthesis contrib 20

installation --version iggi --branch cooker --arch i586 --nosrcfit \
--synthesis -l fr,en -t iggi -i pieces/install/iggi/x86/ -d 3/main 3/rpmcluster 3/contrib \
-r pieces/install/iggi/x86/media/media_info/rpmsrate

boot --udf --isolinux -b isolinux/isolinux.bin -f --first pieces/install/iggi/x86/isolinux \
-f --dest install/images pieces/install/iggi/x86/install/images

cp pieces/iggi/extra/patch-oem.pl /install/stage2/patch-oem.pl


##########################
## DVD version
#########################

disc 4 4.37g iggi_dvd "(X86_32)" "Iggi DVD" -v "4" -p Mandriva
dir main media/main
dir rpmcluster media/rpmcluster
dir contrib media/contrib
dir cdcom media/cdcom
dir modules media/modules
dir firmwares media/firmwares
dir dkms media/dkms
#dir main media/main2
dir wm media/wm
generic --synthesis main 1
generic --synthesis rpmcluster 10
generic --synthesis contrib 20
generic --synthesis cdcom 30
generic --synthesis modules 40
generic --synthesis firmwares 50
generic --synthesis dkms 60
generic --synthesis wm 70

installation --version iggi --branch cooker --arch i586 --nosrcfit --synthesis -l fr,en -t iggi -i pieces/install/iggi/x86/ -d 4/main 4/main2 4/rpmcluster 4/contrib 4/cdcom 4/modules 4/firmwares 4/dkms 4/wm -r pieces/install/iggi/x86/media/media_info/rpmsrate
boot --udf --isolinux -b isolinux/isolinux.bin -f --first pieces/install/iggi/x86/isolinux -f --dest install/images pieces/install/iggi/x86/install/images
cp pieces/iggi/extra/patch-oem.pl /install/stage2/patch-oem.pl
  • iggi : name of the CDROM

  • list 1 -k path_to_key/key rpm_list rpm_list2 : define list number X, and use this key for rpm checksig, and last arg are the list of the rpm

  • rpmlist -b path_to_RPM : path to RPMS, you can put more than one directory

  • rpmlist -s path_to_SRPM : path to SRPMS

  • disc X size cdrom_name "arch" "label" -v volume_name -p publisher : define disc number X, with a size (ie: 700m, 4.4g)

  • dir main media/main : create an alias name main to the directory media/main

  • generic --synthesis rpms X : create a synthesis hdlists number X for RPMS in media/main

  • installation --version iggi --branch cooker --arch i586 --nosrcfit --synthesis -l fr,en -t iggi -i pieces/install/iggi/x86/ -d 1/main 1/rpmcluster -r pieces/install/iggi/x86/media/media_info/rpmsrate

    • installation : this disc is an install CDROM

    • --version iggi : branch could be cooker/2006/stable

    • --arch i586 : specify the architecture

    • --nosrcfit : do not stop if sources discs are full

    • --synthesis : synthesis will be present

    • -l fr,en

      : language on CD will be FR and EN
    • -t iggi : tag added to the VERSION file

    • -d 1/main 1/rpmcluster : Select rpms dir to take into account. 1 is a reference to Disc1, and main a reference to the name of the directory on Disc1

    • -d 1/main 1/rpmcluster 1/contrib 2/main 2/cdcom 2/modules 2/firmwares 2/dkms 2/wm : specify to put main rpmcluster contrib on first disc, and cdcom modules firmwares dkms wm on second disc. Note: hdlists and synthesis will be store on the first disc

    • -r rpmsrate : specify a custom rpmsrate

    • boot --isolinux -b isolinux/isolinux.bin -f --first pieces/install/iggi/x86/isolinux -f --dest install/images pieces/install/iggi/x86/install/images

    • cp pieces/iggi/extra/patch-oem.pl /install/stage2/patch-oem.pl : if you want to put files on disc, just copy them. You need to specify full name, cause it's not the cp of the system

2.1.2. x86/main : list of RPM

List files allow to select which packages will be included into discs. The syntax is "[package] ,". Options are not mandatory. Available options:

  • regexp : the package is a regular expression

  • rate X : increase the packages rpmsrate value to X.

  • section : the given package is a section name of the rpmsrate

  • nodeps : do not handle these packages dependencies

  • noalternatives : do not use these packages to resolve dependencies in alternatives

  • force : put given packages before anything else on the discs

  • needed X : put given packages not after the Xth rpms directory

  • limit : only put given packages if there is space left at the end of build

  • nosrc : do not put sources of the given packages

Several options can be put, separated with "," but without spaces. Last release of MKCd tell if an error occur while reading the list. If you want to exclude RPM, put it at the top of the configuration file. ie: if you want to exclude a specific kernel, because you use an update kernel, the SYSTEM section 1,force will force the use of the first kernel in the list (kernel-2.6.12-12mdk in 2006.0), so if you want to use the kernel-2.6.12-17mdk, just put the exclude before the SYSTEM section 1,force. This tip is available for all package: always put exclude rules at the top of configuration's file list.

2.1.3. a typical x86/main file

kernel-2.6.12.12mdk.* regexp,exclude
kernel-2.6.12.15mdk.* regexp,exclude
kernel-2.6.12.17mdk.* regexp,needed 1
kernel-source-2.6-2.6.12-17mdk.* regexp,noalternatives,needed 1
kernel-smp-2.6.12.12mdk.* regexp,exclude
kernel-smp-2.6.12.15mdk.* regexp,exclude
kernel-smp-2.6.12.17mdk.* regexp,needed 1
kernel-i586-up-1GB.* regexp,exclude

# exclude
libpq4-8.0.7.* regexp,exclude
postgresql-8.0.4.* regexp,exclude
postgresql-contrib-8.0.4.* regexp,exclude

# needed basesystem
INSTALL section 1,force
SYSTEM section 1,force
GAMES section 1,exclude
AUDIO section 1,exclude
acpi needed 1
acpid needed 1
alsa-utils needed 1
aspell-fr needed 1
autoconf needed 2
autologin needed 2
automake1.4 needed 2
basesystem needed 1
bash needed 1
bc needed 1
bdflush needed 1
bind needed 1
bind-utils needed 1
......

2.1.4. tree view of input directory

input/
|-- 2006
|   `-- x86
|-- clustering
|   `-- x86
|       `-- temp
|-- iggi
|   `-- x86
`-- mercury
    `-- x86
        `-- temp

2.2. Log directory

MKCD can create verbose log. We store them into log directory. It's very usefull to create verbose log because it explains how disc was created, and why it rejects some RPMS/SRPMS. -verbose X where X can be 1 (less) to 10 (more).

Another log options is --printdiscsfiles name. It's create a file wich contains all RPMS available on each disc.

2.3. Pieces directory

This directory contains various subdirectory. One for each project (here iggi), and one called install wich link to the installer directory (a builded gi, ie: /export). In the iggi directory, two subdir: extra wich contains all extra things (freedos.img, patch-oem.pl), and x86 directory where you can find link/path to RPMS/SRPMS repositery. Ok it's a bit confuse to explain, so the tree will help us:

|-- 2006
|   |-- extra
|   `-- x86
|       |-- CONTRIBL
|       |-- RPMSL
|       |-- SPECIAL
|       `-- rpmcluster -> /home/nis/guibo/Build/pieces/iggi/x86/RPMCLUSTER
|-- clustering
|   |-- SRPMS-CLUSTER -> /home/nis/guibo//SRPMS-CLUSTER
|   |-- extra
|   `-- x86
|       |-- RPMCLUSTER
|       `-- kernel
|-- iggi
|   |-- extra
|   `-- x86
|       |-- RPMCLUSTER
|       |-- RPMS
|       |-- contrib -> /mnt/ken/dis/2006.0/i586/media/contrib
|       |-- main -> /mnt/ken/dis/2006.0/i586/media/main
|       |-- main_updates -> /mnt/ken/dis/updates/2006.0/main_updates
|       `-- x86
|           `-- RPMS
|-- install
|   |-- 2006
|   |   `-- x86 -> /home/nis/guibo/export_2006
|   |-- clustering
|   |   `-- x86 -> /home/nis/guibo/export_clustering
|   |-- iggi
|   |   `-- x86 -> /home/nis/guibo/export_iggi
|   `-- mercury
|       `-- x86 -> /home/nis/guibo/export_mercury
`-- mercury
    |-- extra
    `-- x86

You can see that i have various directory for each project: IGGI, 2006, clustering, mercury, and one call install.

2.4. build directory

It contains all needed to build ISO.

build/
|---iggi
    |-- 1
    |   |-- install
    |   |   |-- images
    |   |   `-- stage2
    |   |-- media
    |   |   |-- contrib
    |   |   |   `-- media_info
    |   |   |-- main
    |   |   |   `-- media_info
    |   |   |-- media_info
    |   |   `-- rpmcluster
    |   |       `-- media_info
    |   `-- misc
    |       |-- Distribconf
    |       |-- URPM
    |       `-- auto
    |           `-- URPM
    `-- first
        `-- 1
*            `-- isolinux
                |-- alt0
                `-- test

2.5. Iso directory

It contains all ISO.

iso/
|-- 2006_guibo
|-- clusteringIII-x86_32
`-- iggi

3. MKCD help

An MKCD help exists for each fonctions. Use them if you want more explanation about an MKCD's fonction. for example:

mkcd -h installtion
mkcd -h generic
mkcd -h boot
mkcd -h disc
mkcd -h list
mkcd -h dir
mkcd -h rpmlist

4. Build script

A simple script to build ISO. MKCD options used are:

  • --printdiscsfiles name_fil : print the contains of each disc into name_fil

  • --noiso : do not create iso images of the discs

  • --verbose X : print more messages (the higher the more, 5 is the higher)

  • -s input/$NAME/$NAME.conf : configuration file

  • -m 1,2 : build the disc 1 and 2 (define in MKCD configuration file

  • -l : use it if you want to rebuild a Disc, leave untouched others (Advanced option)

#!/bin/bash

NAME=iggi
DATE=`date "+20%y%m%d-%H%M"`

clean_old_data() {
    echo "- Cleaning old builds"
# comment this if you dont want to erase old mkcd_build_list
#rm -rf ~/Build/tmp/.mkcd_build_hdlist
#rm -rf tmp/*

    rm -rf build/$NAME
    rm -rf log/*
    rm -rf iso/$NAME/1*
}

build_cdrom() {
    echo "- Building CD"
    mkcd --printdiscsfiles log/printdiscfiles1-$NAME --noiso --verbose 5 -f -s input/$NAME/$NAME.conf -m 1 >log/$NAME-1.log 2>&1
}

list_cdrom() {
    echo "- list RPM on CD"
    mkcd --testlist input/$NAME/$NAME.conf 1 input/$NAME/x86/rpmsrate --printdiscsfiles log/printdiscfiles-$NAME
}


build_cdrom_iso() {
    echo "- Building CD + ISO"
    mkcd --printdiscsfiles log/printdiscfiles1-$NAME --cpu 2 --verbose 9 -f -s input/$NAME/$NAME.conf -m 1 >log/$NAME-1.log 2>&1
    mv iso/$NAME/1-$NAME.iso iso/$NAME/1-$NAME-$DATE.iso
    create_md5sum
}


create_md5sum() {
    echo "- Creating md5sum"
    md5sum iso/$NAME/*.iso > iso/$NAME/$NAME-$DATE.md5sum
}

# MAIN
clean_old_data
#list_cdrom
#build_cdrom
build_cdrom_iso
Valid XHTML 1.0! Valid CSS!