In order to facilitate development and product customization, Ruixin micro has defined a set of firmware partitions, and these partition information is stored in parameter Txt file, Firefly defines its own Ubuntu partition with reference to this file, and the file is parameter Ubuntu Txt, stored in Linux_ Under the device/rockchip/rk356x directory of SDK; In addition, a package file named rk356x Ubuntu package file is also used when packaging Ubuntu firmware, which is stored in Linux_ Tools / Linux / Linux of SDK_ Pack_ Firmware / rockdev directory. Now let me lead you to briefly analyze these two documents!
1, Parameter Ubuntu txt
Enter the directory of device/rockchip/rk356x, cat parameter Ubuntu txt:
FIRMWARE_VER: 1.0 MACHINE_MODEL: RK3568 MACHINE_ID: 007 MANUFACTURER: RK3568 MAGIC: 0x5041524B ATAG: 0x00200800 MACHINE: 0xffffffff CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 TYPE: GPT CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00010000@0x00008000(boot),0x00010000@0x00018000(recovery),0x00010000@0x00028000(backup),0x00c00000@0x00038000(rootfs),-@0x00c38000(userdata:grow) uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
The following is an overview from the Ruixin micro document:
- The Rockchip android system platform uses the parameter file to configure some system parameters, such as firmware version, memory partition information, etc. (in fact, android system platform is the same as linux system platform)
- Parameter file is a very important system configuration file. It's best to modify it when you can understand each configuration function, so as to avoid the problem that the system cannot work normally due to abnormal configuration of parameter file.
- The size of the Parameter file is limited. The maximum size cannot exceed 64KB.
parameter-ubuntu. Description of TXT file content:
content | explain |
---|---|
FIRMWARE_VER: 1.0 | Firmware version, package updata IMG will be used, and the upgrade tool will identify the firmware version according to this. |
MACHINE_MODEL: RK3568 | Machine model, packing updata IMG uses different items and can be modified by itself to upgrade the tool display. When upgrading firmware in recovery, it can be used to judge whether the firmware matches. |
MACHINE_ID: 007 | Product development ID, which can be a combination of characters and numbers, packaged updata IMG uses different IDs for different items, which can be used to identify the machine model. When upgrading firmware in recovery, it can be used to judge whether the firmware matches. |
MANUFACTURER: RK3568 | Manufacturer information, package updata IMG can be modified by itself and used to upgrade the tool display. |
MAGIC: 0x5041524B | MAGIC cannot be modified. Some new AP S use DTS. This item is useless. For compatibility, do not delete or modify it. |
ATAG: 0x00200800 | ATAG cannot be modified. Some new AP S use DTS. This item is useless. For compatibility, do not delete or modify it. |
MACHINE: 0xffffffff | It is used for kernel recognition and cannot be modified. This definition matches the kernel. |
CHECK_MASK: 0x80 | Reserved and cannot be modified. |
TYPE: GPT | Specify that the partition defined in the file CMDLINE is used to create GPT and will not be burned into NVM (NAND, EMMC, etc.) memory devices. |
MACHINE: 0xffffffff | It is used for kernel recognition and cannot be modified. This definition matches the kernel. |
CMDLINE | (to be explained later) |
uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9 | Reserved and cannot be modified. |
In addition to CMDLINE, we rarely need to modify these in the list!
The CMDLINE attribute is our focus:
CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00010000@0x00008000(boot),0x00010000@0x00018000(recovery),0x00010000@0x00028000(backup),0x00c00000@0x00038000(rootfs),-@0x00c38000(userdata:grow)
The following is a description extracted from the Ruixin micro document:
- For compatibility, all AP S of RK are identified with rk29xxnand.
- Single partition Description:
For example: 0x00010000@0x00008000(boot), the value before the @ symbol is the partition size, the value after the @ symbol is the starting position of the partition, and the characters in parentheses are the name of the partition. The unit of all values is sector, and one sector is 512Bytes. In the above example, the start position of boot partition is 0x8000 sectors and the size is 0x10000 sectors(32MB). - For performance, the starting address of each partition needs to be aligned with 32KB (64 sectors), and the size also needs an integer multiple of 32KB.
- If the image in spark format is used, the data will be erased during upgrade. For better compatibility, the corresponding partition should be aligned according to 4MB, and the size should also be configured according to 4MB integer multiples.
- When GPT partition is used, the addresses defined in the parameter are all real logical addresses (LBA s). For example, uboot is defined as 0x4000, so when burning into EMMC and NAND, the logical address is also 0x4000. The last partition needs to specify the grow th parameter, and the tool will allocate the remaining space to the last partition.
The following is a description of the functions of each partition of Ubuntu firmware:
- Uboot partition: burn uboot compiled by uboot img.
- Misc partition: burn misc img. Boot detection enters recovery mode.
- Boot partition: burn the boot compiled by kernel IMG contains kernel and device tree information.
- Recovery partition: burn recovery img.
- Backup partition: reserved, temporarily useless. It will be used as the backup of recovery just like android.
- rootfs partition: store ubuntu file system, read-only.
- userdata partition: store files temporarily generated by app or for end users. Read and write, mounted in the / userdata directory.
2, Rk356x Ubuntu package file
Enter tools/linux/Linux_Pack_Firmware/rockdev directory, cat rk356x Ubuntu package file:
# NAME Relative path # #HWDEF HWDEF package-file package-file bootloader Image/MiniLoaderAll.bin parameter Image/parameter.txt uboot Image/uboot.img misc Image/misc.img boot Image/boot.img recovery Image/recovery.img rootfs Image/rootfs.img userdata RESERVED backup RESERVED
It is not difficult to see that this file is used to specify the corresponding relationship between the partition and the packaged image! The following is the Ubuntu firmware log packaged in RK format:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh updateimg processing option: updateimg File name is ROC-RK3568-PC-UBUNTU20.04-GPT Rename the file? [N|y]n Make update.img start to make update.img... Resize rootfs partition size dumpe2fs 1.44.1 (24-Mar-2018) Android Firmware Package Tool v1.66 ------ PACKAGE ------ Add file: ./package-file Add file: ./package-file done,offset=0x800,size=0x11a,userspace=0x1 Add file: ./Image/MiniLoaderAll.bin Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x719c0,userspace=0xe4 Add file: ./Image/parameter.txt Add file: ./Image/parameter.txt done,offset=0x73000,size=0x1d5,userspace=0x1 Add file: ./Image/uboot.img Add file: ./Image/uboot.img done,offset=0x73800,size=0x400000,userspace=0x800 Add file: ./Image/misc.img Add file: ./Image/misc.img done,offset=0x473800,size=0xc000,userspace=0x18 Add file: ./Image/boot.img Add file: ./Image/boot.img done,offset=0x47f800,size=0x1ff4800,userspace=0x3fe9 Add file: ./Image/recovery.img Add file: ./Image/recovery.img done,offset=0x2474000,size=0x1e23800,userspace=0x3c47 Add file: ./Image/rootfs.img Add file: ./Image/rootfs.img done,offset=0x4297800,size=0xa744fc00,userspace=0x14e8a0 Add CRC... Make firmware OK! ------ OK ------ ********RKImageMaker ver 1.66******** Generating new image, please wait... Writing head info... Writing boot file... Writing firmware... Generating MD5 data... MD5 data generated successfully! New image generated successfully! Making ./Image/update.img OK. Make update image ok! /home/neutionwei/project/rk356x_linux_release_20211019/rockdev/pack/ROC-RK3568-PC-UBUNTU20.04-GPT-20211203-2103.img Running build_updateimg succeeded.
3, Attention
Linux released by Firefly_ When SDK packages firmware, the size of rootfs partition will change dynamically according to the actual file size of rootfs, in other words, parameter Ubuntu Txt file 0x00c00000@0x00038000(rootfs),-@0x00c38000(userdata:grow) the specified rootfs partition size of the content and the starting address of the userdata partition will be dynamically modified! This is because the size of partitions occupied by different file systems varies greatly. This operation can avoid partition waste!