0

I have embedded device with Linux (stored in EMMC). When i need to update Linux image (i have one .img file) i need to connect via serial terminal, edit boot_targets to start system from SD-card and then rewrite EMMC from host via dd command. But what if i have device in another city and i can only use remote SSH to connect to it.

How can I update new Linux image then ?

I tried to make copy of existing fs to tmpfs, but get stuck at porting existing fs to tmpfs...

2 Answers 2

1

…only use remote SSH to connect to it.
How can I update new Linux image then ?

You're basically close. You need:

  1. a system that's able to talk SSH, and
  2. doesn't depend on the data partitions being in workable state.

The classical embeddded solution to this is having a place where you can prepare the new system, then reboot to use that.

You can approach this different ways; one way is to "simply" have A/B booting, i.e. two different root partitions. One that your Linux currently works from, the "active" one. An update is then just replacing the content of the partition that's not currently in use (the "passive" one), then telling the bootloader to boot from the other one in the future, then rebooting, thus swapping the roles of "active" and "passive" partition. (Or LVM volume, or anything else, Linux bootloaders can be quite flexible there.)

There's ready-made solutions for this, or you can script this together yourself. There's things that are meant to scale this principle up to whole device fleets, like https://mender.io, which allows you to select which devices to update, doing updates in waves (so that if an unexpected problem occurs, you're not bricking all devices at once).

Other ways encompass things like update capsules, where you boot into a specific, smaller system that updates the one root partition you have – that can save a lot of space if updates are rarely full-image updates but mostly differences applied to the last image.

The more modern approach for larger internet-connected devices would be image-based OSes. You define overlays containing the files your update affects (including things like the kernel and system services as well as their configuration), roll out these to the embedded device(s) simply by running a command on them that fetches the overlay from your server, and the device switches over to these. If things failed, you simply remove the overlay, making it look as if nothing happened, and if things are good, you consolidate the overlay and save space by only having one version of the directory tree stored on the device. In the Fedora ecosystem, the framework for that is rpm-ostree, and for embedded devices, you'd use the Fedora IoT distro ported to your device.

-1

I suggest that you try to script what you are usually doing. Copy files (one of them may be the script itself) to the device and then run a script on the device which does what you would do manually otherwise.

When you have managed to do that then all you have to do is

  • copy the files with scp/sftp instead of over the serial port
  • call the script via SSH
2
  • this doesn't really address the problem: when they were doing the flashing via serial line, the data on the eMMC was not used to run the operating system that was being replaced. In the SSH case, you're recommending to overwrite the root partition with new data while it's in use. that won't work. Commented Jan 30 at 22:56
  • @MarcusMüller No, I am not. Commented Jan 31 at 0:12

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.