Re: [PATCH v7 7/7] mtd: ubi: provide NVMEM layer over UBI volumes
From: Daniel Golle
Date: Fri Mar 22 2024 - 11:57:30 EST
On Tue, Mar 19, 2024 at 11:31:18PM +0100, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "Daniel Golle" <daniel@xxxxxxxxxxxxxx>
> >> BTW: Is there a nice way to test this with nandsim in qemu?
> >> I'd love being able to test all ubi attach code paths on my test setup.
> >
> > From what I can tell 'nandsim' doesn't have a way to be defined in
> > Device Tree, making it unsuitable to test the attachment of UBI in
> > this way.
> >
> > However, QEMU does support emulating TI OMAP's OneNAND controller, eg.
> > as part of the Nokia N810 hardware supported by qemu-system-arm, see
> >
> > https://www.qemu.org/docs/master/system/arm/nseries.html
> >
> > So we could use that and modify the device tree in Linux to have a MTD
> > partition for UBI and 'compatible = "linux,ubi";' set therein:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ti/omap/omap2420-n8x0-common.dtsi#n84
> >
> > If you like I can prepare such a test setup.
>
> This would be great!
>
> > Is there a repository for MTD/UBI tests to be run on QEMU which I should
> > contribute this to?
>
> UBI tests reside in the mtd-utils repository.
> http://git.infradead.org/?p=mtd-utils.git;a=tree;f=tests/ubi-tests;h=20fd6a043eeb96a81736dd07885f74e4e0bb0cc0;hb=HEAD
>
> Maybe you can provide a small shell script which configures qemu?
> It doesn't have to be fancy, just something David or I can use as staring point.
I'm working on it but it turns out to be a bit more difficult than I
thought it would be, because
* the only devices with NAND flash emulated in QEMU or Nokia N800 and
N810 as well as some even more ancient Intel PXA270 based PDA like
the Sharp 'spitz'.
* QEMU support for the N800 and N810 has apparently been bitrotting and
is broken at least since 2019, nobody seems to care much.
* The spitz predates device tree and hence is unsuitable for testing
attachment of UBI via DT. But it at least boots because Guenter Roeck
makes sure it does[1].
I was about to create a spitz-like imaginary board with DT, but also that
doesn't seem to be completely trivial.
So: hold my beer, I'll be back shortly ;)
If anyone has better ideas on how to utilize support for raw NAND or the
OneNAND controller in QEMU in a device-tree environment which actually
works, that'd be great. Obviously I don't care about other peripherals
like Bluetooth and all the complicated stuff of the N80x...
[1]: https://github.com/groeck/linux-build-test/blob/master/rootfs/arm/run-qemu-arm.sh#L64