Introduction
This document describes the firmware update of RPI board using FirmwareControl plugin.Plugin can be enabled via controller UI once image is booted. Based on the request given to board, tarred firmware image is downloaded to RPI board from the given HTTP server and the image is updated accordingly.
Environment Setup
The build procedure is as follows:
- repo init -u https://code.rdkcentral.com/r/manifests -m rdkv-asp-nosrc.xml -b thunder-next
- repo sync -j4 --no-clone-bundle
- source meta-cmf-raspberrypi/setup-environment (select option raspberrypi-rdk-hybrid-thunder.conf)
- bitbake rdk-generic-hybrid-thunder-image
Flashing the image
Image is flashed to SD card before inserting to RPI board.
sd-card size requisite It is must to have minimal size of 8GB SD-Card for Firmware upgrade support |
Command to flash the image
Generated image has to be flashed to an SD card using this command in local PC:
$ sudo dd if=<path to ImageName.rpi-sdimg> of=<path to SD card space> bs=4M
Ex: $ sudo dd if=rdk-generic-hybrid-thunder-image_default_20200302130659.rootfs.rpi-sdimg of=/dev/sdc bs=4M 317+0 records in 317+0 records out 1329594368 bytes (1.3 GB, 1.2 GiB) copied, 104.88 s, 12.7 MB/s $ sync |
The SD card is then inserted to the Raspberry Pi board and booted to check for containers created.
The Raspberry Pi board is connected to the PC via a USB to serial converter and the logs can be checked in console or can be connected via HDMI cable to a TV and logs will be shown in the terminal
Test Setup
For testing Firmware Control plugin , we need HTTP server that hosts the tarred image.
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IlotWW9nb21heWEgTWFoYXJhbmEiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiWi1Zb2dvbWF5YSBNYWhhcmFuYSIsImxhbmd1YWdlIjoiZW4iLCJ1aUNvbmZpZyI6Int9IiwiZGlhZ3JhbURpc3BsYXlOYW1lIjoiIiwic0ZpbGVJZCI6IiIsImF0dElkIjoiMTQ0OTAwODYyIiwiZGlhZ3JhbU5hbWUiOiJUZXN0IFNldHVwLmRyYXdpbyIsImFzcGVjdCI6IiIsImxpbmtzIjoiYXV0byIsImNlb05hbWUiOiJSREtWNC4wIEZpcm13YXJlIFVwZ3JhZGUgLSBVc2VyIE1hbnVhbCAtIDIwMjAgLSBNMyIsInRic3R5bGUiOiJ0b3AiLCJjYW5Db21tZW50IjpmYWxzZSwiZGlhZ3JhbVVybCI6IiIsImNzdkZpbGVVcmwiOiIiLCJib3JkZXIiOnRydWUsIm1heFNjYWxlIjoiMSIsIm93bmluZ1BhZ2VJZCI6OTM5MTYxMjcsImVkaXRhYmxlIjpmYWxzZSwiY2VvSWQiOjE1NzMyMTg0NCwicGFnZUlkIjoiIiwibGJveCI6dHJ1ZSwic2VydmVyQ29uZmlnIjp7ImVtYWlscHJldmlldyI6IjEifSwib2RyaXZlSWQiOiIiLCJyZXZpc2lvbiI6MSwibWFjcm9JZCI6ImIyYjg4YzM1LWYyNzMtNDdjNy04OTU1LWRkNTk2NmVmZjNlMiIsInByZXZpZXdOYW1lIjoiVGVzdCBTZXR1cC5kcmF3aW8ucG5nIiwibGljZW5zZVN0YXR1cyI6Ik9LIiwic2VydmljZSI6IiIsImlzVGVtcGxhdGUiOiIiLCJ3aWR0aCI6Im51bGwiLCJzaW1wbGVWaWV3ZXIiOmZhbHNlLCJsYXN0TW9kaWZpZWQiOjE2MTQ2OTQ1NDMwMDAsImV4Y2VlZFBhZ2VXaWR0aCI6ZmFsc2UsIm9DbGllbnRJZCI6IiJ9
Setting up a HTTP server:
For setting up a HTTP server we can use Apache 2.0 or lighttpd. Below are the steps for HTTP server using Apache 2
- Install Apache2 package
- sudo apt update
- sudo apt install apache2
- Check the firewall application profiles
- Modify firewall rules to allow Apache2
- Verify the status
- Verify Apache2 service is running using systemd command
- sudo systemctl status apache2
Server can be connected using http request, http://<ip of device> (ex: http://192.168.2.8)
- Configuration files for Apache2 can be found in /etc/apache2/.
We should place tar file to document root folder for accessing it. Check document root folder mentioned in conf file. This can be found in path /etc/apache2/sites-available/.
Ex: vim /etc/apache2/sites-available/000-default.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> |
---|
Enabling the FirmwareControl Plugin:
FirmwareControl plugin is enabled or disabled via Controller UI. Controller UI is launched using browser via http://<board ip>
Ex: http://192.168.2.20
Upon booting the image, firmwareControl plugin will be disabled
Plugin needs to be enabled before proceeding with firmware update.
RPi - Board :
Eg: sha256sum mediaclient.tar.gz 21dd673fad68fbfd418e7bd9f0f16cb359c5743b4724c9af7347278e3183f2e4 mediaclient.tar.gz |
---|
- During first time execution, firmware update request creates two more partitions in memory(mmcblk0p3, mmcblk0p4) and auto reboots to update partition table. This happens only on the first request, further requests will not result in board reboot before firmware update.
- Once device boots up verify there are 4 partitions in /dev (ex. mmcblk0p1, mmcblk0p2, mmcblk0p3, mmcblk0p4) (use command fdisk -l to verify) .
- Enable FirmwareControl plugin in Metrological UI
- Execute curl request for firmware update for second time.
- Image tar file will be downloaded to a file in /var/lib folder as ImageTemp. Verify image is downloaded to /var/lib
- Reboot RPI board once firmware update process is completed manually using reboot -f command.
- Once board boots up verify the current image version ( cat /version.txt)
- Verify the version of booted image which shows the downloaded image version
Conclusion
Please find the summary on firmware upgrade explained above
Limitations:
- Auto reboot after firmware update is not happening currently. User has to reboot manually after completion of firmware update.
- RPI board will reboot before firmware update only for the first request for updating memory partition table, and user has to give request command once again for firmware update. This occurs only for the first request after board boot up.
TroubleShooting
- Verify /var/lib has enough free space to accommodate the image tar file before initiating the download. This can be done using df -h command.
root@raspberrypi-rdk-hybrid-thunder:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 1.1G 607.4M 443.3M 58% / devtmpfs 300.5M 0 300.5M 0% /dev tmpfs 305.0M 4.0K 305.0M 0% /dev/shm tmpfs 305.0M 8.4M 296.6M 3% /run tmpfs 305.0M 0 305.0M 0% /sys/fs/cgroup tmpfs 305.0M 292.0K 304.7M 0% /tmp tmpfs 305.0M 292.0K 304.7M 0% /etc/snmp/snmpd.conf tmpfs 305.0M 28.0K 305.0M 0% /var/volatile /dev/root 1.1G 607.4M 443.3M 58% /var/lib root@raspberrypi-rdk-hybrid-thunder:~# |
---|