lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251114024452.2927429-1-linchengming884@gmail.com>
Date: Fri, 14 Nov 2025 10:44:51 +0800
From: Cheng Ming Lin <linchengming884@...il.com>
To: richard@....at,
	chengzhihao1@...wei.com,
	miquel.raynal@...tlin.com,
	vigneshr@...com,
	linux-mtd@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Cc: alvinzhou@...c.com.tw,
	leoyu@...c.com.tw,
	Cheng Ming Lin <chengminglin@...c.com.tw>
Subject: [PATCH v2 0/1] mtd: ubi: skip programming unused bits in ubi headers

From: Cheng Ming Lin <chengminglin@...c.com.tw>

v2:
- Modify ubi_io_write_vid_hdr to allow vid_hdr to be written not only at
  the start or end of a subpage
- New experiment: perform a vid_hdr shift under subpage support conditions

This patch verification was performed on a Xilinx Zynq-PicoZed board with
mtd-utils version 2.3.0. Tests were conducted using both the nandsim
simulated NAND and a real NAND flash device.

Before modifying ubi/io.c, running the tests in mtd-utils/tests/ubi-tests
exhibited the following issue.

While running the mtd-utils/tests/ubi-tests/runubitests.sh test suite,
the execution reaches rsvol.c where, after ubi_mkvol is called, it
subsequently calls ubi_get_vol_info. At this point, there is a certain
probability of encountering an "error -2, no such file or directory".

To address this, I modified the ubi_mkvol function within mtd-utils by
adding a polling mechanism that waits for the /dev/ubi0_x device node
to be created before proceeding.

However, after adding this polling, the test encountered a similar "no
such file" error in io_paral.c. Further investigation pointed to a
potential issue with mdev. According to mdev documentation, kernel hotplug
events are not serialized and increment the SEQNUM environmental variable
on each invocation. This can cause hotplug and hot-unplug events to be
reordered, which sometimes results in device nodes not being created
as expected.

To solve this, I introduced an mdev.seq to serialize these events,
effectively resolving the problem.

With both modifications—the polling in ubi_mkvol and the mdev.seq
handling — runubitests.sh completes successfully.

Beyond these fixes, to validate the patch’s behavior with and without
subpage support, I also added a new module parameter subpage to nandsim.
This allows dynamically toggling subpage support. Setting the parameter
to 0 enforces the chip flag NAND_NO_SUBPAGE_WRITE, effectively disabling
subpage writes.

The experimental procedure and logs are detailed below, covering tests
on both real Macronix NAND flash and the nandsim simulated flash, each
tested with and without subpage support enabled. Additionally, when
subpage support is enabled, testing of the vid_hdr_shift performed.

- Without subpage support on Macronix NAND flash
nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xda
nand: Macronix MX30LF2G18AC
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Scanning device for bad blocks

zynq> ./mnt/mtd-utils/flash_lock -u /dev/mtd0

zynq> flash_eraseall /dev/mtd0
Erasing 128 Kibyte @ 10000000 - 100% complete.

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "43a00000.Unified_Extensible_Flash_Controller", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1021331801
ubi0: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 83
UBI device number 0, total 2048 LEBs (260046848 bytes, 248.0 MiB), available 2004 LEBs (254459904 bytes, 242.6 MiB), LEB size 126976 bytes (124.0 KiB)

zynq> hexdump -C -n 4096 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 08 00 00 00 10 00  3c e0 49 59 00 00 00 00  |........<.IY....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 b9 1c 05 fc  |................|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000820  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000830  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000840  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 126977
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     126976
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- With subpage support of Macronix NAND flash
nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xda
nand: Macronix MX30LF2G18AC
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Scanning device for bad blocks

Bad eraseblock 1104 at 0x000008a00000

