Page 1 of 1
Adding new partition to spi-nand image
Posted: 2025-04-30 11:00
by 14Og
Hi! I want to create a system image for spi-nand with ubifs where my rootfs partition will be read-only. However, i need a little amount of rw space inside my filesystem. Is it possible to create a dedicated physical partition on a nand flash for that purpose? I can certainly remount nand partitions in /etc/fstab, but i'm not sure that new partition creation is that straightforward. I wonder, is adding new partition to .BoardConfig.mk file enough?
Re: Adding new partition to spi-nand image
Posted: 2025-05-06 4:05
by Crocodile
Hello, you can refer to the board level support file for the FASTBOOT suffix under project/cfg/BoardConfig_IPC, the RK_PARTITION_CMD_IN_ENV and RK_PARTITION_FS_TYPE_CFG configuration, set the rootfs partition to read-only erofs format, and set userdata to read-write ubifs format
Re: Adding new partition to spi-nand image
Posted: 2025-05-20 12:04
by 14Og
Thank you!
UPD: I changed following line in my BoardConfig:
Code: Select all
export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@erofs,oem@/oem@erofs,userdata@/userdata@ubifs
Unfortunately the image i build after that doesn't boot and i have kernel panic
In uboot environment i have this boot args:
Code: Select all
sys_bootargs= ubi.mtd=6 ubi.block=0,rootfs root=/dev/ubiblock0_0 rootfstype=erofs rk_dma_heap_cma=24M
Is there anything that i can do to make it work? Thanks in advance!
Re: Adding new partition to spi-nand image
Posted: 2025-05-23 9:04
by Crocodile
You can start by looking at the bootarg. The partition information part of the bootarg is composed of env.img. The construction of env.img can be parsed by the build_env running steps in $SDK/project/build.sh. For more information, you need to develop it yourself. We do not have suggestions for changing the file system and the help we can provide is limited.
Re: Adding new partition to spi-nand image
Posted: 2025-05-24 8:34
by 14Og
Ok, got you. Will try to fix it by myself and share with you if something will work out!
Re: Adding new partition to spi-nand image
Posted: 2025-05-24 15:18
by 14Og
I think i'll be fine with rootfs of ubifs and userdata of ubifs. I can remount my rootfs to read-only during boot. However, in spi nand image, it does not mount ubi5_0 block to /userdata successfully. I use your official image and during boot, when S20linkmount tries to mount ubi5_0 as /userdata it can't do that:
So my mount output has no /userdata mounted and in /userdata i only have one file ethaddr.txt. It's weird, how can i properly mount this partition to use it how i want? Thanks in advance.
Re: Adding new partition to spi-nand image
Posted: 2025-05-27 6:13
by Crocodile
We have not actually tested your development content. From the phenomenon, if the userdata is not successfully mounted, then /userdata is an ordinary directory existing in the rootfs (this needs to be determined using the mount command). The ethaddr.txt is created by the startup script RkLunch.sh, but for a read-only rootfs, creating new files is prohibited. Therefore, you need to determine whether /userdata has been mounted or its read-write permissions have been changed.
In summary, our SDK and the provided startup script are based on a RW system. A read-only system cannot ensure that they can be used. We cannot provide assistance and you need to develop and research by yourself.
Re: Adding new partition to spi-nand image
Posted: 2025-05-27 8:16
by 14Og
It turned out that the issue was in my nand flash that was increased to 512MB. It's related to PEB blocks allocation of ubiattach. Increasing /userdata partition size in board config solved the issue and now i can remount rootfs and oem as read-only and use /userdata as my only rw region. Thanks for your assistance anyways!