Skip navigation

Additional information may be taken from - Operator guide. IPTV MAG-200 High resolution device.

Examples are provided on base: OS - Ubuntu 16.04 server, DHCP - isc-dhcp-server, TFTP Server - Openbsd-inetd TFTP, STB MAG-322

https://help.ubuntu.com/community/isc-dhcp-server

TFTP server. Installation, setup

Example of installing and configuring TFTP server for downloading and updating software by TFTP for MAG322

  • Itstall TFTP server (if it was not installed before) :
apt-get install openbsd-inetd tftp tftpd
  • By default TFTP server  is configured to use the directory /srv/tftp. if necessary, change its value in /etc/inetd.conf
  Example: /etc/inetd.conf
#:BOOT: TFTP service is provided primarily for booting.  Most sites
#       run this only on machines acting as "boot servers."
tftp		dgram	udp	wait	nobody	/usr/sbin/tcpd	/usr/sbin/in.tftpd /srv/tftp
  • Create directory /srv/tftp/stb/322 and put the necessary files in it: Bootstrapimageupdatelogo.bmp.gzOP.KEY.

Where:
Bootstrap - OS Kernel (it is provided with STB software release);
imageupdate - STB software image (as a rool it is created by operator);
logo.bmp.gz - Bootloader Logotype (as a rool it is created by operator);
OP.KEY - Operator gpg key (public part).

  • Assign the ownership of created directory to the pseudo-user nobody:
chown -R nobody /srv/tftp/stb/322
  • Restart inetd service:
/etc/init.d/openbsd-inetd restart

TFTP server functionality check up

If the TFTP client runs on a local server, specify the IP address 127.0.0.1. If the client runs on a remote server, specify the IP address of the server.

echo test > /srv/tftp/stb/322/myfile
cd /home
tftp 127.0.0.1
tftp> get stb/322/myfile

DHCP server isc-dhcp-server. Installation, setup

sudo apt-get install isc-dhcp-server
  • DHCP server global (default) Configuration File is  /etc/default/isc-dhcp-server

In this file, you must specify the interface on which the DHCP server should act. In this example, the name of the network interface is enp1s6

  Example: /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#	Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#	Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="enp1s6"
  • DHCP Server Configuration File is /etc/dhcp/dhcpd.conf
  Example: dhcpd.conf
default-lease-time 600;
	max-lease-time 7200;
	ping-check false;


subnet 10.1.1.0 netmask 255.255.255.0 {
	range 10.1.1.10 10.1.1.254;
	option routers 10.1.1.1;
	option domain-name-servers 10.1.1.1;
	option ntp-servers 10.1.1.1;
	next-server 10.1.1.1;
	}	


##################   Option Space Infomir ###################
	option space Infomir;
	option Infomir.autostart        code 1 = text;
	option Infomir.bootargs         code 2 = text;
	option Infomir.mcip             code 3 = ip-address;
	option Infomir.mcport           code 4 = integer 16;
	option Infomir.oppubfile        code 9 = text;
	option Infomir.mcip_img         code 10 = ip-address;
	option Infomir.mcport_img       code 11 = integer 16;
	option Infomir.mcip_mng         code 12 = ip-address;
	option Infomir.mcport_mng       code 13 = integer 16;
	option Infomir.ip_log           code 14 = ip-address;
	option Infomir.port_log         code 15 = integer 16;
	option Infomir.logo_x           code 16 = integer 16;
	option Infomir.logo_y           code 17 = integer 16;
	option Infomir.bg_color         code 18 = integer 32;
	option Infomir.fg_color         code 19 = integer 32;
	option Infomir.VerNumber        code 20 = text;
	option Infomir.DateTime         code 21 = text;
	option Infomir.portal_dhcp      code 22 = text;
	option Infomir.timezone         code 23 = text;
	option Infomir.update_url       code 24 = text;
	option Infomir.update_sboot     code 25 = text;
	option Infomir.update_ver       code 26 = text;
	option Infomir.update_mode      code 27 = text;
	option Infomir.update_sboot_ver	code 28 = text;
	option Infomir.nc_ip        	code 30 = ip-address;
	option Infomir.nc_port      	code 31 = integer 16;
	option Infomir.syslog_srv   	code 32 = text;

