Building a Custom Linux Image

There are two machines for building a custom linux image (apply to both mLinux 3.x and 4.x) :

1) For MTCDT and MTCDTIP (IP67), MACHINE=mtcdt
2) For MTCAP and MTCDTIP2, MACHINE=mtcap

In the build, their names are given in lowercase. Be sure to match the proper hardware platform with the correct machine (for example, do not use MACHINE=mtcdt for MTCDPTIP2).

First, select your machine and set your password, using the following command:

$ export MACHINE=mtcap  ROOT_PASSWORD="MtechPassword"

NOTE: For mLinux 5.2.7  or higher, there is an additional image to consider that requires commissioning. For these images, MTADM_PASSWORD is not used.  The user-id and password are established with Commissioning, which is required before logging in for the first time. Images for each platform include:

  • For MTCDT
    mlinux-commissioning-image
  • For MTCAP
    mlinux-mtcap-commissioning-image

 

New Requirement for 5.3.x and above:

In addition to the packages described here:

https://www.yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#required-packages-for-the-build-host

You will also need the cmake package of your Linux distribution.

 

For versions of mLinux below 4.0:

 

Required Dependencies for Building

Ubuntu or Debian are recommended as build systems, because MultiTech does more testing with these options. For more information regarding distribution compatibility, refer to the release notes.

Ensure the required dependencies for your operating system are installed.

Password

The setup.sh script allows for either an environmental password or, if that is not provided, a random one.

The setup.sh creates a file called password.txt in its home directory which contains the password and its hash.  It also adds two lines to conf/local.conf which match password.txt.

The initial build may take a few hours depending on your hardware. If you have more than 2 cores and lots of RAM, you can increase the BB_NUMBER_THREADS and PARALLEL_MAKE settings in conf/local.conf to speed up build time considerably.

Download Source & Build Default Images

$ git clone https://git.multitech.net/cgit/mlinux.git mlinux-3.x
$  cd mlinux-3.x
$ git checkout 3
$ ./setup.sh  # Random root password or
$ ROOT_PASSWORD="mypassword" ./setup.sh
$ source env-oe.sh

Add the following for MTCDT/MTCDTIP:
$ export MACHINE=mtcdt
$ bitbake mlinux-base-image
# OR
$ export MACHINE=mtcdt
$ bitbake mlinux-factory-image

Add the following for MTCAP:
$ export MACHINE=mtcdt
$ bitbake mlinux-mtcap-image

The mlinux-base-image recipe will build an image with basic networking, file system, and time utilities.

The mlinux-factory-image recipe is flashed into Conduits® at the factory and adds to mlinux-base-image a full array of extra software including python, ruby, nodejs, and the lighttpd web server.

Download Source & Build Images for Wi-Fi/BT version (see Downloads on how to get the rs9113 Redpine file)

$ tar -C downloads -xf ~/Downloads/rs9113-from-src-1.5.0-3.12.27r13.0_mtcdt.tar.gz
$ source env-oe.sh
$ export MACHINE=mtcdt

$ bitbake mlinux-rs9113-base-image
# OR
$ export MACHINE=mtcdt
$ bitbake mlinux-rs9113-factory-image

If you skip the tar step, the system displays the following error from the bitbake command:

ERROR: Need /mlinux-3.3x/downloads/rs9113-ipk/rs9113-from-src_1.5.0-3.12.27r13.0_mtcdt.ipk or set MTS_INTERNAL_GIT and add it to BB_ENV_EXTRAWHITE

The built image files will be located here: build/tmp/deploy/images/mtcdt/ (mtcdt is the machine name)

Create & Build a Custom Image

First, you’ll need to create your custom image recipe here: layers/user-layer/recipes-core/images/ You’ll likely want to build your recipe on top of mlinux-base-image.

A specific recipe must exist in order to add it to an image recipe. To view available recipes, run bitbake-layers show-recipes. If a recipe for your desired software is not available, you’ll need to write a custom recipe.

Example

Perhaps you’d like to build a simple image with LoRa support but without python, node, lighttpd, etc.

The recipe file would be:

# layers/user-layer/recipes-core/images/lora-only-image.bb
require recipes-core/images/mlinux-base-image.bb

IMAGE_INSTALL += "lora-network-server"

To build it, run bitbake lora-only-image

For versions of mLinux 4.0 and higher:

Required Dependencies for Building

Ubuntu or Debian are recommended as build systems, because MultiTech does more testing with these options. For more information regarding distribution compatibility, refer to the release notes.

Ensure the required dependencies for your operating system are installed.

Logging in for the 1st Time Pre-Production

These instructions are intended for users that create their own images.

