Building

From RockWiki

Jump to: navigation, search

First off, this section does not cover the creation of distributions, but building and customising existing ones. If that's not what you want then Creating Targets is probably what you are looking for.

Contents

Know what you want

Before you start building a distribution - just as before you start anything else in life - you should know what you want to do. There are many things you can do in ROCK, some are obvious, some are not. Here's an (incomplete) list of things you can do:

  • optimise for a given processor,
  • cross compile for another architecture,
  • create live systems for working from a ROM-device,
  • create highly specialised systems that do one thing and one thing only,
  • select default programs for given task:
    • cups vs. lprng,
    • sendmail vs. exim vs postfix,
    • colored init vs. plain init,
    • ...

Many of these things you don't have to do, but you can and you should keep that in mind during the next steps.

Prerequisites

To build a distribution using ROCK you need a few things:

  • the ROCK source tree (see Download),
  • a lot of free harddisk space,
  • a fast CPU and a lot of RAM,
  • patience.

As CPU-Speed and RAM goes up, the amount of necessary patience goes down.

Configure your Distribution

Before a distribution can be built it has to be configured. To do this issue the following commands:

$ su -
Password:
# cd /usr/src/rock-src/
# ./scripts/Config -cfg mydistribution

Notes:

  • the path /usr/src/rock-src/ may be different depending on where you downloaded the ROCK sources to,
  • the string mydistribution is free-form and can be anything you like.

Here is a list of the standard options as of ROCK 3:

 ROCK Linux TRUNK Configuration - default            [ 586 active packages ]
─────────────────────────────────────────────────────────────────────────────────────────
 ┌───────────────────────────────── Build Config ────────────────────────────────────┐
 │  Arrow keys navigate the menu.  Press <Enter> to activate menu items.   │
 │  Highlighted letters are hotkeys.                                       │
 │ ┌─────────────────────────────────────────────────────────────────────────────────┐ │
 │ │    - Architecture, CPU and Optimization                             │ │
 │ │    (x86)      Intel x86 and compatible PCs                          │ │
 │ │    (32)       Build 32 bit (normal x86)                             │ │
 │ │    (generic)  No special optimisation                               │ │
 │ │    [ ]        This is a cross-build between architectures           │ │
 │ │    [ ]        This is a pseudo-native cross-build                   │ │
 │ │                                                                     │ │
 │ │    - Target Distribution                                            │ │
 │ │    (crystal)  Crystal ROCK (The general purpose distribution)       │ │
 │ │    [ ]        Also build add-on (non-CORE) packages                 │ │
 │ │    (de es fr it ru) Linguas (translations)                          │ │
 │ │                                                                     │ │
 │ │    - Build System Configuration                                     │ │
 │ │    [ ]    Make a parallel (cluster) build                           │ │
 │ │    [ ]    Abort when a package-build fails                          │ │
 │ │    [ ]    Retry building broken packages                            │ │
 │ │    [ ]    Disable packages which are marked as broken               │ │
 │ │    [ ]    Do not try building packages if deps failed               │ │
 │ │    [ ]    Always clean up src dirs (even on pkg fail)               │ │
 │ │    [ ]    Create debug information (xtrace) for builds              │ │
 │ │    [ ]    Use tmpfs for building packages                           │ │
 │ │    [ ]    Send emails on special events                             │ │
 │ │    [ ]    HTTP GET request on special events                        │ │
 │ │                                                                     │ │
 │ │    - Build Output (terminal and others) Configuration               │ │
 │ │    [*]    Use ANSI colors for terminal output                       │ │
 │ │    [ ]    Print Build-Output to terminal when building              │ │
 │ │    [ ]    Activate HTML output module                               │ │
 │ │    [ ]    MythTV On-Screen-Display Output Plugin                    │ │
 │ │    [ ]    Text-to-Speech Output Plugin                              │ │
 │ │                                                                     │ │
 │ │    [ ]    Show expert-only and experimental options                 │ │
 │ │                                                                     │ │
 │ └─────────────────────────────────────────────────────────────────────────────────┘ │
 ├─────────────────────────────────────────────────────────────────────────────────────┤
 │                    <Select>    < Exit >    < Help >                     │
 └─────────────────────────────────────────────────────────────────────────────────────┘

If you are unexperienced with creating distributions you should only change the options that are presented to you now and should not toggle

[ ]    Show expert-only and experimental options

There is a reason why those are expert-only and experimental.

Every option has an "online-help" with it. You can access it by highlighting the option and using the

< Help >

