How to update bootloader and erase environment

Hello,

Could you please help to find graceful way to update bootloader and its env with mender artifact?

I am using mender Yocto meta layer to assemble artifacts. I don’t have physical access to device and I can not rewrite whole sdcard from PC, but the device connected to mender server.

Sdcard partition looks like:
Device Boot Start End Sectors Size Id Type
test-img.sdimg1 * 49152 81919 32768 16M c W95 FAT32 (LBA)
test-img.sdimg2 81920 409599 327680 160M 83 Linux
test-img.sdimg3 409600 737279 327680 160M 83 Linux
test-img.sdimg4 737280 999423 262144 128M 83 Linux

Uboot.bin is placed on first partition. I understand that updating bootloader is risky but is there any way by using mender artifact from the server?

Hi @Yury,

You can update the bootloader (you already know it is risky), using Update Modules.

https://docs.mender.io/2.0/devices/update-modules

You could use one of the existing modules, e.g

https://hub.mender.io/t/single-file/486/10

Or create your own.

If you are not using 2.0 version of the Mender client you could accomplish this state-scripts,

https://docs.mender.io/2.0/artifacts/state-scripts