Factory Architecture

Design Summary

The factory implementation combines several community standard (best of breed) components: LinuxKernelConfig (kconfig) and GNU make.

Features

  • Common infrastructure; built upon GNU make and LinuxKernelConfig
  • Support for common C libraries: Glibc, uClibc, klibc, eglibc
  • Build customized/optimized toolchain for the board or reuse existing toolchain
  • Many common RFS output formats: ext[2,3], JFFS2, CramFS, SquashFS, cpio, tar, YAFFS, UBIFS
  • Many common package output formats: binary tarball (tgz), Redhat (rpm), Debian (deb), and Itsy (ipkg).
  • supports building kernel with full initramfs based RFS
  • supports building kernel with early userspace
  • Over 140 boards supported
  • over 1300 applications ready to be cross compiled with all supported C libraries and boards.
  • Outputs distribution installer for RFS, kernel binary and source, toolchain, and TimeStorm integration.
  • Build and runtime dependency support for applications.
  • Starting points for all boards, including kernel, bootloader, and application configuration
  • Outputs RFS images, fully relocatable toolchains with common host utilities, packages, bootloaders, and kernel image files.
  • Incremental development supported with exportable RFS working directory.
  • Portable, runs unchanged on Fedora (32bit and 64bit), Ubuntu (32bit and 64bit), openSuSE (32bit and 64bit), Slackware, and more!
  • Does not require root privileges
  • Built in use of ccache
  • distcc easily utilized by setting CCACHE_PREFIX=distcc and DISTCC_HOSTS="foo bar"

Requirements

FactoryHostRequirements

KConfig

The KConfig definitions define a rule based system for what goes into the work order configuration. This includes the packages, kernel and tool chain along with the versions and configurations of each. It allows the definition of each as a symbol that is used by the make rules for the predefined actions of the build.

The definitions for each package include the package name, version (the suggested default, which would typically be the newest version or the “best” version if necessary), a descriptive free form textual string that can be used for help and guidance, configuration options, and dependent packages. Other attributes are also included in the definitions, such as install time options, patch inclusion or exclusion, as well as the location from which to retrieve the package and patch sources. All define symbols to be used by the make rules at build time.

Architecture and board specific options and configuration are integrated so that the default configurations for C library, kernel, boot loader, and package options are pre-filled for the user. The experienced user is also given the ability to provide their own configuration for each in order to remove any real or perceived customization limitation.

The definitions format that is output from Kconfig is simple and light weight. It lends itself well to automatic or by hand generation.

The Kconfig files are named Config.in.

KConfig Menu Hierarchy

  • Target Configuration
    • Architecture and CPU [choice], Global Target Software Compilation Options [strings]
    • Build Root File System (RFS) Images [bool], RFS Image types and options [choices, strings]
    • Build Packages of Selected Software [bool]
  • Tool Chain Configuration
    • Build or Fetch [bool], Global Location [string], Command line options [strings]
    • Components (Compiler, C Library, Debugger, etc) [choice], Component Configuration Options [strings], Location (override Global) [strings], Patches [strings]
    • Additional Utilities [choice], Utility Configuration and Build Options [strings]
    • Install Tool chain to RFS [bool]
  • Target Software
    • Kernel
      • Version [choice]
      • Location (override Global) [string]
      • Configuration [strings]
      • Patches [choices, bools]
    • Boot Loader
      • Specify boot loader [choice]
      • Location (override Global) [string]
      • Configuration [choices, strings]
      • Options [choices]
    • Software Packages
      • Category-A
        • Package-A [bool]
        • advanced options (submenu)
        • Version [string]
        • Location (override Global) [string]
        • Configuration and Build [strings]
        • Functionality [bool]
        • Patches [strings]
        • Additional Source Files [strings]
      • Package-B
  • Advanced Build Configuration (advanced options)

Make

