rauc / meta-rauc

Yocto/Open Embedded meta layer for RAUC, the embedded Linux update framework
MIT License
164 stars 91 forks source link

classes: bundle: allow skipping bytes from image #248

Closed a3f closed 2 years ago

a3f commented 2 years ago

For most i.MX SoCs, BootROM expects bootloader image to be written into boot media at an offset. While barebox pads the image, so i.MX header starts at that offset, U-Boot doesn't and thus bundle.bbclass supported

    RAUC_SLOT_bootloader[offset] = "32K"

To get U-Boot appropriately padded. Now with the i.MX8M Plus and Nano, the tide turns and the BootROM no longer expects an offset for images installed into eMMC boot partitions. It still expects them for SD and eMMC user area. For U-Boot, this means offset can return to the default of 0, but barebox still has a 32K byte preamble, so images are flashable directly to the start of the SD-Card.

To be able to install barebox into an eMMC boot partition on such systems, we will need to shave off these 32K bytes. Allow doing this with:

    RAUC_SLOT_bootloader[offset] = "-32K"

Positive offsets will be handled as dd seek as before, while negative will lead to seeks in the input file. I find this more intuitive than the seek/skip nomenclature with dd.

a3f commented 2 years ago

Positive offsets will be handled as dd seek as before, while negative will lead to seeks in the input file. I find this more intuitive than the seek/skip nomenclature with dd.

I can also add a new var flag like RAUC_SLOT_bootloader[offset_type] or something if that's preferred.

bith3ad commented 2 years ago

Positive offsets will be handled as dd seek as before, while negative will lead to seeks in the input file. I find this more intuitive than the seek/skip nomenclature with dd.

I can also add a new var flag like RAUC_SLOT_bootloader[offset_type] or something if that's preferred.

That sounds more obvious, so it would be RAUC_SLOT_bootloader[seek] and RAUC_SLOT_bootloader[skip]

a3f commented 2 years ago

I always need to lookup what [seek]/[skip] means. But we could make [offset] an alias for [seek_offset] and add a new [skip_offset].

@ejoerns, What do you prefer?

ejoerns commented 2 years ago

I always need to lookup what [seek]/[skip] means. But we could make [offset] an alias for [seek_offset] and add a new [skip_offset].

@ejoerns, What do you prefer?

I would go the simple way and just support the negative offsets. If that actually turns out to be confusing, we could think about a different wording.

In my brain offset is the position you move the image around the zero point (which is the partition start).

a3f commented 2 years ago

I am still on Kirkstone for the forseeable future. Is it possible to backport this patch?

ejoerns commented 2 years ago

I've cherry-picked this to kirkstone to ease cherry-picking #249