当前位置:网站首页>[NAND file system] UBI introduction
[NAND file system] UBI introduction
2022-06-22 06:11:00 【Ruler.】
UBI- Unsorted Block Images
UBI brief introduction
UBI Full name Unsorted Block Images, Is a kind of primitive flash The volume management system of the device . This system can work in a physical flash Multiple volumes are managed on the device and can be used throughout flash Loss equalization on chip .
In a sense ,UBI and LVM(Logical Volume Manager) A bit similar ,LVM Map logical sectors to physical sectors ,UBI Map logical erase block to physical erase block . But apart from mapping ,UBI It also realizes global loss balance and transparent I/O Error handling .
One UBI A volume is a series of consecutive logical erasure blocks (LEBs). Each logical erase block can be mapped to any physical erase block (PEB) above . This mapping is made by UBI management , This mapping is transparent to the user , At the same time, this mapping is also UBI The foundation of realizing global loss balance . The erasure count recorded by each physical erasure block , Data can be transferred from physical blocks with severe loss to erasure blocks with less loss .
UBIFS brief introduction
UBIFS It is a new flash file system developed by Nokia engineers with the help of segade University . In a way ,UBIFS Can be regarded as JFFS2 The next generation of file systems .
UBIFS Working in UBI On the roll , Can't be in MTD Running on the equipment , Nor in block Run on device , because ubifs The design is raw flash File system on the device .
And this is just for the sake of understanding , I mentioned a point ubusfs The concept of , This article will focus on ubi,ubifs Not the focus of this article .
UBI and UBIFS The relationship is shown in the following figure :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-qgpD64ix-1655455233269)(https://note.youdao.com/yws/res/27349/8527018A5D714EA7A3FA01DD7E517BB8)]](/img/69/7213b8b39cebc1626eb6bb8cc10d16.png)
UBI The main function
UBI The main functions are as follows :
- UBI Provides the ability to dynamically create 、 Delete or resize a volume ;
- UBI Wear balance across the flash memory device ( You may think that you are constantly writing / erase UBI The same logical erase block of the volume , But actually UBI It will be evenly distributed to all physical erasure blocks of the flash chip );
- UBI Transparently handle bad physical erase blocks ;
- UBI Will handle bad erase blocks , No upper software is required . UBI There is a reserved pool of physical erasure blocks , When a physical erase block goes bad , It transparently replaces it with a good physical erase block . UBI Move data from the newly discovered bad physical erasure block to the good physical erasure block . The result is UBI Users of the volume will not notice I/O error , because UBI Will handle them transparently .
- UBI Minimize the chance of losing data through cleanup .
- NAND Flash memory is vulnerable to bit flipping errors that occur during read and write operations . Bit flip by ECC Checksum correction , But they can accumulate over time and cause data loss .UBI This problem is handled by moving data from a physical erase block with bit flipping to another physical erase block . This process is called scrub. scrub The work is done transparently in the background , And hide it from the upper layer .
UBI volume
One UBI A volume is a series of consecutive logical erasure blocks (LEBs).
UBI The volume size is specified when the volume is created , But it may change later ( Volumes can be dynamically resized ).UBI Provide user space tools to operate UBI volume .
UBI There are two types of volumes :
- Static volume . Static volumes are read-only , Its contents are subject to CRC-32 Check and protect .
- Dynamic volume . Dynamic volumes are readable and writable , The upper ( file system ) Responsible for ensuring data integrity .
Static volumes are commonly used in the kernel 、initramfs and dtb. Larger static volumes may lose some performance when opened , Because you need to calculate CRC-32.
Dynamic volumes can be created dynamically 、 Delete 、 Resize . kernel 、initramfs or dtb It is best to use dynamic volumes for mirrors other than .
MTD Zoning and UBI The same point of the volume :
- Both consist of erasure blocks —— stay UBI The case of a volume is a logical erase block , stay MTD Physical erasure block in case of partition ;
- Both support three basic operations : read 、 Write and erase .
But with MTD Compartmentalization ,UBI Volumes have the following advantages :
- UBI Realized wear-leveling, Users don't care about this at all , In other words, the upper software will be simpler ;
- UBI Handle bad erase blocks , This also makes the upper layer software simpler ;
- UBI Volumes can be dynamic , They can be created dynamically 、 Delete or resize , and MTD Partitions are always static ;
- UBI Handle bit flipping , This again makes the upper layer software simpler ;
- UBI Provides volume update operations , This makes it easier to detect interrupted software updates and recoveries ;
- UBI Provides atomic logical erase block change operations , If an unclean restart occurs during operation , It allows you to change the contents of a logical erase block without losing data ; This can be very useful for upper tier Software ( for example , For file systems );
- UBI There is one un-map operation , It simply unmaps a logical erase block from the physical erase block , Schedule a physical erase block to erase , Then return ; It's very fast , And make the upper layer software avoid implementing its own mechanism to delay erasure ( for example ,JFFS2 Such a mechanism must be implemented ).
besides ,UBI A block device is also provided , Allow the regular 、 Block oriented file systems are mounted on UBI The top of the roll . It's possible , because UBI Handle bad blocks transparently .
UBI headers
UBI Store at the beginning of each non bad physical erase block 2 Small 64 byte headers:
- Contains physical erase blocks (PEB) Erasure counter and other information erasure counter header (EC header)
- Volume identifier header (VID header), Storage volume ID And this PEB The logical erase block to which it belongs (LEB) Number
This is why the logical erase block is smaller than the physical erase block ——header Take up some flash memory space
all UBI header All suffer CRC-32 Check and protect . see also linux Kernel drivers/mtd/ubi/ubi-media.h File for information about header More information about the content .
struct ubi_ec_hdr {
__be32 magic;
__u8 version;
__u8 padding1[3];
__be64 ec; /* Warning: the current limit is 31-bit anyway! */
__be32 vid_hdr_offset;
__be32 data_offset;
__be32 image_seq;
__u8 padding2[32];
__be32 hdr_crc;
} __packed;
struct ubi_vid_hdr {
__be32 magic;
__u8 version;
__u8 vol_type;
__u8 copy_flag;
__u8 compat;
__be32 vol_id;
__be32 lnum;
__u8 padding1[4];
__be32 data_size;
__be32 used_ebs;
__be32 data_pad;
__be32 data_crc;
__u8 padding2[4];
__be64 sqnum;
__u8 padding3[12];
__be32 hdr_crc;
} __packed;
When UBI attach One MTD Equipment time , It has to scan this MTD equipment , Read all header, Check CRC-32 The checksum , The erasure counter and the logical to physical erasure block mapping information are stored in RAM in .
stay UBI Erased a PEB after , It increases the value of the erase counter and writes it to EC header. It means PEB There is always a valid EC header, Except after erasing and writing EC A short time before the head . If an unexpected restart occurs within this short period of time ,EC header Will be lost or damaged . under these circumstances ,UBI stay MTD Write a new with an average erase counter immediately after the device scan is completed EC header.
When UBI With the LEB When connected , take VID header write in PEB. Let's consider some UBI During operation header What's going to happen .
LEB un-map The operation will just LEB from PEB Unmap and schedule PEB To erase . When PEB When erased ,EC The header is written immediately . Not written VID header.
LEB map Operation or to unmapped LEB The write operation of makes UBI Find the right PEB And will VID The header is written into it (EC header Must already exist ). Please note that , For mapped LEB The write operation of is just to write data directly PEB, And it doesn't change UBI header.
UBI For each PEB Need to maintain two header, Because it needs to write different information to flash memory at different times :
- Erase a PEB after , Write now EC header, Thus, the possibility of losing the erase counter due to accidental restart is minimized ;
- When UBI Will a PEB With a LEB When associated ,VID header To be written to PEB.
When EC header write in PEB when ,UBI I don't know the volume yet ID I don't know what to do PEB Will be associated to LEB Number . That's why UBI You need to do two independent write operations and have two independent headers.
UBI headers Location
EC The header is always at offset 0 And occupy 64 byte ,VID header At the next available minimum I/O Unit or sub-page It's about , It also takes up 64 byte . for example :
- Those who have 1 Minimum bytes I/O The unit's NOR Flash,VID The header is at offset 64;
- In the absence of sub-page Of NAND Flash Under the circumstances ,VID header In the second NAND page;
- Those who have sub-page Of NAND Flash,VID header In the second sub-page.
UBI volume table
The volume table is a flash data structure , It contains information about this UBI Information for each volume on the device . Volume table is an array of volume table records . Each record contains the following information :
- Volume size ;
- Volume name ;
- Volume type ( Dynamic or static );
- Roll alignment ;
- Update tag ( Set on the volume when starting the update , And clear on successful completion );
- auto-resize sign ;
- Of this record CRC-32 The checksum .
Each record describes a UBI volume . The record index in the volume table array corresponds to the volume it describes ID. namely ,UBI volume 0 From the records in the volume table 0 describe , And so on . The total number of records in the volume table is affected by LEB Size limit , Not greater than 128. It means UBI The volume of the device cannot exceed 128 individual .
Each creation 、 Delete 、 Resize 、 Rename or update UBI Volume time , Will change the corresponding volume table record . For reasons of reliability and wrong capacitor breaking ,UBI Maintains two copies of the volume table .
In the internal , The volume table is located in the special purpose UBI In the volume , be called layout volume. This volume consists of 2 individual LEB form (LEB0,LEB1)- One for each volume table and one for each copy .layout volume yes “ Inside ”UBI volume , Users cannot see or access it . Reading or writing layout volume when ,UBI Use the same mechanism as normal user volumes .
UBI Use the following algorithm when updating volume table records :
- Prepare a memory buffer containing the contents of the new volume table .
- Unmap layout volume Of LEB0.
- Write the new volume table to LEB0.
- Unmap layout volume Of LEB1.
- Write the new volume table to LEB1.
- Refresh UBI Work queues to ensure PEB Corresponds to unmapped LEB Erased .
attach MTD Equipment time ,UBI Make sure 2 Volume table copies are equivalent . If they are not equal , It may be caused by dirty restart ,UBI from LEB0 Select one of the and copy it to the... Of the layout volume LEB1( Because according to the algorithm specified above ,LEB0 Is the first update , Therefore, it is considered to have the latest information ). If one of the volume table copies is damaged ,UBI It will be restored from another copy of the volume table .
FLASH Minimum I/O unit
UBI Use the abstract model of flash memory . In short , from UBI From the perspective of , Flash memory ( or MTD equipment ) Composed of erasure blocks , These erasure blocks may be good or bad . Every good erase block can be read 、 Write or erase . A good erase block may also be marked as bad .
FLASH read and write can only be done with minimum input / Multiple of the output unit size , This depends on the flash type .
- NOR Flash memory usually has 1 Minimum of bytes I/O cell size , because NOR Flash memory usually allows reading and writing a single byte ( actually , You can even change a single bit ).
- some NOR Flash memory may have other minimum I/O cell size , For example, for ECC Of NOR Flash memory , by 16 or 32 byte .
- NAND Minimum of flash memory I/O The size is usually 512、2048 or 4096 byte , It's not about page The size corresponds to . NAND Flash presence OOB The area stores each page ECC Code , This means that the entire... Must be written at once NAND Page to calculate ECC, And must read the whole at once NAND Page to check ECC.
Minimum I/O The cell size is MTD A very important feature of the device . It can affect many things , for example :
- VID header The physical location of depends on the minimum I/O cell size , It means LEB The size also depends on it ; Generally speaking , Minimum I/O The larger the cell size ,LEB The smaller the size , therefore UBI The greater the flash memory space overhead ;
- All right LEB All writes should be with minimum I/O Cell size alignment , And it should be the smallest I/O Multiple of unit size ; This does not apply to reading , But remember , stay MTD On a level , All reads are done at a minimum anyway I/O A multiple of the cell size ; This is only done by caching the read data , Copy only the number of bytes actually requested by the user to the user buffer , From the user's point of view, arbitrary byte reading can be realized ( The maximum number of reads is the cache size ).
UBI Flash memory space overhead
UBI Use some flash memory space for your own purposes , Thus reducing the amount of UBI The amount of flash memory space used by the user . namely :
- 2 individual PEB Used to store volume tables ;
- 1 PEB Reserved for wear equalization purposes ;
- 1 individual PEB It's for atoms LEB Change the operation reserved ;
- Keep some PEB Used for undesirable PEB Handle ; This applies to NAND Flash memory , But not for NOR Flash memory ; Reserved PEB Quantity is configurable , The default is equal to every 1024 Block 20 Block ;
- UBI take EC and VID header Stored in each PEB The beginning of ; The number of bytes used for these purposes depends on the flash memory type , As follows .
- W - The total number of physical erase blocks on the flash memory chip (NB: Whole chip , No MTD Partition );
- P - MTD Total number of physical erasure blocks on the partition ;
- SP - Physical erase block size ;
- SL - Logical erase block size ;
- BB - MTD Number of bad blocks on partition ;
- BR - For bad PEB Handle reserved PEB Number ( By default ,NAND by 20 * W/1024,NOR And the others are not bad PEB The flash type of is 0)
- B - MAX(BR,BB)
- O - And store in bytes EC and VID header Related expenses , namely O = SP - SL.
UBI The cost is (B + 4) * SP + O * (P - B - 4), That is, the user cannot access this number of bytes . O For different Flash Is different :
- stay NOR flash Under the circumstances , It has 1 The smallest byte I/O unit ,O yes 128 byte ;
- In the absence of sub-page Of NAND Flash memory ( for example MLC NAND) Under the circumstances ,O yes 2 individual NAND page, That is to say 4KiB NAND page In the case of 8KiB, stay 512 byte NAND page In the case of 1KiB;
- Those who have sub-page Of NAND Flash memory ,UBI Optimize its on-flash Layout and place EC and VID header Put in the same NAND page, But different sub-page in ; under these circumstances ,O Just one. NAND page;
- For other flash memory , If the smallest I/O The cell size is greater than or equal to 64 byte , Then the cost should be 2 Minimum I/O unit , If the smallest I/O Cell size is less than 64 byte , Then the cost should be 2 times 64 Bytes and minimum I/O Cell size alignment .
Be careful : The above formula counts the bad block as UBI expenses . real UBI The cost is :(B - BB + 4) * SP + O * (P - B - 4).
UBI Handle reserved erase blocks for bad blocks (only for NAND chips)
as everyone knows ,NAND The chip has some physical erasure blocks that are labeled bad by the manufacturer . stay NAND During the life cycle of the equipment , There may be other bad blocks . For all that , The manufacturer usually guarantees that the first few physical erasure blocks are not damaged , bad PEB The total number of will not exceed a certain amount . for example , One 256MiB(2048 individual 128KiB PEB) The samsung OneNAND The chip is guaranteed not to exceed... During its service life 40 individual 128KiB PEB. This is a NAND A very common value for devices :20/1024 PEB, About the size of flash memory 2%.
This 20/1024 The ratio is UBI by Every UBI The default number of blocks reserved by the device . It means that if one 4096 PEB NAND There are 2 individual UBI equipment , Every UBI The device will remain 80 individual PEB. It seems like a waste of space , however , Whereas bad blocks can appear in NAND Anywhere in flash memory , And distributed unevenly on the whole equipment , It's safer . therefore , It's not about NAND Multiple... Are used on flash memory UBI equipment , It is better to use only one containing multiple UBI Roll up UBI Equipment saves more space .
Every time 1024 individual PEB Retain 20 individual PEB The default value of is the kernel configuration option . For each UBI equipment , You can use kernel parameters or ubiattach Parameters ( From the kernel 3.7 rise ) Adjust this value .
UBI Mark the bad block
This section is related to NAND Flash memory and other flash memory with bad erase blocks . UBI Mark the physical erase block as bad in the following two cases :
- Erase block write operation failed , under these circumstances ,UBI Remove data from the PEB Move to some other PEB( Data recovery ) And schedule the PEB Conduct “ torture ”;
- The erase operation is caused by EIO Wrong and fail , under these circumstances , The erase block is immediately marked as bad .
“ torture ” It's done backstage , The purpose is to detect whether the physical erase block is actually bad . A write failure can occur for one of several reasons , Including errors in the driver or errors in the upper content such as the file system ( for example ,FS Incorrectly write the same... Multiple times NAND page ). stay “ torture ” UBI period ,UBI The following is done :
- Erase erase block ;
- Read it back and make sure it contains only 0xFF byte ;
- Write test mode bytes ;
- Read back the erase block and check the mode ;
- And so on (0xA5、0x5A、0x00).
If the erase block is in “ cruel torture ” Survived the test , It is not marked as a bad block . However ,“ cruel torture ” Bit flipping during testing is a good reason to mark erase blocks as bad . For more information , see also torture_peb() function .
UBI operations
to be continue
User-space tools
ubi tools Official warehouse
http://git.infradead.org/mtd-utils.git
- UBI relevant tools as follows :
| tools | explain | remarks |
|---|---|---|
| ubinfo | Provide information about UBI Device and volume information | |
| ubiattach | link MTD equipment ( original Flash equipment ) To UBI And create the corresponding UBI equipment | |
| ubidetach | take MTD Equipment and UBI Equipment separation ( And ubiattach The opposite is true ); | |
| ubimkvol | stay UBI Create... On device UBI volume | |
| ubirmvol | from UBI Delete... From the device UBI volume | |
| ubiblock | management UBI The block interface of the volume | |
| ubiupdatevol | to update ubi volume , It can also be used to empty ubi volume | |
| ubicrc32 | Calculation and UBI Use the same file as the initial seed CRC-32 The checksum | |
| ubinize | Generate ubi Mirror image | Note that ubi The mirror image is not ubifs Mirror image |
| ubiformat | Format empty flash, erase flash And keep the erase counter , take UBI Mirror write flash | |
| mtdinfo | Look at all the... In the system mtd Equipment information |
- ubinize Tools
UBI Images can be used ubinize Tool generation . The tool gets the configuration file at input time and generates... At output time UBI Mirror image . The input configuration file is used to describe the UBI Mirror image , And must include all UBI volume .
Usage:ubinize [options] <ini-file>
| options | explain | remarks |
|---|---|---|
| -o, --output= | output to a file | |
| -p, --peb-size= | Create this UBI The size of the physical erase block of the mirrored flash memory , In bytes 、 kilobytes (KiB) Or megabytes (MiB) In units of ( Force parameters ) | |
| -m, --min-io-size= | Flash Minimum input for / Output unit size ( In bytes ) | |
| -s, --sub-page-size= | be used for UBI headers Minimum input for / output unit , for example NAND flash Sub page size in case ( The default is equal to the minimum input / Output unit size ) | |
| -O, --vid-hdr-offset= | Offset , If VID header From the beginning of the physical erasure block ( The default is EC header The next smallest after I/O Unit or subpage ) | |
| -e, --erase-counter= | Put in EC header Erase counter value of ( The default is 0) | |
| -x, --ubi-ver= | Put in EC header Of UBI Version number ( The default is 1) | |
| -Q, --image-seq= | To be used 32 position UBI Image serial number ( Random number is selected by default ) |
The configuration file has ini-file grammar .
| option | explain | remarks |
|---|---|---|
| mode | Fixed for ubi | Required |
| image | The use of ubifs Image file | Static volumes must be specified ubifs Image file |
| vol_id | volume ID | If it is not filled in, it will be automatically allocated |
| vol_size | Volume size | If it is not filled in, a minimum value that can accommodate the current image will be automatically allocated |
| vol_type | Volume type (static、dynamic) | Required |
| vol_name | Volume name | Required |
| vol_flags | Volume flag bit (autoresize,skip-check) | optional |
Here is an example of a configuration file :
[configuration-data-volume]
mode=ubi
image=config_data.img
vol_id=0
vol_size=512KiB
vol_type=static
vol_name=configuration
[rootfs-volume]
mode=ubi
image=rootfs.img
vol_id=1
vol_size=220MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
The above configuration file contains 2 Volumes :
- The static configuration volume size is 512KiB, Distribution for them ID 0 And named it
configuration; The contents of the volume shall be taken fromconfig_data.imgfile ; - The size is 220MiB Dynamic root file system volume , Distribution for them ID 1 And named it
rootfs; The contents of the volume shall be taken fromrootfs.imgfile ; This volume should also haveauto-resizesign , This means that the size of this volume will be in UBI It is modified at the first run ;UBI The volume will be made larger by providing available erase blocks ; This is in NAND Flash memory can be very useful .
Volume flag auto-resize
When UBI When an image is refreshed during production , You should specify the exact size for all volumes ( The size is stored in UBI In the volume table ). However , In the embedded world , We like to set up a read-only volume for the root file system , For the remaining space ( journal 、 User data, etc ) Set a read / Write volume . If the size of the root file system is fixed , Then the size of the second file system may vary by product ( Given different flash sizes ).
This is the purpose of the auto resize flag . If the volume is enabled autoresize sign , The first time you run UBI when , Its size will be expanded to fill the remaining unused space . After resizing the volume ,UBI Remove the auto resize flag , No more volume resizing . The auto resize flag is stored in volume table in , And only one volume can be marked for automatic resizing .
Volume flag skip-check Reserved for static volumes flag
So in the example above ,ubinize Basically read 3 An input file :
- config.ini file , Describe the generated ubi.img How many volumes should the file contain 、 Their size 、 Name, etc ; It also refers to the file that contains the data that should be placed on the volume ; Be careful , If the volume should be empty , Do not specify the image file ;
- The first volume config_data.img Image file ;
- Of Volume II rootfs.img Image file .
ubinize The reason for requiring a configuration file is : One UBI An image may contain many... With different characteristics UBI volume , And it's hard to invent a good command line interface to specify all these features , So the configuration file is used .
- ubiattach Tools
ubiattach Tools are used to link MTD equipment (raw Flash equipment ) To UBI And create the corresponding UBI equipment .
Usage: ubiattach [<UBI control device node file name>]
[-m <MTD device number>] [-d <UBI device number>] [-p <path to device>]
[--mtdn=<MTD device number>] [--devn=<UBI device number>]
[--dev-path=<path to device>]
[--max-beb-per1024=<maximum bad block number per 1024 blocks>]
| option | explain | Options |
|---|---|---|
| -d, --devn= | Assigned to newly created UBI The number of the equipment ( If not specified , Is automatically assigned ) | |
| -p, --dev-path= | To attach MTD The path of the device node | |
| -m, --mtdn= | To attach MTD Device number ( for example /dev/mtdX X namely MTD Device number ) | |
| -O, --vid-hdr-offset | VID header The offset ( Don't specify this unless you really know what you're doing , The default should be optimal ) | |
| -b, --max-beb-per1024 | Every time 1024 The maximum expected number of bad blocks of erasure blocks . For most NAND equipment , The default value is correct . The allowable range is 0-768,0 Indicates the default kernel value . |
If <UBI control device node file name> Not specified , Just use the default values /dev/ubi_ctrl
-p Option is used to specify more specific MTD Device node , for example /dev/mtd19
-m Options and -p similar , Also designated MTD Device node , But more concise , It only needs MTD The equipment number is enough
-b Option specifies the number of bad block redundancy , But not a specific number . But every 1024 individual block How many redundant blocks are required .
Here are some examples :
Example 1: ubiattach -p /dev/mtd0
attach /dev/mtd0 to UBI
Example 2: ubiattach -m 0
attach MTD device 0 (mtd0) to UBI
Example 3: ubiattach -m 0 -d 3
attach MTD device 0 (mtd0) to UBI and create UBI device number 3 (ubi3)
Example 4: ubiattach -m 1 -b 25
attach /dev/mtd1 to UBI and reserve 25*C/1024 ( If FLASH share 4096 Block , Reserve 100 individual )
ubiattach Of mtd The device can be empty , It can also be burned ubi Mirrored devices ; If it's the former , You also need to manually create a volume before you can use . If it's the latter , Will automatically identify the ubi Image information , And according to ubi Mirror configuration file () Automatically create volumes , Finally, the user can manually mount it .
- ubimkvol Tools
ubimkvol Tools are used in UBI Create... On device UBI volume
Usage: ubimkvol <UBI device node file name> [-h] [-a <alignment>] [-n <volume ID>] [-N <name>]
[-s <bytes>] [-S <LEBs>] [-t <static|dynamic>] [-V] [-m] [-k]
[--alignment=<alignment>][--vol_id=<volume ID>] [--name=<name>]
[--size=<bytes>] [--lebs=<LEBs>] [--type=<static|dynamic>] [--help]
[--version] [--maxavsize] [--skipcheck]
| option | explain | remarks |
|---|---|---|
| -a, --alignment= | Roll alignment ( The default is 1) | |
| -n, --vol_id= | UBI volume ID, If you don't specify , volume ID It will be assigned automatically | |
| -N, --name= | Volume name | Required |
| -s, --size= | Volume size . The volume size is in bytes 、 kilobytes (KiB) Or megabytes (MiB) In units of | Required |
| -S, --lebs= | An alternative method of giving volume size in a logical erase block | |
| -m, --maxavsize | Set the volume size to the maximum available size | |
| -t, --type=<static/dynamic> | Volume type ( dynamic 、 static state ), The default is dynamic | |
| -k, --skipcheck | Skip completed when volume is open CRC check |
Here is an example of how to use :
Example: ubimkvol /dev/ubi0 -s 20MiB -N config_data
create a 20 Megabytes volume named "config_data" on UBI device /dev/ubi0.
- ubiformat Tools
ubiformat Tools format MTD Equipment and burning ubi Mirror image
Usage: ubiformat <MTD device node file name> [-s <bytes>] [-O <offs>] [-n]
[-Q <num>] [-f <file>] [-S <bytes>] [-e <value>] [-x <num>] [-y] [-q] [-v] [-h]
[--sub-page-size=<bytes>] [--vid-hdr-offset=<offs>] [--no-volume-table]
[--flash-image=<file>] [--image-size=<bytes>] [--erase-counter=<value>]
[--image-seq=<num>] [--ubi-ver=<num>] [--yes] [--quiet] [--verbose]
[--help] [--version]
| option | explain | remarks |
|---|---|---|
| -s, --sub-page-size= | be used for UBI header Minimum input for / output unit , for example NAND flash Sub page size in case ( The default is equal to the minimum input / Output unit size ) | |
| -O, --vid-hdr-offset= | Offset , If VID header From the beginning of the physical erasure block ( The default is EC The next smallest after the header I/O Unit or subpage ) | |
| -f, --flash-image= | Appoint ubi Image file , If ’-' From stdin Read | |
| -S, --image-size= | When no specific image file is specified , from stdin Number of bytes read | |
| -e, --erase-counter= | Use As the erasure counter value of all erasure blocks | |
| -x, --ubi-ver= | Put in EC header Of UBI Version number ( The default is 1) | |
| -Q, --image-seq= | To be used 32 position UBI Image serial number ( Random number is selected by default ) | |
| -y, --yes | Suppose that the answer to all the questions the program would have asked was “yes” | |
| -q, --quiet | Suppress progress percentage information |
ubiformat Examples of tools are as follows :
Example 1: ubiformat /dev/mtd0 -y
format MTD device number 0 and do not ask questions.
Example 2: ubiformat /dev/mtd0 -y -f ubi.image
format MTD device number 0 and do not ask questions.write ubi.image to /dev/mtd0
Example 3: ubiformat /dev/mtd0 -q -e 0
format MTD device number 0,be quiet and force erase counter value 0.
Use ubiformat erase flash The advantage is that it keeps erasing counters .
in addition ubiformat It can also be used to burn ubi Mirror image ( After image burning , Need to use ubiattach Connect the tool and then mount it for use )
- ubiblock Tools
UBI Allow in UBI Create a read-only block device on the volume , This volume is intended for read-only 、 Block oriented file system , for example squashfs.
UBI Allow in UBI Create a block device on the volume , But there are the following restrictions :
- read-only operation .
- Serialization I/O operation , But remember NAND The driver kernel has also serialized all I/O.
Usage: ubiblock [-c,-r] <UBI volume node file name>
| option | explain | remarks |
|---|---|---|
| -c, --create | be based on UBI Volume creation block device | |
| -r, --remove | Delete based on UBI Block devices for volumes |
Must be based on UBI Volume creation or deletion ubi Block device
$ubiblock -c /dev/ubi0_0
$ubiblock -r /dev/ubi0_0
ubi The read-only block device was successfully created
# ls /dev/ubiblock* -l
brw------- 1 root root 254, 0 Jun 16 15:19 /dev/ubiblock0_0
UBI Can make
Linux Configuration menu
"Device Drivers"
-> "Memory Technology Devices (MTD)"
-> "UBI - Unsorted block images"
Reference resources
边栏推荐
- clickhouse对比两台机器数据
- DOS bat syntax record I
- BinaryFormatter saving and loading game data for unity
- 401 string (344. reverse string, 541. reverse string II, Title: Sword finger offer 05. replace spaces, 151. reverse words in string)
- Frame profiling
- 五大常考SQL面试题
- ForkJoinPool
- h = key.hashCode()) ^ (h >>> 16) 详细解读以及为什么要将hashCode值右移16位并且与原来的hashCode值进行异或操作
- 生信可视化(part1)--柱状图
- MFC TabCtrl 控件修改标签尺寸
猜你喜欢

