Difference between revisions of "UBIFS"

From ArmadeusWiki
Jump to: navigation, search
m
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Under_Construction}}
+
{{Note|UBIFS is now the rootfs filesystem used on [[APF27]], [[APF28]] & [[APF51]] boards, so this page should only be considered as reference for these boards. Due to the FLASH memory size of the [[APF9328]] board, there is no added value to use UBIFS on this board.}}
  
This is a preliminary page dealing with the installation of UBIFS on the APF boards.  
+
This is an old page dealing with the manual installation of UBIFS on the APF boards.  
UBIFS will replace JFFS2 file system on NAND based board because JFFS2 induces a big overhead when parsing, reading and writing on NAND devices [http://www.linux-mtd.infradead.org/doc/ubifs.html#L_scalability UBISFS scalability]
+
UBIFS has replaced JFFS2 filesystem on NAND (and NOR as well) based boards because JFFS2 induces a big overhead when parsing, reading and writing large devices, [http://www.linux-mtd.infradead.org/doc/ubifs.html#L_scalability see UBIFS scalability].
  
 
== Introduction ==
 
== Introduction ==
 
[http://www.linux-mtd.infradead.org/doc/ubifs.html UBIFS website]
 
[http://www.linux-mtd.infradead.org/doc/ubifs.html UBIFS website]
  
== Setting up ==
+
== Host Setup ==
* host system: add mtd-utils uuid uuid-dev packages:  
+
* add ''uuid-dev'' packages (should be already installed as required to build the HEAD of Armadeus repository):
  sudo apt-get install mtd-utils uuid uuid-dev
+
<pre class="host">
 +
$ sudo apt-get install uuid-dev
 +
</pre>
  
* buildroot: target filesystem -> ubifs root filesystem (0x1F800, 0x800, 2047)
+
==APF build config==
* linux: file systems -> Miscellanous -> ubifs support  and disable debugging !!
+
===Buildroot===
* linux: device driver -> mtd -> ubi unsorted block image -> Enable UBI (4096) and disable debugging !!
+
<pre class="host">
 +
$ make menuconfig
 +
</pre>
 +
APF51:
 +
<pre class="config">
 +
Target filesystem options  --->
 +
    [*] ubifs root filesystem
 +
    (0x1f800) UBI logical erase block size
 +
    (0x800) UBI minimum I/O size
 +
    (2047) Maximum LEB count
 +
          ubifs runtime compression (lzo)  --->
 +
          Compression method (no compression)  --->
 +
    [*]  UBI image
 +
    (0x20000) UBI physical erase block size
 +
    (512)  UBI sub-page size
 +
</pre>
  
* uboot: setenv bootcmd run ubifsboot
+
APF27:
* uboot: setenv download_rootfs tftpboot ${loadaddr} ${serverpath}${board_name}-rootfs.arm.ubifs
+
<pre class="config">
 +
Target filesystem options  --->
 +
    [*] ubifs root filesystem
 +
    (0x20000) UBI physical erase block size
 +
    (0x1f800) UBI logical erase block size
 +
    (0x800) UBI minimum I/O size
 +
    (512) UBI sub-page size
 +
    (2047) Maximum LEB count
 +
</pre>
  
 +
<pre class="host">
 +
$ make
 +
</pre>
 +
 +
===Linux===
 +
<pre class="host">
 +
$ make linux-menuconfig
 +
</pre>
 +
<pre class="config">
 +
File systems  --->
 +
    [*] Miscellaneous filesystems  --->
 +
        <*>  UBIFS file system support  and disable debugging !!
 +
 +
Device Drivers  --->
 +
    <*> Memory Technology Device (MTD) support  --->
 +
        UBI - Unsorted block images  --->
 +
            <*> Enable UBI
 +
            (4096) UBI wear-leveling threshold  and disable debugging !!
 +
</pre>
 +
<pre class="host">
 +
$ make linux
 +
</pre>
 +
* reflash your kernel
 +
 +
===U-Boot envt variables===
 +
<pre class="apf">
 +
BIOS> setenv bootcmd run ubifsboot
 +
BIOS> setenv download_rootfs tftpboot \${loadaddr} \${serverpath}\${board_name}-rootfs.arm.ubi
 +
</pre>
  
 
== Additional informations ==
 
== Additional informations ==
A new file 'ubinize.cfg' defining the  ubi volumes is located in target/device/armadeus/apf27
+
A new file 'ubinize.cfg' defining the  ubi volumes is located in ''buildroot/target/ubifs/''. This file contains the different UBI volumes of the UBI image:
this file contains the different UBI volumes of the UBI image:
+
<pre>
* [ubifs]
+
[ubifs]
* mode=ubi
+
mode=ubi
* image=apf27-rootfs.arm.ubifs
+
vol_id=0
* vol_id=0
+
vol_type=dynamic
* vol_size=200MiB
+
vol_name=rootfs
* vol_type=dynamic
+
vol_alignment=1
* vol_name=rootfs
+
vol_flags=autoresize
* vol_alignment=1
+
</pre>
* vol_flags=autoresize
+
 
 +
This file is processed by the ''ubinize'' utility after ''mkfs.ubifs''.
 +
 
 +
=== U-Boot access to UBIFS partitions ===
 +
 
 +
U-Boot can read files from the rootfs/UBIFS partitions using the commands: ''uni'', ''ubifsmount'', ''ubifsls'', ''ubifsload''. Here is an example applicable to the [[APF27]], [[APF28]] and [[APF51]] modules:
 +
 
 +
<pre class="apf">
 +
BIOS> ubi part rootfs
 +
 
 +
UBI: attaching mtd1 to ubi0
 +
UBI: physical eraseblock size:  131072 bytes (128 KiB)
 +
UBI: logical eraseblock size:    129024 bytes
 +
UBI: smallest flash I/O unit:    2048
 +
UBI: sub-page size:              512
 +
UBI: VID header offset:          512 (aligned 512)
 +
UBI: data offset:                2048
 +
UBI: attached mtd1 to ubi0
 +
UBI: MTD device name:            "mtd=7"
 +
UBI: MTD device size:            500 MiB
 +
UBI: number of good PEBs:        3988
 +
UBI: number of bad PEBs:        12
 +
UBI: max. allowed volumes:      128
 +
UBI: wear-leveling threshold:    4096
 +
UBI: number of internal volumes: 1
 +
UBI: number of user volumes:    1
 +
UBI: available PEBs:            0
 +
UBI: total number of reserved PEBs: 3988
 +
UBI: number of PEBs reserved for bad PEB handling: 39
 +
UBI: max/mean erase counter: 2/0
 +
 
 +
BIOS> ubifsmount ubi0:rootfs
 +
 
 +
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
 +
UBIFS: mounted read-only
 +
UBIFS: file system size:  504483840 bytes (492660 KiB, 481 MiB, 3910 LEBs)
 +
UBIFS: journal size:      9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
 +
UBIFS: media format:      w4/r0 (latest is w4/r0)
 +
UBIFS: default compressor: LZO
 +
UBIFS: reserved for root:  0 bytes (0 KiB)
 +
 
 +
BIOS> ubifsls /boot
 +
  2604048  Thu Oct 03 08:38:56 2013  apf51-linux.bin
 +
 
 +
BIOS> ubifsload 90000000 /boot/apf51-linux.bin
 +
Loading file '/boot/apf51-linux.bin' to addr 0x90000000 with size 2604048 (0x0027bc10)...
 +
Done
 +
 
 +
</pre>
 +
 
 +
Access to UBIFS files from U-Boot can be used for an update of your system after deployment on site, through some U-Boot scripts..
  
This file is processed by the ubinize utility after mkfs.ubifs.
+
==Links==
 +
* https://elinux.org/UBIFS

Latest revision as of 10:43, 10 January 2019

Note Note: UBIFS is now the rootfs filesystem used on APF27, APF28 & APF51 boards, so this page should only be considered as reference for these boards. Due to the FLASH memory size of the APF9328 board, there is no added value to use UBIFS on this board.


This is an old page dealing with the manual installation of UBIFS on the APF boards. UBIFS has replaced JFFS2 filesystem on NAND (and NOR as well) based boards because JFFS2 induces a big overhead when parsing, reading and writing large devices, see UBIFS scalability.

Introduction

UBIFS website

Host Setup

  • add uuid-dev packages (should be already installed as required to build the HEAD of Armadeus repository):
$ sudo apt-get install uuid-dev

APF build config

Buildroot

$ make menuconfig

APF51:

Target filesystem options  --->
    [*] ubifs root filesystem
    (0x1f800) UBI logical erase block size
    (0x800) UBI minimum I/O size
    (2047) Maximum LEB count
          ubifs runtime compression (lzo)  --->
          Compression method (no compression)  --->
    [*]   UBI image
    (0x20000) UBI physical erase block size
    (512)   UBI sub-page size

APF27:

Target filesystem options  --->
    [*] ubifs root filesystem
    (0x20000) UBI physical erase block size
    (0x1f800) UBI logical erase block size
    (0x800) UBI minimum I/O size
    (512) UBI sub-page size
    (2047) Maximum LEB count
$ make

Linux

$ make linux-menuconfig
File systems  --->
    [*] Miscellaneous filesystems  --->
        <*>   UBIFS file system support   and disable debugging !!

Device Drivers  --->
    <*> Memory Technology Device (MTD) support  --->
        UBI - Unsorted block images  --->
            <*> Enable UBI
            (4096) UBI wear-leveling threshold  and disable debugging !!
$ make linux
  • reflash your kernel

U-Boot envt variables

BIOS> setenv bootcmd run ubifsboot
BIOS> setenv download_rootfs tftpboot \${loadaddr} \${serverpath}\${board_name}-rootfs.arm.ubi

Additional informations

A new file 'ubinize.cfg' defining the ubi volumes is located in buildroot/target/ubifs/. This file contains the different UBI volumes of the UBI image:

 [ubifs]
 mode=ubi
 vol_id=0
 vol_type=dynamic
 vol_name=rootfs
 vol_alignment=1
 vol_flags=autoresize

This file is processed by the ubinize utility after mkfs.ubifs.

U-Boot access to UBIFS partitions

U-Boot can read files from the rootfs/UBIFS partitions using the commands: uni, ubifsmount, ubifsls, ubifsload. Here is an example applicable to the APF27, APF28 and APF51 modules:

BIOS> ubi part rootfs

UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=7"
UBI: MTD device size:            500 MiB
UBI: number of good PEBs:        3988
UBI: number of bad PEBs:         12
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 3988
UBI: number of PEBs reserved for bad PEB handling: 39
UBI: max/mean erase counter: 2/0

BIOS> ubifsmount ubi0:rootfs

UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   504483840 bytes (492660 KiB, 481 MiB, 3910 LEBs)
UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: LZO
UBIFS: reserved for root:  0 bytes (0 KiB)

BIOS> ubifsls /boot
	  2604048  Thu Oct 03 08:38:56 2013  apf51-linux.bin

BIOS> ubifsload 90000000 /boot/apf51-linux.bin
Loading file '/boot/apf51-linux.bin' to addr 0x90000000 with size 2604048 (0x0027bc10)...
Done

Access to UBIFS files from U-Boot can be used for an update of your system after deployment on site, through some U-Boot scripts..

Links