7.1. Microserver Customized Software Package
Adaptation Scenarios
Processors: BM1684 BM1684X BM1688 CV186AH
SDK Versions:
BM1688 & CV186AH v1.3 and later versions (adapted to the packaging function and packaging and bag making function)
84&X v3.0.0 and previous versions (adapted to the packaging function)
84&X v3.0.0 and later versions (adapted to the packaging function and packaging and bag making function)
Environmental Requirements:
External Storage:
The storage partition format should be ext4 to prevent packaging failure due to special partition restrictions.
The packaging function requires external storage to be at least 1.5 times the total amount of emmc currently in use.
The packaging and bag making function requires external storage to be at least 2.5 times the total amount of emmc currently in use.
Device Requirements:
The packaging function requires an Ubuntu 18/20 X86 host in addition to the packaging device.
The packaging and bag making function only requires a device for packaging and bag making.
7.1.1. Function 1: Packaging and Bag Making Function
This function is used in the same way on the 84&X and 1688/CV186x platforms.
Use the following command to download the tools required for packaging.
pip3 install dfss --upgrade
python3 -m dfss --dflag=socbak
The downloaded file is a socbak.zip file.
Insert the external storage into the target device and perform the following operations.
sudo su
cd /
mkdir socrepack
# This step requires the user to select the mount device path based on their external storage; however, the target path must be set to /socrepack.
mount /dev/sda1 /socrepack
chmod 777 /socrepack
cd /socrepack
Then transfer the previously downloaded socbak.zip to the /socrepack directory.
Execute the following command to package.
unzip socbak.zip
cd socbak
export SOC_BAK_ALL_IN_ONE=1
bash socbak.sh
Wait for a while.
After successful execution, the following files will be generated.
root@sophon:/socrepack/socbak# tree -L 1
.
├── binTools
├── output
├── script
├── socbak.sh
├── socbak_log.log
└── socbak_md5.txt
3 directories, 3 files
The socbak_log.log file is the execution information record, and the flash package is in the output/sdcard/ path.
7.1.2. Function 2: Packaging Only Function
84&X v3.0.0 and later, BM1688/CV186AH V1.3 and later versions
Use the following command to download the tools required for packaging.
pip3 install dfss --upgrade
python3 -m dfss --dflag=socbak
The downloaded file is a socbak.zip file
Insert the external storage into the target device and perform the following operations.
sudo su
cd /
mkdir socrepack
# This step requires the user to select the mount device path based on their external storage. Please note that the target path must be /socrepack.
mount /dev/sda1 /socrepack
chmod 777 /socrepack
cd /socrepack
Then transfer the previously downloaded socbak.zip to the /socrepack directory
Execute the following command to package.
unzip socbak.zip
cd socbak
bash socBak.sh
Wait for a while
After successful execution, the following files will be generated (this is an example, the actual files generated may be more).
root@sophon:/socrepack/socbak# tree -L 1.
.
├── binTools
├── boot.tgz
├── data.tgz
├── fip.bin
├── partition32G.xml
├── recovery.tgz
├── rootfs.tgz
├── script
├── socbak.sh
├── socbak_log.log
└── socbak_md5.txt
2 directories, 9 files
Use the document “SOC Mode Cross-compilation Docker Environment” at https://developer.sophgo.com/thread/682.html to set up the correct cross-compilation docker environment.
Download the repackaging files. Note: This step is different for BM1688 & CV186AH and 84&X.
7.1.2.1. BM1688 & CV186AH
BM1688 & CV186AH require the following files to be downloaded:
Create a directory named “pack”, and then extract the original firmware package into this directory.
cd to the same directory as the “depack.sh” file, and then execute the “./depack.sh” script to unpack it.
The generated partition compressed packages will be generated in the “update” directory. At this time, copy all the files generated by “socbak” to this directory.
After the modification is completed, cd to the same directory as the “enpack.sh” file, and then execute the “./enpack.sh sdcard” or “./enpack.sh tftp” command to package it.
The generated new firmware package is in the “update/sdcard” and “update/tftp” directories.
7.1.2.2. BM1684 & BM1684X
The files that need to be downloaded for BM1684 & BM1684X are as follows:
bootloader-arm64 : Source code on GitHub, needs to be manually cloned
sdcard.tgz : The original card flashing package for the microserver.
Create an install directory in the same directory as bootloader-arm64, and create a soc_bm1684 directory under the install directory; move sdcard.tgz to the install/soc_bm1684 path.
The final directory structure is as follows
├── bootloader-arm64
└── install
└── soc_bm1684
└── sdcard.tgz
cd to the same directory as bootloader-arm64
Execute the following command
source bootloader-arm64/scripts/envsetup.sh
revert_package
The unpacking result will be in the install/soc_bm1684 path, and its directory structure is as follows
└── soc_bm1684
├── boot.tgz
├── package_update
├── rootfs.tgz
├── sdcard.tgz
├── spi_flash_bm1684.bin
├── data.tgz
├── opt.tgz
├── recovery.tgz
├── rootfs_rw.tgz
├── spi_flash.bin
└── spi_flash_bm1684x.bin
Replace the generated files with the same name on the microserver to the install/soc_bm1684 directory.
Replace the generated partition32G.xml on the microserver to the bootloader-arm64/scripts/ directory.
Use the build_update sdcard command to update the flashing package, and the customized flashing package is located in the install/soc_bm1684/sdcard directory.