Power & Source of Big Ideas

EMMC with two rootfs partitions

Moderators: chensy, FATechsupport

Hi!

I'm trying to create two rootfs partitions on my nanopi neo4 emmc.
My starting point is this instruction: https://github.com/friendlyarm/sd-fuse_ ... lasher-rom.
It shows how to prepare SD card for flashing emmc, however I couldn't find out how to customize the build of the image to achieve what I need. Have tried experimenting with parameter.txt file which seems to describe layout of partitions on EMMC (mtdparts parameter), but without success.
When emmc is flashed according to the instruction, it has 7 or 8 raw partitions (idbloader, uboot, trust, kernel, rootfs etc). But I also did not find a way to to update these partitions afterwards.
Does anybody know how to make two rootfs on emmc? I guess, bootloader needs to be somehow updated too so it can boot with either of the two?
For those who might be interested, I've managed to create two rootfs partitions. Here's an instruction:
1. Start with instruction for building sd-to-emmc card: https://github.com/friendlyarm/sd-fuse_rk3399
2. Put into friendlycore-arm folder the parameter.txt file and remove mentioning of data partition from it, so that CMDLINE lists only 7 partitions. This appears to prevent from creating overlay fs which we don't need.
3. Create eflasher sd according to the instruction, flash emmc with it and then boot from emmc.
4. Partition table appears to be written at block 0x2000 of emmc. It can be modified in the following way:
i) Take parameter.txt file as a basis.
ii) Update it by adding more partitions in mtdparts parameter (e.g. second rootfs partition)
iii) Edit file in hex mode and add 8 bytes at the beginning: 4 bytes header "PARM" and 4 bytes length of following data (in little endian encoding). Then add 4 bytes rockchip CRC at the end (also little endian). This CRC is calculated according to the following algorithm: https://github.com/neo-technologies/roc ... er/rkcrc.h.
5. dd the resulting parameter.img file into emmc at affset 0x2000 (=8192):

Code: Select all

dd if=parameter.img of=/dev/mmcblk1 seek=8192 count=2

6. Reboot. Kernel will be started with the new cmdline and lsblk will now show your new partitions. What remains is to create a filesystem on it with mkfs.ext4 tool. Or in my case I just cloned mmcblk1p7 into mmcblk1p8 with dd.

Who is online

In total there are 34 users online :: 0 registered, 0 hidden and 34 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 34 guests