Where to set rootfs size?

I've recently realized that we don't have set any image-/kernel-size limit for NBG7815.

define Device/zyxel_nbg7815
	$(call Device/FitImage)
	$(call Device/EmmcImage)
	DEVICE_VENDOR := ZYXEL
	DEVICE_MODEL := NBG7815
	DEVICE_DTS_CONFIG := config@nbg7815
	SOC := ipq8074
	DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci \
		kmod-bluetooth kmod-hwmon-tmp103
endef
TARGET_DEVICES += zyxel_nbg7815

For kernel we can set:

KERNEL_SIZE := 6144k for 6 MiB.

I saw.

Rootfs does not get a size as far as I can see for any device. But there is an image size for some devices. I don't know the exact meaning/calculation of IMAGE_SIZE := nor if it can be used like I think of using it. Basically kernel size + rootfs size. Is this correct?

We have 60 MiB for rootfs => 66*1024

IMAGE_SIZE := 67584

We also do not have set any Blocksize for emmc. Is 512 an usual size for this sort of devices (like for any emmc card)?

The rootfs is set in the the device's specific dts file.

EDIT: You should probably take note of this https://github.com/openwrt/openwrt/blob/main/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts#L92-L101

1 Like

Thx for helping.

This device has two flash chips. One 8MB SPI NOR and one 4GB EMMC. While the device' config resides on the SPI (sbl, art, etc.) rootfs and kernel resides on the emmc. Emmc is not defined within DTS file. Bootloader/zloader is pointing to emmc.

The rootfs size I'm asking is the rootfs size packaged for the resulting sysupgrade image. I should have been more precise here. Sorry.

Right, sorry. According to the wiki it's layed out like this:

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34           16417   8.0 MiB     FFFF  rootfs_data
   2           16418           18465   1024.0 KiB  FFFF  header
   3           18466           30753   6.0 MiB     FFFF  0:HLOS
   4           30754          153633   60.0 MiB    FFFF  rootfs
   5          153634          161825   4.0 MiB     FFFF  0:WIFIFW
   6          161826          163873   1024.0 KiB  FFFF  header_1
   7          163874          176161   6.0 MiB     FFFF  0:HLOS_1
   8          176162          299041   60.0 MiB    FFFF  rootfs_1
   9          299042          307233   4.0 MiB     FFFF  0:WIFIFW_1
  10          307234         1355809   512.0 MiB   FFFF  nbg
  11         1355810         7122977   2.8 GiB     FFFF  appdata

I can't find any reference for these in the OpenWrt codebase, are you sure OpenWrt doesn't use them as is from stock without any change to the eMMC partitions?

1 Like

I'm pretty sure that OpenWrt does not reference anything regarding the imagesize for this device. I've recently tested samba v4.22. The resulting sysupgrade image was ~95MB. I've flashed it to the device blindly ofc. I've got no warning about the size or anything red coloured (what usually appears in those situations). The device didn't come up again ofc. I had to use tftp. I could have used one of my units with resized rootfs ... but my bad.

So I would like to fix it and create a PR if I have the correct setup.

Check the note in the DTS re partitions.

1 Like

I think, but don't quote me on this, that you need to define the eMMC partitions in the dts file. This way sysupgrade knows where the readonly image partition ends.

1 Like

So do I understand it right that there is a workaround in place to get the device booted correctly (refereing to the "note"). So emmc is recognized by the kernel during boot only. And if I connect the dots with that what @Cthulhu88 wrote here. This would mean that we cannot define a rootfs size within the DTS. So no fix for this.

Thanks for clarifying this.

You can (assuming the note only applies to the NOR chip), but that would be a different partition table than stock, which means going back to stock firmware wouldn't be as trivial.

1 Like

O. K. now I have the picture here. Why it was/is done in this way.

I do not mark any solution because its parted over several answers. The topic is short anyway.

Thx @Cthulhu88 and @anomeome.