zynq> ./mnt/mtd-utils/flash_lock -u /dev/mtd0
zynq> flash_eraseall /dev/mtd0
Erasing 128 Kibyte @ 89e0000 - 53% complete.
Skipping bad block at 0x08a00000
Erasing 128 Kibyte @ 10000000 - 100% complete.

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "43a00000.Unified_Extensible_Flash_Controller", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 2047, bad PEBs: 1, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1673979568
ubi0: available PEBs: 2004, total reserved PEBs: 43, PEBs reserved for bad PEB handling: 39
ubi0: background thread "ubi_bgt0d" started, PID 83
UBI device number 0, total 2047 LEBs (264112128 bytes, 251.8 MiB), available 2004 LEBs (258564096 bytes, 246.5 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 2048 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 02 00 00 00 08 00  63 c6 e6 b0 00 00 00 00  |........c.......|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 a0 51 60 dd  |.............Q`.|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000240  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- With subpage support and vid_hdr shift of Macronix NAND flash
nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xda
nand: Macronix MX30LF2G18AC
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Scanning device for bad blocks

Bad eraseblock 1104 at 0x000008a00000

zynq> ./mnt/mtd-utils/flash_unlock -u /dev/mtd0
zynq> flash_eraseall /dev/mtd0
Erasing 128 Kibyte @ 89e0000 - 53% complete.
Skipping bad block at 0x08a00000
Erasing 128 Kibyte @ 10000000 - 100% complete.

zynq> ./mnt/mtd-utils/ubiattach -O 1280 -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "43a00000.Unified_Extensible_Flash_Controller", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 1280 (aligned 1024), data offset: 2048
ubi0: good PEBs: 2047, bad PEBs: 1, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 481366231
ubi0: available PEBs: 2004, total reserved PEBs: 43, PEBs reserved for bad PEB handling: 39
ubi0: background thread "ubi_bgt0d" started, PID 745
UBI device number 0, total 2047 LEBs (264112128 bytes, 251.8 MiB), available 2004 LEBs (258564096 bytes, 246.5 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 2048 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 05 00 00 00 08 00  1c b1 10 d7 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 4d bf 63 fc  |............M.c.|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000500  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000510  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000520  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000530  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000540  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Running mkvol_bad /dev/ubi0
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 128MiB 1,8V 8-bit without subpage support
zynq> modprobe nandsim do_delays=1 subpage=0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
nand: Toshiba NAND 128MiB 1,8V 8-bit
nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
flash size: 128 MiB
page size: 512 bytes
OOB area size: 16 bytes
sector size: 16 KiB
pages number: 262144
pages per sector: 32
bus width: 8
bits in sector size: 14
bits in page size: 9
bits in OOB size: 4
flash size with OOB: 135168 KiB
page address bytes: 4
sector address bytes: 3
options: 0x42
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":
0x000000000000-0x000008000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 128MiB 1,8V 8-bit", size 128 MiB)
ubi0: PEB size: 16384 bytes (16 KiB), LEB size: 15360 bytes
ubi0: min./max. I/O unit sizes: 512/512, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 1024
ubi0: good PEBs: 8192, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 89
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1589130535
ubi0: available PEBs: 8028, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160
ubi0: background thread "ubi_bgt0d" started, PID 92
UBI device number 0, total 8192 LEBs (125829120 bytes, 120.0 MiB), available 8028 LEBs (123310080 bytes, 117.5 MiB), LEB size 15360 bytes (15.0 KiB)

zynq> hexdump -C -n 1024 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 02 00 00 00 04 00  5e b8 35 27 00 00 00 00  |........^.5'....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 52 64 4e dd  |............RdN.|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000240  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000400

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    89
        alignment 1
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 15361
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 513
        bytes     123310080
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     15360
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 89, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 89, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 128MiB 1,8V 8-bit with subpage support
zynq> modprobe nandsim do_delays=1 subpage=1
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
nand: Toshiba NAND 128MiB 1,8V 8-bit
nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
flash size: 128 MiB
page size: 512 bytes
OOB area size: 16 bytes
sector size: 16 KiB
pages number: 262144
pages per sector: 32
bus width: 8
bits in sector size: 14
bits in page size: 9
bits in OOB size: 4
flash size with OOB: 135168 KiB
page address bytes: 4
sector address bytes: 3
options: 0x42
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":
0x000000000000-0x000008000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 128MiB 1,8V 8-bit", size 128 MiB)
ubi0: PEB size: 16384 bytes (16 KiB), LEB size: 15872 bytes
ubi0: min./max. I/O unit sizes: 512/512, sub-page size 256
ubi0: VID header offset: 256 (aligned 256), data offset: 512
ubi0: good PEBs: 8192, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 92
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1426356124
ubi0: available PEBs: 8028, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160
ubi0: background thread "ubi_bgt0d" started, PID 93
UBI device number 0, total 8192 LEBs (130023424 bytes, 124.0 MiB), available 8028 LEBs (127420416 bytes, 121.5 MiB), LEB size 15872 bytes (15.5 KiB)

zynq> hexdump -C -n 512 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 01 00 00 00 02 00  23 79 a7 a5 00 00 00 00  |........#y......|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 51 66 a6 80  |............Qf..|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000100  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000130  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    92
        alignment 1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 15873
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 513
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     15872
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 92, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 92, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 128MiB 1,8V 8-bit with subpage support and vid_hdr
  shift
zynq> modprobe nandsim do_delays=1 subpage=1
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
nand: Toshiba NAND 128MiB 1,8V 8-bit
nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
flash size: 128 MiB
page size: 512 bytes
OOB area size: 16 bytes
sector size: 16 KiB
pages number: 262144
pages per sector: 32
bus width: 8
bits in sector size: 14
bits in page size: 9
bits in OOB size: 4
flash size with OOB: 135168 KiB
page address bytes: 4
sector address bytes: 3
options: 0x42
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":
0x000000000000-0x000008000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -O 384 -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 128MiB 1,8V 8-bit", size 128 MiB)
ubi0: PEB size: 16384 bytes (16 KiB), LEB size: 15872 bytes
ubi0: min./max. I/O unit sizes: 512/512, sub-page size 256
ubi0: VID header offset: 384 (aligned 256), data offset: 512
ubi0: good PEBs: 8192, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 92
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 3550195649
ubi0: available PEBs: 8028, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160
ubi0: background thread "ubi_bgt0d" started, PID 94
UBI device number 0, total 8192 LEBs (130023424 bytes, 124.0 MiB), available 8028 LEBs (127420416 bytes, 121.5 MiB), LEB size 15872 bytes (15.5 KiB)

zynq> hexdump -C -n 512 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 01 80 00 00 02 00  d3 9b af c1 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 f7 06 13 d3  |................|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000180  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000190  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
000001c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    92
        alignment 1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 15873
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 513
        bytes     127420416
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 8028 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     15872
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 92, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 92, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Micron NAND 256MiB 3,3V 8-bit without subpage support
zynq> modprobe nandsim do_delays=1 subpage=0 first_id_byte=0x2C second
_id_byte=0xDA third_id_byte=0x90 fourth_id_byte=0x95
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
nand: Micron NAND 256MiB 3,3V 8-bit
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 256 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 131072
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 270336 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000010000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 256MiB 3,3V 8-bit", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2741000969
ubi0: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 93
UBI device number 0, total 2048 LEBs (260046848 bytes, 248.0 MiB), available 2004 LEBs (254459904 bytes, 242.6 MiB), LEB size 126976 bytes (124.0 KiB)

zynq> hexdump -C -n 4096 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 08 00 00 00 10 00  a3 60 5b 09 00 00 00 00  |.........`[.....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 65 74 6c af  |............etl.|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000820  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000830  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000840  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 126977
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     254459904
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     126976
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Micron NAND 256MiB 3,3V 8-bit with subpage support
zynq> modprobe nandsim do_delays=1 subpage=1 first_id_byte=0x2C second
_id_byte=0xDA third_id_byte=0x90 fourth_id_byte=0x95
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
nand: Micron NAND 256MiB 3,3V 8-bit
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 256 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 131072
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 270336 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000010000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 256MiB 3,3V 8-bit", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1436200945
ubi0: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 93
UBI device number 0, total 2048 LEBs (264241152 bytes, 252.0 MiB), available 2004 LEBs (258564096 bytes, 246.5 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 1024 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 02 00 00 00 08 00  55 9a af f1 00 00 00 00  |........U.......|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 d2 9b bc f7  |................|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000240  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000400

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Micron NAND 256MiB 3,3V 8-bit with subpage support and vid_hdr
  shift
zynq> modprobe nandsim do_delays=1 subpage=1 first_id_byte=0x2C second
_id_byte=0xDA third_id_byte=0x90 fourth_id_byte=0x95
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
nand: Micron NAND 256MiB 3,3V 8-bit
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 256 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 131072
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 270336 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000010000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -O 1600 -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 256MiB 3,3V 8-bit", size 256 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 1600 (aligned 1536), data offset: 2048
ubi0: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2060544972
ubi0: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 94
UBI device number 0, total 2048 LEBs (264241152 bytes, 252.0 MiB), available 2004 LEBs (258564096 bytes, 246.5 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 2048 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 06 40 00 00 08 00  7a d1 6b cc 00 00 00 00  |...@....z.k.....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 d9 57 22 1e  |.............W".|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000640  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000650  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000660  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000670  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000680  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     258564096
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 2004 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 512MiB 3,3V 8-bit without subpage support
zynq> modprobe nandsim do_delays=1 subpage=0 first_id_byte=0x98 second
_id_byte=0xdc third_id_byte=0x91 fourth_id_byte=0x15
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0xdc
nand: Toshiba NAND 512MiB 3,3V 8-bit
nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 512 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 262144
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 540672 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 512MiB 3,3V 8-bit":
0x000000000000-0x000020000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 512MiB 3,3V 8-bit", size 512 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4096, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 3027964992
ubi0: available PEBs: 4012, total reserved PEBs: 84, PEBs reserved for bad PEB handling: 80
ubi0: background thread "ubi_bgt0d" started, PID 93
UBI device number 0, total 4096 LEBs (520093696 bytes, 496.0 MiB), available 4012 LEBs (509427712 bytes, 485.8 MiB), LEB size 126976 bytes (124.0 KiB)

zynq> hexdump -C -n 4096 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 08 00 00 00 10 00  b4 7b 14 40 00 00 00 00  |.........{.@....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 cb 04 bb 52  |...............R|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000820  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000830  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000840  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 126977
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     509427712
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     126976
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 512MiB 3,3V 8-bit with subpage support
zynq> modprobe nandsim do_delays=1 subpage=1 first_id_byte=0x98 second
_id_byte=0xdc third_id_byte=0x91 fourth_id_byte=0x15
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0xdc
nand: Toshiba NAND 512MiB 3,3V 8-bit
nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 512 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 262144
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 540672 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 512MiB 3,3V 8-bit":
0x000000000000-0x000020000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 512MiB 3,3V 8-bit", size 512 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 4096, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 330582522
ubi0: available PEBs: 4012, total reserved PEBs: 84, PEBs reserved for bad PEB handling: 80
ubi0: background thread "ubi_bgt0d" started, PID 92
UBI device number 0, total 4096 LEBs (528482304 bytes, 504.0 MiB), available 4012 LEBs (517644288 bytes, 493.6 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 2048 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 02 00 00 00 08 00  13 b4 49 fa 00 00 00 00  |..........I.....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 76 50 d5 f2  |............vP..|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
00000240  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

- nandsim: Toshiba NAND 512MiB 3,3V 8-bit with subpage support and vid_hdr
  shift
zynq> modprobe nandsim do_delays=1 subpage=1 first_id_byte=0x98 second
_id_byte=0xdc third_id_byte=0x91 fourth_id_byte=0x15
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
nand: device found, Manufacturer ID: 0x98, Chip ID: 0xdc
nand: Toshiba NAND 512MiB 3,3V 8-bit
nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
flash size: 512 MiB
page size: 2048 bytes
OOB area size: 64 bytes
sector size: 128 KiB
pages number: 262144
pages per sector: 64
bus width: 8
bits in sector size: 17
bits in page size: 11
bits in OOB size: 6
flash size with OOB: 540672 KiB
page address bytes: 5
sector address bytes: 3
options: 0x8
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 512MiB 3,3V 8-bit":
0x000000000000-0x000020000000 : "NAND simulator partition 0"

zynq> ./mnt/mtd-utils/ubiattach -O 1152 -m 0
ubi0: attaching mtd0
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd0 (name "NAND 512MiB 3,3V 8-bit", size 512 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 1152 (aligned 1024), data offset: 2048
ubi0: good PEBs: 4096, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 3375335517
ubi0: available PEBs: 4012, total reserved PEBs: 84, PEBs reserved for bad PEB handling: 80
ubi0: background thread "ubi_bgt0d" started, PID 93
UBI device number 0, total 4096 LEBs (528482304 bytes, 504.0 MiB), available 4012 LEBs (517644288 bytes, 493.6 MiB), LEB size 129024 bytes (126.0 KiB)

zynq> hexdump -C -n 2048 /dev/mtd0
00000000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 01  |UBI#............|
00000010  00 00 04 80 00 00 08 00  c9 2f 88 5d 00 00 00 00  |........./.]....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 40 05 05 1e  |............@...|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000480  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00000490  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000004a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000004b0  00 00 00 00 00 00 00 00  00 00 00 00 65 b3 bd 2d  |............e..-|
000004c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000800

zynq> ./mnt/mtd-utils/tests/ubi-tests/runubitests.sh /dev/ubi0
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    -2
        alignment 1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    128
        alignment 1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 0
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment -1
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 129025
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 2049
        bytes     517644288
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     -1
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     0
        vol_type  3
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_create_volume: not enough PEBs, only 4012 available
ubi0 error: ubi_create_volume: cannot create volume 0, error -28
ubi0 error: ubi_cdev_ioctl: bad volume creation request
Volume creation request dump:
        vol_id    0
        alignment 1
        bytes     129024
        vol_type  7
        name_len  22
        1st 16 characters of name: mkvol_bad:test_m
ubi0 error: ubi_create_volume: volume 0 already exists
ubi0 error: ubi_create_volume: cannot create volume 0, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_create_volume: volume "mkvol_bad:test_mkvol()" exists (ID 0)
ubi0 error: ubi_create_volume: cannot create volume 1, error -17
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume -1, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 128, error -22
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
ubi0 error: ubi_open_volume: cannot open device 0, volume 0, error -19
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
Running io_update /dev/ubi0
Running io_paral /dev/ubi0
Running volrefcnt /dev/ubi0
SUCCESS

Cheng Ming Lin (1):
  mtd: ubi: skip programming unused bits in ubi headers

 drivers/mtd/ubi/io.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