Development/Packaging/Tools/mkcd

From Mandriva

Jump to: navigation, search
Using the MakeCD/mkcd script to create a set of ISO images

There is a script located in the misc directory of the distribution tree that will make a set of ISO images to burn to CDR.

Contents


You may also be intersted in the more technical mkcd Howto

[edit]

Automatic mode

The basic syntax for automatic operation is:

./misc/MakeCD -a /path/to/cooker/

The leading ./ is necessary if your pwd is the top of an ISO-like tree because the MakeCD script pulls out the path from $0, deletes the "misc/" from it, and if the result is empty various things complain about missing arguments.

To limit the number of ISO images that are created, use the -c option followed by the number of disks you want:

./misc/MakeCD -a -c 2 /path/to/cooker/

By default, the script makes ISO images that will fit on 650MB blanks. If you want to change this, use the --discsize option to select an alternative image size:

./misc/MakeCD --discsize 700m -a /path/to/cooker/

It is a good idea to send the ISOs elsewhere, otherwise any subsequent auto runs will try to include the previous generation of ISOs on the first ISO, with predictable results.

./misc/MakeCD -i /path/for/ISOs -a /path/to/cooker/

Note that since it's release LE2005, the distribution does not propose any more the MakeCd script in the /misc tree directory, it is henceforth necessary to directly use mkcd Howto. More information on Image:bug_small.png Bug #13324

[edit]

Configuration files

Most of the help regarding a command line option can be accessed with: mkcd -h

The help about configuration file syntax can be accesses with: mkcd -h config

The help about a specific function can be accessed with: mkcd -h installation boot

[edit]

Disc specification files

The specification file contains first the definition of the list of rpms that will be used and then the definition of the different discs.

[edit]

List files syntax

List files allow to select which packages will be included in the discs. The syntax is [package] <option1>,<options2>. Options are not mandatory. The available options are:

  • 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 in, separated with "," but without spaces.

[edit]

Testing list files

You can test the result of the package selection of your list file with:

mkcd --testlist <configuration file> <list number> <rpmsrate path>

This mode will list every line of the list configuration file with the packages found into the list associated rpm repositories.

e.g.:

$ mkcd--testlist mkcd/10.1/10.1.conf 1 /c/i586/media/media_info/rpmsrate

Checking kolab-server exclude
Exclude kolab-server-1.0-0.23mdk.i586

Checking kdebluetooth
  kdebluetooth-0.0.cvs20040718-2mdk.i586

Checking gnome-bluetooth
  gnome-bluetooth-0.5.1-7mdk.i586

Checking kernel-enterprise regexp
  kernel-enterprise-2.6.8.0.rc2.2mdk-1-1mdk.i586
  kernel-enterprise-2.4.27.0.pre2.1mdk-1-1mdk.i586
[edit]

Basic configuration

9.2

list -k <rep_path>/Mandrake/base/pubkey 1 <config_path>/download <config_path>/main
rpmlist -b <RPMS_path>/RPMS

# download

disc 1 650m 92DOWNLOAD1 "Installation CD 1 (x86)" "Mandrakelinux9.2-Download-1" -p Mandrakesoft
dir rpms Mandrake/RPMS
generic --synthesis rpms 1
advertising <ad_path>/01-thanks.png <ad_path>/02-community.png <ad_path>/03-software.png 
installation -o 50,3,0.1 --synthesis -l fr,it,en,de,es -t [[GuessWhat-download-i586]] \\

-i <install_path>/ -d 1/rpms 2/rpms 3/rpms
boot --isolinux isolinux -b isolinux/isolinux.bin --first <install_path>/isolinux \\

-f <install_path>/images 

disc 2 695m 92DOWNLOAD2 "Installation CD 2 (x86)" "Mandrakelinux9.2-Download-2" -p Mandrakesoft
dir rpms Mandrake/RPMS2
generic --synthesis rpms 1
boot -b Boot/cdrom-changedisk.img -- -d -f Boot/ <install_path>/images/cdrom-changedisk.img

