Skip to content

Commit

Permalink
Disable small sector erase size for UBIFS on flash (sonic-net#382)
Browse files Browse the repository at this point in the history
UBIFS does not work on NOR Flash with small sector erasesize.
https://cateee.net/lkddb/web-lkddb/MTD_SPI_NOR_USE_4K_SECTORS.html

* Disabling small sector erase size to enabled UBIFS on flash

* Disable small sector erase size for UBIFS on flash

UBIFS does not work on NOR Flash with small sector erasesize.

Ubiattach commands fails with the following error messages:

[  145.820167] ubi0 error: validate_vid_hdr [ubi]: bad data_size
[  145.826621] ubi0 error: validate_vid_hdr [ubi]: bad VID header
[  145.833163] Volume identifier header dump:
[  145.837752]  magic     55424921
[  145.841270]  version   1
[  145.844109]  vol_type  1
[  145.846934]  copy_flag 1
[  145.849775]  compat    5
[  145.852609]  vol_id    2147479551
[  145.856318]  lnum      0
[  145.859146]  data_size 22016
[  145.862370]  used_ebs  0
[  145.865207]  data_pad  0
[  145.868044]  sqnum     1
[  145.870869]  hdr_crc   11f8b00c
[  145.874390] Volume identifier header hexdump:
[  145.879362] ubi0 error: ubi_io_read_vid_hdr [ubi]: validation failed for PEB 2064
[  145.891655] ubi0 error: ubi_attach_mtd_dev [ubi]: failed to attach mtd4, error -22

From the description of CONFIG_MTD_SPI_NOR_USE_4K_SECTORS:
    Please note that some tools/drivers/filesystems may not work with 4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).

The kernel config CONFIG_MTD_SPI_NOR_USE_4K_SECTORS, which is enabled by default is removed.

Unit Test:

    cisco@sonic:~$ grep CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /boot/config-5.10.0-18-2-amd64
    # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
    cisco@sonic:~$ findmnt -n /mnt/obfl
    /mnt/obfl ubi0   ubifs  rw,relatime,assert=read-only,ubi=0,vol=0

* Addressed PR comments.

* Removed the config from amd64 arch.
  • Loading branch information
bmridul authored Mar 11, 2024
1 parent 45295bf commit bab1510
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions patch/kconfig-exclusions
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CONFIG_CGROUP_NET_CLASSID
CONFIG_NET_CLS_CGROUP
CONFIG_NETFILTER_XT_MATCH_CGROUP
CONFIG_CGROUP_NET_PRIO
# Unset to enable UBIFS on flash
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
###-> mellanox_common-start
###-> mellanox_common-end

Expand Down

0 comments on commit bab1510

Please sign in to comment.