Skip to content

Build Instructions

Piotr Oniszczuk edited this page May 24, 2022 · 12 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 initial complete build takes approximately 10-11 hours and 65GB of disk space. Please note: this amount time is consumed only for clean first build of system. After this stage - any change will require recompilation of only changed component - and because of cross compilation - recompilation will be realized with speed of build machine (fast multi-core i7 machine in my case) instead of target (i.e. low-power tiny ARM SoC).

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
  • mercurial
  • subversion
  • texinfo
  • gcc

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.

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.

Building procedure:

  • 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.

Quick build guide on Ubuntu 22.04

(just this version was tested)

You may consider to build under dedicated user 'minimyth' - but this is not mandatory.

For building under dedicated 'minimyth' user, start terminal, and run commands:

useradd --create-home minimyth

passwd minimyth <pass>

relogin with user 'minimyth'

start terminal and run commands below:

sudo apt install git bison make cvs flex gawk mercurial subversion texinfo gcc-multilib g++

cd ~/Desktop

git clone https://github.com/warpme/minimyth2.git

mkdir ../.minimyth2 ../build

cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk

If you are not building under dedicated user 'minimyth' - set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to {build-root} directory path. Skip setting mm_HOME when you are building under dedicated user 'minimyth'

cd ~/Desktop/minimyth2/script/meta/minimyth/

make build

Quick build guide on ArchLinux

(tested on 24-05-2022 rolling release state)

You may consider to build under dedicated user 'minimyth' - but this is not mandatory.

For building under dedicated 'minimyth' user start terminal, and run commands:

useradd --create-home minimyth

passwd minimyth <pass>

relogin with user 'minimyth'

start terminal, and run commands below:

sudo pacman -S bison make cvs flex gawk mercurial subversion texinfo gcc glibc patch wget which

git clone https://github.com/warpme/minimyth2.git

mkdir .minimyth2 build

cp minimyth2/minimyth.conf.mk.example.aarch64 .minimyth2/minimyth.conf.mk

If you are not building under dedicated user 'minimyth' - set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to {build-root} directory path. Skip setting mm_HOME when you are building under dedicated user 'minimyth'

cd ~/minimyth2/script/meta/minimyth/

make build

Quick build guide on Fedora

(tested on Fedora36)

You may consider to build under dedicated user 'minimyth' - but this is not mandatory.

For building under dedicated 'minimyth' user, start terminal, and run commands:

useradd --create-home minimyth

passwd minimyth <pass>

relogin with user 'minimyth'

start terminal and run commands below:

sudo dnf install bison make cvs flex gawk mercurial subversion texinfo gcc gcc-c++ patch wget git

cd ~/Desktop

git clone https://github.com/warpme/minimyth2.git

mkdir ../.minimyth2 ../build

cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk

If you are not building under dedicated user 'minimyth' - set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to {build-root} directory path. Skip setting mm_HOME when you are building under dedicated user 'minimyth'

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, when mm_INSTALL_NFS_ROOT=yes in $(HOME)/{build-root}/minimyth.conf.mk issuing make install command may may prompt you for the root password as command needs to perform the operations as root when install script makes copy of files to the TFTP and NFS directories.