#############   MAG 322   #################################
class "MAG322_boot" {
	match if (( option vendor-class-identifier="InfomirMAG322boot"));
    filename "stb/322/2.20.07-a6/Bootstrap";
    next-server 10.1.1.1;
    option ntp-servers 10.1.1.1;
    vendor-option-space Infomir;
    }
class "MAG322_vendor" {
    match if (( option vendor-class-identifier="InfomirMAG322"));
	next-server 10.1.1.1;
    option ntp-servers 10.1.1.1;
    vendor-option-space Infomir;
	option Infomir.portal_dhcp "http://10.1.1.1/stalker_portal/c/index.html";
    option Infomir.update_ver "220";
	option Infomir.update_url "tftp://10.1.1.1/stb/322/2.20.07-a6/imageupdate";
	}
class "MAG322_upgrade" {
    match if (( option vendor-class-identifier="InfomirMAG322upgrade"));
	next-server 10.1.1.1;
    option ntp-servers 10.1.1.1;
    vendor-option-space Infomir;
    option Infomir.update_url "tftp://10.1.1.1/stb/322/2.20.07-a6/imageupdate";
    }
class "MAG322_upglogo" {
    match if (( option vendor-class-identifier="InfomirMAG322upglogo"));
    next-server 10.1.1.1;
    option ntp-servers 10.1.1.1;
    vendor-option-space Infomir;
    filename "stb/322/logo.bmp.gz";
    option Infomir.oppubfile "stb/322/OP.KEY";
    }

Option Space

To exchange "vendor-specific" information between the server and the client (STB), DHCP option # 43 is used. To describe the manufacturer's information, STB uses "option space Infomir". The list of possible options:

option space Infomir;
option Infomir.autostart         code 1 = text;
option Infomir.bootargs          code 2 = text;
option Infomir.mcip              code 3 = ip-address;
option Infomir.mcport            code 4 = integer 16;
option Infomir.oppubfile         code 9 = text;
option Infomir.mcip_img          code 10 = ip-address;
option Infomir.mcport_img        code 11 = integer 16;
option Infomir.mcip_mng          code 12 = ip-address;
option Infomir.mcport_mng        code 13 = integer 16;
option Infomir.ip_log            code 14 = ip-address;
option Infomir.port_log          code 15 = integer 16;
option Infomir.logo_x            code 16 = integer 16;
option Infomir.logo_y            code 17 = integer 16;
option Infomir.bg_color          code 18 = integer 32;
option Infomir.fg_color          code 19 = integer 32;
option Infomir.VerNumber         code 20 = text;
option Infomir.DateTime          code 21 = text;
option Infomir.portal_dhcp       code 22 = text;
option Infomir.timezone          code 23 = text;
option Infomir.update_url        code 24 = text;
option Infomir.update_sboot      code 25 = text;
option Infomir.update_ver        code 26 = text;
option Infomir.update_mode       code 27 = text;
option Infomir.update_sboot_ver  code 28 = text;

Description of vendor-specific options

