Build System


The purpose of the Midori build system is to construct a bootable Flash ROM image of Midori from source code and a small number of binary objects. This bootable Flash ROM image can then be loaded into Flash ROM and executed on a prototype device.

This chapter describes the Midori build system: its requirements, organization and procedures as well as the organization of the software modules on the target system.

Note: Midori is built with software development tools from the GNU project. The Midori build system includes specific versions of the GCC compiler and binutils tools and then depends on your native development environment for the rest of its build tools. You build ("bootstrap") the Midori build system once with your system's native compiler and thereafter the Midori build system uses these internal build tools. These bundled tools increase the reliability and consistency of the Midori build system.

Requirements

The standard Midori release takes about 150 MB of disk space. While you can use a variety of platforms to build Midori, a recent model PC with about 128MB of RAM, 2GB of free disk space and a recent version of Linux should work fine.

In addition to needing a host development environment for building Midori, you will also need a mechanism for formatting and downloading Flash ROM images of Midori. Usually, this is includes a serial interface to your development board and a Flash ROM burner (we use a Sandisk ImageMate USB SDDR-31).

Note: You need root permission to perform a software build for Midori.

Note: It's much faster to perform a software build on a local filesystem.

Build System Organization

The sections below describe the files and sub-directories in the top-level directory of the Midori build system:

Files

The top-level directory contains the following files:
Makefile top-level make(1) description file
README description of Midori software release
VERSION software release version number

apps directory

The apps directory contains all of the MLZ packages, including XFree86, Netscape, etc.

configurations directory

The configurations directory contains standard configuration files.

docs directory

The docs directory contains the HTML source to this document and other Midori system notes.

Procedures

Downloading and building the Midori build system can take hours. The first time you build Midori can also take more than an hour because it builds the entire Linux kernel, compiler, libraries and window system. Subsequent builds should be much faster.

The following sections describe the basic procedures for the Midori build system:

  1. Download the Midori tarball.

  2. Unpack it into a filesystem.

  3. Configure the Midori build system. The Midori build system uses a Web-based script to build a configuration file that specifies build-time options.

    Configuring the Midori build system is a multi-step process:

    1. Run make webconfig.

    2. Launch your Web browser and open a page for the URL localhost:2000.

    3. Modify the configuration options. The web interface for the Midori build system has a tree structure. To change a configuration option, you first find it in the tree hierarchy, change the configuration option and then be sure to press the Accept button in the configuration panel.

    4. Save the configuration file. By default, you need to save the configuration to a file named config in the configuration directory. At the bottom of the web interface page, type in the configuration file name ("config") and press the Save button. This will display a save confirmation dialog. You may need to scroll down to finish this dialog.

    5. Quit the web interface.

    After configuring the Midori build system, you're ready to build Midori.

  4. Build Midori. After configuring the Midori build system, simply run make as root. This will launch the build system, compile, link and build the Flash ROM image.

    Note: The first time you build Midori, it will compile a large number of packages, including the compiler used by the build system. This will take over an hour for most systems. Subsequent builds should be much faster.

    The table below shows the other common make targets for the Midori build system.

    images all default build target
    webconfig generate the Web-based config files
    clean deletes root tree
    cleanimage delete cramfs images, packed cramfs images forces a check to get all packages if you do an update
    distclean clean everything including tools
    install install to Flash ROM or local hard disk
    install_zero zero flash or local hard disk, then install
    install_new install only stuff that changed
    upgrade run simple-minded http update server

    The final disk images are put in cache/image. The directory cache/root contains the root filesystem used to build the Flash ROM image.

    The layout of the software modules in the target Flash ROM is divided into 4 partitions. The first ("root") partition contains the kernel image and everything necessary to perform a software upgrade over a network connection. The second partition is a duplicate root partition. The third partition contains configuration data like network configuration data, timezone and personalization data. The freeze utility can be used to save state in Flash ROM. The last partition contains the applications, /usr and everything else.

    The final Flash ROM image files are:

    root.img.cram primary root partition contains a cramfs filesystem (contains the kernel image)
    config.img.packed configuration data in /config
    main.img.packed main partition containing the /usr directory on a cramfs filesystem
    mbr.img 512-byte master boot record

  5. Burn the Flash ROM image. Once you are ready to install the Flash ROM image, run make install. The install script creates and loads a Midori runtime onto a block device. This includes the images described above, in addition to a small read-write partition. The install script partitions the Flash ROM, loads the images onto the Flash ROM, and installs the bootloader on the Flash ROM so that it knows where to find the kernel.
    Note: This process will destroy data in the target device.
    Note: You must specify the Flash writer installation device in the INSTALL_DEVICE parameter of the mlinstall configuration panel. For example, if you're using a SanDisk USB Flash writer, then set INSTALL_DEVICE to the last SCSI device. On a machine with two SCSI drives, the first would be named /dev/sda and the second /dev/sdb. The USB Flash writer would then be /dev/sdc.
    After the build completes, the Flash ROM in the writer should contain a bootable Flash ROM image of Midori.

  6. Operate and test Midori on the target device.