The administrator login on mLinux is now mtadm. There is no root password. You cannot log into the device as the root user. Administrative commands may be executed by prefixing with sudo.

The initial mtadm password for mLinux on production images is “root”.

If the user creates his own images he may choose any password for his image. This is useful if the image is to be installed on a system that is on the public internet.

Entering the default root and U-Boot password

mtcdt:~$ sudo mts-ubpasswd                                                                                                                                                             
Password:
salt: ZdQV5pyDW//0qZ2nX51PzGSi6c6TE7MagR9FvwmMXC6W7HS5I8sRC592Om2ApEUZysXaR40QvanwA+qZojrf2udXJ1CtvfmPK/SBi6dLuMpRBh6xyLNjz6pDTCGAv4gD                                                 
uboot password hash: "7a35a6c891c12840199293acdb717190cf09c114b891c8005ec161dbc2883d28"                                                                                                
setting mtadm password to 2CSYQDpG                                                                                                                                                     
u-boot password is 2CSYQDpG                                                                                                                                                            
+ /usr/bin/u-boot setenv mtss ZdQV5pyDW//0qZ2nX51PzGSi6c6TE7MagR9FvwmMXC6W7HS5I8sRC592Om2ApEUZysXaR40QvanwA+qZojrf2udXJ1CtvfmPK/SBi6dLuMpRBh6xyLNjz6pDTCGAv4gD                         
+ /usr/bin/u-boot setenv mtsp 7a35a6c891c12840199293acdb717190cf09c114b891c8005ec161dbc2883d28                                                                                         
mtcdt:~$

The environmental variables mtss and mtsp are the salt and password used to create the U-Boot password. To remove the U-Boot password, do the following:

sudo u-boot setenv mtss
sudo u-boot setenv mtsp

To dump the U-Boot environment:

sudo u-boot printenv

Password

For mLinux 4, there is no root password.  Logins should use the user-id mtadm, or one created by the user after the system first boots.

The setup.sh script allows for either an environmental password or, if that is not provided, a random one.

The setup.sh creates a file called password.txt in its home directory which contains the password and its hash.  It also adds two lines to conf/local.conf which match password.txt.

The initial build may take a few hours depending on your hardware. If you have more than 2 cores and lots of RAM, you can increase the BB_NUMBER_THREADS and PARALLEL_MAKE settings in conf/local.conf to speed up build time considerably.

Download Source & Build Default Images

$ git clone https://git.multitech.net/cgit/mlinux.git mlinux-4.x
$ cd mlinux-4.x
$ ./setup.sh  # Random root password or
$ MTADM_PASSWORD="mypassword" ./setup.sh
$ source oe-init-build-env

Add the following for MTCDT/MTCDTIP:
$ bitbake mlinux-base-image
# OR
$ bitbake mlinux-factory-image

Add the following for MTCAP:
$ bitbake mlinux-mtcap-image

The mlinux-base-image recipe will build an image with basic networking, file system, and time utilities.

The mlinux-factory-image recipe is flashed into Conduits at the factory and adds to mlinux-base-image a full array of extra software including python, LoRa software, lighttpd web server, and a commissioning image.

Download Source & Build Images for Wi-Fi/BT version (see Downloads on how to get the rs9113 Redpine file)

$ tar -C downloads -xf ~/Downloads/rs9113-from-src-1.5.0-3.12.27r13.0_mtcdt.tar.gz
$ source oe-init-build-env
$ bitbake mlinux-rs9113-base-image
# OR
$ bitbake mlinux-rs9113-factory-image

If you skip the tar step, the system displays the following error from the bitbake command:

ERROR: Need /mlinux-3.3x/downloads/rs9113-ipk/rs9113-from-src_1.5.0-3.12.27r13.0_mtcdt.ipk or set MTS_INTERNAL_GIT and add it to BB_ENV_EXTRAWHITE

The built image files will be located here: build/tmp/deploy/images/mtcdt/ (mtcdt is the machine name)

Create & Build a Custom Image

First, you’ll need to create your custom image recipe here: layers/user-layer/recipes-core/images/ You’ll likely want to build your recipe on top of mlinux-base-image.

A specific recipe must exist in order to add it to an image recipe. To view available recipes, run bitbake-layers show-recipes. If a recipe for your desired software is not available, you’ll need to write a custom recipe.

Example

Perhaps you’d like to build a simple image with LoRa support but without python, node, lighttpd, etc.

The recipe file would be:

# layers/user-layer/recipes-core/images/lora-only-image.bb
require recipes-core/images/mlinux-base-image.bb

IMAGE_INSTALL += "lora-network-server"

To build it, run bitbake lora-only-image