HOWTO use MKCD the Mandriva Linux Disc maker

Antoine Ginies (aginies _at_ mandriva.com)

2007

Revision History
Revision 0.420/08/2007ag
mkcd 4.2.x adjustement
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 someMandriva Linux ISO. I use MKCD-4.2.6 and keep in mind that MKCD configuration can change between release (before 4.2.X release).

external links speaking about MKCD can be 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

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

  • iso: generated ISO

2.1. input directory

In this directory you can create a sub-directory with the name of our projet if you want to store various configurations. Store the main MKCD's configraution file (in our case 2008.0.conf), and files that are lists of wanted RPM and SRPMS.

2.1.1. 2008.0.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.

2008.0

VERSION=2008.0
TAG=galile
#beta1: cassini beta2: galile
BRANCH=cooker
INPUT=./input
PIECES=./pieces
CDSIZE=700M

# lists for the mini version
# mini32
list 1 -k $PIECES/$VERSION/i586/media/media_info/pubkey_main \
    $INPUT/exclude \
    $INPUT/exclude-free \
    $INPUT/theme-free \
    $INPUT/basesystem_mini
rpmlist -b $PIECES/$VERSION/i586/media/main/release
    #$INPUT/main \

# mini 64
list 2 -k $PIECES/$VERSION/x86_64/media/media_info/pubkey_main \
    $INPUT/exclude \
    $INPUT/exclude-free \
    $INPUT/theme-free \
    $INPUT/basesystem_mini
rpmlist -b $PIECES/$VERSION/x86_64/media/main/release

###############################################
#                                             #
#                Mini  dual arch              #
#                                             #
###############################################

# basesystem dual arch CD, size is bigger than 700MB because we share noarch package between both arch
disc 1 810M MDV2008-Mini "Mandriva Linux $VERSION Installer (Mini)" "2008-mini-disc" -v "Mandriva Linux - 2008 Spring (Mini)" -p Mandriva
dir main i586/media/main
dir main64 x86_64/media/main64
generic --synthesis main 1
generic --synthesis main64 2

advertising advertising/AD-ISV/IM_001-FON-UK.png \
    advertising/AD-ISV/IM_002-WENGOUK.png \
    advertising/AD-PWP-FREE-ONE/IM_01RANGE.png \
    advertising/AD-PWP-FREE-ONE/IM_02METISSE.png \
    advertising/AD-PWP-FREE-ONE/IM_03-3D.png \
    advertising/AD-PWP-FREE-ONE/IM_04virtualization.png \
    advertising/AD-PWP-FREE-ONE/IM_05AMAROK.png \
    advertising/AD-PWP-FREE-ONE/IM_06STUDIO.png

installation --askmedia --suppl --type basic --version $VERSION --branch $BRANCH --arch i586 --minor 0 --subversion 1 --product Download -o 50,3,0.1 -c pieces/cd/compssUsers.pl -r pieces/cd/rpmsrate -t $TAG --synthesis -l en,it,fr,de,es,pt,pt_BR -i $PIECES/$VERSION/i586/ -d 1/main 2/main2
installation --askmedia --suppl --type basic --version $VERSION --branch $BRANCH --arch x86_64 --minor 0 --subversion 1 --product Download -o 50,3,0.1 -c pieces/cd/compssUsers.pl -r pieces/cd/rpmsrate -t $TAG --synthesis -l en,it,fr,de,es,pt,pt_BR -i $PIECES/$VERSION/x86_64/ -d 1/main64