button.

  • - Architecture, CPU and Optimization
    • (x86) Intel x86 and compatible PCs
      Here you can choose the architecture you want to build for. Some examples:
      • x86
      • SPARC
      • PowerPC
    • (32) Build 32 bit (normal x86)
      This option specifies if you want a 32 or 64 bit system. Refer to the specifications of your CPU as to which you need. Most people should select 32 bit here.
    • (generic) No special optimisation
      Here you can specify if you want to optimise your distribution for a specific CPU. This also means that any system this distribution is going to be installed on must have support for the instruction set of the processor you are building for. Good settings for a general-purpose distribution for x86 computers are:
      • No special optimisation
      • Pentium with MMX (any modern PC or compatible has support for this)
        Note: using other optimisations may produce buggy software. Read Broken Compiler Optimizations for details.
  • - Target Distribution -
    Here you select the distribution you want to build. As of ROCK 3 it includes the following choices:
    • Boot-, Install- and Rescue-System
    • Crystal ROCK (The general purpose distribution)
    • ROCK Linux for VIA EPIA M
    • Generic ROCK Linux
    • Live CD-ROM system
    • LVP
    • Reference-Build for creating *.cache files
    • Advanced rescue-system-in-a-tar
    • ROCK Router Linux
      The distributions are stored in subdirectories in the rock-src/target directory. In these directories there is more documentation about the respective targets. TODO: More information about the targets.
  • Build System Configuration
    • Make a parallel (cluster) build
      If you have more than one computer available you can distribute the workload of building a whole distribution among them. See Cluster_Build for details.
    • Abort when a package-build fails
      Sometimes it is fatal if a package build fails. Unfortunately there is no sane way to check for this. So if you want ROCK to completely stop building your distribution in case of an error, check this option.
    • Retry building broken packages
      If a package failed and you restart the build process ROCK will retry to build the package only if this option is checked.
    • Disable packages which are marked as broken
      If packages are marked as broken in ROCK then they will not be included.
    • Do not try to build packages if deps failed
      Almost every package in ROCK depends on at least one other package. For example, the KDE packages depend on Xorg. Now if Xorg failed for some reason, the KDE packages (and subsequent packages that depend on KDE packages) will not be built.
    • Always clean up src dirs (even on pkg fail)
      A package is always built in a directory called "rock-src/src.package.id". If the package is successfully built then this directory will be deleted. If the package fails it is not deleted and you can use this directory to search for the error. If you check this option then the directory is deleted also if the package fails to build.
    • Create debug information (xtrace) for builds
      If you check this option then the bash option -x will be set. Every command that is executed will be logged (WARNING: This will create huge logfiles)
    • Use TMPFS for building packages
      If you have a lot of RAM (more than 1 GigaByte) you can use TMPFS for building. The package will be extracted and built in a filesystem that resides entirely in RAM thus decreasing access times and load on hard disks. You can also use this with less RAM if you set up enough swap space (with mkswap and swapon). NOTE: All packages except OpenOffice require a TMPFS not larger than 1 GigaByte to build. OpenOffice needs about 4.5 GigaByte. WARNING: Be sure you have enough virtual RAM (physical RAM plus swap space) before you use this feature. Otherwise your computer may hang.
  • - Build Output (terminal and others) Configuration
    • Use ANSI colors for terminal output
      Check this option if your terminal supports colored output
    • Print Build-Output to terminal when building
      If you want to see the package build on your terminal then check this option.
    • Activate HTML output module
      If you want your build output to be available in HTML form then check here.

Download sources

After you configured your distribution you need to download the sources necessary for building it. To do this just run the following command:

# ./scripts/Download -cfg mydistribution -required

The Download script will automatically download a list of mirrors and select the fastest one available. The downloaded files will be checksummed and reported as error if the checksum doesn't match the value in the respective [D] tag. For more information on this you can have a look at the *.desc files. Should the file not be available on the mirrors then the Download script will try to download the file from the original download location.

Build your distribution

After all sources have been downloaded you can now build your distribution with the following command:

# ./scripts/Build-Target -cfg mydistribution

This command will take between hours and days or even weeks, depending on the distribution and machine you are building on.

An unmodified Crystal takes about four days on a Pentium 4 1.8GHz with one GigaByte RAM.
A more recent estimate: an unmodified Crystal takes about one day on an Athlon XP 2000+ (1,66 GHz) with 512 MB RAM.

If you want to burn this distribution on a bootable CD-ROM you can find necessary instructions in Creating Bootable ISOs.