NOTE! For the long and detailed explanation on how to create custom MeeGo images, just jump to the MeeGo wiki: http://wiki.meego.com/Image_Creation
These steps shown here are the minimum set required in an Ubuntu 11.04 host to be able to create MeeGo images easily. They do not try to be extensive, or very explanatory, these are just my personal notes on how to do it 🙂
1. Install MeeGo Image Creator
Include the MeeGo tools and SDK repositories to your APT configuration, by adding the following lines to your /etc/apt/sources.list:
deb http://repo.meego.com/MeeGo/tools/repos/ubuntu/10.10/ /
deb http://repo.meego.com/MeeGo/sdk/host/repos/ubuntu/10.10/ /
Add the MeeGo repository key:
$> gpg --keyserver subkeys.pgp.net --recv 0BC7BEC479FC1F8A
$> gpg --export --armor 0BC7BEC479FC1F8A | sudo apt-key add -
Update the APT cache:
$> sudo apt-get update
Install the mic2 package:
$> sudo apt-get install mic2
Note: ‘mic2’ is also in natty/universe, just not the latest version.
2. Prepare a MIC bootstrap
In order to be able to create images from within your Ubuntu 11.04, you will need to use a MIC bootstrap. If you’re using one of the supported platforms (Ubuntu 10.10 for example), you can possibly skip using it. The generated bootstrap will be a chroot-able location which contains MIC and all its exact dependencies.
$> sudo mic-create-bootstrap \
-n trunk \
-k /opt/meego/repo-cache \
-r http://repo.meego.com/MeeGo/builds/trunk/latest/repos/oss/ia32/packages \
-o /opt/meego/ia32-bootstrap
This previous command will create a trunk named bootstrap in /opt/meego/ia32-bootstrap
using /opt/meego/repo-cache
as path to store cached packages.
3. Prepare a kickstart file
Kickstart files are the ones defining the contents of the image to be built. Not only what packages will be installed, but also which default users will be created, the default root password, the default locale settings, the default keyboard layout…
Preparing a new kickstart file is best done by taking an officially used one, and modifying it as you like (a.k.a. the autotools way):
http://repo.meego.com/MeeGo/releases/1.2.0/builddata/image-configs/
The kickstart files I’ve been using are based on the upstream official ones, but with updated repo URLs and bigger root partition sizes. You can find them here:
Note: If you want to know more about the format of kickstart files, what they do and such, just check the Fedora wiki.
4. Create a raw image and launch it under KVM
The MeeGo Image Creator can build ‘raw’ images which can be then launched under QEMU/KVM. The following command will build one of such ‘raw’ images, using the previously created bootstrap and one of the kickstart files we prepared. Note that the command also defines a cache path, where the RPMs downloaded from the MeeGo online repos will be stored (and therefore available for new images created afterwards).
$> sudo mic-image-creator \
--bootstrap=/opt/meego/ia32-bootstrap \
--format=raw \
--config=meego-core-ia32-1.2.0.ks \
--cache=/opt/meego/repo-cache
You can then use mic-vm-launcher
as follows to launch the image under QEMU/KVM:
$> sudo mic-vm-launcher meego-core-ia32-raw/meego-core-ia32-sda.raw
Or call kvm directly and tweak the parameters used to launch the image:
$> sudo kvm \
-s \
-m 1024 \
-hda meego-core-ia32-raw/meego-core-ia32-sda.raw \
-vga std
Note: Ensure that virtualization is enabled in your BIOS, or KVM won’t be able to work properly. You can use ‘$> sudo kvm-ok
‘ to check whether it is enabled or not.
5. Create a LiveUSB image and write it to a USB dongle
You will probably want to test your MeeGo build in the real hardware, and for that using LiveUSB images is one of the best options. The MeeGo Image Creator also allows building LiveCD and LiveUSB images directly from kickstart files; again, just changing the ‘format‘ argument:
$> sudo mic-image-creator \
--bootstrap=/opt/meego/ia32-bootstrap \
--format=liveusb \
--config=meego-core-ia32-1.2.0.ks \
--cache=/opt/meego/repo-cache
Once you get the image, you can use ‘mic-image-writer
‘ to directly copy it to a connected USB disk. This tool will scan all available external disks, and prompt a menu to select the one where you want to write the image to. The ‘-c
‘ switch (--console
) just tells the tool to avoid launching any GUI, and present the menu directly in the console. During this step, the USB disk is also prepared with sysconfig/isolinux to boot the newly written image.
$> sudo mic-image-writer -c meego-core-ia32.usbimg
Now you’re ready to boot your hardware with the LiveUSB image.
6. Create a loop image and chroot into it
With the MeeGo Image Creator, you can also build loop images, just changing the ‘format‘ parameter in the call to mic-image-creator
:
$> sudo mic-image-creator \
--bootstrap=/opt/meego/ia32-bootstrap \
--format=loop \
--config=meego-core-ia32-1.2.0.ks \
--cache=/opt/meego/repo-cache
Once you have the loop image built, you can chroot into it:
$> sudo mic-chroot meego-core-ia32.img
While in the chroot, you can remove or update existing packages, and even add new ones. When you are done, just type $> exit
to leave the chroot.
Note: If you want to use zypper inside the chroot, ensure that you included ‘@MeeGo Base Development’ group of packages in your kickstart file.
7. Convert loop images to LiveUSB images
Once you have your loop image modified as you wanted, you can then convert it to a LiveUSB image so that it can be written to an external USB disk, as in the previous step. Converting between image types is done with the ‘mic-image-convertor
‘ tool:
$> sudo mic-image-convertor \
--source-image=meego-core-ia32.img \
--target-format=liveusb
Additional notes
- Be careful with
mic-chroot
.
- The Meego Image Creation set of tools make a hard use of disk space under
/var/tmp
. If you (like me) usually don’t have much space left in your root partition, you’d better symlink that path to a partition without disk space worries.
- I’ve found several times that when I try to build new images, the tools tell me that the packages downloaded in the cache are corrupted, and need to be re-downloaded. Just make sure you have a good connection 🙂
- Again, visit http://wiki.meego.com/Image_Creation if you want to have further details on these tools.