In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about the embedded Linux system flash partition design and file system format selection example analysis, the editor feels very practical, so share with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.
Embedded system applications are upgraded frequently, which requires a reasonable division of flash. In general, the basic partition of flash has these parts:
1.uboot partition
2.kernel partition
3.rootfs partition
These three parts are the most basic and generally have.
If the application is partitioned in this way, and then the application is put together with the file system, it will be troublesome to upgrade the application, because the application is put with the file system, and the file system will be re-erased and written each time, which is a waste of time and high risk. If the flash is being erased or the power is suddenly cut off while writing to the image file. It will cause the device to fail to boot (file system corruption)! You also have to re-download the file system from uboot, which brings a lot of trouble to the upgrade.
In embedded system design, the file system is generally separated from the frequently updated applications and placed in different flash partitions, so that when upgrading, only the application partition needs to be erased and re-erased, so that even if the power is cut off during the upgrade process, it will not lead to damage to the file system, and the system can still be started. You can put the upgrade program with the file system so that the device can be upgraded after the device is rebooted.
Another approach is to implement upgrades in Uboot, which does not avoid problems caused by power outages, but the most important thing is that applications cannot be put together with the file system.
There is also someone in flash to do a "safe mode" partition, if the system is damaged, resulting in the device can not start normally, then you can boot from safe mode, safe mode only provides the most basic functions, such as: upgrade, network, etc., these basic functions can help you redo the system.
This is also similar to windows's win PE.
In short, updating the application by upgrading the entire file system is the least desirable approach.
Here are several common file system formats for embedded systems:
In fact, we all know the format of the embedded root file system, such as jffs2,cramfs,ramdisk, yaffs and so on.
Their respective characteristics will not be introduced in detail, Baidu, Google said in great detail.
Here I would like to talk about some problems and doubts when I was studying.
1.flash partition format
At first, I always thought that the partition of flash should correspond to a format. I was very confused about this. I was asked what format is your root file system.
Do not know how to answer, later found that this flash partition is no specific format, you download what format of the file system, it is not like the windows C disk, D disk as there are FAT32 format, NTFS format, windows these formats are also the format after the format, this formatting process is equivalent to the disk installed with a basic file system.
two。 File system format
The file system format here refers to the jffs2, cramfs and so on mentioned above. These file system formats need to be supported by the kernel, which is generally supported by configuring the kernel. Select the relevant options in the kernel.
A brief introduction to the collocation of production.
When the file system is stable, when the product is ready to be released and officially put into the system and application, the file system is generally made in the form of ramdisk. The purpose of this is to prevent the embedded device from being unable to boot due to the damage of the file system caused by bad external conditions. Ramdisk reads and decompresses the file system image from flash to run in memory after the system is booted, so changes made to the file system while the device is running will be restored after the device is rebooted. Cramfs is a read-only file system, so why didn't you choose cramfs as the root file system format for the device? Compared with ramdisk, cramfs file system does have its advantages: it does not extract all of it to memory, but decompresses most of it as much as it uses. For embedded devices, this is very memory-saving, but it will also cause the device to run faster than ramdisk. The disadvantage is that no files can be created under cramfs, and during the normal operation of the program, it is inevitable to rebuild some temporary files (for example: Unix domain sockets, a file will be created in the specified directory), so I think it is better to use ramdisk.
Cramfs format is not completely negative, the application into cramfs format is a good choice, the application is running in the process of generally we do not want to be changed, so that cramfs, is read-only, will not cause damage to it.
In addition, we will do a parameter partition in our system, that is, this partition is used to store some basic parameters (configuration files). This partition is required to be readable and writable, so we can consider the jffs2 file system. Jffs2 is a read-write file system designed specifically for embedded systems.
A relatively perfect embedded system, at least to achieve the file system, applications, parameters these partitions, and the format as described above. This is very convenient for future upgrade and maintenance.
The above is an example analysis of embedded Linux system flash partition design and file system format selection. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.