disc 3 695m 92DOWNLOAD3 "International CD (x86)" "Mandrakelinux9.2-Download-3" -p Mandrakesoft
dir rpms Mandrake/RPMS3
generic --synthesis rpms 1

Such a configuration might be run like this (after <appropriate_symbols> have been replaced):

mkcd -s nameofconfigfile -m 1,2,3
[edit]

More complex configuration

This example was cribbed from a message thoughtfully posted by Warly today:

9.2

list -k pieces/9.2/install/i586/Mandrake/base/pubkey 1 input/9.2/main
rpmlist -b pieces/9.2/updates/RPMS -s pieces/9.2/updates/SRPMS
rpmlist -b pieces/9.2/extra/RPMS -s pieces/9.2/extra/SRPMS
rpmlist -b pieces/9.2/RPMS -s pieces/9.2/SRPMS

list 7 input/9.2/all
rpmlist -b pieces/9.2/plf/i586/ pieces/9.2/plf/noarch/

list 12 input/9.2/all
rpmlist -b pieces/9.2/contrib/all/RPMS

disc 42 4.36g 01SPP-9214 "DVD" "MandrakeLinux9.2w-DVD" -p PLF
dir rpms Mandrake/RPMS
dir rpms2 Mandrake/RPMS2
dir rpms3 Mandrake/RPMS3
dir rpms4 Mandrake/RPMS4
generic --synthesis rpms 1
cdcom -k pieces/9.2/install/i586/Mandrake/base/pubkey rpms2 -d Applications pieces/9.2/cdcom/Discovery
cdcom -k pieces/9.2/install/i586/Mandrake/base/pubkey rpms2 -d Applications pieces/9.2/cdcom/Discovery-updates
generic --synthesis rpms3 12
generic --synthesis rpms4 7
generic srpms 1
advertising img1.png img2.png img3.png img4.png
installation -o 50,3,0.1 --nosrcfit --synthesis -l en,fr -c pieces/9.2/plf/install/compssUsers \\

-r pieces/9.2/plf/install/rpmsrate -t [[FiveStar-i586]] -i pieces/9.2/install/i586/ -d 42/rpms 42/rpms2 42/rpms3 42/rpms4
boot --isolinux isolinux -b isolinux/isolinux.bin --first pieces/9.2/install/i586/isolinux -f pieces/9.2/install/i586/images 
[edit]

Caveats for copying from CDs

Remove the files .rr_moved and isolinux/boot.cat before starting MakeCD or mkcd. They are generated by the script and may interfere with it's operation (Warly is enhancing mkcd to cope with this cleanly).

[edit]

Adding extra stuff to the first ISO

If you have branded material, special instructions, pat-and-stanley videos etc that you want included in the first ISO image, just put them in the tree you specify to -a or the list config command, and they are included. For an example of this, see below.

[edit]

Selecting a non-standard set of packages

Adding packages is easy, just add more directory names after the main RPM collection, or place the extras in subdirectories of it. For 9.2, the main distro plus the contribs comes out to about 7 ISOs. Subtracting packages is harder since it's easy to break dependencies.

The following technique has worked well for selecting a viable subset of existing packages:

  • grab the latest, greatest mkcd (which probably involves grabbing a later perl as well) and install
  • do a fresh installation onto a scratch disk (or partition) from various sources
  • install other kernels (e.g. -smp, -enterprise)
  • update to latest-greatest (and uninstall older kernels)
  • rpm -qa -OR-
  • rpm -qa > /path/to/work/area/randomfilename
  • reboot into or cd to your working environment
  • for r in $(cat randomfilename); do echo dir_wildcard/$r.*.rpm
  • locate any missing items or remove them from the file by hand if safe, repeat above step until clean
  • mkdir temp_repository
  • for r in $(cat randomfilename); do cp dir_wildcard/$r.*.rpm temp_repository/; done
  • mkcd -i /path/to/write/isos --discsize 700m -a /path/to/distro/tree /path/to/temp_repository
  • burn resulting ISO(s)

