问题描述
我有一个运行在嵌入式Linux设备上的应用程序,并且不时更改软件,有时甚至更改根文件系统,甚至安装的内核.
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.
在当前更新系统中,仅删除旧应用程序目录的内容,并在其上复制新文件.对根文件系统进行更改后,新文件将作为更新的一部分提供,并且只需在旧文件上进行复制即可.
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.
现在,当前方法存在一些问题,我正在寻找改善情况的方法:
Now, there are several problems with the current approach and I am looking for ways to improve the situation:
- 用于创建文件系统映像的目标的根文件系统未版本化(我认为我们甚至没有原始的rootfs).
- 用于更新的rootfs文件是手动选择的(而不是diff)
- 更新持续增长,因此成为皮塔饼.现在,更新/升级之间存在分歧,其中升级包含较大的rootfs更改.
- 我的印象是,如果完全执行更新中的一致性检查,则相当脆弱.
要求是:
- 应用程序更新包不应太大,并且在进行修改的情况下还必须能够更改根文件系统.
- 升级可以更大,并且仅包含进入根文件系统的内容(例如新库,内核等).更新可能需要安装升级.
升级是否可以包含整个根文件系统,并且只需在目标的闪存驱动器上执行dd
? - 创建更新/升级程序包应尽可能自动进行.
- 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.
- 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.
Could the upgrade contain the whole root file system and simply do add
on the flash drive of the target? - Creating the update/upgrade packages should be as automatic as possible.
我绝对需要某种方法来对根文件系统进行版本控制.这必须以某种方式完成,我可以从中计算出某种diff
,该diff
可用于更新目标设备的rootfs.
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 diff
from it which can be used to update the rootfs of the target device.
我已经研究了Subversion,因为我们将Subversion用于源代码,但这不适用于Linux根文件系统(文件许可权,特殊文件等).
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.).
我现在已经创建了一些shell脚本,这些脚本可以为我提供类似于svn diff
的内容,但是我真的很想知道是否已经存在可运行且经过测试的解决方案.
I've now created some shell scripts that can give me something similar to an svn diff
but I would really like to know if there already exists a working and tested solution for this.
使用这样的diff
,我想升级将变成一个包含基于已知根文件系统状态的增量更新的软件包.
Using such diff
's I guess an Upgrade would then simply become a package that contains incremental updates based on a known root file system state.
您对此有何想法?您将如何实施这样的系统?我更喜欢一个可以在不太多的时间内实现的简单解决方案.
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.
推荐答案
我相信您在看问题时错了-任何非原子性的更新(例如dd是文件系统映像,替换目录中的文件)都被破坏设计-如果电源在更新过程中停电,则该系统是固定的;对于嵌入式系统,电源可能会在升级过程中停电.
I believe you are looking wrong at the problem - any update which is non atomic (e.g. dd a file system image, replace files in a directory) is broken by design - if the power goes off in the middle of an update the system is a brick and for embedded system, power can go off in the middle of an upgrade.
我写了一份白皮书,介绍如何正确地在嵌入式Linux系统上进行升级/更新[1].它是在OLS上提出的.您可以在此处找到该论文: https://www. kernel.org/doc/ols/2005/ols2005v1-pages-21-36.pdf
I have written a white paper on how to correctly do upgrade/update on embedded Linux systems [1]. It was presented at OLS. You can find the paper here: https://www.kernel.org/doc/ols/2005/ols2005v1-pages-21-36.pdf
[1]本·约瑟夫,吉拉德. 构建与Murphy兼容的嵌入式Linux系统." Linux座谈会. 2005.
[1] Ben-Yossef, Gilad. "Building Murphy-compatible embedded Linux systems." Linux Symposium. 2005.
这篇关于为嵌入式Linux设备实现更新/升级系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!