All of lore.kernel.org
 help / color / mirror / Atom feed
* Ubinize squashfs in ubiblock.
@ 2017-05-08 12:03 Jonas Rydow
  2017-05-08 12:26 ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Jonas Rydow @ 2017-05-08 12:03 UTC (permalink / raw)
  To: linux-mtd

Hi,

I am using squashfs on ubiblock on a nand flash. This works fine when
flashed on target with ubi tools but when I try to make ubi image with
the squash fs on I run into trouble. The version of the ubi tools is
1.5.2.

Short version:
I have searched but I don't find any info on how to use ubinize to
accomplish the setup with several ubi volumes containing ubiblock
devices with squashfs on top. Any help would be appreciated.

The long version:
The squash rootfs is created like this:
*****************************************
/usr/bin/mksquashfs rootfs rootfs.sqfs
*****************************************
This works fine when flashing on target this way:

# flash_erase /dev/mtd10 0 0
# ubiformat /dev/mtd10 -O 2048

# ubiattach -p /dev/mtd10 -O 2048

# ubimkvol /dev/ubi0 -N rootfs -s 80MiB
# ubiblock -c /dev/ubi0_0
# ubiupdatevol /dev/ubi0_0 rootfs.sqfs
# ls /tmp/sqsh/ #Shows the expected rootfs

I then tried to make a ubi image of the above with the following ini file:
*****************************************
[rootfs-volume]
mode=ubi
image=rootfs.sqfs
vol_id=0
vol_size=80MiB
vol_type=dynamic
vol_name=rootfs

[rootfs-backup-volume]
mode=ubi
image=rootfs.sqfs
vol_id=1
vol_size=80MiB
vol_type=dynamic
vol_name=rootfs-backup
*****************************************

This is then ubinized with the following command:

# ubinize -o rootfs.ubi -m 2048 -p 128KiB -s 512 -O 2048 ubinize.ini

I previously used ubifs instead of squashfs and that worked correctly,
which means that should have working parameters for the flash layout
for in the ubinize command.

I flash this to target:
# flash_erase /dev/mtd10 0 0
# nandwrite -p /dev/mtd10 rootfs.ubi

