Motorola Mobility Confidential Restricted.

Boot IP-STB with HTTP

Note! KreaTV HTTP boot were introduced with KreaTV Firmware version 3.03.
Only parts of HTTP 1.1 specification are implemented, only simple non escaped URLs can be used and server redirect with code 301, 302 and 303 are supported.

KreaTV HTTP boot is a two step download mechanism where the first step is always an HTTP GET from HTTP server, the second step can be all protocols except from SAP, i.e. TFTP, Infocast, Local Storage or HTTP.

The HTTP server address and port is configured via DHCP (VIP19xx DHCP options), KreaTV Firmware menu or production parameters.

Downloading the meta data file in the first step is done by requesting a page from the server's root using the bootcast id, i.e. for VIP1903 the request will be http://www.example.com/motorola-vip1903.

For making the HTTP boot more dynamic and configurable on the server side, the requests to the HTTP server will add product (i.e., bootcastid), serial number, firmware version, software version and splash version as parameters to the request, i.e. http://www.example.com/motorola-vip1903?product=motorola-vip1903&serial=1931690851&fw_version=3.03&kernel_version=1.0&splash_version=1.0.

In the second step the KreaTV HTTP boot will start to download the splash and boot image with the protocols specified in the meta data file, see "Types of URLs in Stb Config" below for protocol syntax and "Stb Config meta data file example" for a meta data file example.

For HTTP protocol in the second step it has the same limitations as the first step and the parameters is also added to the request for making this step scriptable on the server side.

Version handling

The version tags KernelVersion and SplashVersion are used to determine if a software update is required. Some devices store the boot image and boot splash image in flash memory. If a version tag changes, the device will discard the version stored in flash and download the newer version from the network next time it boots.

The boot splash image itself does not contain version information and the version tag SplashVersion can be set arbitrarily. It is stored together with the boot splash image in flash memory.

For devices running KreaTV Firmware DBL 3.x

On devices running KreaTV Firmware DBL version 3.x such as VIP1903, VIP1963 and VIP1002 the boot image version tag KernelVersion is an arbitrary text string and does not have to match the actual boot image version stored in the boot image binary. This version is separately stored in flash memory.

For devices running KreaTV Firmware DBL 4.x

On devices running KreaTV Firmware DBL version 4.0 or later such as VIP2853, VIP1103 and VIP1113 the boot image version tag KernelVersion must match the one stored in the boot image binary. The boot image version is chosen when a boot image binary is built. A boot image is built using the build_boot_image command. The boot image version is specified using the --info version parameter. The command boot_image_version can be used to retrieve the version of a boot image.

StbConfig

Stb Config DTD

<!ELEMENT StbConfig (BootParams)>
<!ELEMENT BootParams (KernelUrl, KernelVersion?, SplashUrl, SplashVersion?)>
<!ELEMENT KernelUrl (#PCDATA)>
<!ELEMENT KernelVersion (#PCDATA)>
<!ELEMENT SplashUrl (#PCDATA)>
<!ELEMENT SplashVersion (#PCDATA)>

Types of URLs in Stb Config

[] = Required
<> = Optional

Infocast: infocast://[multicast group]<:port>/[object name]
TFTP    : tftp://[server ip]<:port>/[path/to/file]
Local   : local://
HTTP    : http://[server name or ip]<:port>/[path/to/file]

Stb Config meta data file example

Create the following motorola-vip1903 file in your WWW/html/ folder and change the Kernel and Splash URLs according to "Types of URLs in Stb Config".

<?xml version="1.0"?>
<!DOCTYPE StbConfig SYSTEM "stbconfig.dtd">
<StbConfig>
  <BootParams>
    <KernelUrl>http://download.motorola.com/bootimage</KernelUrl>
    <KernelVersion>1.0</KernelVersion>
    <SplashUrl>http://download.motorola.com/splashimage</SplashUrl>
    <SplashVersion>1.0</SplashVersion>
  </BootParams>
</StbConfig>

Example Apache2 configurations

Simple internal redirect using mod_rewrite

Make sure that AllowOverride All is set in the Apache configuration file and restart the server.

Create the following .htaccess file in your WWW root folder.

RewriteEngine on
RewriteRule   ^motorola-vip(.*)$ cgi-bin/stbconfig [L]

Simple external redirect using mod_rewrite

Make sure that AllowOverride All is set in the Apache configuration file and restart the server.

Create the following .htaccess file in your WWW root folder.

RewriteEngine on
RewriteRule   ^motorola-vip1903$ http://www.example2.com/cgi-bin/stbconfig [R]

Example CGI script

Create the following file, stbconfig, in you cgi-bin folder, remember to make the file executable.

#!/usr/bin/python

import os
import traceback

def generate_stbconfig(server, image, splash):
    out = """<?xml version="1.0"?>
<!DOCTYPE StbConfig SYSTEM "stbconfig.dtd">
<StbConfig>
  <BootParams>
    <KernelUrl>%s/%s</KernelUrl>
    <KernelVersion>1.0</KernelVersion>
    <SplashUrl>%s/%s</SplashUrl>
    <SplashVersion>1.0</SplashVersion>
  </BootParams>
</StbConfig>
"""
    return out % (server, image, server, splash)

def parse_qs(qs):
    d = {}
    for item in qs.split('&'):
        name, value = item.split('=')
        if name in d:
            d[name].append(value)
        else:
            d[name] = [value]
    return d

serial_db = {'1931690851' : 'kreatv-bi-special_1903.bin'}
product_db = {'motorola-vip1903' : ('kreatv-bi-default_1903.bin',
                                    'splash-1903.bmp')}
output = ''
try:
    http_server = 'http://%s' % os.getenv('SERVER_ADDR')
    parameters = parse_qs(os.getenv('QUERY_STRING'))

    default_bi, splash = product_db[parameters['product'][0]]
    image = serial_db.get(parameters['serial'][0],
                          default_bi)
    output += generate_stbconfig(http_server,
                                 image,
                                 splash)
    output = 'Content-type: text/xml\n\n' + output
except Exception, e:
    output = 'Status: 500 Internal Server Error\n'
    output += 'Content-type: text/html\n\n'
    output += '<html><body>HTTP/1.1 500 Internal Server Error\n'
    output += '<br>%s</body></html>' % traceback.format_exc()

print output