From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42803 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pn4K0-0005k0-4P for qemu-devel@nongnu.org; Wed, 09 Feb 2011 02:18:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pn4Jy-0000bz-9D for qemu-devel@nongnu.org; Wed, 09 Feb 2011 02:18:39 -0500 Received: from mail.inorg.chem.msu.ru ([195.208.208.137]:36557 helo=inorg.chem.msu.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pn4Jx-0000XL-US for qemu-devel@nongnu.org; Wed, 09 Feb 2011 02:18:38 -0500 Received: from exb1.main.inorg.chem.msu.ru ([77.241.144.68] verified) by inorg.chem.msu.ru (CommuniGate Pro SMTP 5.2.8) with ESMTPS id 11771769 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 10:18:27 +0300 From: "Anton L. Vinokurov" Date: Wed, 9 Feb 2011 07:18:02 +0000 Message-ID: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> Content-Language: ru-RU Content-Type: multipart/alternative; boundary="_000_2F734DBCC05CAB4DAA198E581D746C1A05AB063Bexh1maininorgch_" MIME-Version: 1.0 Subject: [Qemu-devel] /dev/mtd emulation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" --_000_2F734DBCC05CAB4DAA198E581D746C1A05AB063Bexh1maininorgch_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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, w= hich 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 s= ome 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 --_000_2F734DBCC05CAB4DAA198E581D746C1A05AB063Bexh1maininorgch_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Dear Developers,

 

I am struggling to run some exo= tic box firmware inside of QEMU. Originally it is i386 processor, MontaVist= a-Linux based appliance. I was able to boot and run it, but main guest appl= ication 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<= /p>

Linux (none) 2.6.10_mvl401 #1 T= ue Jun 1 15:50:57 PDT 2010 i686 unknown

~ # ls -la /dev/mtd*=

crw-r--r--    1 = root     root      90, &n= bsp; 0 Oct 16  2008 /dev/mtd0

crw-r--r--    1 = root     root      90, &n= bsp; 2 Oct 16  2008 /dev/mtd1

crw-r--r--    1 = root     root      90, &n= bsp; 4 Oct 16  2008 /dev/mtd2

~ # cat /proc/mtd

dev:    size&nbs= p;  erasesize  name

~ # dmesg | grep mtd=

~ #

 

Well, I am fine to write some e= mulation code, ideally to map some host file to make It visible as /dev/mtd= X from the guest. Would you please give me some hint where to start from?

Unfortunately, neither 2.6.10_m= vl401 sources nor physical appliance itself are not available to me.

 

Regards,

 

Anton Vinokurov

anton@netams.com

 

 

 

--_000_2F734DBCC05CAB4DAA198E581D746C1A05AB063Bexh1maininorgch_-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40658 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pn5Au-00065c-PU for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:13:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pn5At-0000iz-3m for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:13:20 -0500 Received: from mail-yi0-f45.google.com ([209.85.218.45]:38931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pn5As-0000iu-TF for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:13:19 -0500 Received: by yie21 with SMTP id 21so2848861yie.4 for ; Wed, 09 Feb 2011 00:13:18 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> References: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> Date: Wed, 9 Feb 2011 08:13:18 +0000 Message-ID: Subject: Re: [Qemu-devel] /dev/mtd emulation From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Anton L. Vinokurov" Cc: "qemu-devel@nongnu.org" On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38376 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pn5hB-0001jI-DI for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:46:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pn5h9-0008Uq-2R for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:46:41 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:47210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pn5h8-0008Uh-OP for qemu-devel@nongnu.org; Wed, 09 Feb 2011 03:46:39 -0500 Message-ID: <4D52546C.1090908@web.de> Date: Wed, 09 Feb 2011 09:46:36 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3FE014945960CE7EF498FD49" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: /dev/mtd emulation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: "Anton L. Vinokurov" , "qemu-devel@nongnu.org" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3FE014945960CE7EF498FD49 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-02-09 09:13, Stefan Hajnoczi wrote: > On Wed, Feb 9, 2011 at 7:18 AM, Anton L. Vinokurov w= rote: >> ~ # dmesg | grep mtd >> >> ~ # >=20 > Have you tried qemu -drive if=3Dmtd,file=3D/path/to/firmware? >=20 > 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 --------------enig3FE014945960CE7EF498FD49 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk1SVGwACgkQitSsb3rl5xRTmACfT9LVIwKS07RHuoWLZybhc/fl IysAniDd0A9gWZ1LbTKkxROEdju2O6uO =3ZLz -----END PGP SIGNATURE----- --------------enig3FE014945960CE7EF498FD49-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42863 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnC4Y-0003GN-8W for qemu-devel@nongnu.org; Wed, 09 Feb 2011 10:35:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnC4W-00016o-Qf for qemu-devel@nongnu.org; Wed, 09 Feb 2011 10:35:14 -0500 Received: from mail.inorg.chem.msu.ru ([195.208.208.137]:41908 helo=inorg.chem.msu.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnC4W-00016F-EX for qemu-devel@nongnu.org; Wed, 09 Feb 2011 10:35:12 -0500 From: "Anton L. Vinokurov" Date: Wed, 9 Feb 2011 15:34:41 +0000 Message-ID: <2F734DBCC05CAB4DAA198E581D746C1A05AB08A9@exh1.main.inorg.chem.msu.ru> References: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> <4D52546C.1090908@web.de> In-Reply-To: <4D52546C.1090908@web.de> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [Qemu-devel] RE: /dev/mtd emulation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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=3Dhd removable=3D0 file=3Dvimage.dat ro=3D0 drv=3Draw encryp= ted=3D0 mtd0: type=3Dhd removable=3D0 file=3Dfirmware.bin ro=3D0 drv=3Draw encrypte= d=3D0 floppy0: type=3Dfloppy removable=3D1 locked=3D0 [not inserted] sd0: type=3Dfloppy removable=3D1 locked=3D0 [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 Cisc= o ISR routers: 1GHz Celeron CPU, CompactFlash disk, 1Gb DRAM, 1 FastEtherne= t, ... Flash memory chip is STM M50FW080 8Mbit NVRAM. Regards, Anton. -----Original Message----- From: jan.kiszka@web.de [mailto:jan.kiszka@web.de]=20 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 wro= te: >> ~ # dmesg | grep mtd >> >> ~ # >=20 > Have you tried qemu -drive if=3Dmtd,file=3D/path/to/firmware? >=20 > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33121 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnDdZ-0005SQ-P5 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 12:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnDdY-0008AM-5T for qemu-devel@nongnu.org; Wed, 09 Feb 2011 12:15:29 -0500 Received: from mail-qy0-f180.google.com ([209.85.216.180]:33026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnDdY-0008A9-28 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 12:15:28 -0500 Received: by qyk29 with SMTP id 29so319766qyk.4 for ; Wed, 09 Feb 2011 09:15:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <2F734DBCC05CAB4DAA198E581D746C1A05AB08A9@exh1.main.inorg.chem.msu.ru> References: <2F734DBCC05CAB4DAA198E581D746C1A05AB063B@exh1.main.inorg.chem.msu.ru> <4D52546C.1090908@web.de> <2F734DBCC05CAB4DAA198E581D746C1A05AB08A9@exh1.main.inorg.chem.msu.ru> From: Artyom Tarasenko Date: Wed, 9 Feb 2011 18:15:06 +0100 Message-ID: Subject: Re: [Qemu-devel] RE: /dev/mtd emulation Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 wrote= : > Jan, Stefan, > > I've tried indeed but with no luck: > (qemu) info block > ide0-hd0: type=3Dhd removable=3D0 file=3Dvimage.dat ro=3D0 drv=3Draw encr= ypted=3D0 > mtd0: type=3Dhd removable=3D0 file=3Dfirmware.bin ro=3D0 drv=3Draw encryp= ted=3D0 > floppy0: type=3Dfloppy removable=3D1 locked=3D0 [not inserted] > sd0: type=3Dfloppy removable=3D1 locked=3D0 [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 Ci= sco ISR routers: 1GHz Celeron CPU, CompactFlash disk, 1Gb DRAM, 1 FastEther= net, ... 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 wr= ote: >>> ~ # dmesg | grep mtd >>> >>> ~ # >> >> Have you tried qemu -drive if=3Dmtd,file=3D/path/to/firmware? >> >> QEMU has some flash emulation code in >> hw/{nand.c,onenand.c,pflash_cfi01.c,pflash_cfi02.c}. =A0I'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 > > > --=20 Regards, Artyom Tarasenko solaris/sparc under qemu blog: http://tyom.blogspot.com/