Re: qemu: arm: mounting ubifs using nandsim on busybox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 10 Jun 2021 at 19:22, Richard Weinberger <richard@xxxxxx> wrote:
>
> Pintu,
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@xxxxxxxxx>
> >> nandsim works as expected. It creates a new and *erased* NAND for you.
> >> So you have no UBI volumes. Therfore UBIFS cannot be mounted.
> >> I suggest creating a tiny initramfs that creates UBI volumes before mounting
> >> UBIFS on
> >> one of the freshly created (and empty) volumes.
> >>
> > oh sorry I forgot to mention this.
> > I am able to create and update volumes manually after booting the
> > system with initramfs.
> > {{{
> > Creating rootfs volume:
> > mknod /dev/ubi0 c 250 0
> > mknod /dev/ubi0_0 c 250 1
> > ubiattach /dev/ubi_ctrl -m 2
> > ubimkvol /dev/ubi0 -N rootfs -m
> > ubiupdatevol /dev/ubi0_0 ubifs-rootfs.img
> > mount -t ubifs ubi0:rootfs ubi-root/
> > }}}
> >
> > But I wanted to do all these automatically during boot time itself.
> > Also I wanted to use ubinize.cfg as is from the original system and
> > simulate everything using qemu and nadsim (if possible)
> > So I thought it must be possible by setting some parameters in qemu such as:
> > mtdparts=nand:,
> > -device nand,chip_id=0x39,drive=mtd0,
> > -drive if=mtd,file=./ubi-boot.img,id=mtd0,
> > anything else ?
>
> Well, this has nothing to do with nandsim.
> If qemu can emulate a NAND chip (plus a controller) all you need is a driver on the Linux side.
Okay let me add qemu guys here.
I am not sure which driver is required from Linux side. I thought it
is nandsim only.
Is it some existing driver, or we need to develop a new driver on our own ?
I think it is not able to find the required driver..
I see in the boot log that it is detecting Toshiba nand driver:
===> nand: Toshiba NAND 128MiB 1,8V 8-bit

Also the root volume seems empty.
===> ubi0: empty MTD device detected
How to fill the root volume at boot time ?


These are the commands I am using:
$ mkfs.ubifs -r _install -m 512 -e 15872 -c 5000 -o ubifs-rootfs.img
$ ubinize -o ubi-boot.img -m 512 -p 16KiB -s 256 ubiconfig.cfg
$ qemu-system-arm -M vexpress-a9 -m 512M -kernel
linux/arch/arm/boot/zImage -dtb
linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -append
"console=ttyAMA0,115200 ubi.mtd=2 root=/dev/mtdblock2 rootfstype=ubifs
mtdparts=nand:-(rootfs)" -device nand,chip_id=0x39,drive=mtd0 -drive
if=mtd,file=./ubi-boot.img,id=mtd0 -nographic -smp 4

Any corrections here ?

$ cat ubiconfig.cfg
[rootfs]
mode=ubi
image=./ubifs-rootfs.img
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize


But I am still getting this error:
{{{
List of all partitions:
1f00          131072 mtdblock0
 (driver?)
1f01           32768 mtdblock1
 (driver?)
1f02          131072 mtdblock2
 (driver?)
No filesystem could mount root, tried:
 ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[...]
}}}

Some log references below:
[....]
Using buffer write method
Concatenating MTD devices:
(0): "40000000.flash"
(1): "40000000.flash"
into device "40000000.flash"
physmap-flash 48000000.psram: physmap platform flash device: [mem
0x48000000-0x49ffffff]
[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"
[nandsim] warning: CONFIG_MTD_PARTITIONED_MASTER must be enabled to
expose debugfs stuff
[....]
ubi0: attaching mtd2
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd2 (name "NAND simulator partition 0", 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: 2149713893
ubi0: available PEBs: 8028, total reserved PEBs: 164, PEBs reserved
for bad PEB handling: 160
[...]

Thanks,
Pintu




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux