RK Series Development Boards - Customized File System Partition Sizes

Document classification: □ Top secret □ Secret □ Internal information ■ Open

Overview

This article describes the methods for using the partition table of Forlinx’s RK series products, including modifying partition sizes, adding new partitions, deleting partitions, etc.

Revision History

Date

Manual Version

Revision History

31/10/2025

V1.0

Initial Version

Requirements Background

In the current source code, the root directory has a fixed size, and the remaining space is automatically allocated to the userdata partition. To meet the needs, such as allocating all the memory to the root directory and adding custom partitions, a comprehensive method for modifying the partition table is uniformly provided to facilitate you to make adjustments according to your own requirements.

1. Explanation of the Partition Table

  • Taking the 3562 partitions as an example:

forlinx@ubuntu:~/work/OK3562-linux-source$ vi device/forlinx/.chips/ok3562/parameter-buildroot-fit.txt
[……]
CMDLINE: mtdparts=:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),0x00c00000@0x00078000(rootfs),0x00040000@0x00c78000(oem),0x00002000@0x00cb8000(amp),-@0x00cba000(userdata:grow)
[……]

@ On the left is the partition size, and on the right is the start address in emmc:

Partition Name

Initial Address

Partition size:

uboot

0x00004000

0x00002000

misc

0x00006000

0x00002000

boot

0x00008000

0x00020000

recovery

0x00028000

0x00040000

backup

0x00068000

0x00010000

rootfs

0x00078000

0x00c00000

oem

0x00c78000

0x00040000

amp

0x00CB8000

0x00002000

userdata

0x00CBA000

Remaining total

Taking the first two partitions as an example, the starting address of the uboot partition is 0x00004000, and the partition size is 0x00002000. Therefore, the starting address of the second partition, misc, is the starting address of the uboot partition plus its partition size: 0x00004000 + 0x00002000 = 0x00006000.

The partition size in the partition table is in hexadecimal format, while the partition size displayed on the development board after actual flashing is in decimal format, so corresponding conversion is required.

2. Modification of the Partition Table

Note: Write “:grow” in the parentheses of the last partition!

2.1 Fix the size of the userdata partition and allocate all the remaining space to the root partition

In the current partition table, the order is rootfs, oem, amp, and userdata. Since userdata is the last partition, all the remaining space will be allocated to it. If you want to allocate the remaining space to the rootfs, you can move the rootfs to the end.

Here, taking the example of fixing the userdata partition to 2G and moving the rootfs to the end:

[……]
CMDLINE: mtdparts=:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),0x00040000@0x00078000(oem),0x00002000@0x000b8000(amp),0x00200000@0x000ba000(userdata),-@0x002ba000(rootfs:grow)
[……]

After modifying and saving the partition table, perform a full compilation:

forlinx@ubuntu: ~/work/OK3562-linux-source$ ./build.sh all

Flash the device using the update.img image generated by the compilation.

2.2 Add a new partition

Here, taking the example of adding a test partition in 3562. By default, the test partition is placed before the userdata partition:

[……]
// 添加test分区: 0x00100000@0x00cba000(test),修改userdata分区: -@0x00dba000(userdata:grow)
CMDLINE: mtdparts=:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),0x00c00000@0x00078000(rootfs),0x00040000@0x00c78000(oem),0x00002000@0x00cb8000(amp),0x00100000@0x00cba000(test),-@0x00dba000(userdata:grow)
[……]

After modifying and saving the partition table, perform a full compilation:

forlinx@ubuntu: ~/work/OK3562-linux-source$ ./build.sh all

Flash the device using the update.img image generated by the compilation.

2.3 Delete the oem and userdata partitions

If you need to delete the last few partitions, in addition to modifying the partition table, you also need to modify the contents of the rootfs image.

  1. Modify the partition table to delete the last few partitions:

[……]
CMDLINE: mtdparts=:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),-@0x00078000(rootfs:grow)
[……]

After modifying and saving the partition table, perform a full compilation:

forlinx@ubuntu: ~/work/OK3562-linux-source$ ./build.sh all
  1. Mount and modify the contents of the rootfs.img:

forlinx@ubuntu:~/work/OK3562-linux-source$ cd rockdev
forlinx@ubuntu:~/work/OK3562-linux-source/rockdev$ mkdir rootfs
forlinx@ubuntu:~/work/OK3562-linux-source/rockdev$ sudo mount board-rootfs.ext4 rootfs
[sudo] forlinx password: forlinx			// Enter the password, no display
forlinx@ubuntu:~/work/OK3562-linux-source/rockdev$ sudo vi rootfs/etc/fstab 
block out:
PARTLABEL=oem   /oem    ext4    defaults        0 2
PARTLABEL=userdata      /userdata       ext4    defaults        0 2

forlinx@ubuntu:~/work/OK3562-linux-source/rockdev$ sudo umount rootfs
forlinx@ubuntu:~/work/OK3562-linux-source/rockdev$ rm -rf rootfs/
  1. Repackage the image to generate update.img:

forlinx@ubuntu: ~/work/OK3562-linux-source$ ./build.sh updateimg

Verify after flashing with the newly generated image.