Operator Utilities and instructions for building STB software image
Image-making Operator Utilities
To make STB software image, customers (operators) should use the following Operator Utilities provided by the manufacturer:
Requirements to OS of Development Host
It is required to use the *nix i386 (32-bit) system. We recommend using Ubuntu OS Linux distribution.
In the case of use 64-bit OS, it should be additionally installed appropriate packages for supporting 32-bit shared libraries. For example, for Ubuntu 14.04 - 16.04, the lib32z1 package (32-bit shared libraries for AMD64) must be installed.
All examples in this manual are given for Ubuntu Server 12.04 i386.
Required Linux OS packages
For recommended OS, the following packages should be installed:
Ubuntu Server 12.04 i386:
Ubuntu Server 12.04-16.04 x86_64:
Software image variants
Operator utilities provide making three different variants of STB software image:
- PublicImage - image signed with standard manufacturer's public key (ID = STB_PUBLIC). PublicImage version by the manufacturer (imageupdate file) is put in the root directory of each current release of the appropriate STB model.
Options for updating from PublicImage:
1. It is updated from the Bootloader menu or System Recovery Utility menu to various versions of PublicImage and transitional version of CustomImage.
2. It is updated from the Portal menus (using 'HTTP' or 'USB' methods) only to the Factory image software versions. - CustomImage - image signed with custom-key which is created by operators without requesting the manufacturer of STB. This kind of image is recommended for those operators who want to implement secure software updating from the portal only to their own software versions (using HTTP / USB methods) with the ability to update to PublicImage public software versions from Bootloader menu or System Recovery Utility menu.
Options for updating from CustomImage:
1. It is updated from the Bootloader menu or System Recovery Utility menu to various versions of PublicImage and transitional version of CustomImage.
2. It is updated from the Portal menu (using 'HTTP' or 'USB' methods) only to software versions signed with the same custom-key. - OperatorImage - image signed with operator key. Before setting in STB, the operator key must be signed by the manufacturer of STB.
Updating variants from OperatorImage: It can be updated to OperatorImage versions signed only with the same operator's key.
Creation of software image. Key points
Before making an image, we recommend to familiarize with the following documents:
Operator's Guide (pdf)
Specification JavaScript API (SW ver. prior to 0.2.18)
Specification JavaScript API (SW ver. from 0.2.18)
It is recommended:
- Run all commands with root permission.
- Use the tar command line archiver.
Warning! The Command Shell which is in the scripts and System Shell can be different from each other!
The image creation algorithm in the general case is as follows:
1. Preparation of environment variables.
2. Profile preparation.
3. Copying the kernel source file from the STB release to the working directory of Operator Utilities.
4. Creation kernel images (running the kernel signing script).
5. Running the image building.
1. Preparation of environment variables
Required values of environment variables, that should be set in software image, are specified in the env.txt file. The original version of the file (which should be edited according to operator's preference) located in images subdirectory of the Operator Utilities directory. Access path to images directory depends on STB model - example for MAG-254:
Some environment variables are described in the Most used variables section.
By default, update and auto-update in the Embedded portal by HTTP perform only to Factory image versions.
In case of building your own image it is recommended:
- Specify URL of your own imageupdate version in the Update_url variable.
- Arrange your own automatic update system and specify appropriate values of the variables autoupdateURL, autoupdate_cond, and betaupdate_cond, guided by the Autoupdate module description section. Otherwise, you must turn off the Autoupdate URL.
In order to improve security and prevent unauthorized changes of variables, it is recommended to check necessary/critical variables during STB software loading (for example portal1, portal2, update_url, autoupdate_cond, etc.). Read more - Checking of variables during STB / portal start.
2. Profile preparation
Image building options are specified in the profile. Profile templates for various STB models, that should be properly edited before image-making, are located in the root of Operator Utilities directory:
For correct work of Operator Utilities, KERNEL_PATH variable should be set to:
Variable
MAG200_OP_KEY must contain a key identifier (ID_key) that will be used to image signing. ID_key should set to:
- STB_PUBLIC - for public image-making. Operator Utilities contain public key;
- Custom-keyID - for custom image-making;
- Operators keyID - for operator image-making.
3. Copying the original kernel image from release into Operator Utilities directory
The original kernel image is located in the release of an appropriate STB model:
- MAG-250/254/270 - the following file is used:
- MAG-256/3xx/4xx - the following file is used:
Pay attention! For MAG322 and MAG324 the same file is used: uImage_mag324.clean.
4. Kernel signing, producing files uImage / Bootstrap, uImzlib_null.img, uImzlib.img
- For MAG-2xx/3xx the following script file is used:
Use for MAG322 and MAG324 models the same file: ./kernel_sign_324.sh
- For MAG-4xx the following script file is used:
./kernel_sign.sh
Command to running the script:
./kernel_sign.sh <STB model> <path to kernel> <profile>
Example for MAG-420:
./kernel_sign.sh mag420 ./mag420/images/uImage_mag420.clean img_make.profile.mag420
5. Imageupdate making
Syntax:
./img_make.sh <version_number> "<description>" <path_to_rootfs> <modelname> <path_to_profile>
Example for MAG254:
./img_make.sh 218 "Test_my_version" ../../254/rootfs-0.2.18r14 MAG254 ./img_make.profile.mag254
Example for MAG256:
./img_make.sh 220 "Test_my_version" ../../256/rootfs-2.20.04 MAG256 ./img_make.profile.mag256
Example for MAG420:
./img_make.sh 220 "Test_my_version" ../../420/rootfs-2.20.02-r5 MAG420 ./img_make.profile.mag420
As a result of successful command execution, the imageupdate file will be created and placed into the directory of Operators Utilities.
Notes on using GPG
To deal with secure keys and creating a digital signature of images the program GPG is used - gnupg.org, GNU Privacy Guard - Wikipedia
For example, to transfer the key from one computer (or virtual machine) to another you can use the following commands:
- to save the secret key in the file opsecbin.KEY:
gpg -o opsecbin.KEY --export-secret-keys ID_Key
- to add this key to the GPG from the file opsecbin.KEY:
gpg --import opsecbin.KEY
- to look through currently available keys:
gpg --list-keys
PublicImage - preparing, making
CustomImage - preparing, making
OperatorImage
Instructions for making and updating the image are provided after agreeing on the procedure for signing the operator's key with the commercial department.