编译服务/KIWI/QEMU-VMDK镜像
Contents
Kiwi for Qemu and Vmdk images
Introduction
The base of this document is that the first writer needed to build Qemu files for use with Xen (Full virtualisation) so I decided to use kiwi to create them. Just a reminder KIWI is a project that changes very fast. In the coming time this document shall be extended and updated. The working environment in this document is a suggestion, like directories for the storage of images can be changed according to the users wish.
Used system
Every opensuse 10.2 or sles 10.0 will do, But I used Opensuse 10.2 x86_64 with Xen installed so I could test the resulting qemu files and boot them.
Preferred situation
Make sure that you have enough diskspace for:
1) Repository of the installation source (4.3 GB if you make a copy of the DVD version) more if you have more repositories and architectures.
2) Enough diskspace for the build of the image (who is as big as you want it. Remember its a harddisk image..)
3) Enough diskspace for the build of the qemu and vmdk images, Kiwi makes standard both + a raw image + the initrd files. So you need at least 3 times the build harddisk space.
Step 1 Getting Kiwi
The KIWI main repository is
http://ftp.opensuse.org/pub/opensuse/repositories/openSUSE:/Tools
Don't forget to take the right configuration for your system. In my case,
http://ftp.opensuse.org/pub/opensuse/repositories/openSUSE:/Tools/openSUSE_10.2/
And add the resource to yast, yum or smart
Step 2 Install the Kiwi tools.
The full set of kiwi tools consists out of:
- kiwi - The primary program installed in /usr/sbin/kiwi - All modules and extra files are installed in /usr/share/kiwi kiwi-desc-isoboot - Configuration files for iso-bootimages (LiveDVD/CD) installed in /usr/share/kiwi/images kiwi-desc-netboot - Configuration files for net-bootimages (Netboot) installed in /usr/share/kiwi/images kiwi-desc-usbboot - Configuration files for usb-bootimages (USBstick) installed in /usr/share/kiwi/images kiwi-desc-vmxboot - Configuration files for vmx-bootimages (Qemu clients and VMDK clients (vmware)) installed in /usr/share/kiwi/images kiwi-desc-xenboot - Configuration files for xen-bootimages (Xen Clients) installed in /usr/share/kiwi/images kiwi-desc-xennetboot - Configuration files for xennetboot-bootimages (Xenimages booting from network) installed in /usr/share/kiwi/images kiwi-pxeboot - Configuration files for pxe-bootimages (pxe bootimages) installed in /usr/share/kiwi/images osc - OpenSUSE build service command-line tool perl-Socket-MsgHdr - Perl library used by kiwi richclient - The base for the future graphical client richclient-debuginfo - Debug info graphical client
Step 3 Creating the Kiwi image environment.
To grow your kiwi images you need to create a spacefull situation and some ingredients.
The repositories.
You need at least one repository, these can be local or remote over nfs, ftp. It is going to connected by the smart packager so you can place it everywhere, or just use the installation repositories on the internet.
I use local repositories, because they are fast.
To create repository you just create a directory with a meaningful name and copy the contents of the DVD to this place.
Example's /vm/repository/oss10.2 /vm/repository/oss10.2-64 /vm/repository/sles10 /vm/repository/sles10-64
The kiwi image directories.
Do the same for your kiwi image directories
/vm/kiwi-build - the directory where later the builds are created /vm/kiwi-image - the directory where later the final images are created
The image configuration directory.
Image configurations are in directory /usr/share/kiwi/images
There is a BETA example of the kiwi-desc-qemu-vmdk package is available in:
http://software.opensuse.org/download/home:/gwayne/openSUSE_10.2/noarch/
To have a basic configuration its easy to make a copy of the image configuration directory it provides.
cp -a qemu-vmdk-suse-10.2
This directory contains
root - This directory contains all the files that shall be copied to the final image For example you can create directory etc and place your ntp.conf in it. Or your passwd/shadow files repo - A extra repository directory where extra rpm files are placed used in the installation config.sh - Configuration file that contains the actions executed inside the chroot environment of the image. config.xml - Configuration file of the image parameters. build.sh - My buildscript for lazy people, actually just the commands to build the full image.
First modifications so that the system actually works.
There have to be modifications in two directories
Your own new image directory
/usr/share/kiwi/image/qemu-vmdk-suse-10.2-myownversion
And the boot image directory you are going to use
/usr/share/kiwi/image/vmxboot/suse-10.2
In both you have to change the source directories you use in the config.xml file.
The one in vmxboot
<repository type="yast2" status="replaceable"> <!--<source path="opensuse://10.2"/>--> <source path="/image/dist/full-10.2-i386"/> <---------- change this one to your resources
And the one in qemu-vmdk-suse-10.2-myownversion extended to use two repositories, I added in this example the repo directory so you can add personal packages. You can also put a third one, with all updates. Just make sure that the updates are only the ones of the right architecture.
<repository type="rpm-dir"> <source path="this://repo"/> </repository> <repository type="yast2"> <!--<source path="/image/CDs/full-i386"/>--> <!--<source path="/mounts/machcd2/consistent/full-i386"/>--> <!--<source path="opensuse://SL-OSS-factory"/>--> <source path="/vm/res/oss102"/> <---------------- change this one to your own resources </repository>
Optional you can change the build.sh script to reflect the environment and be lazy in building.
configdir=/usr/share/kiwi/image/qemu-vmdk-suse-10.2-myownversion <---- change it to your config dir buildroot=/vm/kiwi-builds/oss102 <---- change it to where you want the build to be created imageroot=/vm/kiwi-images <---- change it to where you want the images to be created buildarch=i386 <---- because I build on a x86_64 system I have to tell him I want a i386 or x86_64 image # Remove buildroot before starting cleanup=yes <---- otherwise I get the error "already exists" when I rerun the image build.
So now you should be able to build a 2700 MB test image.
So you either start it with ./build.sh
or on a i386 machine, just replace the variables with your real directories. And start the commands by hand.
kiwi -r $buildroot -p $configdir kiwi -c $buildroot -d $imageroot
Now you should have a basic image, if you run it with vmware, xen or qemu it should install the bootloader on the first run and then you have a running image.
The root password is linux.