LMU-55XX SDK Build

Preparing the Build Machine

The SDK build requires a host running Ubuntu Linux 16.04.

There are two options for this:

Option 1: Using a CalAmp ISO image
Note that this is the recommended method.

Download an ISO image from the following link:

This ISO image has all the required packages to perform a complete build. An app such as VMware Player is required to create a Linux virtual machine using this ISO.

Option 2: Using a native Linux Ubuntu 16.04 machine
First, install the following packages and tools on top of a freshly installed Ubuntu 16.04:

  • libncurses-dev
  • subversion
  • gettext
  • gengetopt
  • dos2unix
  • lzop
  • chrpath
  • zip
  • unzip
  • python
  • make
  • zlib1g-dev

Then install the proper cmake, installing these items in sequential order:

  1. git clone git://cmake.org/cmake.git
  2. cd cmake
  3. git checkout v2.8.12.2
  4. sudo apt-get install libcurl4-openssl-dev
  5. ./bootstrap --system-curl
  6. make
  7. sudo make install
  8. sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force

Downloading and Installing the LMU-55XX SDK

Use the following link to download the latest SDK: https://files.developer.calamp.com/Private+Files/EdgeApp_LMU55xx/lmu5541_lmu5530_41g_CAVNG-v1.0.6.503_SDK.tar.bz

  1. Uncompress the SDK file, yielding a .tar file format.
  2. Transfer this tar file to your build machine home directory (ubuntu>>/home//).
  3. ssh to your build machine and untar the file from your home directory:
    ubuntu>>tar xvf .tar
    This command will create an lmu5541_sdk directory and untar all the files inside.

Compiling the SDK

For the first instance, a user must compile a complete SDK build. You can compile an SDK for the targets LMU-5541, LMU-5530, or all.

A package compiled for LMU-5541 won’t be installed on LMU-5530 and vice versa. A package built for all can be installed on both LMU-5541 and LMU-5530.

📘

Note

When selecting the all option, there cannot be a dependency on the code to the hardware version.

Building for the LMU-5541 platform:

  • ubuntu>> cd lmu5541_sdk
  • ubuntu>> cd calamp_env/lmu5541 && ./setup.sh && cd ../..
  • ubuntu>> echo lmu5541 > .common_build_env
  • ubuntu>>make dirclean
  • ubuntu>>make V=s -j4

Building for the LMU-5530 platform:

  • ubuntu>> cd lmu5541_sdk
  • ubuntu>> cd calamp_env/lmu5530 && ./setup.sh && cd ../..
  • ubuntu>> echo lmu5530 > .common_build_env
  • ubuntu>>make dirclean
  • ubuntu>>make V=s -j4

Building for all platforms:

  • ubuntu>> cd lmu5541_sdk
  • ubuntu>> echo all > .common_build_env
  • ubuntu>> cd calamp_env/lmu5541 && ./setup.sh && cd ../..
  • ubuntu>>make dirclean
  • ubuntu>>make V=s -j4

Depending on the machine being used, compiling an SDK for the first time may take long periods of time.

If you are switching between targets (going from LMU-5530 to LMU-5541), you need to run >>make clean before following the above steps.

Compiling and Installing a Hello World IPK

CalAmp provides a very simple package as part of the SDK to demonstrate the creation, compilation, and installation of a build using the OpenWrt environment.

Load the helloworld package to the proper location for compiling:

  • ubuntu>> cd LMU5541_sdk
  • ubuntu>> tar xvf helloworld.tar -C openwrt/package/

Select the helloworld package to build:

  • ubuntu>> make menuconfig

The above command will launch the menuconfig GUI. Go to the utility tab and select the helloworld package. Save and exit the menuconfig.

Compile the helloworld package:

  • ubuntu>> make package/helloworld/{clean,compile} V=s

The above command will create the following packages under the bin directory:

  • bin/lmu5541/packages/helloworld_1.0.0-1_lmu5541.ipk

📘

Note:

The above build is for an LMU-5541 target.

Deploy and run the package to the target.

SCP the above IPK to lmu5541 and install it with the following command:

  • Lmu5541>> opkg install helloworld_1.0.0-1_lmu5541.ipk
  • Run helloworld, which prints HelloWorld!!
  • LMU5541>>helloworld
  • “Hello World”

Click the link below for more information on creating an IPK in OpenWrt:

If you have built an SDK for the LMU-5541 or LMU-5530 platform and you want to just build one package for all platforms, you can do the following:

  • Run make menuconfig to select your package.

  • Change the following line in .config (which resides in the top-level directory):

    CONFIG_TARGET_ARCH_PACKAGES="lmu5541"
    to:
    CONFIG_TARGET_ARCH_PACKAGES="all"

  • Clean, compile, and install your package:
    ubuntu>> make packages//{clean,compile,install} V=s

The Benefits of Installing an IPK Under PEG Control

  • You can deploy up to 16 different IPKs under PEG through PULS/DM-CTC, over the air or sideloaded.
  • The LMU reports all installed IPK information as part of an ID report to PULS/DM-CTC.
  • You can query the status of all installed packages over an entire fleet through PULS API.
  • You can install, uninstall, and remove each individual package through DM-CTC or locally using PEG action 169.
  • You can get package information by querying the following parameter:
>>at$app param 4033 <Index>  <Package name>                   /* your package name */
>>at$app param 4034 <Index>  <Package Version>                 /* your package version */
>>at$app param 4035 <Index>  <Package MD5>                      /* MD5 of binary - 32 bytes */ 
>>at$app param 4036 <Index>  <package_type>                      /*  package type = 12 */   
>>at$app param 4043 <Index>  <package_merge>                  /* explained later default  = 0*/

 >>at$app param? 4034 <Index>  

     Returns : package installed status    

         1 = SUCCESS  , <Everything else > = FAILED

Deploying a Custom IPK Using DM-CTC

  • Create your EdgeApp IPK using the CalAmp SDK.
  • Use the format <package name>_<package version>_<platform>.ipk for the package name.
  • Create a tar binary from this IPK with the following command:
ubuntu>>>tar   vczf     <package name>_<package version>_<optional>.bin   
	<package name>_<package version>_<platform>.ipk

📘

Note

It is important to use the exact package name and version when making a bin file.

This binary is ready to be uploaded to DM-CTC/PULS.

  • In PULS, you will be asked to enter the name and version of the package. Make sure to enter the exact name and version from the filename.
  • In DM-CTC, upload the file, and the IPK name and version will be derived from the filename.

Sideloading a Custom IPK Under PEG

  • Create your EdgeApp IPK using the CalAmp SDK.
  • Create a tar binary from this IPK with the following command:
ubuntu>>>tar   vczf     <package name>_<package version>_<optional>.bin   
	<package name>_<package version>_<platform>.ipk

Calculate md5sum of the package using the following command:

ubuntu>> md5sum  <package name>_<package version>_<optional>.bin

The return will be a 32-byte string.

  • Push the above binary to the target and rename it as /user1/ota-dnld-file.
  • Use the SCP tool from Linux or other tools to load the file to the LMU-55XX.
ubuntu>>>scp      -p 2001  <package name>_<package version>_<optional>.bin  [email protected]:/user1/ota-dnls-file
  • Find the first empty slot by querying the following PARAM:
at$app param? 4032,*
4032,0,"FALSE"
4032,1,"FALSE"
4032,2,"FALSE"
4032,3,"FALSE"
4032,4,"FALSE"
4032,5,"FALSE"
4032,6,"FALSE"
4032,7,"FALSE"
4032,8,"FALSE"
4032,9,"FALSE"
4032,10,"FALSE"
4032,11,"FALSE"
4032,12,"FALSE"
4032,13,"FALSE"
4032,14,"FALSE"
4032,15,"FALSE"

OK

The above output shows that no IPK has been installed. It is recommended to pick the lowest empty slot.

Index =0

  • Start programming the appropriate parameters for this IPK as described below:
>>at$app param 4033 <Index>  <Package name>       /* your package name */
>>at$app param 4034 <Index>  <Package Version>    /* your package version */

>>at$app param 4035 <Index>  <Package MD5>        /* MD5 string calculated above */
>>at$app param 4036 <Index>  <package_type>         /*  package type = 12 */
>>at$app param 4043 <Index>  <package_merge>     /* explained in the next section */
  • Install the package using the following PEG action:
at$app peg action  196  <Index>
  • Query the installation status by querying param 4037:
at$app param?  4037,<Index>
      1 = PASS  
      <Anything else> = FAILED

Merging Option

Merging is useful only if the IPK has some UCI files in the /etc/config/ directory. If there are no UCI files, this field setting can be ignored.

There are four different merge types, which are defined below. If there is no merge defined, the default is zero.

Merging keeps the previous data in the file and does not overwrite it during the upgrade.

The merge applies on all UCI files defined in the /etc/config directory. It doesn't apply to other files.

0: Merge the old and new files based on the new files.

  • Keep all the options from the new files but load all the values from the old file.

1: No merge — everything from the new package.

2: Merge old and new based on both the old and new files.

  • Keep all the changes between the old and new files in terms of sections; the values are all from the old files.

3: Keep the old file intact. Don't overwrite it — only new files get copied.

Merge Example
New File:

config section1 '1'
   option option1 'N1'
   option option2 'N2'
   option option3 'N3'
   config section '2'
    option option4  'N4'
    option option5  'N5'

config section '3' 

      option option4  'N6'

Old File:

config section1 '1'
      option option1 'O1'
     option option2 'O2'
     option option3 'O3'
config section '2'
     option option4  'O4'
     option option6  'O5'
config section '4'
     option option4  'O6'
     option option6  'O7'

Final Merged File
Merge 0:

config section1 '1'
        option option1 'O1'
        option option2 'O2'
        option option3 'O3'
config section '2'
	option option4  'O4'
	option option5  'N5'
config section '3'
	option option4  'N6'

Merge 1 (equal to the new file):

config section1 '1'
   option option1 'N1'
   option option2 'N2'
   option option3 'N3'
   config section '2'
    option option4  'N4'
    option option5  'N5'

config section '3' 

      option option4  'N6'

Merge 2:

config section1 '1'
  option option1 'O1'
   option option2 'O2'
   option option3 'O3'
   
 config section '2'
    option option4  'O4'
    option option5  'N5'
     option option6  'O5'

config section '3'

 	option option4  'N6'	 

 config section '4' 	

         option option4  'O6'   

 	option option6  'O7'

Merge 3 (equal to the old file):

config section1 '1'
                    option option1 'O1'
                    option option2 'O2'
                    option option3 'O3'
                config section '2'
                    option option4  'O4'
                     option option6  'O5'
                 config section '4'
                      option option4  'O6'
                      option option6  'O7'