Name Code Type Description Who use
mcip 3 ip-address IP address of multicast group for kernel/Bootstrap receiving Boolloader
mcport 4 integer 16 Port of multicast group for kernel/Bootstrap receiving Boolloader
oppubfile 9 text Contains the file name, in which prepared operator's key for installation Bootstrap
mcip_img 10 ip-address IP address of multicast group for imageupdate receiving Bootstrap
mcport_img 11 integer 16 Port of multicast group for imageupdate receiving Bootstrap
mcip_mng 12 ip-address IP address of multicast group for commands receiving Firmware
mcport_mng 13 integer 16 Port of multicast grop for commands receiving Firmware
ip_log 14 ip-address IP address of server, on which Bootstrap can send reports Bootstrap
port_log 15 integer 16 Port of server, on which Bootstrap can send reports Bootstrap
logo_x 16 integer 16 Coordinates by x, left-top corner of logo Boolloader
logo_y 17 integer 16 Coordinates by y, left-top corner of logo Boolloader
bg_color 18 integer 32 Background color in “XRGB” format for messages while loading Boolloader
fg_color 19 integer 32 Fonts color “XRGB” format for messages while loading Boolloader
VerNumber 20 text Bootstrap version 3 digits with leading zero. Example: substring( option vendor-encapsulated-options,2,3)=“002” Dhcp-сервер
DateTime 21 text Date and time of Bootstrap creation Dhcp-сервер
portal_dhcp 22 text Starting portal, if there is no variables in “portal1” and “portal2” & variable ”use_portal_dhcp” doesn't set or has value “true”. If the variable “use_portal_dhcp” is set to ”false”, then it will not used Dhcp-сервер
timezone 23 text Timezone value that is passed to STB to set the variable timezone_conf.
update_url 24 text URL (location) of imageupdate file (to update STB software). Example: "tftp: //10.1.1.1/322/imageupdate"
update_sboot 25 text URL of Bootloader image that used for update.
update_ver 26 text Version number of STB software update (imageupdate) file. If the number of the current image (used in STB) and transmitted for update coincides, then the update is not performed.
update_mode 27 text URL of Bootstrap image. Example: "tftp: //10.1.1.1/254/Bootstrap".
update_sboot_ver 28 text Bootloader version that used for update.

Loading OS kernel (Bootstrap / uImage) via TFTP on Emergency mode

Example of the contents of the section "MAG322_boot":

class "MAG322_boot" {
   match if (( option vendor-class-identifier="InfomirMAG322boot"));
   filename "stb/322/Bootstrap";
   next-server 10.1.1.1;
   option ntp-servers 10.1.1.1;
   vendor-option-space Infomir;
   }

Note. Emergency Recovering with Service button MAG322/324/349/351

Updating software (imageupdate) from System Recovery Utility menu

Example of section "MAG322_upgrade" contents:

class "MAG322_upgrade" {
  match if (( option vendor-class-identifier="InfomirMAG322upgrade"));
  next-server 10.1.1.1;
  option ntp-servers 10.1.1.1;
  vendor-option-space Infomir;
  option Infomir.update_url "tftp://10.1.1.1/stb/322/imageupdate";
  }

Note. Selecting software update mode on System Recovery Utility MAG-3xx

After update completing: 1) bootloader variables Image_Version, Image_Date and Image_Desc are set, according to the updated version parameters; 2) NAND boot mode is set; 3) STB is restarted.

Automatic software update via TFTP when STB starting in DHCP

Example of section "MAG322_vendor" contents:

class "MAG322_vendor" {
  match if (( option vendor-class-identifier="InfomirMAG322"));
  next-server 10.1.1.1;
  option ntp-servers 10.1.1.1;
  vendor-option-space Infomir;
  option Infomir.portal_dhcp "http://10.1.1.1/stalker_portal/c/index.html";
  option Infomir.update_ver "220";
  option Infomir.update_url "tftp://10.1.1.1/stb/322/imageupdate";
  }

After the successful update: 1) bootloader variables Image_Version, Image_Date and Image_Desc are set, according to the updated version parameters; 2) NAND boot mode is set; 3) STB is restarted.

Also in this class ("MAG322_vendor"), can be transfered external portal address from which the portal must be loaded on STB. External portal will be loaded in case if the variables portal1 and portal2 are not set and the variable use_portal_dhcp is not set or it has the value " true". If use_portal_dhcp variable is set to "false", then the value of the Infomir.portal_dhcp option is not used.


