Table of contents
Add new partition calculation rules
Partition information unit analysis
The new version adds partitioning methods
Android 11+ adds a tool that can automatically generate parameter.txt and supports compiling parameter.txt
According to configuration parameters. If there is no configuration template file, the tool will find and add the modified parameter.txt file. (If you want to know the calculation rules, please see the following content)
Reference document "Rockchip_Android13_SDK_Developer_Guide_EN.pdf"
FIRMWARE_VER: 11.0 MACHINE_MODEL: rk3568_r MACHINE_ID: 007 MANUFACTURER: rockchip MAGIC: 0x5041524B ATAG: 0x00200800 MACHINE: rk3568_r CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 TYPE: GPT CMDLINE:mtdparts=rk29xxnand:0x00002000@0x00002000(security),0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x00002000@0x00008000(misc),0x00002000@0x0000a000(dtbo),0x00000800@0x0000c000(vbmeta),0x00014000@0x0000c800(boot),0x00030000@0x00020800(recovery),0x000c0000@0x00050800(backup),0x000c0000@0x00110800(cache),0x00008000@0x001d0800(metadata),0x00000800@0x001d8800(baseparameter),0x00614000@0x001d9000(super),-@0x007ed000(userdata:grow)
Firmware information
The following is the firmware information of the Rockchip RK3568 device, including the device model, manufacturer, firmware version, etc.:
FIRMWARE_VER
: The version number of the firmware, the version number here is 11.0.MACHINE_MODEL
: The model of the device. The model here is rk3568_r.MACHINE_ID
: The ID of the device, the ID here is 007.MANUFACTURER
: The manufacturer of the device, the manufacturer here is rockchip.MAGIC
: A special value used to identify the device. The value here is 0x5041524B.ATAG
: A special value used to identify the device. The value here is 0x00200800.MACHINE
: The model of the device. The model here is rk3568_r.CHECK_MASK
: Special value used to check the device, the value here is 0x80.PWR_HLD
: A special value used to control the power of the device. The value here is 0,0,A,0,1.TYPE
: The type of device, the type here is GPT.CMDLINE
: The command line parameters of the device, including various partition information of the device.
Partition information
The following is the partition information of the device, including the name, starting address, offset, size and purpose of the partition:
Partition name |
Partition starting address (sector) |
Partition offset (sector) |
Partition size (sector) |
Partition size (MB) |
Zoning purpose |
security |
0x00002000 |
0x00002000 |
0x00002000 |
4MB |
Used to store security-related information |
uboot |
0x00004000 |
0x00002000 |
0x00002000 |
4MB |
Used to store U-Boot boot loader |
trust |
0x00006000 |
0x00002000 |
0x00002000 |
4MB |
Used to store TrustZone related information |
misc |
0x00008000 |
0x00002000 |
0x00002000 |
4MB |
Used to store various miscellaneous information |
dtbo |
0x0000a000 |
0x00002000 |
0x00002000 |
4MB |
Used to store device tree coverage information |
vbmeta |
0x0000c000 |
0x00002000 |
0x00000800 |
1MB |
Used to store AVB metadata |
boot |
0x0000c800 |
0x00000800 |
0x00014000 |
10MB |
Used to store boot partition |
recovery |
0x00020800 |
0x00014000 |
0x00030000 |
24MB |
Used to store recovery partition |
backup |
0x00050800 |
0x00030000 |
0x000c0000 |
96MB |
Used to store backup partitions |
cache |
0x00110800 |
0x000c0000 |
0x000c0000 |
96MB |
Used to store cache partitions |
metadata |
0x001d0800 |
0x000c0000 |
0x00008000 |
16MB |
Partition used to store metadata |
base parameter |
0x001d8800 |
0x00008000 |
0x00000800 |
1MB |
Used to store basic parameters |
super |
0x001d9000 |
0x00000800 |
0x00614000 |
394MB |
Used to store super partitions |
userdata |
0x007ed000 |
0x00614000 |
- |
- |
Partition used to store user data |
Note: This table is generated based on the CMDLINE parameters provided, the actual partition information may vary depending on the specific configuration of the device. In addition, the size of the "userdata" partition is "-", which means that it will occupy all remaining space.
Partitioning
Each partition has a specific role in the Android system. The following is a brief explanation of each partition:
boot.img
: Contains ramdisk, kernel, and dtb, which are used to start the device and load the core components of the operating system.boot-debug.img
: The difference from boot.img is that user firmware can program this boot.img to perform root privilege operations.dtbo.img
: Device Tree Overlays (device tree overlays), data structures used to describe hardware configuration.config.cfg
: The configuration file of the programming tool can be directly imported into the programming tool to display the options that need to be programmed.MiniLoaderAll.bin
: Contains a first-level loader, used for the startup process of the boot loader.misc.img
: Contains recovery-wipe boot identification information, and recovery operations will be performed after programming.parameter.txt
: Contains partition information and records the partition layout of the device.pcba_small_misc.img
: Contains PCBA boot identification information. After programming, it will enter the simple version of PCBA mode.pcba_whole_misc.img
: Contains PCBA boot identification information. After programming, it will enter the full version of PCBA mode.recovery.img
: Contains recovery-ramdisk, kernel, and dtb, used for repair operations when device problems occur.super.img
: Contains the contents of the odm, product, vendor, system, and system_ext partitions. It is a super partition containing multiple sub-partitions.trust.img
: Contains BL31 and BL32, used to store TrustZone-related information and create a secure environment to run sensitive code and process sensitive data.uboot.img
: Contains uboot firmware, which is a program that runs when the device starts and is responsible for loading the kernel and other important system components.vbmeta.img
: Contains avb verification information, used for the verification mechanism of Android Verified Boot (AVB).update.img
: Contains the above img files that need to be programmed, and can be used to directly program the entire firmware package.security
: Used to store security-related information, such as device encryption keys, etc.cache
: Storage cache partition, used to store temporary data.userdata
: Store user data partition, including user application data, downloaded files, etc.metadata
: Storage metadata partition, used to store system metadata, such as the IMEI number of the device, etc.backup
: Storage backup partition, used to back up important data during system update or recovery.
Add new partition calculation rules
If you want to add a new partition, such as a partition named "odm" with a size of 15MB, you need to first determine the starting address of this partition. This address should be the starting address of the previous partition plus the size of the previous partition. For example, if the previous partition is a "super" partition, then the starting address of the "odm" partition should be 0x007ed000 + 0x00614000 = 0x00df1000.
The size of this partition needs to be converted to sectors. Since 1 sector is equal to 512Bytes, 15MB is equal to 15 * 1024 * 1024 / 512 = 0x0000f000 sector.
This partition can be added to the CMDLINE parameter, like this: 0x0000f000@0x00df1000(odm).
Therefore, the CMDLINE parameters after adding the "odm" partition should be like this:
mtdparts=rk29xxnand:0x00002000@0x00002000(security),0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x00002000@0x00008000(misc),0x00002000@0x0000a000(dtbo),0x00000800@0x0000c000(vbmeta),0x00014000@0x0000c800(boot),0x00030000@0x00020800(recovery),0x000c0000@0x00050800(backup),0x000c0000@0x00110800(cache),0x00008000@0x001d0800(metadata),0x00000800@0x001d8800(baseparameter),0x00614000@0x001d9000(super),0x0000f000@0x00df1000(odm),-@0x00e01000(userdata:grow)
This CMDLINE parameter contains the new "odm" partition, whose starting address is 0x00df1000 and whose size is 0x0000f000 sector (15MB). The starting address of the "userdata" partition has also been moved backward by 0x0000f000 sector accordingly to leave space for the "odm" partition.
Partition information unit analysis
When processing device partition information, you usually encounter two units: sectors and bytes.
Sector
Sector is the smallest storage unit on the device, usually 512 bytes. In the partition information, the partition size and partition offset are expressed in sectors.
byte
A byte is the basic storage unit in a computer, usually represented by B. One sector is equal to 512 bytes, that is to say, one sector can store 512 B of data.
Why use Sector?
Using sectors as units can better align the storage space on the device and improve storage efficiency and performance. If you use bytes as the unit, it may cause a waste of space on the device or read and write errors.
For example, if the size of a partition is 8192 bytes, then it occupies 16 sectors (8192 / 512 = 16). If the size of a partition is 8193 bytes, then it occupies 17 sectors (8193 / 512 = 16.00195), but only one byte of the 17th sector is actually used, and the remaining 511 bytes are wasted. . If the size of a partition is 8191 bytes, then it occupies 16 sectors (8191 / 512 = 15.99805), but one byte of the 16th sector is actually used less, which may cause read and write errors.
Unit conversion
If you want to see partition information in bytes, you can multiply the sector by 512 to convert it to bytes. Likewise, if you want to see partition information in MB (megabytes), you can multiply the sector by 512 / 1024 / 1024 to convert to MB.
For example, if the size of a partition is 0x00002000 sector
, then its size is 0x00002000 * 512 bytes, or 0x00002000 * 512 / 1024 / 1024 MB.