* [Qemu-devel] /dev/mtd emulation
@ 2011-02-09 7:18 Anton L. Vinokurov
2011-02-09 8:13 ` Stefan Hajnoczi
0 siblings, 1 reply; 5+ messages in thread
From: Anton L. Vinokurov @ 2011-02-09 7:18 UTC (permalink / raw)
To: qemu-devel@nongnu.org
[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]
Dear Developers,
I am struggling to run some exotic box firmware inside of QEMU. Originally it is i386 processor, MontaVista-Linux based appliance. I was able to boot and run it, but main guest application fails while reading from /dev/mtd1 (generic open()). To my understanding, it is a some form of onboard flash, which I don't have inside of QEMU guest:
~ # uname -a
Linux (none) 2.6.10_mvl401 #1 Tue Jun 1 15:50:57 PDT 2010 i686 unknown
~ # ls -la /dev/mtd*
crw-r--r-- 1 root root 90, 0 Oct 16 2008 /dev/mtd0
crw-r--r-- 1 root root 90, 2 Oct 16 2008 /dev/mtd1
crw-r--r-- 1 root root 90, 4 Oct 16 2008 /dev/mtd2
...
~ # cat /proc/mtd
dev: size erasesize name
~ # dmesg | grep mtd
~ #
Well, I am fine to write some emulation code, ideally to map some host file to make It visible as /dev/mtdX from the guest. Would you please give me some hint where to start from?
Unfortunately, neither 2.6.10_mvl401 sources nor physical appliance itself are not available to me.
Regards,
Anton Vinokurov
anton@netams.com<mailto:anton@netams.com>
[-- Attachment #2: Type: text/html, Size: 4636 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] /dev/mtd emulation
2011-02-09 7:18 [Qemu-devel] /dev/mtd emulation Anton L. Vinokurov
@ 2011-02-09 8:13 ` Stefan Hajnoczi
2011-02-09 8:46 ` [Qemu-devel] " Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-02-09 8:13 UTC (permalink / raw)
To: Anton L. Vinokurov; +Cc: qemu-devel@nongnu.org
On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov <anton@netams.com> wrote:
> ~ # dmesg | grep mtd
>
> ~ #
Have you tried qemu -drive if=mtd,file=/path/to/firmware?
QEMU has some flash emulation code in
hw/{nand.c,onenand.c,pflash_cfi01.c,pflash_cfi02.c}. I've never used
them but perhaps someone else can help if you provide more details
about the hardware you are trying to emulate.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: /dev/mtd emulation
2011-02-09 8:13 ` Stefan Hajnoczi
@ 2011-02-09 8:46 ` Jan Kiszka
2011-02-09 15:34 ` [Qemu-devel] " Anton L. Vinokurov
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-02-09 8:46 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Anton L. Vinokurov, qemu-devel@nongnu.org
[-- Attachment #1: Type: text/plain, Size: 632 bytes --]
On 2011-02-09 09:13, Stefan Hajnoczi wrote:
> On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov <anton@netams.com> wrote:
>> ~ # dmesg | grep mtd
>>
>> ~ #
>
> Have you tried qemu -drive if=mtd,file=/path/to/firmware?
>
> QEMU has some flash emulation code in
> hw/{nand.c,onenand.c,pflash_cfi01.c,pflash_cfi02.c}. I've never used
> them but perhaps someone else can help if you provide more details
> about the hardware you are trying to emulate.
You also need to wire up that flash device on board init, i.e. add some
pflash_*_register to pc_init1. Check some embedded board for the precise
pattern.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] RE: /dev/mtd emulation
2011-02-09 8:46 ` [Qemu-devel] " Jan Kiszka
@ 2011-02-09 15:34 ` Anton L. Vinokurov
2011-02-09 17:15 ` Artyom Tarasenko
0 siblings, 1 reply; 5+ messages in thread
From: Anton L. Vinokurov @ 2011-02-09 15:34 UTC (permalink / raw)
To: 'jan.kiszka@web.de', Stefan Hajnoczi; +Cc: qemu-devel@nongnu.org
Jan, Stefan,
I've tried indeed but with no luck:
(qemu) info block
ide0-hd0: type=hd removable=0 file=vimage.dat ro=0 drv=raw encrypted=0
mtd0: type=hd removable=0 file=firmware.bin ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
but same time:
~ # cat /dev/mtd0
cat: /dev/mtd0: No such device
~ # cat /dev/mtdblock0
cat: /dev/mtdblock0: No such device or address
Guest /dev/mtd0 is character device but QEMU thinks mtd0 is block.
My hardware is a network module (like NME-CUE, NME-APPRE, NME-WAE) for Cisco ISR routers: 1GHz Celeron CPU, CompactFlash disk, 1Gb DRAM, 1 FastEthernet, ... Flash memory chip is STM M50FW080 8Mbit NVRAM.
Regards,
Anton.
-----Original Message-----
From: jan.kiszka@web.de [mailto:jan.kiszka@web.de]
Sent: Wednesday, February 09, 2011 11:47 AM
To: Stefan Hajnoczi
Cc: Anton L. Vinokurov; qemu-devel@nongnu.org
Subject: Re: /dev/mtd emulation
On 2011-02-09 09:13, Stefan Hajnoczi wrote:
> On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov <anton@netams.com> wrote:
>> ~ # dmesg | grep mtd
>>
>> ~ #
>
> Have you tried qemu -drive if=mtd,file=/path/to/firmware?
>
> QEMU has some flash emulation code in
> hw/{nand.c,onenand.c,pflash_cfi01.c,pflash_cfi02.c}. I've never used
> them but perhaps someone else can help if you provide more details
> about the hardware you are trying to emulate.
You also need to wire up that flash device on board init, i.e. add some
pflash_*_register to pc_init1. Check some embedded board for the precise
pattern.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] RE: /dev/mtd emulation
2011-02-09 15:34 ` [Qemu-devel] " Anton L. Vinokurov
@ 2011-02-09 17:15 ` Artyom Tarasenko
0 siblings, 0 replies; 5+ messages in thread
From: Artyom Tarasenko @ 2011-02-09 17:15 UTC (permalink / raw)
To: Anton L. Vinokurov
Cc: Stefan Hajnoczi, jan.kiszka@web.de, qemu-devel@nongnu.org
On Wed, Feb 9, 2011 at 4:34 PM, Anton L. Vinokurov <anton@netams.com> wrote:
> Jan, Stefan,
>
> I've tried indeed but with no luck:
> (qemu) info block
> ide0-hd0: type=hd removable=0 file=vimage.dat ro=0 drv=raw encrypted=0
> mtd0: type=hd removable=0 file=firmware.bin ro=0 drv=raw encrypted=0
> floppy0: type=floppy removable=1 locked=0 [not inserted]
> sd0: type=floppy removable=1 locked=0 [not inserted]
>
> but same time:
> ~ # cat /dev/mtd0
> cat: /dev/mtd0: No such device
> ~ # cat /dev/mtdblock0
> cat: /dev/mtdblock0: No such device or address
Looks like your guest kernel expects some other type of flash, or
looks for it not where you wired it up?
Maybe there are some hints in the dmesg output?
> Guest /dev/mtd0 is character device but QEMU thinks mtd0 is block.
>
> My hardware is a network module (like NME-CUE, NME-APPRE, NME-WAE) for Cisco ISR routers: 1GHz Celeron CPU, CompactFlash disk, 1Gb DRAM, 1 FastEthernet, ... Flash memory chip is STM M50FW080 8Mbit NVRAM.
>
> Regards,
>
> Anton.
>
>
> -----Original Message-----
> From: jan.kiszka@web.de [mailto:jan.kiszka@web.de]
> Sent: Wednesday, February 09, 2011 11:47 AM
> To: Stefan Hajnoczi
> Cc: Anton L. Vinokurov; qemu-devel@nongnu.org
> Subject: Re: /dev/mtd emulation
>
> On 2011-02-09 09:13, Stefan Hajnoczi wrote:
>> On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov <anton@netams.com> wrote:
>>> ~ # dmesg | grep mtd
>>>
>>> ~ #
>>
>> Have you tried qemu -drive if=mtd,file=/path/to/firmware?
>>
>> QEMU has some flash emulation code in
>> hw/{nand.c,onenand.c,pflash_cfi01.c,pflash_cfi02.c}. I've never used
>> them but perhaps someone else can help if you provide more details
>> about the hardware you are trying to emulate.
>
> You also need to wire up that flash device on board init, i.e. add some
> pflash_*_register to pc_init1. Check some embedded board for the precise
> pattern.
>
> Jan
>
>
>
--
Regards,
Artyom Tarasenko
solaris/sparc under qemu blog: http://tyom.blogspot.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-09 17:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 7:18 [Qemu-devel] /dev/mtd emulation Anton L. Vinokurov
2011-02-09 8:13 ` Stefan Hajnoczi
2011-02-09 8:46 ` [Qemu-devel] " Jan Kiszka
2011-02-09 15:34 ` [Qemu-devel] " Anton L. Vinokurov
2011-02-09 17:15 ` Artyom Tarasenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).