[Meta-mender] Add new partition

apologies, i keep forgetting that there’s no read only anonymous access to mender issue tracker.
Below is the issue info:

“we should allow extra wic partition lines to be specified and appended to the mender dynamically generated wic file. Possibly another mender variable that contains extras lines to be appended. Lines will need to be parsed for --fixed-size and --size parameters so that the mender a/b rootfs size calculation can adjust accordingly”

1 Like

keep forgetting that there’s no read only anonymous access to mender issue tracker

There is read-only anonymous access,

https://tracker.mender.io/browse/MEN-2362

The problem was that you had a “?filter=2”, appended to the URL which seems to require an account to view.

Thanks Mirzak :grinning:

apologies, i took the filter off of the label but not off of the url itself. it should work now

Actually, there is, it’s the link that contains a filter value which is
not permitted. The bug itself is public. This is the correct link:
https://tracker.mender.io/browse/MEN-2362

Yes a variable with the size and the / app for example.
Is it warned to be able to update other partition than A / B? If I take an example on rauc with we can update a specific slot

its early stages at the moment, just kicking around ideas.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

@drewmoseley

@dellgreen Can you provide the logical steps for the same to replicate this behaviour on mender-convert?

I have been trying to use mender-convert and add an extra partition which was exceeding the maximum number (4) of primary partitions allowed on MBR partition table. So, I forcefully tried to create an extended partition and then add the extra partition along with the data partition as a logical partition.

I am getting an Error, “Error: The location 7176190 is outside of the device /mender-convert/output/image.sdimg.”*

What am I doing wrong here?

Below is the link to the patch file that came out of the commits I made locally, the log file and output of fdisk -u -l image.img. The branch used was 1.2.x in mender-convert

patch file
log file
fdisk.out

Thanks in advance

Add support for GPT partition tables

@drewmoseley I think if the above one is introduced then the Problem can be resolved for adding extra partitions for mender-convert

@dellgreen looking forward to your reply

I’ll have to defer this one, as i have no experience with mender-convert, and the yocto work i was doing on this has been shelved for now as other priorities have taken over.

I will do give a try to Yocto as I have some experience but mender-convert seemed convenient enough.
Will it be possible for you @dellgreen to guide me through this? The goal is to add an extra partition but currently the total number of partitions exceed 4 and MBR is limited to 4 primary partitions.

Is there any other way?

Hi,

Is this issue resolved? How do I add a new partition outside of /data ?
I am tasked to create additional two partitions:

mmcblk1p1 = rootfs A
mmcblk1p2 = rootfs B
mmcblk1p3 = data
mmcblk1p4 = factorydata
mmcblk1p5 = userdata

Please help. Thank you!

Yes, use the MENDER_EXTRA_PARTS variable.

Hi,

This is what I did but nothing happens. I did not see any directories under /mnt

# Extra partitions to create after the data partition
MENDER_EXTRA_PARTS = "factorydata userdata"
#
# Size (in MB) of specified extra partition
MENDER_EXTRA_PARTS_SIZES_MB[factorydata] = "512"
MENDER_EXTRA_PARTS_SIZES_MB[userdata] = "2048"
#
# FSTAB options of specified extra partition (optional)
MENDER_EXTRA_PARTS_FSTAB[factorydata] = "auto,defaults,nofail,0,0"
MENDER_EXTRA_PARTS_FSTAB[userdata] = "auto,defaults,nofail,0,0"

Which meta-mender branch are you using? This first appeared in zeus, I believe.

Also, I discovered that the documentation is slightly wrong. It should be specified like this.

Hi @kacf ,

I am using zues branch.

I changed the fstab options to:

MENDER_EXTRA_PARTS_FSTAB[factorydata] = "auto defaults,nofail 0 0"
MENDER_EXTRA_PARTS_FSTAB[userdata] = "auto defaults,nofail 0 0"

still, I can’t see any additional partitions.

In that case I think you will have to do some manual debugging and find out why this doesn’t expand correctly (the function itself is in mender-helpers.bbclass).

Hi,

I was able to successfully create a partition but seems like I can’t create a folder or put any files on it.

# Extra partitions to create after the data parition
MENDER_EXTRA_PARTS = "part1"
MENDER_EXTRA_PARTS[part1] = "--label=hero-secc --fstype=ext4 --fixed-size=2048"
#
# Size (in MB) of specified extra partition
MENDER_EXTRA_PARTS_SIZES_MB[part1] = "2048"
#
# FSTAB options of specified extra partition (optional)
MENDER_EXTRA_PARTS_FSTAB[part1] = "auto defaults 0 2"

This is how I create folder on it:

SRC_URI += " file://config.json \
             file://productionData.json \
"

FILES_${PN} = "/data/hero-secc/factorydata \
               /mnt/hero-secc/userdata \		        
"

do_install() {
	install -d -m 755 ${D}/data/hero-secc/factorydata
	install -m 755 ${WORKDIR}/productionData.json ${D}/data/hero-secc/factorydata

	install -d -m 755 ${D}/mnt/hero-secc/userdata
	install -m 755 ${WORKDIR}/config.json ${D}/mnt/hero-secc/userdata
}

This is the fstab:

root@hero-secc:/data/hero-secc/factorydata# cd
# stock fstab - you probably want to override this with a machine specific one

/dev/root            /                    auto       ro,ro           1  0
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,stri
ctatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0

/dev/mmcblk1p3       /data                auto       defaults              0  2
/dev/mmcblk1p4       /mnt/hero-secc       auto       defaults              0  2

Please advise. Thank you!

I think this is not supported yet, actually. There are two things that would need to be implemented for this to work:

  1. The mount paths for the partitions in MENDER_EXTRA_PARTS need to be added to IMAGE_ROOTFS_EXCLUDE_PATH. This makes sure that any files added to these folders are not included in the root filesystem.
  2. In the get_extra_parts_wks function, it needs to take into account that it should reference those folders. I don’t recall the exact syntax off the top of my head, but it’s something like --rootfs=${IMAGE_ROOTFS}/mnt/hero-secc. The last hero-secc part should be extracted from MENDER_EXTRA_PARTS, ideally, and not be hard coded. This makes sure that the folder do get included in the extra partitions’ filesystems.

You can either hardcode those things locally, or even better if you can make it generic and submit a pull request!

1 Like