boot --isolinux --theme Mandriva-Free -b i586/isolinux/isolinux.bin -f --dest i586/isolinux --first $PIECES/$VERSION/i586/isolinux -f --dest x86_64/isolinux --first $PIECES/$VERSION/x86_64/isolinux -f --dest x86_64/install/images $PIECES/$VERSION/x86_64/install/images -f --dest i586/install/images $PIECES/$VERSION/i586/install/images
cp --first /usr/share/gfxboot/themes/Mandriva-Free/welcome.jpg i586/isolinux/
cp --first /usr/share/gfxboot/themes/Mandriva-Free/back.jpg i586/isolinux/
cp --first /usr/share/gfxboot/themes/Mandriva-Free/welcome.jpg x86_64/isolinux/
cp --first /usr/share/gfxboot/themes/Mandriva-Free/back.jpg x86_64/isolinux/

disc 2 700M MDV2008-Mini-CD2 "Mandriva Linux $VERSION Installer (Mini) CD2" "2008-mini-disc2" -v "Mandriva Linux - 2008 Spring (Mini)" -p Mandriva
dir main2 i586/media/main2
generic --synthesis main2 1
  • 2008.0 : 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 i586/media/main : create an alias name main to the directory i586/media/main

  • generic --synthesis rpms X : create a synthesis hdlists number X for RPMS in i586/media/main. X is the number of the list.

  • installation --askmedia --suppl --type basic --version $VERSION --branch $BRANCH --arch i586 --minor 0 --subversion 1 --product Download -o 50,3,0.1 -c pieces/cd/compssUsers.pl -r pieces/cd/rpmsrate -t $TAG --synthesis -l en,it,fr,de,es,pt,pt_BR -i $PIECES/$VERSION/i586/ -d 1/main 2/main2

    • installation : this disc is an install CDROM

    • --branch cooker : branch could be cooker/2008.0/stable

    • --version : version of the release

    • --arch i586 : specify the architecture (i586 or x86_64)

    • --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 galile : tag added to the VERSION file

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

    • -d 1/main 2/main2 : specify to put main on first disc, and main2 on second disc. Note: hdlists and synthesis will be store on the first disc (in that case it's just an example, mini-cd is a one CD set)

    • -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 /usr/share/gfxboot/themes/Mandriva-Free/welcome.jpg i586/isolinux/ : 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. input/basesystem_mini : 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 (really a dangerous option... use it with care)

  • 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 an 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, put the "exclude" before the "needed":

kernel-2.6.22.(1-6)mdv.* regexp,exclude
kernel-legacy-2.6.22.6mdv.* regexp,needed 1

This tip is available for all package: always put exclude rules at the top of configuration's file list. Please do not use force option, it's really a dangerous option, and it can lead you to write bad configuration file.

2.1.3. a typical input/basesystem_mini file

basesystem needed 1
kbd

# exclude old kernels
kernel-.*2.6.17.* regexp,exclude
kernel-2.6.19 regexp,exclude
kernel-2.6.20 regexp,exclude
kernel.*-2.4. regexp,exclude

# official kernel
kernel-2.6.22.(1-6)mdv.* regexp,exclude
kernel-legacy-2.6.22.6mdv.* regexp,needed 1

# we don't release contrib kernels, at all
kernel-.*tmb- regexp,exclude
kernel-.*uml- regexp,exclude
kernel-.*win4lin- regexp,exclude
kernel-.*desktop regexp,exclude
kernel-.*laptop regexp,exclude
kernel-.*vserver regexp,exclude
kernel-.*linus regexp,exclude
kernel-.*multimedia- regexp,exclude

mandriva-kde-icons exclude
mandriva-kde-config-common exclude
x11-server-xmetisse exclude
grub needed any

acpitool
acpi needed any
acpid needed any

mandi
mandi-ifw force
dhcp-client
mandriva-gfxboot-theme
alsa-utils
#alsa-plugins
screen
openssh-server
openssh-clients
#postfix
traceroute
wget
#lynx
lsof
tcpdump
smartmontools
gnupg
file
#xorg-x11-75dpi-fonts
xterm
monitor-edid
vim-enhanced
urpmi
locales-(en|fr|pt_BR) regexp,limit
iputils
lftp
cpio
msec
wireless-tools
cpufreqd
cpufreq
apmd
hotkeys
pcmciautils
dmraid
laptop-mode-tools
numlock
netprofile
nscd
sndconfig
fbset
vlan-utils
reiserfsprogs
xfsprogs
#quota
alsa-utils
aoss
task-x11
pptp-linux
ppp
nfs-utils-clients
nfs-utils
ppp-pppoe
ppp-pppoatm
autologin
ntp
shorewall
bind-utils
mkinitrd
irssi
iptables
perl-Net-DNS
nc
sndconfig
curl
usbutils
zcip
ibod
isdn4net
isdn-light
isdn4k-utils
eagle-usb
speedtouch
bpalogin
ndiswrapper
bcm43xx-fwcutter
synaptics
dkms-minimal
imwheel
prism2-utils
wpa_supplicant
linuxwacom

x11-driver-input needed any
x11-driver-video needed any
xfs
drakxtools
drakx-kbd-mouse-x11
drakx-net
drakx-net-text
drakconf
drakxtools-curses
rpmdrake
alsaconf

brltty needed any
lilo needed 1

jfsprogs needed any
hfsutils needed any
dosfstools needed any
e2fsprogs needed any
util-linux needed any
dmidecode
setarch
eject
ldetect
harddrake
udev
sharutils
urpmi
tmpwatch
gnupg
lvm2 needed any
mdadm needed any
ethtool needed any
rp-pppoe needed any
mozilla-firefox
mozilla-firefox-(en|fr|pt_BR) regexp,limit
icewm regexp,needed 1

sudo
usermode
gdm

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 discs were 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, and why some RPMS where not present on the disc. Use the printediscfile.cd before the .log to debug an MKCD bug.

2.3. Pieces directory

This directory contains various subdirectory. One for each project (here 2008.0). In the 2008.0 directory, there is two subdir for each arch: x86_64 wich contains a mirror of 2008.0 repositery for x86_64 arch, and i586 for i586 arch.

2.4. build directory

It contains all needed to build ISO.

build
`-- 2008.0
    |-- 1
    |   `-- i586
    |       |-- COPYING
    |       |-- INSTALL.txt
    |       |-- LICENSE.txt
    |       |-- README.txt
    |       |-- VERSION
    |       |-- autorun.inf
    |       |-- default.xbe
    |       |-- doc
    |       |   `-- install
    |       |       |-- af
    |       |       |   |-- INSTALL.txt
    |       |       |   |-- LICENSE-APPS.txt
    |       |       |   |-- LICENSE.txt
    |       |       |   |-- README.txt
    |       |       |   |-- index.htm
    |       |       |   `-- install.htm
    |       |       |-- ar
...........
    |       |-- dosutils
    |       |   |-- COPYING
    |       |   |-- README
    |       |   |-- autorun.exe
    |       |   |-- autorun.ico
    |       |   |-- changes.txt
    |       |   |-- diskio.dll
    |       |   |-- fips.exe
    |       |   |-- gzip.exe
    |       |   |-- lang
    |       |   |   |-- autorun-10.1.jpg
    |       |   |   `-- autorun.conf
    |       |   |-- rawrite.exe
    |       |   |-- rawwrite.exe
    |       |   |-- rawwritewin.exe
    |       |   |-- rdev.exe
    |       |   |-- readme.txt
    |       |   `-- restorrb.exe
    |       |-- export
    |       |-- index.htm
    |       |-- install
    |       |   |-- extra
    |       |   |   `-- advertising
    |       |   |       |-- IM_001-FON-UK.pl
    |       |   |       |-- IM_001-FON-UK.png
    |       |   |       |-- IM_002-WENGOUK.pl
    |       |   |       |-- IM_002-WENGOUK.png
    |       |   |       |-- IM_01RANGE.pl
......
    |       |   |       `-- list
    |       |   |-- images
    |       |   |   |-- MD5SUM
    |       |   |   |-- all.img
    |       |   |   |-- alternatives
    |       |   |   |   |-- MD5SUM
    |       |   |   |   `-- all.img-2.6.22-4mdvlegacy
    |       |   |   |-- boot.iso
    |       |   |   `-- hd_grub.img
    |       |   `-- stage2
    |       |       |-- VERSION
    |       |       |-- mdkinst.sqfs
    |       |       `-- rescue.sqfs
    |       |-- lang
    |       |   |-- autorun-10.1.jpg
    |       |   `-- autorun.conf
    |       |-- linuxboot.cfg
    |       |-- media
    |       |   |-- main
    |       |   |   `-- media_info
    |       |   |       |-- MD5SUM
    |       |   |       `-- synthesis.hdlist.cz
    |       |   |-- media_info
    |       |       |-- MD5SUM
    |       |       |-- compss
    |       |       |-- compssUsers.pl
    |       |       |-- depslist.ordered
    |       |       |-- file-deps
    |       |       |-- hdlist1.cz
    |       |       |-- hdlist2.cz
    |       |       |-- hdlists
    |       |       |-- media.cfg
    |       |       |-- provides
    |       |       |-- pubkey1
    |       |       |-- pubkey2
    |       |       |-- rpmsrate
    |       |       |-- synthesis.hdlist1.cz
    |       |       `-- synthesis.hdlist2.cz
    |       |            `-- synthesis.hdlist.cz
    |       |-- misc
    |       |   |-- ChangeLog.bz2
    |       |   |-- README
    |       |   |-- auto
    |       |   |   `-- URPM
    |       |   |       `-- URPM.so
    |       |   |-- autorun.tar.gz
    |       |   |-- bin
    |       |   |   `-- mkisofs
    |       |   |-- drakx-in-chroot
    |       |   |-- gendistrib
    |       |   |-- mdkinst_stage2_tool
    |       |   |-- packdrake
    |       |   |-- packdrake.pm
    |       |   `-- rpm2header
    |       |-- pkg-2008.0-cassini.idx
    |       |-- product.id
    |       `-- release-notes.txt
    |-- README
    `-- first
        `-- 1
            `-- i586
                `-- isolinux
                    |-- advanced.msg
                    |-- alt0
                    |   |-- all.rdz
                    |   `-- vmlinuz
                    |-- alt1
                    |   |-- all.rdz
                    |   `-- vmlinuz
                    |-- bg.hlp
                    |-- bootlogo
                    |-- help.msg
                    |-- isolinux.bin
                    |-- isolinux.cfg
                    |-- langs
                    |-- mandriva.pcx
                    |-- memtest
                    |-- pt.hlp
                    |-- pt_BR.hlp
....

2.5. Iso directory

It contains all ISO.

iso/
`-- 2008.0
    |-- 1-2008.0.i586.idx
    |-- 1-2008.0.iso

2.6. Advertising directory

In this directory sore all adverts.

advertising
|-- AD-DISCOVERY
|   |-- IM_01RANGE.png
|   |-- IM_02METISSE.png
|   |-- IM_03-3D.png
|   |-- IM_04virtualization.png
|   `-- IM_05AMAROK.png
|-- AD-ISV
|   |-- IM_001-FON-FR.png
|   |-- IM_001-FON-UK.png
|   |-- IM_002-WENGOFR.png
|   `-- IM_002-WENGOUK.png
|-- AD-PWP+
|   |-- IM_01RANGE.png
|   |-- IM_02METISSE.png
|   |-- IM_03-3D.png
|   |-- IM_04virtualization.png
|   |-- IM_05ERP.png
|   `-- IM_06CRM.png
`-- AD-PWP-FREE-ONE
    |-- IM_01RANGE.png
    |-- IM_02METISSE.png
    |-- IM_03-3D.png
    |-- IM_04virtualization.png
    |-- IM_05AMAROK.png
    `-- IM_06STUDIO.png

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!