title: Implementing an update/upgrade system for embedded Linux devices
body: <p>I have an application that runs on an embedded Linux device and every now and then changes are made to the software and occasionally also to the root file system or even the installed kernel.</p>
  
  <p>In the current update system the contents of the old application directory are simply deleted and the new files are copied over it. When changes to the root file system have been made the new files are delivered as part of the update and simply copied over the old ones.</p>
  
  <p>Now, there are several problems with the current approach and I am looking for ways to improve the situation:</p>
  
  <ul>
  <li>The root file system of the target that is used to create file system images is not versioned (I don't think we even have the original rootfs).</li>
  <li>The rootfs files that go into the update are manually selected (instead of a diff)</li>
  <li>The update continually grows and that becomes a pita. There is now a split between update/upgrade where the upgrade contains larger rootfs changes.</li>
  <li>I have the impression that the consistency checks in an update are rather fragile if at all implemented.</li>
  </ul>
  
  <p>Requirements are:</p>
  
  <ul>
  <li>The application update package should not be too large and it must also be able to change the root file system in the case modifications have been made.</li>
  <li>An upgrade can be much larger and only contains the stuff that goes into the root file system (like new libraries, kernel, etc.). An update can require an upgrade to have been installed.<br>
  Could the upgrade contain the whole root file system and simply do a <code>dd</code> on the flash drive of the target?</li>
  <li>Creating the update/upgrade packages should be as automatic as possible.</li>
  </ul>
  
  <p>I absolutely need some way to do versioning of the root file system. This has to be done in a way, that I can compute some sort of <code>diff</code> from it which can be used to update the rootfs of the target device. </p>
  
  <p>I already looked into Subversion since we use that for our source code but that is inappropriate for the Linux root file system (file permissions, special files, etc.).</p>
  
  <p>I've now created some shell scripts that can give me something similar to an <code>svn diff</code> but I would really like to know if there already exists a working and tested solution for this.</p>
  
  <p>Using such <code>diff</code>'s I guess an Upgrade would then simply become a package that contains incremental updates based on a known root file system state.</p>
  
  <p>What are your thoughts and ideas on this? How would you implement such a system? I prefer a simple solution that can be implemented in not too much time.</p>