Summary
-
Introduces firmware backup and flashing for set-top boxes using HiSilicon CPU. Connect the set-top box using USB-TTL serial programmer CH340, use Huawei HiSilicon flashing tool HiTool to create and modify partition table files, backup and flash firmware, and upgrade the system through upgrade packages. Install Home Assistant in the Hinas system, access files via FTP, WebDAV, Alist cloud disk, determine the real CPU model and reg name, and methods to speed up flashing.
Background Information
-
Using Home Assistant (abbreviated as HA) requires a personal server, with different home Linux server solutions depending on the situation.
Server Solution Advantages Disadvantages Old Phone Small size, low power consumption, low cost Low performance, limited network Set-Top Box Small size, low power consumption, low cost Low performance, limited network Raspberry Pi Small size, low power consumption High cost, medium performance, limited network Mini PC Small size, medium cost Medium power consumption, medium performance, limited network NAS Medium size, medium cost High power consumption, high performance, limited network Computer/Server High performance High cost, large size, high power consumption, limited network Cloud Server No network restrictions, high performance High cost -
Old phones can be used for simple functional verification, installation is more complex, and issues can easily arise. Currently common solutions include 「termux」, 「termux+proot」, 「Alpine Term+docker」, 「linux deploy (requires root permissions)」. The termux and termux+proot solutions mainly install HA by installing Python. After attempting, installing HA on termux results in dependency errors; termux+proot+debian shows version error prompts when starting HA; Alpine Term+docker can run HA normally after installation, but performance is severely low and laggy.
-
Set-top boxes can be used for simple personal use, with moderate installation difficulty and not prone to issues. Currently common options include 「Armbian」 and 「Hinas System」, primarily installing HA via Docker. 「Hinas System」 mainly supports 「HiSilicon」 chips including 「Hi3798MV100」, 「Hi3798MV200」, 「Hi3798MV300」, and does not support 「Hi3798MV300H」 and other suffix processors. 「Armbian」 mainly supports 「Amlogic」 chips in the 「S9xx」 series.
-
Initially planned to flash the set-top box model
CM211-2
, later found that the CPU model isHi3798MV300H
. Thus changed to flash the modelHG680-j
with CPUHi3798MV100
.
Operational Practice
Prerequisites
-
Software: Huawei HiSilicon flashing tool 「HiTool」, set-top box tool 「Happy TV Assistant」 (optional).
-
Hardware: Computer, USB-TTL serial programmer CH340, USB drive.
-
Firmware Package: Hinas hinas firmware TTL-hi3798mv100-202301.zip
Obtain System Information
-
Connect the set-top box and computer to the network using an Ethernet cable, and connect the set-top box and USB-TTL serial programmer.
-
Open 「HiTool」 and click 「HiBurn」.
-
Set 「PC and Board Configuration」 parameters. Set 「Local PC Configuration」 under 「Serial Port」 and 「Server IP」, and set 「Board Configuration」 under 「IP Address」 and 「Gateway」. 「Serial Port」 is the port number used by the USB-TTL serial programmer (check via: 「Control Panel」 -> 「Device Manager」 -> 「Ports (COM and LPT)」), 「Server IP」 is the computer’s IP address. 「IP Address」 is the set-top box’s IP address, and 「Gateway」 is generally kept default. Choose 「Transmission Method」 as 「Network (Recommended)」.
-
Obtain the CPU model and pin configuration table. Click 「Open Terminal Tool」, then click 「Connect」, and finally power on the set-top box. The startup information contains the pin configuration table, CPU model, memory specifications, PCB layer count, and flash type.
-
View the partition table. For the model
CM211-2
with CPUHi3798MV300H
, the startup information will display partition table information. For the modelHG680-j
with CPUHi3798MV100
, the startup information will not show the partition table, and the commandcat /proc/cmdline
needs to be executed to view the partition table information. -
View the mount information. Execute
mount
command to view all mounted file systems in the system. -
View flash block partitions. For the model
CM211-2
set-top box, executecd /dev/block/platform/soc/by-name
andls -al
commands to view the partition names pointed to by the flash block partitions. For the modelHG680-j
, executecd /dev/block/platform/hi_mci.1/by-name
andls -al
commands to view the partition names pointed to by the flash block partitions. For other set-top boxes, look for theby-name
folder in the subdirectories under/dev/block/platform
. -
View file system information. Execute
df
command to view the size and usage of partitions in the system. -
Based on the usage of partitions in the system, clean up unnecessary information to prepare for data backup. Software uninstallation can use 「Happy TV Assistant」, which can also conveniently obtain partition tables, mount information, file system information, etc.
Create and Modify Partition Table
-
Set chip model. Click 「Chip」 -> 「Switch Chip」 -> 「Hi3798MV100」.
-
Click 「Flash eMMC」, and click the green plus sign on the right side of the table to create a new partition.
-
Click the name item, enter the partition name according to
partition table
, and follow the block order inflash block partition
(frommmcblk0p1
tommcblk0p17
). -
Click the file item and select the file path by clicking the folder icon on the right (appears when selected), then click 「Open」 after entering the file name. It is recommended that the file name be consistent with the partition name.
-
Click the length item and set the corresponding partition size according to
partition table
. -
Click the file system item and select the corresponding partition file system according to
mount information
. This item only affects the speed of flashing. -
Check the checkbox in front of the partition to be operated on.
-
Click
eMMC partition table file
on the right side of 「Browse」, select the file path in the pop-up dialog and click 「Open」, then click 「Save」. It is recommended that the file name contains the CPU model and flash type of the device.
Operate Firmware
Backup Firmware
Method 1: TTL+HiTool
-
Click 「Upload」 in the last step of creating and modifying the partition table.
-
Close the power of the set-top box after the pop-up dialog appears.
-
Turn on the power of the set-top box.
-
Wait for the progress bar in the dialog box to finish.
Method 2: TTL+USB Drive
-
Click 「Open Terminal Tool」, then click 「Connect」, and finally power on the set-top box.
-
Execute
df
command to check the usage of partitions in the system. -
Insert the USB drive (FAT32 format), then execute
df
command to check the usage of partitions in the system, the newly appeared/mnt/sda/sda1
indicates that the USB drive is successfully mounted. -
Execute
cd /dev/block/platform/soc/by-name
andls -al
commands to view the partition names pointed to by the flash block partitions.root@Hi3798MV300:/ # cd /dev/block/platform/soc/by-name root@Hi3798MV300:/dev/block/platform/soc/by-name # ls -al lrwxrwxrwx root root 1970-01-01 08:00 baseparam -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 1970-01-01 08:00 boot -> /dev/block/mmcblk0p9 lrwxrwxrwx root root 1970-01-01 08:00 cache -> /dev/block/mmcblk0p14 lrwxrwxrwx root root 1970-01-01 08:00 fastboot -> /dev/block/mmcblk0p1 lrwxrwxrwx root root 1970-01-01 08:00 fastplay -> /dev/block/mmcblk0p8 lrwxrwxrwx root root 1970-01-01 08:00 logo -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 1970-01-01 08:00 misc -> /dev/block/mmcblk0p10 lrwxrwxrwx root root 1970-01-01 08:00 partition -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 1970-01-01 08:00 pqparam -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 1970-01-01 08:00 recovery -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 1970-01-01 08:00 securestore -> /dev/block/mmcblk0p12 lrwxrwxrwx root root 1970-01-01 08:00 swdb -> /dev/block/mmcblk0p13 lrwxrwxrwx root root 1970-01-01 08:00 swdevinfo -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 1970-01-01 08:00 system -> /dev/block/mmcblk0p15 lrwxrwxrwx root root 1970-01-01 08:00 trustedcore -> /dev/block/mmcblk0p11 lrwxrwxrwx root root 1970-01-01 08:00 userdata -> /dev/block/mmcblk0p16
-
Execute
cd /mnt/sda/sda1
command to switch the current working directory to/mnt/sda/sda1
, and executemkdir FW_BK
command to create a folder namedFW_BK
in the current working directory. -
Use the following
dd
command to backup partitions. For larger partitions, executedd if=/dev/block/platform/soc/by-name/userdata | gzip > /mnt/sda/sda1/FW_BK/userdata.bin.gz
command to compress and then output.dd if=/dev/block/platform/soc/by-name/fastboot of=/mnt/sda/sda1/FW_BK/fastboot.bin dd if=/dev/block/platform/soc/by-name/partition of=/mnt/sda/sda1/FW_BK/partition.bin dd if=/dev/block/platform/soc/by-name/recovery of=/mnt/sda/sda1/FW_BK/recovery.bin dd if=/dev/block/platform/soc/by-name/swdevinfo of=/mnt/sda/sda1/FW_BK/swdevinfo.bin dd if=/dev/block/platform/soc/by-name/baseparam of=/mnt/sda/sda1/FW_BK/baseparam.bin dd if=/dev/block/platform/soc/by-name/pqparam of=/mnt/sda/sda1/FW_BK/pqparam.bin dd if=/dev/block/platform/soc/by-name/logo of=/mnt/sda/sda1/FW_BK/logo.bin dd if=/dev/block/platform/soc/by-name/fastplay of=/mnt/sda/sda1/FW_BK/fastplay.bin dd if=/dev/block/platform/soc/by-name/boot of=/mnt/sda/sda1/FW_BK/boot.bin dd if=/dev/block/platform/soc/by-name/misc of=/mnt/sda/sda1/FW_BK/misc.bin dd if=/dev/block/platform/soc/by-name/trustedcore of=/mnt/sda/sda1/FW_BK/trustedcore.bin dd if=/dev/block/platform/soc/by-name/securestore of=/mnt/sda/sda1/FW_BK/securestore.bin dd if=/dev/block/platform/soc/by-name/swdb of=/mnt/sda/sda1/FW_BK/swdb.bin dd if=/dev/block/platform/soc/by-name/cache of=/mnt/sda/sda1/FW_BK/cache.bin dd if=/dev/block/platform/soc/by-name/system of=/mnt/sda/sda1/FW_BK/system.bin dd if=/dev/block/platform/soc/by-name/userdata of=/mnt/sda/sda1/FW_BK/userdata.bin
Flash Firmware
Method 1: TTL+HiTool
-
Unzip the Hinas system firmware package
TTL-hi3798mv100-202301.zip
. -
Click
eMMC partition table file
on the right side of 「Browse」, select the eMMC partition table file from the Hinas system firmware package, and click 「Open」. -
Check the checkboxes in front of the partitions to be flashed.
-
Click 「Flash」.
-
Close the power of the set-top box after the pop-up dialog appears.
-
Turn on the power of the set-top box.
-
Wait for the flashing progress bar in the dialog box to finish.
Method 2: TTL+USB Drive
-
Click 「Open Terminal Tool」, then click 「Connect」, and finally power on the set-top box.
-
Execute
df
command to check the usage of partitions in the system. -
Insert the USB drive (FAT32 format), then execute
df
command to check the usage of partitions in the system, the newly appeared/mnt/sda/sda1
indicates that the USB drive is successfully mounted. -
Execute
cd /dev/block/platform/soc/by-name
andls -al
commands to view the partition names pointed to by the flash block partitions.root@Hi3798MV300:/ # cd /dev/block/platform/soc/by-name root@Hi3798MV300:/dev/block/platform/soc/by-name # ls -al lrwxrwxrwx root root 1970-01-01 08:00 baseparam -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 1970-01-01 08:00 boot -> /dev/block/mmcblk0p9 lrwxrwxrwx root root 1970-01-01 08:00 cache -> /dev/block/mmcblk0p14 lrwxrwxrwx root root 1970-01-01 08:00 fastboot -> /dev/block/mmcblk0p1 lrwxrwxrwx root root 1970-01-01 08:00 fastplay -> /dev/block/mmcblk0p8 lrwxrwxrwx root root 1970-01-01 08:00 logo -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 1970-01-01 08:00 misc -> /dev/block/mmcblk0p10 lrwxrwxrwx root root 1970-01-01 08:00 partition -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 1970-01-01 08:00 pqparam -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 1970-01-01 08:00 recovery -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 1970-01-01 08:00 securestore -> /dev/block/mmcblk0p12 lrwxrwxrwx root root 1970-01-01 08:00 swdb -> /dev/block/mmcblk0p13 lrwxrwxrwx root root 1970-01-01 08:00 swdevinfo -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 1970-01-01 08:00 system -> /dev/block/mmcblk0p15 lrwxrwxrwx root root 1970-01-01 08:00 trustedcore -> /dev/block/mmcblk0p11 lrwxrwxrwx root root 1970-01-01 08:00 userdata -> /dev/block/mmcblk0p16
-
Use the following
dd
command to flash partitions. The location of the backed-up firmware is theFW_BK
folder. For larger partitions, executegzip -dc /mnt/sda/sda1/FW_BK/userdata.bin.gz | dd of=/dev/block/platform/soc/by-name/userdata
command to decompress and then output.dd if=/mnt/sda/sda1/FW_BK/fastboot.bin of=/dev/block/platform/soc/by-name/fastboot dd if=/mnt/sda/sda1/FW_BK/partition.bin of=/dev/block/platform/soc/by-name/partition dd if=/mnt/sda/sda1/FW_BK/recovery.bin of=/dev/block/platform/soc/by-name/recovery dd if=/mnt/sda/sda1/FW_BK/swdevinfo.bin of=/dev/block/platform/soc/by-name/swdevinfo dd if=/mnt/sda/sda1/FW_BK/baseparam.bin of=/dev/block/platform/soc/by-name/baseparam dd if=/mnt/sda/sda1/FW_BK/pqparam.bin of=/dev/block/platform/soc/by-name/pqparam dd if=/mnt/sda/sda1/FW_BK/logo.bin of=/dev/block/platform/soc/by-name/logo dd if=/mnt/sda/sda1/FW_BK/fastplay.bin of=/dev/block/platform/soc/by-name/fastplay dd if=/mnt/sda/sda1/FW_BK/boot.bin of=/dev/block/platform/soc/by-name/boot dd if=/mnt/sda/sda1/FW_BK/misc.bin of=/dev/block/platform/soc/by-name/misc dd if=/mnt/sda/sda1/FW_BK/trustedcore.bin of=/dev/block/platform/soc/by-name/trustedcore dd if=/mnt/sda/sda1/FW_BK/securestore.bin of=/dev/block/platform/soc/by-name/securestore dd if=/mnt/sda/sda1/FW_BK/swdb.bin of=/dev/block/platform/soc/by-name/swdb dd if=/mnt/sda/sda1/FW_BK/cache.bin of=/dev/block/platform/soc/by-name/cache dd if=/mnt/sda/sda1/FW_BK/system.bin of=/dev/block/platform/soc/by-name/system dd if=/mnt/sda/sda1/FW_BK/userdata.bin of=/dev/block/platform/soc/by-name/userdata
Upgrade Firmware
-
Method 1: Use TTL+HiTool+USB Drive. Flash
recovery
torecovery
, flashemmc
tomisc
, then restart the set-top box to enter recovery mode, and finally selectapply update from external storage
in recovery mode to flash theupdate.zip
package from the USB drive. -
Method 2: Use TTL+USB Drive or ADB+USB Drive. Use
dd
command to outputrecovery
torecovery
,emmc
tomisc
, then executereboot
command to restart into recovery mode, and finally selectapply update from external storage
in recovery mode to flash theupdate.zip
package from the USB drive. -
Method 3: Use ADB or TTL or TTL+HiTool to flash
recovery
and then install the native version of thesettings
software package. Enter the native version of 「Settings」 and select 「Local Upgrade」 to upgrade the system. The upgrade package must be namedupdate.zip
and located in the root directory of the USB drive. The package is generally namedSWProductCheck.apk
, which can be searched in related tutorials for flashing rescue. -
Method 4: Copy
fastboot.bin
,bootargs.bin
, andrecovery.img
files to the root directory of the USB drive. Short-circuit the forced flashing short-circuit point, then turn on the power of the set-top box, wait a few seconds, and then release the short-circuit. The set-top box will loadfastboot.bin
from the USB drive and bootrecovery.img
from the USB drive into recovery mode, and finally selectapply update from external storage
in recovery mode to flash theupdate.zip
package from the USB drive. -
Method 5: Copy
fastboot.bin
,bootargs.bin
, andrecovery.img
files to the root directory of the USB drive. Use ADB or TTL or TTL+HiTool to erase thefastboot.bin
partition. After rebooting, the set-top box will loadfastboot.bin
from the USB drive and bootrecovery.img
from the USB drive into recovery mode, and finally selectapply update from external storage
in recovery mode to flash theupdate.zip
package from the USB drive.
Usage Summary
-
Enter the IP address of the set-top box in the browser to access the Hinas system homepage.
-
Click 「External Network」 on the homepage, then click 「Terminal Management」, the initial username and password are
root
andecoo1234
, and the current system root account password can be modified using thepasswd root
command. -
On the 「Terminal Management」 page, enter
apt install minidlna
to install MiniDLNA software. The system has built-in software installation scripts for basic functions, enter the following commands to automatically install and configure the software. Portainer is a visual container image management tool, Qinglong panel is a task management platform that supports Python3, JavaScript, Shell, Typescript scripts, Home Assistant is an open-source home automation platform developed based on Python 3 that integrates existing smart home ecosystems.install-portainer.sh Install Docker container management panel install-qinglong.sh Install Docker application: Qinglong panel install-homeassistant.sh Install smart home control panel
-
Support document management on the server via FTP or SCP, the initial username and password are
ubuntu
andecoo1234
. SFTP mode’s port 22 can access the root directory, while FTP mode’s port 21 can only access the/home
directory. -
The built-in WebDAV server is on port 8081, with the initial username and password both as
admin
, and the default storage location is/home/ubuntu/webdav
. -
The built-in Alist cloud disk supports multiple storage types and allows web browsing and WebDAV access. The initial username and password are
admin
andadmin123
. -
Executing
recoverbackup
command can restore the backup system, and all data in the root partition will be cleared and overwritten by the original backup system.
Precautions
-
About chip models: The CPU models of the Magic Box CM211-2 include MV100, MV300, MV300H. The actual CPU model is based on the
reg name
containing the CPU model or the chip’s own silk screen. -
About
reg name
: Thereg name
of the firmware to be flashed in the chip’sfastboot
should be consistent with thereg name
in the existingfastboot
of the set-top box in terms of pin configuration table and CPU model; otherwise, thefastboot
cannot be flashed. Thereg name
displayed in the startup information is for reference only; the actual pin configuration table is based on thereg name
in the existingfastboot
of the set-top box. -
About 「HiBurn」 in 「Transmission Method」: Regardless of whether the transmission method is set to serial port or network port, when flashing
fastboot
, the data is actually transmitted via the serial port, which is very slow. -
About 「HiBurn」 in 「File System」: If a file system actually exists but is set to
none
in the software, during the flashing operation, the partition image will be transmitted in binary form; if set to a specific file system likeext3/4
, the partition image will be transmitted in compressed form, meaning the image is compressed before transmission, and then decompressed and written to the partition. Therefore, setting the file system during the flashing operation can reduce the time required for partition image transmission, ultimately speeding up the overall flashing process. For the upload operation, regardless of whether the file system is set in the software, the uploaded partition image is always transmitted in binary form, which does not change the upload speed. -
About compression: The image size of the
userdata
partition will exceed 4GB, surpassing the FAT32 file system limit, so compression is needed. When using thedd
command, deciding whether to compress based on the partition size and usage can effectively save space and transmission time. -
About terminal content being overwritten and lost: Click 「Window」 -> 「Preferences」, click 「Terminal」 and modify the terminal cache line count.
-
About failure to flash and backup firmware using HiTool: Click 「Window」 -> 「Preferences」, then click 「HiBurn」, modify the TFTP settings and command settings. Adjust corresponding parameters based on the error messages in the 「Console」. Sometimes redoing the operation can also restore normalcy.
References
-
HiSilicon Set-Top Box NAS Hinas System User Guide -
Building the Strongest Huawei HiSilicon Hi3798MV100/200/300 Set-Top Box NAS Server System – Huawei Box Forum – ZNDS -
Which TV Box Chip Performance is Stronger? TV Box Transforms into Linux System Install Docker Panel Qinglong Opens Another World of the Box -
【Dog Egg】Build a Family Server, Hardware, Software, Configuration Recommendations【Ten Thousand Words Long Article Continuously Updated】 – Zhihu -
Magic Box CM211-2 Network Set-Top Box Firmware Download Summary and Motherboard Distinction – Evaluation/Image Sharing – Android Flashing Firmware Network【Kirin Flashing Network】 -
Henan Mobile CMCC-2 CH TV Box Hi3798MV310 Line Flashing – Card Flashing – Rescue – Zhihu -
Which Method to Use for Flashing HiSilicon Devices -
HiSilicon Hi3798MV300/300H Universal Unlock Version Recovery – China Mobile Magic Box – ZNDS -
Magic Box CM211-2 Flashing (MV300 Chip) OEM Disassembly TTL Cracking Firmware – Set-Top Box/Smart TV Digital Home -
Beijing CM211-2 Original Rescue Package Flashing Dongbei No Disassembly Tutorial – China Mobile Magic Box – ZNDS
Copyright Statement: This article is original by 「Dream Heart Star」 and is licensed under CC BY-NC-SA 4.0. Please include the original source link and this statement when reprinting.
Blog Garden Address: https://www.cnblogs.com/Sky-seeker WeChat Public Account: Follow the WeChat Public Account for instant push