{"id":7913,"date":"2015-06-23T16:33:35","date_gmt":"2015-06-23T21:33:35","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=7913"},"modified":"2022-08-17T10:52:10","modified_gmt":"2022-08-17T15:52:10","slug":"building-a-custom-linux-image","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/mlinux\/mlinux-building-images\/building-a-custom-linux-image\/","title":{"rendered":"Building a Custom Linux Image"},"content":{"rendered":"<p>There are two machines for building a custom linux image (apply to both\u00a0mLinux<sup>\u2122<\/sup> 3.x and 4.x) :<\/p>\n<p>1) For MTCDT and MTCDTIP (IP67), MACHINE=mtcdt<br \/>\n2) For MTCAP and MTCDTIP2, MACHINE=mtcap<\/p>\n<p>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).<\/p>\n<p>First, select your machine and set your password, using the following command:<\/p>\n<p><code>$ export MACHINE=mtcap\u00a0 ROOT_PASSWORD=\"MtechPassword\"<\/code><\/p>\n<p><strong>NOTE<\/strong>: For\u00a0<strong>mLinux 5.2.7\u00a0 or higher<\/strong>, there is an additional image to consider that requires commissioning.\u00a0For these images, MTADM_PASSWORD is not used.\u00a0 The user-id and password are established with <a href=\"https:\/\/www.multitech.net\/developer\/software\/mlinux\/getting-started-with-conduit-mlinux\/commissioning-for-mlinux-devices\/\">Commissioning<\/a>, which is required before logging in for the first time. Images for each platform include:<\/p>\n<ul>\n<li><strong>For MTCDT<br \/>\n<\/strong>mlinux-commissioning-image<\/li>\n<\/ul>\n<ul>\n<li><strong>For MTCAP<br \/>\n<\/strong>mlinux-mtcap-commissioning-image<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><span style=\"font-size: medium;\"><b>New Requirement for 5.3.x and above:<\/b><\/span><\/span><\/p>\n<p>In addition to the packages described here:<\/p>\n<p><a id=\"LPlnk700718\" href=\"https:\/\/www.yoctoproject.org\/docs\/2.6\/ref-manual\/ref-manual.html#required-packages-for-the-build-host\">https:\/\/www.yoctoproject.org\/docs\/2.6\/ref-manual\/ref-manual.html#required-packages-for-the-build-host<\/a><\/p>\n<p>You will also need the<strong>\u00a0cmake<\/strong>\u00a0package of your Linux distribution.<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"text-decoration: underline;\">For versions of mLinux below\u00a0<span style=\"text-decoration: underline;\"><strong style=\"font-size: medium;\">4.0:<\/strong><\/span><\/span><\/h2>\n<p>&nbsp;<\/p>\n<p><strong style=\"font-size: medium;\">Required Dependencies for Building<\/strong><\/p>\n<p>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.<\/p>\n<p><strong>Ensure <a href=\"http:\/\/www.yoctoproject.org\/docs\/1.6.1\/ref-manual\/ref-manual.html#required-packages-for-the-host-development-system\">the required dependencies for your operating system<\/a> are installed.<\/strong><\/p>\n<p><span style=\"font-size: medium;\"><strong>Password<\/strong><\/span><\/p>\n<p>The <strong>setup.sh script<\/strong> allows for either an environmental password or, if that is not provided, a random one.<\/p>\n<p>The<strong> setup.sh<\/strong> creates a file called <strong>password.txt<\/strong> in its home directory which contains the password and its hash.\u00a0 It also adds two lines to <strong>conf\/local.conf<\/strong> which match <strong>password.txt.<\/strong><\/p>\n<div class=\"note\">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\u00a0<code>BB_NUMBER_THREADS<\/code>\u00a0and\u00a0<code>PARALLEL_MAKE<\/code>\u00a0settings in conf\/local.conf to speed up build time considerably.<\/div>\n<h3>Download Source &amp; Build Default Images<\/h3>\n<p><code>$ git clone https:\/\/git.multitech.net\/cgit\/mlinux.git<\/code>\u00a0<code>mlinux-3.x<br \/>\n<\/code><code>$<\/code>\u00a0\u00a0<code>cd mlinux-3.x<br \/>\n<code>$ git checkout 3<\/code><br \/>\n<\/code><code>$ .\/setup.sh\u00a0 # Random root password or<br \/>\n<\/code><code>$ <\/code><code>ROOT_PASSWORD=\"mypassword\"<\/code><code> .\/setup.sh<br \/>\n<\/code><code>$<\/code> <code>source\u00a0<code>env-oe.sh<\/code><\/code><\/p>\n<p><strong>Add the following for MTCDT\/MTCDTIP:<\/strong><br \/>\n<code>$ export MACHINE=mtcdt<br \/>\n$ bitbake mlinux-base-image<br \/>\n<\/code><code># OR<br \/>\n$ export MACHINE=mtcdt<br \/>\n<\/code><code>$ bitbake mlinux-factory-image<br \/>\n<\/code><br \/>\n<strong>Add the following f<\/strong><strong>or MTCAP:<\/strong><br \/>\n<code>$\u00a0export MACHINE=mtcdt<br \/>\n$ bitbake mlinux-mtcap-image<br \/>\n<\/code><\/p>\n<p>The\u00a0<a href=\"http:\/\/git.multitech.net\/cgi-bin\/cgit.cgi\/meta-mlinux.git\/tree\/recipes-core\/images\/mlinux-base-image.bb\">mlinux-base-image recipe<\/a>\u00a0will build an image with basic networking, file system, and time utilities.<\/p>\n<p>The\u00a0<a href=\"http:\/\/git.multitech.net\/cgi-bin\/cgit.cgi\/meta-mlinux.git\/tree\/recipes-core\/images\/mlinux-factory-image.bb\">mlinux-factory-image recipe<\/a>\u00a0is flashed into\u00a0Conduits<sup>\u00ae<\/sup> at the factory and adds to\u00a0<code>mlinux-base-image<\/code>\u00a0a full array of extra software including python, ruby, nodejs, and the lighttpd web server.<\/p>\n<h3>Download Source &amp; Build Images for Wi-Fi\/BT version (see <a href=\"https:\/\/www.multitech.net\/developer\/downloads\/\">Downloads<\/a> on how to get the rs9113 Redpine file)<\/h3>\n<p><code>$ tar -C downloads -xf ~\/Downloads\/rs9113-from-src-1.5.0-3.12.27r13.0_mtcdt.tar.gz<br \/>\n<\/code><code>$<\/code> <code>source\u00a0<code>env-oe.sh<br \/>\n$ export MACHINE=mtcdt<\/code><br \/>\n<\/code><code>$ bitbake mlinux-rs9113-base-image<br \/>\n<\/code><code># OR<br \/>\n$ export MACHINE=mtcdt<br \/>\n<\/code><code>$ bitbake mlinux-rs9113-factory-image<\/code><\/p>\n<p>If you skip the tar step, the system displays the following error from the bitbake command:<\/p>\n<p><span style=\"color: #ff0000;\"><code style=\"color: #f3300b;\">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<\/code><\/span><\/p>\n<p><strong>The built image files will be located here:<\/strong> <code>build\/tmp\/deploy\/images\/mtcdt\/<\/code> (mtcdt is the machine name)<\/p>\n<h3>Create &amp; Build a Custom Image<\/h3>\n<p>First, you&#8217;ll need to create your custom image recipe here: <code>layers\/user-layer\/recipes-core\/images\/<\/code> You&#8217;ll likely want to build your recipe on top of <code>mlinux-base-image<\/code>.<\/p>\n<p>A specific recipe must exist in order to add it to an image recipe. To view available recipes, run <code>bitbake-layers show-recipes<\/code>. If a recipe for your desired software is not available, you&#8217;ll need to write a custom recipe.<\/p>\n<h4>Example<\/h4>\n<p>Perhaps you&#8217;d like to build a simple image with LoRa support but without python, node, lighttpd, etc.<\/p>\n<p>The recipe file would be:<\/p>\n<pre class=\"brush:ruby\"># layers\/user-layer\/recipes-core\/images\/lora-only-image.bb\r\nrequire recipes-core\/images\/mlinux-base-image.bb\r\n\r\nIMAGE_INSTALL += \"lora-network-server\"<\/pre>\n<p>To build it, run <code>bitbake lora-only-image<\/code><\/p>\n<h2><span style=\"text-decoration: underline;\"><strong style=\"font-size: 1.17em;\">For versions of mLinux 4.0 and higher:<\/strong><\/span><\/h2>\n<h3><strong>Required Dependencies for Building<\/strong><\/h3>\n<p>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.<\/p>\n<p><strong>Ensure\u00a0<a href=\"http:\/\/www.yoctoproject.org\/docs\/2.2\/ref-manual\/ref-manual.html#required-packages-for-the-host-development-system\">the required dependencies for your operating system<\/a>\u00a0are installed.<\/strong><\/p>\n<h3 id=\"firstHeading\" lang=\"en\">Logging in for the 1st Time Pre-Production<\/h3>\n<div id=\"bodyContent\">\n<div id=\"siteSub\">These instructions are intended for users that create their own images.<\/div>\n<div dir=\"ltr\" id=\"mw-content-text\" lang=\"en\">\n<p>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.<\/p>\n<p>The initial mtadm password for mLinux on production images is &#8220;root&#8221;.<\/p>\n<p>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.<\/p>\n<p>Entering the default root and U-Boot password<\/p>\n<pre class=\"brush:shell\">mtcdt:~$ sudo mts-ubpasswd                                                                                                                                                             \r\nPassword:\r\nsalt: ZdQV5pyDW\/\/0qZ2nX51PzGSi6c6TE7MagR9FvwmMXC6W7HS5I8sRC592Om2ApEUZysXaR40QvanwA+qZojrf2udXJ1CtvfmPK\/SBi6dLuMpRBh6xyLNjz6pDTCGAv4gD                                                 \r\nuboot password hash: \"7a35a6c891c12840199293acdb717190cf09c114b891c8005ec161dbc2883d28\"                                                                                                \r\nsetting mtadm password to 2CSYQDpG                                                                                                                                                     \r\nu-boot password is 2CSYQDpG                                                                                                                                                            \r\n+ \/usr\/bin\/u-boot setenv mtss ZdQV5pyDW\/\/0qZ2nX51PzGSi6c6TE7MagR9FvwmMXC6W7HS5I8sRC592Om2ApEUZysXaR40QvanwA+qZojrf2udXJ1CtvfmPK\/SBi6dLuMpRBh6xyLNjz6pDTCGAv4gD                         \r\n+ \/usr\/bin\/u-boot setenv mtsp 7a35a6c891c12840199293acdb717190cf09c114b891c8005ec161dbc2883d28                                                                                         \r\nmtcdt:~$<\/pre>\n<p>The environmental variables <i>mtss<\/i> and <i>mtsp<\/i> are the salt and password used to create the U-Boot password. To remove the U-Boot password, do the following:<\/p>\n<pre class=\"brush:shell\">sudo u-boot setenv mtss\r\nsudo u-boot setenv mtsp<\/pre>\n<p>To dump the U-Boot environment:<\/p>\n<pre class=\"brush:shell\">sudo u-boot printenv<\/pre>\n<\/div>\n<\/div>\n<p><strong>Password<\/strong><\/p>\n<p>For mLinux 4, there is no root password.\u00a0 Logins should use the user-id mtadm, or one created by the user after the system first boots.<\/p>\n<p>The\u00a0<strong>setup.sh script<\/strong>\u00a0allows for either an environmental password or, if that is not provided, a random one.<\/p>\n<p>The<strong>\u00a0setup.sh<\/strong>\u00a0creates a file called\u00a0<strong>password.txt<\/strong>\u00a0in its home directory which contains the password and its hash.\u00a0 It also adds two lines to\u00a0<strong>conf\/local.conf<\/strong>\u00a0which match\u00a0<strong>password.txt.<\/strong><\/p>\n<div>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\u00a0<code>BB_NUMBER_THREADS<\/code>\u00a0and\u00a0<code>PARALLEL_MAKE<\/code>\u00a0settings in conf\/local.conf to speed up build time considerably.<\/div>\n<h3>Download Source &amp; Build Default Images<\/h3>\n<p><code><code>$ git clone https:\/\/git.multitech.net\/cgit\/mlinux.git<\/code>\u00a0<code>mlinux-4.x<\/code><br \/>\n<\/code><code>$<\/code>\u00a0<code>cd mlinux-4.x<br \/>\n<\/code><code>$ .\/setup.sh\u00a0 # Random root password or<br \/>\n<\/code><code>$ MTADM<\/code><code>_PASSWORD=\"mypassword\"<\/code><code>\u00a0.\/setup.sh<br \/>\n<\/code><code>$<\/code>\u00a0<code>source\u00a0oe-init-build-env<\/code><code><br \/>\n<\/code><\/p>\n<p><strong>Add the following for MTCDT\/MTCDTIP:<\/strong><br \/>\n<code>$ bitbake mlinux-base-image<br \/>\n<\/code><code># OR<br \/>\n<\/code><code>$ bitbake mlinux-factory-image<br \/>\n<\/code><br \/>\n<strong>Add the following f<\/strong><strong>or MTCAP:<\/strong><br \/>\n<code>$ bitbake mlinux-mtcap-image<\/code><\/p>\n<p>The\u00a0<a href=\"http:\/\/git.multitech.net\/cgi-bin\/cgit.cgi\/meta-mlinux.git\/tree\/recipes-core\/images\/mlinux-base-image.bb\">mlinux-base-image recipe<\/a>\u00a0will build an image with basic networking, file system, and time utilities.<\/p>\n<p>The\u00a0<a href=\"http:\/\/git.multitech.net\/cgi-bin\/cgit.cgi\/meta-mlinux.git\/tree\/recipes-core\/images\/mlinux-factory-image.bb\">mlinux-factory-image recipe<\/a>\u00a0is flashed into Conduits at the factory and adds to\u00a0<code>mlinux-base-image<\/code>\u00a0a full array of extra software including python, LoRa software, lighttpd web server, and a commissioning image.<\/p>\n<h3>Download Source &amp; Build Images for Wi-Fi\/BT version (see\u00a0<a href=\"https:\/\/www.multitech.net\/developer\/downloads\/\">Downloads<\/a>\u00a0on how to get the rs9113 Redpine file)<\/h3>\n<p><code>$ tar -C downloads -xf ~\/Downloads\/rs9113-from-src-1.5.0-3.12.27r13.0_mtcdt.tar.gz<br \/>\n<\/code><code>$<\/code>\u00a0<code>source\u00a0oe-init-build-env<br \/>\n<\/code><code>$ bitbake mlinux-rs9113-base-image<br \/>\n<\/code><code># OR<br \/>\n<\/code><code>$ bitbake mlinux-rs9113-factory-image<\/code><\/p>\n<p>If you skip the tar step, the system displays the following error from the bitbake command:<\/p>\n<p><code>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<\/code><\/p>\n<p><strong>The built image files will be located here:<\/strong>\u00a0<code>build\/tmp\/deploy\/images\/mtcdt\/<\/code>\u00a0(mtcdt is the machine name)<\/p>\n<h3>Create &amp; Build a Custom Image<\/h3>\n<p>First, you&#8217;ll need to create your custom image recipe here:\u00a0<code>layers\/user-layer\/recipes-core\/images\/<\/code>\u00a0You&#8217;ll likely want to build your recipe on top of\u00a0<code>mlinux-base-image<\/code>.<\/p>\n<p>A specific recipe must exist in order to add it to an image recipe. To view available recipes, run\u00a0<code>bitbake-layers show-recipes<\/code>. If a recipe for your desired software is not available, you&#8217;ll need to write a custom recipe.<\/p>\n<h4>Example<\/h4>\n<p>Perhaps you&#8217;d like to build a simple image with LoRa support but without python, node, lighttpd, etc.<\/p>\n<p>The recipe file would be:<\/p>\n<pre class=\"brush:shell\"># layers\/user-layer\/recipes-core\/images\/lora-only-image.bb\r\nrequire recipes-core\/images\/mlinux-base-image.bb\r\n\r\nIMAGE_INSTALL += \"lora-network-server\"<\/pre>\n<p>To build it, run\u00a0<code>bitbake lora-only-image<\/code><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>\u00a0<\/strong><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>There are two machines for building a custom linux image (apply to both\u00a0mLinux\u2122 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 [&hellip;]<\/p>\n","protected":false},"author":537,"featured_media":0,"parent":9195,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-7913","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/7913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/537"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=7913"}],"version-history":[{"count":84,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/7913\/revisions"}],"predecessor-version":[{"id":8908,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/7913\/revisions\/8908"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/9195"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=7913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}