When I try to attach:
# ubiattach -p /dev/mtd10 -O 2048
I get the following from the kernel:
*****************************************
[  241.198465] ubi0: default fastmap pool size: 95
[  241.203056] ubi0: default fastmap WL pool size: 47
[  241.208834] ubi0: attaching mtd10
[  241.213988] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.220805] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[  241.232551] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.239101] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[  241.250797] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.257261] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[  241.268941] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.275156] ubi0 error: ubi_io_read: error -74 (ECC error) while
reading 64 bytes from PEB 0:0, read 64 bytes
[  241.285453] CPU: 0 PID: 561 Comm: ubiattach Not tainted 4.4.41-g7c580a51af #1
[  241.292624] Hardware name: Generic AM33XX (Flattened Device Tree)
[  241.299074] [<c0015bb0>] (unwind_backtrace) from [<c0012d7c>]
(show_stack+0x10/0x14)
[  241.306908] [<c0012d7c>] (show_stack) from [<c02f5f90>]
(ubi_io_read+0x12c/0x308)
[  241.314436] [<c02f5f90>] (ubi_io_read) from [<c02f63a0>]
(ubi_io_read_ec_hdr+0x48/0x204)
[  241.322890] [<c02f63a0>] (ubi_io_read_ec_hdr) from [<c02fb680>]
(scan_peb.part.1+0x30/0x6f8)
[  241.331408] [<c02fb680>] (scan_peb.part.1) from [<c02fcd20>]
(ubi_attach+0x13c/0x3a8)
[  241.339508] [<c02fcd20>] (ubi_attach) from [<c02f0304>]
(ubi_attach_mtd_dev+0x72c/0xd14)
[  241.347673] [<c02f0304>] (ubi_attach_mtd_dev) from [<c02f1a30>]
(ctrl_cdev_ioctl+0xe8/0x1fc)
[  241.356379] [<c02f1a30>] (ctrl_cdev_ioctl) from [<c00f28a0>]
(do_vfs_ioctl+0x484/0x720)
[  241.364432] [<c00f28a0>] (do_vfs_ioctl) from [<c00f2ba8>]
(SyS_ioctl+0x6c/0x7c)
[  241.372004] [<c00f2ba8>] (SyS_ioctl) from [<c000f620>]
(ret_fast_syscall+0x0/0x3c)
[  241.380133] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.386778] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 512 bytes from PEB 0:2048, read only 512 bytes, retry
[  241.398943] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.405161] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 512 bytes from PEB 0:2048, read only 512 bytes, retry
[  241.417627] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.423851] ubi0 warning: ubi_io_read: error -74 (ECC error) while
reading 512 bytes from PEB 0:2048, read only 512 bytes, retry
[  241.436229] omap2-nand 8000000.nand: uncorrectable bit-flips found
[  241.442451] ubi0 error: ubi_io_read: error -74 (ECC error) while
reading 512 bytes from PEB 0:2048, read 512 bytes
[  241.453097] CPU: 0 PID: 561 Comm: ubiattach Not tainted 4.4.41-g7c580a51af #1
[  241.460294] Hardware name: Generic AM33XX (Flattened Device Tree)
[  241.466659] [<c0015bb0>] (unwind_backtrace) from [<c0012d7c>]
(show_stack+0x10/0x14)
[  241.474455] [<c0012d7c>] (show_stack) from [<c02f5f90>]
(ubi_io_read+0x12c/0x308)
[  241.482221] [<c02f5f90>] (ubi_io_read) from [<c02f65a8>]
(ubi_io_read_vid_hdr+0x4c/0x204)
[  241.490470] [<c02f65a8>] (ubi_io_read_vid_hdr) from [<c02fb770>]
(scan_peb.part.1+0x120/0x6f8)
[  241.499342] [<c02fb770>] (scan_peb.part.1) from [<c02fcd20>]
(ubi_attach+0x13c/0x3a8)
[  241.507240] [<c02fcd20>] (ubi_attach) from [<c02f0304>]
(ubi_attach_mtd_dev+0x72c/0xd14)
[  241.515584] [<c02f0304>] (ubi_attach_mtd_dev) from [<c02f1a30>]
(ctrl_cdev_ioctl+0xe8/0x1fc)
[  241.524073] [<c02f1a30>] (ctrl_cdev_ioctl) from [<c00f28a0>]
(do_vfs_ioctl+0x484/0x720)
[  241.532335] [<c00f28a0>] (do_vfs_ioctl) from [<c00f2ba8>]
(SyS_ioctl+0x6c/0x7c)
[  241.539708] [<c00f2ba8>] (SyS_ioctl) from [<c000f620>]
(ret_fast_syscall+0x0/0x3c)
[  241.548115] omap2-nand 8000000.nand: uncorrectable bit-flips found
*****************************************
Which goes on and on.

I am obviously missing something when I create the rootfs.ubi. Any
ideas of what I am doing wrong? Do I need to prepare the squashfs in
some way to make it suitable for nand usage?

Best regards
Jonas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ubinize squashfs in ubiblock.
  2017-05-08 12:03 Ubinize squashfs in ubiblock Jonas Rydow
@ 2017-05-08 12:26 ` Richard Weinberger
  2017-05-08 13:25   ` Jonas Rydow
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2017-05-08 12:26 UTC (permalink / raw)
  To: Jonas Rydow; +Cc: linux-mtd

Jonas,

On Mon, May 8, 2017 at 2:03 PM, Jonas Rydow <jrydow@gmail.com> wrote:
> I then tried to make a ubi image of the above with the following ini file:
> *****************************************
> [rootfs-volume]
> mode=ubi
> image=rootfs.sqfs
> vol_id=0
> vol_size=80MiB
> vol_type=dynamic
> vol_name=rootfs
>
> [rootfs-backup-volume]
> mode=ubi
> image=rootfs.sqfs
> vol_id=1
> vol_size=80MiB
> vol_type=dynamic
> vol_name=rootfs-backup
> *****************************************

ubinize does not care what volume data you flash. So, it should just work.
BTW: You can also use static volumes for read-only data.

