Midori includes a basic package management system called MLZ that is designed specifically for the needs of small devices. This chapter introduces the MLZ package management system and describes the following:
MLZ is much simpler than general-purpose package management systems like RPM and Debian. General-purpose package management systems can create modules that may be installed on a variety of different runtime systems. MLZ depends on the Midori build system to ensure that its packages can be bundled into a Flash ROM for a specific runtime target. In particular, MLZ packages have the following advantages:
Each Midori Flash ROM image is a runtime image that contains a collection of MLZ packages. The Midori build system assembles the package into the final Flash ROM image. The MLZ package management system is a wrapper system that mediates between the Midori build system and each package's internal build system. For example, the Midori software release includes both a configured Linux 2.4 kernel and an XFree86 4.x distribution. From the perspective of the Midori build system, these are just two more MLZ packages. But both of these packages have very different internal build systems. The MLZ package management system allows the Midori build system to manage these package's internal build systems and generate a single Flash ROM image.
MLZ packages are stored in the apps directory and follow these conventions:
- format
- MLZ files are stored in .tar.gz format.
- unpacking
- MLZ package files must unpack into their own directory.
- file name
- Each MLZ package must have a file name with the form name-n.mlz, with n being an MLZ-based version number to distinguish different package files. So for vim-3.0, the first MLZ package file name would be vim-3.0-1.mlz.
- build file (required)
- Each package must contain an executable script named build.
Note: We strongly recommend that each build script uses the standard build functions described in build.txt.
- CONFIG file (required)
- Each MLZ package must contain a CONFIG file which sets build variables. These build variables can be overwritten by the top-level config file.
- source files
- An MLZ file can contain a collection of source files or a single .tar.gz archive file containing source files.
For example, suppose we have a package called foo-6.18 and we get a source patch from its original author. Rather than apply the source patch to the original sources we put the patch file in a special directory with a script to run it. The sections below elaborate on how this is done.
Keeping a copy of what the directory originally contained (before customizing) would make it easy to "diff", of course.
cd cache/build/mlbuild-0.2/buildscripts/ ./setup /usr/local/ml_custom
Note: Be sure to edit the MIDORI variable in the new "Makefile.vars" file to point to the top of your Midori tree.
Go to your custom directory and from there untar the package you wish to customize:
cd /usr/local/ml_custom tar -xzvf /usr/local/midori/apps/foo-6.18_ML2.4.mlzThen add the package name and version to the "PACKAGES" variable in the main Makefile ("/usr/local/ml_custom/foo-6.18/Makefile" in our example) to read:
PACKAGES=foo-6.18
This is where the changes which you decide to keep will be stored, under this custom directory.
cd /usr/local/ml_custom/foo-6.18 tar -xzvf foo-6.18.tar.gz mv -f foo-6.18 foo-6.18.orig tar -xzvf foo-6.18.tar.gz (Here, apply your changes or patches.) cd /usr/local/ml_custom/foo-6.18 diff -urN foo-6.18.orig foo-6.18 > my_change.patch
Be sure to name the file with the ".patch" ending. If it's very large and you want to save space, you can gzip it (leaving the name with a ".patch.gz" ending). Those names are automatically applied with "patch" by the default build function "ml_patchit_default".
One step more: In order for your patch file to be included in the package you must add it to the "SOURCE" list in the package's Makefile:
SOURCE=CONFIG VERSION foo-6.18.tar.gz my_change.patchAfter that, you can clean up by removing the directories which were untarred to make the patch ("foo-6.18.orig/" and "foo-6.18/"). Leaving them there won't hurt anything though. Since they're not listed in the SOURCE variable, they won't be included in the .mlz file.
Another reason for changing the build script would be if you wanted to make some sort of change dynamic, something which could only be determined at build-time (like a timestamp, for example).
If you put a ".precious" file in the package directory in "cache/build/", now is the time to remove it.
The next "make" done in the top of the Midori tree should then unpack your modified package into "cache/build" and build it with your changes included.