linux-automation / meta-lxatac

Build your own LXA TAC images and bundles
MIT License
5 stars 15 forks source link

emmc-image: remove size workaround #62

Closed rohieb closed 9 months ago

rohieb commented 9 months ago

genimage knows about the 'size' option for images to fill the image to a certain size, and since genimage v14 it supports the 'fill' option to write all zeroes at the end of the image and not cut them off to optimise image size. Use this to blow up the images to the full 2 GiB, and remove our invisible-partition-at-the-end hack.

hnez commented 9 months ago

When building with this patch applied i get:

1) The following info (unrelated to this PR, but this would be a great opportunity to fix it as well):

    INFO: hdimage(emmc-image-lxatac-20231010135745.img): The option 'gpt' is deprecated.
    Use 'partition-table-type' instead

2) The following error:

    ERROR: hdimage(emmc-image-lxatac-20231010135745.img): partition [GPT backup]
    (offset 0x7fffbe00, size 0x4200) overlaps previous partition root-a (offset 0x200000, size 0x80000000)

I did not yet look into the cause of the error, so I'll leave this as a reminder to look into it.

rohieb commented 9 months ago

When building with this patch applied i get:

1. The following info (unrelated to this PR, but this would be a great opportunity to fix it as well):
   ```
    INFO: hdimage(emmc-image-lxatac-20231010135745.img): The option 'gpt' is deprecated.
    Use 'partition-table-type' instead
   ```

Ah yes, I've included a fix for this warning too.

2. The following error:
   ```
    ERROR: hdimage(emmc-image-lxatac-20231010135745.img): partition [GPT backup]
    (offset 0x7fffbe00, size 0x4200) overlaps previous partition root-a (offset 0x200000, size 0x80000000)
   ```

I should have forseen that – the 2048 MiB root partition no longer fits into the 2 GiB image when there is a GPT primary header (with protective MBR) at the start and a GPT backup header at the end of the image, and a 1 MiB reserved partition. I've now also decreased the rootfs size to 2045 MiB so it fits again.

jluebbe commented 9 months ago

Isn't a rootfs-a size of 2045MiB inconsistent with https://github.com/linux-automation/meta-lxatac/blob/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart/files/repart.d/50-root-a.conf? Does this trigger a resize of the active rootfs partition on first boot?

I'd expect the image to be extended so that a 2GiB rootfs fits.

rohieb commented 9 months ago

Hmmm, as that file should only be used for matching the root partition, we could even remove the SizeMinBytes and SizeMaxBytes settings, so systemd-repart does not touch the first root partition. Type and Label should be enough for matching it.