Remotely install new rootfs

Hey all, I’ve got about 100 stock debian BeagleBone Black devices that only have the onboard emmc as memory very far far away from me that I can only ssh into. We recently decided to include Mender into our image. However I am having trouble finding a way to get the Mender image onto those devices.

The first idea I had was using fdisk and create a new partition at the end of the device (keep in mind mmcblk1p1 occupied the whole space), copy a minimal rootfs, boot from there. Then I can copy the first half of the Mender image, reboot into the Mender partition and dd the remaining image. However, that does not work because I cannot reboot. The old partition table or superblocks are interfering with the boot process. Since I can’t unmount, I also can’t update the partition table.

The other idea I had was to somehow get it to boot from the network, but I have no idea on how to begin to do that.

So does anyone have suggestions on how I can remotely upgrade my device’s rootfs with a completely new rootfs (and partitions) using only the onboard 4gb emmc?