|
|
|
Login
|
Introduction to umibuilder
This documents umibuilder which is a good tool to make a memory disk or a Live CD based on Mandrake Linux for OpenBrick and other hardware.
Overviewumibuilder is an easy tool to prepare a memory disk or a Live CD based on Mandrake Linux for OpenBrick and other hardware, such as Sumicom barebone machines. Because it installs Mandrake Linux from the internet with security updates on the fly, it is very easy to keep your installation up-to-date and secure. umibuilder downloads the latest RPM packages from the internet, installing them into a local directory, removing unnecessary packages and files, customizing the installation, making OS images, formatting your memory disk, and making it bootable. These steps are all automatic, so all you need to do is wait for some minutes to finish. The idea behind umibuilder is to make it quite easy and fast to test new ideas of embedded appliances and share the knowledge base on the Internet. This is made possible by having a simple configuration file for each target in plain text format. For example, you can define a VPN (virtual private network) appliance target with umibuilder. For this target, you will simply have to create one simple text file which specifies what RPM packages to be installed, what files should be removed, which kernel to be used, and some shell commands to modify the contents dynamically as you wish. In addition, you can optionally have files which are merely copied, so you can add new files and overwrite existing files easily. This is very convenient when you want to replace configuration files statically without modifying official RPM packages. Also, you can add new hardware support into umibuilder. This is done only by a single text file again. For this, all you have to do is define kernel modules included in initrd and boot devices. Thus it is straightforward to support your own hardware and share the information with others using the umibuilder repository. You are encouraged to contribute to umibuilder. umibuilder is under the term of GNU General Public License (GPL), so we can develop and share knowledge on making good appliances using umibuilder in Open Source way. The CVS repository, which provides everyone the cutting-edge version of umibuilder, is open to all people who are interested in getting the latest version and adding new targets into umibuilder. We are looking forward to seeing your contribution to the CVS repository of umibuilder. For non-Mandrake systemsumibuilder currently runs only under Mandrake Linux, because it uses some Mandrake-specific features (such as urpmi) to install Mandrake locally. So it would be very convenient if you have a Mandrake machine. However, even if you don't have Mandrake running systems, you can still play umibuilder using a chroot environment. chroot is a usual way to make another OS environment in a single system by changing the root directory virtually only in a new shell process. Once you make a chroot environment based on Mandrake Linux in your machine, you can use Mandrake Linux as if you installed it to the whole machine. For your convenince, a tarball file which can be simply extracted is ready. All you need to do is to extract it in your working directory, and configure a few things. It's quite instant and takes only 5 minutes. Please download the tarball from http://www.nexedi.org/static/mdk-9.2.tar.bz2 . Please follow these steps to make a chroot environment based on Mandrake Linux in your own OS:
$ su root
# tar jxpf mdk-9.2.tar.bz2
# cd mdk-9.2
# cp -f /etc/resolv.conf etc
# mount -t devfs none dev
# mount -t proc none proc
# mount -t usbfs none proc/bus/usb
# chroot .
Because this environment already contains Umigumi, you don't need to download
Umigumi separately. You can find Umigumi in the directory Getting the latest version of umibuilderumibuilder is a part of Umigumi, which is Free Software to simplify the installation and the distribution of operating system installers. You can get Umigumi from our CVS repository using your favorite web browser. Just click Download tarball and save it somewhere. Then, extract it on your Mandrake Linux machine:
$ tar zxf umigumi.tar.gz
$ cd umigumi
That's it! Note that if you want a specific version (eg : umibuilder for Mandrake 9.2), you have to select this specific branch before clicking "Download tarball". Quick overview : How to build a system in five minutes
This example makes a VPN setup for OpenBrick. You can check all supported setup targets by running:
# ./umibuilder --help
Detailed operation of umibuilderThe five steps of building an image are called in this order when invoking umibuilder with the -ba (all steps) option. Note : the letter between parenthesis refers to the -b? option of umibuilder.
Important optionsthe commandline format is "umibuilder OPTIONS TARGET". General options and parameters
Live-cd OptionsThese options are only used if you are building an iso image.
How to extend umibuilderOne can easily add new targets and hardwares to umibuilder. In each case, there is only one file to add, unless you want custom files to be copied into the directory before creating the image (eg : files that aren't in packages, or that need to be modified). The easiest way to create a new target or hardware file is simply to copy an existing one and modify it :
# cp -a config/vpn.py config/newtarget.py (use an existing target as a template)
# vim config/newtarget.py (modify the newtarget.py file)
# ./umibuilder -ba newtarget (build an image for the target)
The same can be done to create a new hardware file, in the Adding a targetTo add a new target, you need to add two things : the "config/target_name.py" file that describes your target, and (optionally) the "custom/target_name" tree that allows you to modify files or add new ones to the image. The "config/target_name.py" fileThis file contains eight elements. They mainly list the data that will be processed during the five steps of umibuilder. Here is an example of such a file :
# The canonical name of this image.
canonical_name = 'VPN'
# The directory where the image will be built.
build_dir = 'mdk-vpn'
# The kernel package used in the image.
kernel = '2.6.3.8mdk'
# The list of packages to be installed.
package_list = ('basesystem',
'devfsd',
(...)
'ipsec-tools')
# The list of packages to be removed after installation.
package_remove_list = ('eject',
'urpmi',
(...)
'harddrake')
# The list of files to be removed from the directory (regular expressions).
file_remove_list = ('^/usr/share/man/.',
'^/usr/share/info/.',
(...)
'^/sbin/lilo$',)
# The directory which holds custom files to be copied.
# If this is set to '', nothing will be done.
custom_dir = 'custom/vpn'
# The list of shell commands executed to customize the image (launched from a chroot).
shell_command_list = ('/sbin/chkconfig alsa off',
'/sbin/chkconfig sound off',
(...)
'/usr/sbin/msec 3')
The custom_dir tree (generally "custom/target_name")This tree reproduces the structure of the install directory. For example, if you want to overwrite the default /etc/fstab, you'll just have to put your modified file in "custom/target_name/etc/fstab". Else, if you want a script to be present in "/usr/local/bin/", just add it to "custom/target_name/usr/local/bin/" and it will be copied into the image. Adding a hardwareTo support a new hardware, you just need to add a file named "hardware/hardware_name.py". This file contains very few things, the important one is the list "initrd_module_list" which contains every module that need to be loaded by the initrd. Generally, you WANT to add your hard disk controller driver and partition type modules in here, unless they are statically compiled into the kernel. If the hardware has multiple hard disks or uses SCSI, you may also need to modify the boot_partition and boot_device parameters accordingly. Finally, in order to build an image for your new target that will run on your new hardware, just run :
# ./umibuilder -w newhardware -ba newtarget
After installation notesFor details about the boot process, please have a look at the linuxrc script contained in the initrd.img archive. Basically, what it does is quite simple :
Usefull Noteif you want to overwrite some of the files, without having to rebuild an image, add them to the config.tgz file. Do not forget to run the sync command before rebooting, so that the files are actually written on the medium. Resources
|
|
|