[英]Linux-Based Firmware, how to implement a good way to update?
I'm developing a linux-based appliance using an alix 2d13. 我正在使用alix 2d13开发基于linux的设备。
I've developed a script that takes care of creating an image file, creating the partitions, installing the boot loader (syslinux), the kernel and the initrd and, that takes care to put root filesystem files into the right partition. 我开发了一个脚本,负责创建映像文件,创建分区,安装引导加载程序(syslinux),内核和initrd,并注意将根文件系统文件放入正确的分区。
Configuration files are on tmpfs filesystem and gets created on system startup by a software that reads an XML file that resides on an own partition. 配置文件位于tmpfs文件系统上,并在系统启动时由读取驻留在自己分区上的XML文件的软件创建。
I'm looking a way to update the filesystem and i've considered two solutions: 我正在寻找一种更新文件系统的方法,我考虑过两种解决方案:
Every solution has its own advantages: - a filesystem image will let me to delete any unused files but needs a lot of time and it will kill the compact flash memory fastly; 每个解决方案都有自己的优势: - 文件系统映像将允许我删除任何未使用的文件但需要大量时间,它会快速杀死紧凑型闪存; - an archive is smaller, needs less time for update, but i'll have the caos on the root filesystem in short time.
- 存档较小,需要较少的更新时间,但我会在短时间内对根文件系统产生问题。
An alternative solution could be to put a file list and to put a pre/post update script into the tar archive, so any file that doesn't reside into the file list will be deleted. 另一种解决方案可能是放置文件列表并将前/后更新脚本放入tar存档中,因此任何不驻留在文件列表中的文件都将被删除。
What do you think? 你怎么看?
I used the following approach. 我使用了以下方法。 It was somewhat based on the paper "Building Murphy-compatible embedded Linux systems," available here .
这是有点根据的论文“构建墨菲兼容的嵌入式Linux系统”,可在这里 。 I used the versions.conf stuff described in that paper, not the cfgsh stuff.
我使用了那篇文章中描述的versions.conf东西,而不是cfgsh的东西。
You can have a seperate partition for update(Say Side1/Side2). 您可以有一个单独的分区进行更新(Say Side1 / Side2)。 The existing kernel,rootfs is in Side1, then put the update in Side2 and switch.
现有的内核,rootfs在Side1中,然后将更新放在Side2中并切换。 By this you can reduce wear leveling and increase the life but the device gets costlier.
通过这种方式,您可以减少磨损均衡并延长使用寿命,但设备成本更高。
You can quick format the partitions before extracting the tar files. 您可以在提取tar文件之前快速格式化分区。 Or go with the image solution but use the smallest possible image and after dd do a filesystem resize (although that is not necessary for readonly storage)
或者使用图像解决方案,但使用尽可能小的图像,并在dd后重新调整文件系统(尽管这对于只读存储不是必需的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.