Skip to content

Build Instructions

Piotr Oniszczuk edited this page May 13, 2020 · 14 revisions

General

Building MiniMyth2 from sources involves so called cross-canadian compilation and by this it is quite time consuming process. It takes a long time to build and may fail to build on some systems. The build procedure has three stages:

  1. build the native environment
  2. build the cross environment
  3. build target MiniMyth2 image

While most packages needed for MiniMyth2 only build their cross versions, some of the packages needed for MiniMyth2 such as LLVM, MySQL, some Xorg modules needs to build their native versions in order to build their cross versions.

This long, multi-stage, build process exists to ensure as high as possible independence from the local system on which MiniMyth2 is being built. Goal with build process is to avoid MiniMyth2 binaries to link to or depend on any of local system libraries. Also MiniMyth2 build process is removing impact of any differences in local system environment on resulting MiniMyth2 build.

Unfortunately, the price for this local system independence is time and disk space. For me, on a 3.4GHz Intel i7 3770 computer, running MiniMyth2 development KVM virtual machine with 8 cores, 4GB of RAM assigned and with Archlinux as host for MiniMyth2 build system - a complete build takes approximately 7 hours and 45GB of disk space.

Prerequisites

The build system assumes that you are building on either an i386 or an x86_64 architecture computer that is running Linux. In addition, the build system assumes that you have a basic set of binaries and libraries installed, including:

*git *bison *make *cvs *flex *gawk *gcc[gcc-multilib] *grep *mercurial *patch *subversion *texinfo *wget

The build system does its best to check for the presence of any needed binaries at the beginning of the build process. In order to ensure independence from the local system on which MiniMyth2 is being built, the build system only uses these binaries and libraries for the early part of the native environment build stage. During the native environment build stage, the MiniMyth2 build system builds its own versions of these binaries and libraries (with the exception of cvs, git and subversion).

Some Linux distributions, including Fedora, install and use ccache as part of their collection of developer packages. Unfortunately, ccache breaks the MiniMyth2 build system. Therefore, before you attempt to build MiniMyth2, make sure that the ccache package is not installed on your system. Retrieving the build system from the GIT

MiniMyth2 uses GIT as sources control system.

To use you will need the GIT client, which should be available through your Linux distribution's package management system.

Once you have installed the GIT client, you can clone MiniMyth2 sources from GIT server located here: MiniMyth2 GIT.

Information on how to use GIT can be found in the free online tutorials like in example: "try.github.io". Build instructions

If your local system meets the prerequisites, and you have obtained a copy of the MiniMyth2 build system by Retrieving the build system from the GIT, then you are ready to build MiniMyth2.

You can build MiniMyth2 by following steps:

Configure the build system with your settings in your '$(HOME)/.minimyth2/minimyth.conf.mk' file. These settings override the default settings in the build system's '{build-root}/script/minimyth.conf.mk' file, where '{build-root}' is the root directory of the MiniMyth2 build system. Be sure to set 'mm_HOME' variable in '$(HOME)/.minimyth2/minimyth.conf.mk' with path of the root directory of the MiniMyth2 build system. The build system does its best to check for stale, incorrect or missing settings, but it cannot catch everything. Therefore, be sure that your '$(HOME)/.minimyth2/minimyth.conf.mk' file is up-to-date and contains correct values for settings that you need for building MiniMyth2.
Clean the entire build system by running the command 'cd {build-root} ; make clean'.
Download the distribution source files by running the following command 'cd ${build-root} ; make garchive'. Because some source tarballs are large and some download servers are slow, this can take awhile.
Build MiniMyth2 by running the following command 'cd ${build-root}/script/meta/minimyth ; make build'. This is the step that take a long time.
Install MiniMyth2 by running the following command 'cd ${build-root}/script/meta/minimyth ; make install'.

For Ubuntu 16.04 LTS or 18.04 LTS (just those two were tested) quick build guide is folowing:

Start terminal and run commands below:

sudo apt install git bison make cvs flex gawk mercurial subversion texinfo gcc-multilib cd Desktop git clone https://github.com/warpme/minimyth2.git mkdir ../.minimyth2 cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory cd Desktop/minimyth2/script/ make garchive cd Desktop/minimyth2/script/meta/minimyth/ make build

For ArchLinux (tested on 21-12-2019 rolling release state) quick build guide is folowing:

Start terminal, and run commands below:

sudo pacman -S bison make cvs flex gawk mercurial subversion texinfo gcc patch wget git clone https://github.com/warpme/minimyth2.git mkdir .minimyth2 cp minimyth2/minimyth.conf.mk.example.aarch64 .minimyth2/minimyth.conf.mk set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory cd minimyth2/script/ make garchive cd minimyth2/script/meta/minimyth/ make build

For Fedora (tested on Fedora31) quick build guide is folowing:

Start terminal and run commands below:
`sudo dnf install bison make cvs flex gawk mercurial subversion texinfo gcc gcc-c++ patch wget`
`cd Desktop`
`git clone https://github.com/warpme/minimyth2.git`
`mkdir ../.minimyth2`
`cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk`
`set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory`
`cd Desktop/minimyth2/script/`
`make garchive`
`cd Desktop/minimyth2/script/meta/minimyth/`
`make build`

While care is taken to make sure the the build system is free of bugs, assuming that it is free of bugs would be foolish. If a bug in the build system caused the build system to install files in the wrong location, then your local system could be crippled. Therefore, the build system performs checks to reduce the chance that it will damage the system.

First, the build system checks whether or not you are the root user (any user with UID='0' or GID='0'). If you are the root user, then the build system prints an error message and exits. Everything, with the exception of parts of 'make install', can be done as a user with very limited access rights.

Second, the build system checks whether or not you have write access to typical system directories. If you have write access to any of these directories, then the build system prints an error message and exits.

However, 'make install' needs to perform the following operations as root:

copy files to the TFTP and NFS directories, when mm_INSTALL_NFS_ROOT='yes'

As a result, 'make install' may prompt you for the root password, depending on your settings in '$(HOME)/{build-root}/minimyth.conf.mk'.