【自己动手写CPU】异常相关指令的实现

单细胞论文记录(part8)--Cell2location maps fine-grained cell types in spatial transcriptomics

idea本地运行scope

单细胞论文记录(part13)--SpaGCN: Integrating gene expression, spatial location and histology to ...

单细胞论文记录(part9)--Spatial charting of single-cell transcriptomes in tissues

活动预告|EdgeX 开发者峰会@南京站 来啦!

Frame profiling

PyG教程(7):剖析邻域聚合

生信可视化(part2)--箱线图

舰载机自动着舰控制系统研究
随机推荐
活动预告|EdgeX 开发者峰会@南京站 来啦!
单细胞论文记录(part7)--DL and alignment of spatially resolved single-cell transcriptomes with Tangram
swagger常用注解汇总
Detailed interpretation of tab[i = (n - 1) & hash]
Matlab system identification
DOS bat syntax record I
402 string (Title: Sword finger offer58 ii. left rotation string, 28. implementation of strstr(), 459 Repeated substrings)
文献记录(part106)--GRAPH AUTO-ENCODER VIA NEIGHBORHOOD WASSERSTEIN RECONSTRUCTION
h = key.hashCode()) ^ (h >>> 16) 详细解读以及为什么要将hashCode值右移16位并且与原来的hashCode值进行异或操作
Empirical mode decomposition (EMD) and Hilbert Huang transform (HHT)
关于jinja2 宏定义的小问题
Current harmonic suppression strategy of grid connected inverter with PIR controller regulator
Use of idea plug-in EASYCODE
D3D学习笔记(1)—— SO 阶段介绍 AutoDraw使用条件
Shengxin visualization (Part3) -- violin diagram
上传文件提示 413 Request Entity Too Large 错误
Single precision, double precision and precision (Reprint)
单细胞文献学习(part2)--stPlus: a reference-based method for the accurate enhancement of ST
leetcode每周3道(八)图之最短路
Modeling and Simulation of Radar Seeker Servo System