I had to build a custom Mandriva Live/Install CD from Mandriva DVD, I found that the best tool for building a live CD based on Mandriva to be draklive.
First, I would like to thank Olivier Blin for draklive and helping me with this build.
For this how-to, I installed a plain Mandriva system, enabled “Main”, “Main Updates”, “Contrib”, “Contrib Updates” repositories then installed few more packages and started the build.
Following the requirements to get draklive to work without issues, these packages have to be installed:
# urpmi x11-server-xnest squashfs3-tools squashfs-tools syslinux mkisofs rsync curl mtools
Grab the tools and config files for draklive
# svn co http://svn.mandriva.com/svn/soft/draklive/trunk draklive
# svn co http://svn.mandriva.com/svn/config/One/trunk live-config
# cd live-config
And start customizing the config files; For my specific build though, I had to make the live CD from a DVD version not for an online repository.
First file needs editing is config/settings.cfg, here is the one I used for my build:
repository=/media/cdrom
updates_repository=
additional_repository=
arch=i586
desktop=KDE4
media=cdrom
region=int
pack=
name=mandriva-linux
product=one
version=2010-spring
commercial=0
default_user=ahmed
Since I had to work from the DVD version, there had to be few tweaks in the default config files for the build to work properly.
Open config/auto_inst.cfg.pl, and change the lines (also if you commented them out it’s the same):
selected_names => join(‘,’,
’Main’, ‘Main Updates’,
’Contrib’, ‘Contrib Updates’,
’Non-free’, ‘Non-free Updates’,
’Restricted’, ‘Restricted Updates’,
),
to:
selected_names => join(‘,’,
’Main media’,
’Contrib media’,
’Non-free media’,
’Restricted media’,
),
Then comment out the following two lines:
“/^mandriva-theme(?!-common|-$mandriva_theme(?:|-screensaver)-)/”,
“/^mandriva-release(?!-common|-$mandriva_release)-/”,
Also you can modify the config/auto_inst.cfg.pl file. It contains a list of packages to install (‘default_packages’), and of categories to select (‘rpmsrate_flags_chosen’). The categories are defined in the media/media_info/rpmsrate file of your mirror tree.
You might also want to remove the following line:
‘match_all_hardware’ => 1,
It tells the installer to install all hardware support packages, including proprietary graphical drivers, and wireless firmwares.
To install additional packages, you can add them to default_packages in auto_inst.cfg.pl, thus you will avoid manual steps in the process (explained later). Also to remove packages, it’s better if you automate this, for
example by putting the packages in skipped_packages list, or in erase_packages in live.cfg
1.1 – Launch draklive, and let it build the new system automatically:
# perl -I../draklive/lib ../draklive/draklive --clean --all
This command will result in running all the steps, from installation to mastering. This process passes by the following steps automatically in order:
- Install selected distribution in a chroot-ed environment (–install)
- Prepare initrd and bootloader files (–boot)
- Build a compressed loopback files (–loop)
- Build master image (–master)
- Build compressed master image (–image)
- Build replicator image (–replicator)
I still haven’t used the last 2 steps, so I will skip them till I further understand them.
(Cross your fingers, close your eyes, hold your breath but not for too long, cause the process take some time depend of the hardware); And if the previous command completes without any issues then you are lucky, and you will find the iso image of the newly created CD in /var/lib/draklive/build/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/dist/, which will be ready to be burnt and used.
(Here comes the ‘but’ part) But for my build, or in case something went wrong in the above build, you will have to go through the process step by step manually.
2.1 – First you will have to install the distribution in a chroot-ed environment
# perl -I../draklive/lib ../draklive/draklive --clean --install
This will result in an almost full system install in /var/lib/draklive/chroot/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/; you could do:
# chroot /var/lib/draklive/chroot/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/
and drop in the system you just installed, basically this is the system that will be compressed on the live CD, so you could do whatever changes you would like in this system. For me, I had to install some packages, make some adjustments, edit few config files; I will state only how to install/remove packages in/from that system. Also, you could install additional kernel modules which will be included with you new live system.
To exit the chroot-ed environment just type ‘exit’, you will move back to your normal system.
2.1.1 – Installing packages in the chroot-ed environment:
# urpmi --root /var/lib/draklive/chroot/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/ busybox-static cups
2.1.2 – Removing packages from the chroot-ed environment:
# urpme --root /var/lib/draklive/chroot/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/ package1 package2
2.2 – Second, you will have to prepare initrd and boot loader files
# perl -I../draklive/lib ../draklive/draklive --boot
2.3 – Then you will have to build the compressed loopback files
# perl -I../draklive/lib ../draklive/draklive --loop
2.4 – Finally, you will have to build master image
# perl -I../draklive/lib ../draklive/draklive --master
Steps 2.2, 2.3 and 2.4 can be accomplished also using this command:
# perl -I../draklive/lib ../draklive/draklive --boot --loop --master
This will result in building a live system and generating an iso image for it in /var/lib/draklive/build/mandriva-linux-one-2010-spring-KDE4-int-cdrom-i586/dist/ just burn the CD and boot from it and you will have your new live system up and running.
I will be updating this post on how to create the live CD from an online repository, and how to make a live distribution on a USB stick.