Since I had disparate sources scattered all over the drive, I made symlinks called mdk92* to them, for example mdk92main, mdk92updates, mdk92contrib, mdk92local and used mdk92* as the dir_wildcard to keep it simple.

[edit]

Example: trimmed-back single CD with foreign files included

Here is the file tree cloned from CD1 of a 9.2 download set (with the messy and unrelated bits trimmed off, along with any files called .rr_moved or boot.cat):

28M     ./Mandrake/base
484K    ./Mandrake/mdkinst/etc
19M     ./Mandrake/mdkinst/lib
38M     ./Mandrake/mdkinst/usr
57M     ./Mandrake/mdkinst
1.6M    ./Mandrake/share/advertising
1.6M    ./Mandrake/share
4.0K    ./Mandrake/RPMS      [packages not included]
86M     ./Mandrake
196K    ./screenshots/thumbs
2.5M    ./screenshots        [screenshots of this CD installing]
400K    ./ColdFusionTute     [this is supporting material for a Cold Fusion tute]
4.0K    ./doc
8.0K    ./dosutils/lang
676K    ./dosutils
4.3M    ./images/alternatives
13M     ./images
3.7M    ./isolinux/alt0
2.5M    ./isolinux/alt1
6.3M    ./isolinux
8.0K    ./lang
180K    ./misc/auto/URPM
184K    ./misc/auto
412K    ./misc/bin
28K     ./misc/doc
764K    ./misc/perl5
1.5M    ./misc
248M    ./WinDev             [this is a Windows-based IDE]
358M    .

Here is the mkcd script to pack that all up; the above tree lives in adcd/ and the RPMs for it live in server-RPMs/

The disc and advertising lines are shown backslashed below but in the real config file they are each on only one line.

9.2

list -k adcd/Mandrake/base/pubkey1 1 adcd/misc/doc/main adcd/misc/doc/download
rpmlist -b server-RPMs

disc 1 680m 92AUSDEVEL "AusDeveloper CD 1 (x86)" \\

  "MandrakeLinux9.2-AusDeveloper-1" -p [[Australian_Developer]]
dir rpms Mandrake/RPMS
generic --synthesis rpms 1
advertising adcd/Mandrake/share/advertising/warning.png \\

  adcd/Mandrake/share/advertising/AusDeveloper.png \\

  adcd/Mandrake/share/advertising/01-thanks.png \\

  adcd/Mandrake/share/advertising/02-community.png \\

  adcd/Mandrake/share/advertising/03-software.png \\

  adcd/Mandrake/share/advertising/computer-angels.png \\

  adcd/Mandrake/share/advertising/CyberKnights.png \\

  adcd/Mandrake/share/advertising/GoldenLight.png \\

  adcd/Mandrake/share/advertising/lca2004.png \\

  adcd/Mandrake/share/advertising/LinuxAus.png \\

  adcd/Mandrake/share/advertising/04-configuration.png \\

  adcd/Mandrake/share/advertising/05-desktop.png \\

  adcd/Mandrake/share/advertising/06-development.png \\

  adcd/Mandrake/share/advertising/07-server.png \\

  adcd/Mandrake/share/advertising/08-store.png \\

  adcd/Mandrake/share/advertising/09-mdksecure.png \\

  adcd/Mandrake/share/advertising/10-security.png \\

  adcd/Mandrake/share/advertising/11-mnf.png \\

  adcd/Mandrake/share/advertising/12-mdkexpert.png \\

  adcd/Mandrake/share/advertising/13-mdkexpert_corporate.png
installation -o 50,3,0.1 --synthesis -l en -t [[GuessWhat-ausdevel-i586]] -i adcd/ -d 1/rpms
boot --isolinux isolinux -b isolinux/isolinux.bin --first adcd/isolinux -f adcd/images
[edit]

Various mails about MakeCD

http://archives.mandrivalinux.com/cooker/2004-05/msg04994.php

Personal tools