Bootloader variables value can be viewed in Device Information section of System Recovery Utility menu, as well as with the fw_printenv utility.

Message Exchange via DHCP protocol

Consider an example of exchanging DHCP-protocol messages between STB and server in case of using the class "MAG322_upgrade" in dhcpd.conf according to example.

The following network parameters are used in the example:

  • MAC address of the network interface (Ethernet) of the set-top box - 0: 1a: 79: 51: 8: 98
  • MAC address of the network interface (Ethernet) of the server - 0: 30: 48: fd: 9e: 5f
  • IP-address, which is assigned to the STB by the server - 10.1.1.26
  • IP address of the server is 10.1.1.1

STB sends dhcp-request with the following parameters (only certain parameters are specified):

  • IP: 0.0.0.0 (0:1a:79:51:8:98) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
  • OP: 1 (BOOTPREQUEST)
  • CHADDR: 00:1a:79:51:08:98:00:00:00:00:00:00:00:00:00:00
  • Option 53 DHCP message type: 1 (DHCPDISCOVER)

  • Option 61 Client identifier 0:1a:79:51:8:98
  • Option 55 Parameter Request List: 1 (Subnet mask), 3 (Routers), 6 (DNS server), 12 (Host name), 15 (Domain name), 28 (Broadcast address), 42 (NTP servers), 43 (Vendor specific info)

  • Option 60 Vendor class identifier: InfomirMAG322upgrade

The server receives and analyzes request from STB and then sends a dhcp-response with the following parameters (only certain parameters are specified):

  • IP: 10.1.1.1 (0:30:48:fd:9e:5f) > 10.1.1.26 (0:1a:79:51:8:98)
  • OP: 2 (BOOTPREPLY)
  • YIADDR: 10.1.1.26
  • SIADDR: 10.1.1.1
  • CHADDR: 00:1a:79:51:08:98:00:00:00:00:00:00:00:00:00:00
  • OPTION 53 (1) DHCP message type: 2 (DHCPOFFER)

  • OPTION: 54 ( 4) Server identifier 10.1.1.1
  • OPTION: 51 ( 4) IP address leasetime 600 (10m)
  • OPTION: 1 ( 4) Subnet mask 255.255.255.0
  • OPTION: 3 ( 4) Routers 10.233.0.104
  • OPTION: 6 ( 8) DNS server 8.8.8.8,8.8.4.4
  • OPTION: 28 ( 4) Broadcast address 10.1.1.255
  • OPTION: 42 ( 4) NTP servers 10.1.1.1
  • Option 43 Vendor specific info: tftp://10.1.1.1/stb/322/2.20.07-a6/imageupdate

After receiving settings from DHCP server, STB connects to TFTP server and gets the imageupdate file by the path specified in these settings. The screen displays messages about the stage of the updating procedure:

Starting update from DHCP
Receive is starting tftp://10.1.1.1/stb/322/2.20.07-a6/imageupdate
Wrighting image to flash///
Checking signature,
etc.

Setting operator's logotype and key

class "MAG322_upglogo" {
  match if (( option vendor-class-identifier="InfomirMAG322upglogo"));
  next-server 10.1.1.1;
  option ntp-servers 10.1.1.1;
  vendor-option-space Infomir;
  filename "stb/322/logo.bmp.gz";
  option Infomir.oppubfile "stb/322/OP.KEY";
  }
NoteLogo Bootloader
Need Help

Dave is an expert on the MAG STB and the author of this article.

Was this article helpful?

Yes No

Sorry to hear that.
How can we improve this article?

We use cookies in order to optimise our website, provide you with the best possible user experience and help us promote our products. Please read our Cookie Policy to find out how we use cookies and how you can control cookies.
By using this website or closing this message, you acknowledge our Privacy Policy and agree to our use of cookies as described in our Cookie Policy.