The make rules define actions to be performed on all of the configuration symbols defined within Kconfig. Rules are present for each unit (this includes packages, toolchain components, and the kernel) that define each phase of the build and install process. All units have standard make targets (implemented as macros) that cover the standard configure, build, and install phases. Packages that do not follow the standard procedures still rely upon some of the macro rules, override others, as well as define custom rules.

The top level Makefile includes (with the -include directive) all sub make files (name {unit}.mk).

Common Make/Build Targets

The following can be used with make directly on the command line:

  • menuconfig, oldconfig -- kconfig CLI configuration utilities
  • sources -- download all sources archives and patches required to build selections
  • toolchain -- build and package the cross toolchain
  • host-utilities -- build the host utilities
  • rfs -- compile all the selections and kernel and create the RFS output
  • rfs-images -- generate the RFS images (called by RFS)
  • packages -- generates packages for all selections
  • installer -- generates the installer for the factory distribution
  • distclean -- purges build directories and files
  • rfs-distclean -- reset RFS working directory
  • packages-distclean -- reset packages
  • busybox-menuconfig -- fetches files and invokes the busybox menuconfig interface
  • kernel-menuconfig -- fetches files and invokes the Linux kernel menuconfig interface
  • uclibc-menuconfig -- fetches files and invokes the uClibc menuconfig interface

The help target also explains the common options:

$ make help
Host targets:
* checksystem            - Check that the system meets build requirements
* checkupdates           - Check for updates from Timesys
  update                 - Update work order with new defaults from Timesys
  menuupdate             - Menu based update tool
  update-noprompt        - Update work order without prompting for each change
  checktool-oprofile, checktool-ltp, 
  checktool-mpatrol, checktool-gdb
                         - Check current configuration for compatibility with
                           tool (oprofile, ltp, etc)
  advice                 - Upload current configuration to the TimeSys server
                           and receive advice about selections

Cleaning targets:
  clean                  - Purge build directories
  download-clean         - Purge source files
  distclean              - Purge build directories, source files and .config
  rfs-distclean          - Reset RFS working directory
  packages-distclean     - Reset package state for selected applications
  software-distclean     - Distclean all selected applications
  reset-toolchain        - Resets the build environment to a pristine toolchain

Per application targets:
  [application]-clean        - Purge build directory
  [application]-distclean    - Purge build and source directories
  [application]-fetch        - Fetch source, patches, and files
  [application]-unpack       - Unpack into working directory
  [application]-patch        - Apply patches to working directory
  [application]-configure    - Configure
  [application]-build        - reset build status to unbuilt
  [application]-build        - Build
  [application]-package      - Generate package
  [application]-rfs-install  - Install to RFS working directory
  [application]-host-install - Install to Host Toolchain
  [application]-show         - display application information
  [application]-select       - add application to current configuration

Configuring targets:
  config         - Update configuration file using command-line utility
  menuconfig     - Update configuration file using ncurses utility
  oldconfig      - Update configuration file using current .config as a base
* showpackages   - Show summary of packages selected in current .config
* showoutput     - Show summary of the build output

Fetching targets:
* sources        - Download all sources and patches required to build selections

Building targets:
* packages       - Generate packages for all selections
* toolchain      - Build and package the cross toolchain
* rfs            - Compile all selections and kernel and create RFS output
* rfs-images     - Generate RFS images (Called by RFS)
* installer      - Generate the installer for the custom target SDK

Execute "make" to build all targets marked with [*]

What is a Work Order?

What we call "work order" is a listing of KConfig keys and their values. It is in a format easily parsed by GNU make that drives the make rules defined within the build system. The work order includes (but is not limited to) the following:

  • Version of Build System to use, including build checkout and CHROOT environment.
  • Kernel version and configuration
  • Tool chain version and configuration, such as which C library to use
  • Host configuration for the targeted host tool chains
  • Target configuration
  • RFS configuration, package selection and configuration
  • Global location for sources and patches along with per package override

The make rules use the work order to fill in the above values during the build process.

FactoryOutput