> This is then ubinized with the following command:
>
> # ubinize -o rootfs.ubi -m 2048 -p 128KiB -s 512 -O 2048 ubinize.ini
>
> I previously used ubifs instead of squashfs and that worked correctly,
> which means that should have working parameters for the flash layout
> for in the ubinize command.
>
> I flash this to target:
> # flash_erase /dev/mtd10 0 0
> # nandwrite -p /dev/mtd10 rootfs.ubi

Why -p?

> When I try to attach:
> # ubiattach -p /dev/mtd10 -O 2048
> I get the following from the kernel:
> *****************************************
> [  241.198465] ubi0: default fastmap pool size: 95
> [  241.203056] ubi0: default fastmap WL pool size: 47
> [  241.208834] ubi0: attaching mtd10
> [  241.213988] omap2-nand 8000000.nand: uncorrectable bit-flips found
> [  241.220805] ubi0 warning: ubi_io_read: error -74 (ECC error) while
> reading 64 bytes from PEB 0:0, read only 64 bytes, retry

This error is long before squashfs and mounting. UBI is unable to read the
very first page. Can it be that the process of writing the image is broken?
Please double check.

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ubinize squashfs in ubiblock.
  2017-05-08 12:26 ` Richard Weinberger
@ 2017-05-08 13:25   ` Jonas Rydow
  0 siblings, 0 replies; 3+ messages in thread
From: Jonas Rydow @ 2017-05-08 13:25 UTC (permalink / raw)
  To: linux-mtd

Hi Richard,
thanks for the prompt response. You were right, there was a flaw in my
flashing. I had not detached properly from the mtd device.
running
# ubidetach -d 0
before staring flashing was the key. The attach was done on booting
for some reason even though the mtd10 was empty.

Regarding the nandwrite -p, you are right it is not needed.

Thanks again
Jonas

On Mon, May 8, 2017 at 2:26 PM, Richard Weinberger
<richard.weinberger@gmail.com> wrote:
> Jonas,
>
> On Mon, May 8, 2017 at 2:03 PM, Jonas Rydow <jrydow@gmail.com> wrote:
>> I then tried to make a ubi image of the above with the following ini file:
>> *****************************************
>> [rootfs-volume]
>> mode=ubi
>> image=rootfs.sqfs
>> vol_id=0
>> vol_size=80MiB
>> vol_type=dynamic
>> vol_name=rootfs
>>
>> [rootfs-backup-volume]
>> mode=ubi
>> image=rootfs.sqfs
>> vol_id=1
>> vol_size=80MiB
>> vol_type=dynamic
>> vol_name=rootfs-backup
>> *****************************************
>
> ubinize does not care what volume data you flash. So, it should just work.
> BTW: You can also use static volumes for read-only data.
>
>> This is then ubinized with the following command:
>>
>> # ubinize -o rootfs.ubi -m 2048 -p 128KiB -s 512 -O 2048 ubinize.ini
>>
>> I previously used ubifs instead of squashfs and that worked correctly,
>> which means that should have working parameters for the flash layout
>> for in the ubinize command.
>>
>> I flash this to target:
>> # flash_erase /dev/mtd10 0 0
>> # nandwrite -p /dev/mtd10 rootfs.ubi
>
> Why -p?
>
>> When I try to attach:
>> # ubiattach -p /dev/mtd10 -O 2048
>> I get the following from the kernel:
>> *****************************************
>> [  241.198465] ubi0: default fastmap pool size: 95
>> [  241.203056] ubi0: default fastmap WL pool size: 47
>> [  241.208834] ubi0: attaching mtd10
>> [  241.213988] omap2-nand 8000000.nand: uncorrectable bit-flips found
>> [  241.220805] ubi0 warning: ubi_io_read: error -74 (ECC error) while
>> reading 64 bytes from PEB 0:0, read only 64 bytes, retry
>
> This error is long before squashfs and mounting. UBI is unable to read the
> very first page. Can it be that the process of writing the image is broken?
> Please double check.
>
> --
> Thanks,
> //richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-08 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 12:03 Ubinize squashfs in ubiblock Jonas Rydow
2017-05-08 12:26 ` Richard Weinberger
2017-05-08 13:25   ` Jonas Rydow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.