{"id":25696,"date":"2018-07-23T16:42:13","date_gmt":"2018-07-23T21:42:13","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=25696"},"modified":"2021-04-20T15:51:28","modified_gmt":"2021-04-20T20:51:28","slug":"upgrading-mlinux","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/mlinux\/upgrading-mlinux\/","title":{"rendered":"Upgrading mLinux"},"content":{"rendered":"<h2>Upgrading mLinux using an image install<\/h2>\n<p>The command <strong>\/usr\/sbin\/mlinux-firmware-upgrade<\/strong> may be used to upgrade the firmware. The upgrade file should be placed in <strong>\/var\/volatile<\/strong> or one of its subdirectories. The command must be run as the root user.<\/p>\n<p>There are two types of upgrade files. One type is created by the build named *upgrade*.bin and found in the deploy image directory of the build see:<\/p>\n<p><a href=\"https:\/\/www.multitech.net\/developer\/software\/mlinux\/mlinux-building-images\/building-a-custom-linux-image\/\">https:\/\/www.multitech.net\/developer\/software\/mlinux\/mlinux-building-images\/building-a-custom-linux-image\/<\/a><\/p>\n<p><strong>Example image upgrade files:<\/strong><\/p>\n<p><strong>build\/tmp\/deploy\/images\/mtcdt\/mlinux-factory-image-mtcdt-upgrade.bin<\/strong><br \/>\n<strong>build\/tmp\/deploy\/images\/mtcap\/mlinux-mtcap-image-mtcap-upgrade-withboot.bin<\/strong><\/p>\n<p>Be sure to use the correct image upgrade file for the appropriate hardware platform. For MTCDTIP2, use the mtcap image upgrade file.<\/p>\n<p>Files with <strong>withboot<\/strong> in the name include the bootstrap and U-Boot partitions. Unless you are upgrading from\u00a0mLinux<sup>\u2122<\/sup> 3 to mLinux 4, it is usually not necessary to update bootstrap or U-Boot.<\/p>\n<p><b><i>Note:<\/i><\/b><i> For images installed with <strong>mLinux 5.2x or higher<\/strong>, user passwords are removed and Commissioning mode starts after reboot. Refer to <\/i><a href=\"https:\/\/www.multitech.net\/developer\/software\/mlinux\/getting-started-with-conduit-mlinux\/commissioning-for-mlinux-devices\/\">Commissioning for mLinux Devices<\/a><i> for more details.<\/i><\/p>\n<h2>Updating packages during a reboot (for mLinux 4.0 or higher)<\/h2>\n<p>The second type of upgrade file does not do a complete firmware update. It updates packages using the <strong>opkg<\/strong> command. A package update only affects packages that are changed. Unlike an image update, most files are maintained.<\/p>\n<p>The purpose of updating packages during a reboot is to provide greater resources (memory and temporary file space) for the upgrade. Very small upgrades to commands can be applied without rebooting using the <strong>opkg <\/strong>command and the feeds. See: <a href=\"http:\/\/www.multitech.net\/mlinux\/feeds\">http:\/\/www.multitech.net\/mlinux\/feeds<\/a><strong><br \/>\n<\/strong><br \/>\nIf you have initscripts 2.0-r155.43 (mLinux 4.0.0 or greater), it is possible to upgrade packages using <strong>mlinux-firmware-upgrade<\/strong>.<\/p>\n<p>These files are found at\u00a0<a href=\"http:\/\/www.multitech.net\/mlinux\/upgrades\/\">http:\/\/www.multitech.net\/mlinux\/upgrades\/<\/a>\u00a0when available. Choose your device (mtcdt or mtcap). The version pertains to the specific\u00a0firmware update or where\u00a0a fix applies.<\/p>\n<p>Since these are not image updates, they may take longer to apply. They leave the configuration alone, except for the packages being updated. For example, the login password(s) will not change.\u00a0<strong>NOTE:<\/strong> Make sure that newly installed packages are correctly configured.<\/p>\n<h2>Creating an update package\u00a0that uses opkg<\/h2>\n<p>This method uses\u00a0opkg\u00a0and local files.<\/p>\n<p>See an update package example: <a href=\"http:\/\/multitech.net\/mlinux\/upgrades\/example\/\">http:\/\/multitech.net\/mlinux\/upgrades\/example\/<strong><br \/>\n<\/strong><\/a><br \/>\nCarefully review the\u00a0 initial list of packages and verify that they match the final list. Packages may be split or merged. In these cases a package may need to be removed or added, not<br \/>\njust updated. Packages may require other packages. So dependencies also need to be in the update package tree. An easy way to determine what packages are required is to use the mLinux feeds, <a href=\"http:\/\/www.multitech.net\/mlinux\/feeds\/\">http:\/\/www.multitech.net\/mlinux\/feeds\/<\/a> with opkg. The file <strong>\/etc\/opkg\/mlinux-feed.conf<\/strong> may need to be configured for the desired level of mLinux in the update.<\/p>\n<p>The update package is a tar file containing <strong>IPK files<\/strong> and a <strong>shell script<\/strong> to initiate the update.<\/p>\n<h2>Tree<\/h2>\n<p>The final tree in this example looks as follows:<br \/>\n.<br \/>\n\u251c\u2500\u2500 build.sh<br \/>\n\u251c\u2500\u2500 install_list.txt.md5<br \/>\n\u251c\u2500\u2500 install.sh<br \/>\n\u251c\u2500\u2500 install.sh.md5<br \/>\n\u251c\u2500\u2500 install.template<br \/>\n\u251c\u2500\u2500 local.conf.md5<br \/>\n\u251c\u2500\u2500 log.txt<br \/>\n\u251c\u2500\u2500 model<br \/>\n\u251c\u2500\u2500 remove_list.txt.md5<br \/>\n\u2514\u2500\u2500 update-4.0.0<\/p>\n<p style=\"padding-left: 30px;\">\u251c\u2500\u2500 install_list.txt<br \/>\n\u251c\u2500\u2500 install_list.txt.md5<br \/>\n\u251c\u2500\u2500 local.conf<br \/>\n\u251c\u2500\u2500 local.conf.md5<br \/>\n\u251c\u2500\u2500 remove_list.txt<br \/>\n\u251c\u2500\u2500 remove_list.txt.md5<br \/>\n\u2514\u2500\u2500 repo<\/p>\n<p style=\"padding-left: 60px;\">\u251c\u2500\u2500 arm926ejste<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5-noinst-tools_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5-obex_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5-pand_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5-rfcomm_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 bluez5-testtools_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 libasound-module-bluez_5.47-m3.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 libmts-io0_1.0.8-r0.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 lora-network-server_2.0.19-r4.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages.gz<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages.stamps<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 python-pybluez_0.22-r0.0_arm926ejste.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 python-terminal_2.7.12-r1.0_arm926ejste.ipk<br \/>\n\u251c\u2500\u2500 mtcap<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500\u00a0mlinux-version_4.0.1_ea6ba1..2713b2-r2.0_mtcap.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 mts-id-eeprom_0.3.8-r1.0.0_mtcap.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages.gz<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 Packages.stamps<br \/>\n\u251c\u2500\u2500 mtcdt<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 mlinux-version_4.0.1_ea6ba1..2713b2-r2.0_mtcdt.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 mts-id-eeprom_0.3.8-r1.0.0_mtcdt.ipk<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Packages.gz<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 Packages.stamps<br \/>\n\u2514\u2500\u2500 Packages<\/p>\n<h2>Generated Files<\/h2>\n<p>The files ending in<strong> ipk<\/strong> must be gathered from either a build, or the mLinux feeds found from the<strong>\u00a0<\/strong><a href=\"https:\/\/www.multitech.net\/developer\/downloads\/\">downloads<\/a> page under Conduit<sup>\u00ae<\/sup>:\u00a0mLinux\u00a0Model. The files ending in <strong>md5<\/strong> are created by <strong>build.sh<\/strong>. The files that start with <strong>Packages*<\/strong> are created by the Yocto package-index operation. <strong>install.sh<\/strong> is created from install.template by the <strong>build.sh<\/strong> script.<\/p>\n<h2>Purpose of files in package<\/h2>\n<ul>\n<li><strong>install_list.txt<\/strong> is a list of packages to be installed.<\/li>\n<li><strong>delete_list.txt<\/strong> is a list of packages to be deleted. No <strong>IPK<\/strong> files need to be supplied in order to remove a package.<\/li>\n<li><strong>package list<\/strong> contains the names of packages to be added or removed. An example from the <strong>install_list.txt<\/strong> file would be:<br \/>\n<strong>\u00a0 \u00a0 \u00a0 \u00a0python-terminal<\/strong><\/li>\n<\/ul>\n<p><strong>Python-terminal<\/strong> is not normally installed in mLinux, but is available from the feeds. Likewise the file <strong>delete_list.txt<\/strong> contains <strong>gpsd-udev<\/strong>. This package is required by <strong>gpsd<\/strong>, but is used to find GPS\u2019s over the USB bus, which is not needed by the device (unless you plug a GPS into a USB port).<\/p>\n<h2>OPKG Configuration<\/h2>\n<p><strong>local.conf<\/strong> is the <strong>opkg<\/strong> configuration file. It tells <strong>opkg<\/strong> the location of update packages.<\/p>\n<p>Example local.conf:<\/p>\n<pre class=\"brush:text\"># Set mtcap instead of mtcdt for mtcap\r\narch all 1\r\narch any 6\r\narch noarch 11\r\narch arm 16\r\narch armv4 21\r\narch armv4t 26\r\narch armv5 31\r\narch armv5t 36\r\narch armv5e 41\r\narch armv5te 46\r\narch arm926ejste 51\r\narch arm926ejse 56\r\narch mtcdt 61\r\narch mtcap 61\r\n\r\nsrc\/gz mlinux-mtcdt file:\/\/FLASHDIR\/repo\/mtcdt\r\nsrc\/gz mlinux-mtcap file:\/\/FLASHDIR\/repo\/mtcap\r\nsrc\/gz mlinux-arm926ejste file:\/\/FLASHDIR\/repo\/arm926ejste<\/pre>\n<p>In this case, <strong>FLASHDIR<\/strong> is replaced at install time by the <strong>install.sh<\/strong> script, and either the line containing <strong>mlinux-mtcdt<\/strong> or <strong>mlinux-mtcap<\/strong> is removed depending on the device hardware.<\/p>\n<h2>Creating opkg Required Files<\/h2>\n<p>To create a set of packages, have a <strong>Yocto 2.2 build system<\/strong> in order. Place the desired packages under <strong>build\/tmp\/deploy\/ipk\/<\/strong> in all, mtcdt, mtcap, arm926ejste, as appropriate. Remove any unneeded <strong>ipk<\/strong> files from <strong>build\/tmp\/deploy\/ipk<\/strong>.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"brush:text\">$ cd build\/tmp\/deploy\/ipk\r\n$ ls\r\narm926ejste mtcap mtcdt Packages\r\n$ rm -rf *\r\n$ # Now copy the files from the upgrade tree\r\n$ cp -a ~\/update-example\/my-upgrade\/repo\/* .\r\n$ bitbake package-index\r\n\u2026\r\n\r\nNOTE: Tasks Summary: Attempted 161 tasks of which 159 didn't need to be rerun and all succeeded.\r\nSummary: There was 1 WARNING message shown.<\/pre>\n<p>Building the package index will create or update files named <strong>Packages*<\/strong><\/p>\n<pre class=\"brush:text\">repo\/arm926ejste\/Packages\r\nrepo\/arm926ejste\/Packages.gz<\/pre>\n<p>The <strong>Packages.gz<\/strong> file is used by <strong>opkg<\/strong> to test the packages for corruption and to provide a description. <strong>Packages<\/strong> provides the same file, uncompressed, for reference.<\/p>\n<p>After that, the files need to be copied back:<\/p>\n<pre class=\"brush:text\">cd build\/tmp\/deploy\/ipk\r\ncp -a * ~\/update-example\/my-upgrade\/repo\/<\/pre>\n<h2>Installer script<\/h2>\n<p>The file<strong> install.sh<\/strong> is the installer script. To make life easier, this file is derived from a template file, which is updated by the <strong>build.sh<\/strong> script.<\/p>\n<p>Example instructions in the <strong>install.template<\/strong> script:<\/p>\n<pre class=\"brush:text\">#!\/bin\/bash\r\n# This script works with a tar archive\r\n# called upgrade.bin and is intended for\r\n# use with mlinux-firmware-upgrade<\/pre>\n<pre class=\"brush:text\">NAME=install.sh\r\necho \"$NAME starting in directory $(pwd)\"\r\ncd flash-upgrade\/update-4.0.0<\/pre>\n<pre class=\"brush:text\">id=$(id -u)\r\nif ((id != 0)) ; then\r\n     echo 'You must be root (admin in AEP) to install packages.'\r\n     exit 1\r\nfi\r\n\r\ncat \/proc\/mounts\r\nls \/\r\nls -l \/tmp\r\nlocalcnf=local.conf\r\nif ! [[ -f ${localcnf} ]] ; then\r\n     echo \"Cannot find ${localcnf}\"\r\n     echo \"This file must be in the current directory.\"\r\n     exit 1\r\nfi\r\ndir=$(pwd)\r\nsed -i \"s?FLASHDIR?${dir}?\" ${localcnf}\r\nmachine=$(mts-io-sysfs show product-id | sed 's\/-.*\/\/')\r\nif [[ $machine == MTCAP ]] ; then\r\n     # remove mtcdt\r\n     sed -i '\/mtcdt\/d' ${localcnf}\r\nelse\r\n     # remove mtcap\r\n     sed -i '\/mtcap\/d' ${localcnf}\r\nfi\r\ncat ${localcnf}\r\npkglist_file=\"install_list.txt\"\r\ncat ${pkglist_file} |\r\n(if ! md5sum -c ${pkglist_file}.md5 ; then\r\n     echo \"md5sum bad on ${pkglist_file}\"\r\n     umount_all error\r\nfi)\r\ncat ${localcnf}\r\npkglistrm_file=\"remove_list.txt\"\r\ncat ${pkglistrm_file} |\r\n(if ! md5sum -c ${pkglistrm_file}.md5 ; then\r\n     echo \"md5sum bad on ${pkglistrm_file}\"\r\n     umount_all error\r\nfi)\r\necho \"Update package list ... \/usr\/bin\/opkg -f ${localcnf} update\"\r\n\/usr\/bin\/opkg -t \/var\/volatile\/ -f \"${localcnf}\" update\r\n\/usr\/bin\/opkg -t \/var\/volatile\/ -f \"${localcnf}\" upgrade\r\nif [[ -r ${pkglistrm_file} ]] ; then\r\n     OIFS=\"${IFS}\"\r\n     IFS=$'\\n'\r\n     for p in $(cat ${pkglistrm_file}) ; do\r\n          echo \/usr\/bin\/opkg --force-depends -t \/var\/volatile\/ -f \"${localcnf}\" install $p\r\n          \/usr\/bin\/opkg opkg --force-depends -t \/var\/volatile\/ -f \"${localcnf}\" remove $p\r\n     done\r\n     IFS=\"${OIFS}\"\r\nfi\r\nif [[ -r ${pkglist_file} ]] ; then\r\n     OIFS=\"${IFS}\"\r\n     IFS=$'\\n'\r\n     for p in $(cat ${pkglist_file}) ; do\r\n          echo \/usr\/bin\/opkg -t \/var\/volatile\/ -f \"${localcnf}\" install $p\r\n          \/usr\/bin\/opkg -t \/var\/volatile\/ -f \"${localcnf}\" install $p\r\n     done\r\n     IFS=\"${OIFS}\"\r\nfi\r\nversion=$(grep mLinux \/etc\/mlinux-version | sed 's\/mLinux \/\/')\r\nsed -ri \"s\/mLinux [0-9][^ ]* \/mLinux ${version} \/\" \/etc\/issue\r\nsed -ri \"s\/Version: [0-9][^ ]*\/Version: ${version} \/\" \/etc\/issue<\/pre>\n<h2>Build Script<\/h2>\n<p>To generate the package, there is a script for that purpose, called <strong>build.sh<\/strong>:<\/p>\n<pre class=\"brush:text\">#!\/bin\/bash\r\ndir=$(ls -d update-*)\r\nsed \"s\/UPGRADE_DIR\/${dir}\/\" install.template &gt;install.sh\r\necho \"Upgrade directory is ${dir}\"\r\ncat install.sh | md5sum &gt;install.sh.md5\r\ncd update-*\r\ncat local.conf | md5sum &gt;local.conf.md5\r\ncat install_list.txt | md5sum &gt;install_list.txt.md5\r\ncat remove_list.txt | md5sum &gt;remove_list.txt.md5\r\ncd ..\r\nset -x\r\nchmod +x install.sh\r\ntar --owner=0 --group=0 -cJf ~\/${dir}.bin model install.sh* update-*<\/pre>\n<p>The script assumes a directory starting with update- in the current directory. The directory name is used to create the tar file called <strong>${dir}.bin<\/strong>. This file is then copied to<strong> \/var\/volatile<\/strong>, and <strong>mlinux-firmware-upgrade ${dir}.bin<\/strong> is executed as root to update the packages. The file <a href=\"http:\/\/www.multitech.net\/mlinux\/upgrades\/example\/log.txt\">http:\/\/www.multitech.net\/mlinux\/upgrades\/example\/log.txt<\/a> shows what to expect during the package installs, removals, and upgrades.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Upgrading mLinux using an image install The command \/usr\/sbin\/mlinux-firmware-upgrade may be used to upgrade the firmware. The upgrade file should be placed in \/var\/volatile or one of its subdirectories. The command must be run as the root user. There are two types of upgrade files. One type is created by the build named *upgrade*.bin and [&hellip;]<\/p>\n","protected":false},"author":1478,"featured_media":0,"parent":7861,"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-25696","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/25696","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\/1478"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=25696"}],"version-history":[{"count":36,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/25696\/revisions"}],"predecessor-version":[{"id":25705,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/25696\/revisions\/25705"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/7861"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=25696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}