Skip to content

PenUniverse/RKCfgTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RKCfgTool

This tool allows you to extract the contents from the cfg file generated by RKDevTool, and also allows you to create a cfg file that can be read by it.

Features

  • Cross-platform, open source and free.
  • Completely reliable reading from or writing to cfg file.
  • Convert between cfg files and json files at will.
  • Generate cfg file directly from parameter.txt, support automatic scanning of available image files.
  • Use the command line to manipulate cfg files.

Usage

Usage: rkcfgtool [--help] [--version] --input VAR [--output VAR] [--show] [--enable-auto-scan] [--set-auto-scan-prefix VAR] [--remove-partition VAR]...

Optional arguments:
  -h, --help              shows help message and exits 
  -v, --version           prints version information and exits 
  -i, --input             Import a file. [required]
  -o, --output            Set the output file path (if any). 
  -s, --show              Print the partition table information contained in the cfg file. 
  --enable-auto-scan      When converting  parameter.txt to cfg file, the image file in the current directory will be automatically scanned and applied. 
  --set-auto-scan-prefix  Add a prefix to the results of the automatic image_path scan, will add a slash at the end (if not already there). Example: './Output' [nargs=0..1] [default: ""]
  --remove-partition      Remove all matching partitions from the input. Syntax: '(address|name|image_path|index):..., example: 'name:userdisk'. [may be repeated]

For example, We have the following directory structure:

$ ls
boot.img  MiniLoaderAll.bin  misc.img  parameter.txt  recovery.img  rootfs.img  trust.img  uboot.img

parameter.txt contains the partition table information, which comes from the general format of rockchip and looks like this:

FIRMWARE_VER: 8.1
MACHINE_MODEL: RK3326
MACHINE_ID: 007
MANUFACTURER: XXXX
MAGIC: 0x5041524B
ATAG: 0x00200800
MACHINE: 3326
CHECK_MASK: 0x80
PWR_HLD: 0,0,A,0,1
TYPE: GPT
mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),...,-@0x0123a000(userdisk:grow)
uuid:rootfs=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Now, we can create a cfg file that can be read by RKDevTool directly with the following command:

./rkcfgtool -i parameter.txt -o test.cfg --enable-auto-scan

--enable-auto-scan will automatically scan all files in the same directory as parameter.txt, and fill in the image_path field if the partition name may match a file.

If you need to delete some partition from the result(take userdisk as an example), use the following command:

./rkcfgtool -i parameter.txt -o test.cfg --enable-auto-scan --remove-partition "name:swap" --remove-partition "name:userdisk"

Furthermore, add a prefix to the result path of the automatic scan:

./rkcfgtool -i parameter.txt -o test.cfg --enable-auto-scan --set-auto-scan-prefix "./Output" --remove-partition "name:swap" --remove-partition "name:userdisk"

License

We are not responsible for the actions of users.

Open source under the Apache-2.0 license.

Additional Information

File format is analyzed based on RKDevTool v2.86.
If you ran into problems, please open an issue.