* Emulating MIPS -- please help!
@ 2006-03-28 20:39 Chris Boot
2006-03-28 22:37 ` Daniel Jacobowitz
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Chris Boot @ 2006-03-28 20:39 UTC (permalink / raw)
To: linux-mips
Hi all,
I'm desperately trying to get a MIPS emulator running Linux, and while
I've managed to get gxemul and (I think) qemu running, I can't for the
life of me get them to (1) output anything or (2) use an initrd.
Can anyone post some instructions and, perhaps, a .config for 2.6.16 so
I can get some output like kernel boot messages and a login screen?
I've got gxemul emulating code and running a kernel, which I can test by
stopping emulation and stepping the code. Qemu seems to boot my
qemu-specific kernel but I get no output and qemu appears to hang (won't
take keyboard input). I can't seem to get either emulator to load my
initrd, but that doesn't really matter at this stage since I can't see
anything anyway (I have no idea how to using gxemul, and qemu refuses to
load the image).
Something that could emulate a NEC VR41xx chip would be icing on the
cake, but I'll take anything I can get at this stage.
Many thanks in advance,
Chris
--
Chris Boot
bootc@bootc.net
http://www.bootc.net/
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: Emulating MIPS -- please help! 2006-03-28 20:39 Emulating MIPS -- please help! Chris Boot @ 2006-03-28 22:37 ` Daniel Jacobowitz 2006-03-28 23:58 ` Thiemo Seufer 2006-03-29 6:59 ` Alexander Voropay 2 siblings, 0 replies; 11+ messages in thread From: Daniel Jacobowitz @ 2006-03-28 22:37 UTC (permalink / raw) To: Chris Boot; +Cc: linux-mips On Tue, Mar 28, 2006 at 09:39:02PM +0100, Chris Boot wrote: > I've got gxemul emulating code and running a kernel, which I can test by > stopping emulation and stepping the code. Qemu seems to boot my > qemu-specific kernel but I get no output and qemu appears to hang (won't > take keyboard input). I can't seem to get either emulator to load my > initrd, but that doesn't really matter at this stage since I can't see > anything anyway (I have no idea how to using gxemul, and qemu refuses to > load the image). For qemu, are you looking at its VGA window, or its serial console window? Should use the latter. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-28 20:39 Emulating MIPS -- please help! Chris Boot 2006-03-28 22:37 ` Daniel Jacobowitz @ 2006-03-28 23:58 ` Thiemo Seufer 2006-03-29 15:47 ` Chris Boot 2006-03-29 6:59 ` Alexander Voropay 2 siblings, 1 reply; 11+ messages in thread From: Thiemo Seufer @ 2006-03-28 23:58 UTC (permalink / raw) To: Chris Boot; +Cc: linux-mips On Tue, Mar 28, 2006 at 09:39:02PM +0100, Chris Boot wrote: > Hi all, > > I'm desperately trying to get a MIPS emulator running Linux, and while > I've managed to get gxemul and (I think) qemu running, I can't for the > life of me get them to (1) output anything or (2) use an initrd. > > Can anyone post some instructions and, perhaps, a .config for 2.6.16 so > I can get some output like kernel boot messages and a login screen? > > I've got gxemul emulating code and running a kernel, which I can test by > stopping emulation and stepping the code. Qemu seems to boot my > qemu-specific kernel but I get no output and qemu appears to hang (won't > take keyboard input). VGA support for qemu isn't there yet, use -nographics to get the serial console output. > I can't seem to get either emulator to load my > initrd, but that doesn't really matter at this stage since I can't see > anything anyway (I have no idea how to using gxemul, and qemu refuses to > load the image). Current qemu confuses virtual and physical adresses when loading initrds, this and a bunch of other bugs are fixed in a set of patches I have. Note that these are work in progress, and may cause different bugs. Notably, the gcc4 support patch won't work on x86, and probably only on powerpc. It has, however, emulated IDE support, I use a self-compiled qemu kernel and a Debian/mips image to boot from, no ramdisk. The patchset is available at http://people.debian.org/~ths/qemu-patches-bogus/ Use at your own risk. Thiemo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-28 23:58 ` Thiemo Seufer @ 2006-03-29 15:47 ` Chris Boot 2006-03-29 16:03 ` Thiemo Seufer 0 siblings, 1 reply; 11+ messages in thread From: Chris Boot @ 2006-03-29 15:47 UTC (permalink / raw) To: Thiemo Seufer; +Cc: linux-mips Hi there, On 29 Mar 2006, at 00:58, Thiemo Seufer wrote: > On Tue, Mar 28, 2006 at 09:39:02PM +0100, Chris Boot wrote: >> Hi all, >> >> I'm desperately trying to get a MIPS emulator running Linux, and >> while >> I've managed to get gxemul and (I think) qemu running, I can't for >> the >> life of me get them to (1) output anything or (2) use an initrd. >> >> Can anyone post some instructions and, perhaps, a .config for >> 2.6.16 so >> I can get some output like kernel boot messages and a login screen? >> >> I've got gxemul emulating code and running a kernel, which I can >> test by >> stopping emulation and stepping the code. Qemu seems to boot my >> qemu-specific kernel but I get no output and qemu appears to hang >> (won't >> take keyboard input). > > VGA support for qemu isn't there yet, use -nographics to get the > serial > console output. > >> I can't seem to get either emulator to load my >> initrd, but that doesn't really matter at this stage since I can't >> see >> anything anyway (I have no idea how to using gxemul, and qemu >> refuses to >> load the image). > > Current qemu confuses virtual and physical adresses when loading > initrds, > this and a bunch of other bugs are fixed in a set of patches I have. > Note that these are work in progress, and may cause different bugs. > Notably, the gcc4 support patch won't work on x86, and probably > only on > powerpc. It has, however, emulated IDE support, I use a self-compiled > qemu kernel and a Debian/mips image to boot from, no ramdisk. The > patchset is available at > > http://people.debian.org/~ths/qemu-patches-bogus/ > > Use at your own risk. Thanks for all the help, I've now got a step further (I think) and get a few boot messages from 2.6.16, and it appears as though my initrd loads. However, it gets stuck early in the boot process: bootc@arcadia nsfdb $ qemu-system-mips -kernel linux-2.6.16/arch/mips/ boot/vmlinux.bin -nographic -initrd buildroot/rootfs.mips.squashfs (qemu) mips_r4k_init: load BIOS '/usr/share/qemu/mips_bios.bin' size 131072 Linux version 2.6.16 (bootc@arcadia) (gcc version 3.4.6) #9 Wed Mar 29 16:35:35 BST 2006 CPU revision is: 00018000 Determined physical RAM map: memory: 08000000 @ 00000000 (usable) Built 1 zonelists Kernel command line: console=ttyS0 Primary instruction cache 2kB, physically tagged, 2-way, linesize 16 bytes. Primary data cache 2kB, 2-way, linesize 16 bytes. Synthesized TLB refill handler (19 instructions). Synthesized TLB load handler fastpath (31 instructions). Synthesized TLB store handler fastpath (31 instructions). Synthesized TLB modify handler fastpath (30 instructions). PID hash table entries: 1024 (order: 10, 16384 bytes) Using 100.000 MHz high precision timer. Console: colour dummy device 80x25 Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Memory: 128480k/131072k available (907k kernel code, 2556k reserved, 172k data, 96k init, 0k highmem) Mount-cache hash table entries: 512 Checking for 'wait' instruction... available. At this stage it gets stuck and I have to kill qemu. Any ideas how to debug this? I've only applied the elf-loader patch since I was having trouble applying some of the others to my Ubuntu qemu 0.8.0. Many thanks, Chris -- Chris Boot bootc@bootc.net http://www.bootc.net/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-29 15:47 ` Chris Boot @ 2006-03-29 16:03 ` Thiemo Seufer 2006-03-29 21:31 ` Chris Boot 0 siblings, 1 reply; 11+ messages in thread From: Thiemo Seufer @ 2006-03-29 16:03 UTC (permalink / raw) To: Chris Boot; +Cc: linux-mips On Wed, Mar 29, 2006 at 04:47:23PM +0100, Chris Boot wrote: [snip] > Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) > Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) > Memory: 128480k/131072k available (907k kernel code, 2556k reserved, > 172k data, 96k init, 0k highmem) > Mount-cache hash table entries: 512 > Checking for 'wait' instruction... available. > > At this stage it gets stuck and I have to kill qemu. Any ideas how to > debug this? Familiar symptom, I fixed it but don't remember offhand which patch contains the fix. It was either related to TLB emulation or to kernel-mode/user-mode mismatch. > I've only applied the elf-loader patch since I was having > trouble applying some of the others to my Ubuntu qemu 0.8.0. The patches are for upstream CVS. Thiemo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-29 16:03 ` Thiemo Seufer @ 2006-03-29 21:31 ` Chris Boot 2006-03-30 6:19 ` Domen Puncer 0 siblings, 1 reply; 11+ messages in thread From: Chris Boot @ 2006-03-29 21:31 UTC (permalink / raw) To: Thiemo Seufer; +Cc: linux-mips On 29 Mar 2006, at 17:03, Thiemo Seufer wrote: > On Wed, Mar 29, 2006 at 04:47:23PM +0100, Chris Boot wrote: > [snip] >> Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) >> Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) >> Memory: 128480k/131072k available (907k kernel code, 2556k reserved, >> 172k data, 96k init, 0k highmem) >> Mount-cache hash table entries: 512 >> Checking for 'wait' instruction... available. >> >> At this stage it gets stuck and I have to kill qemu. Any ideas how to >> debug this? > > Familiar symptom, I fixed it but don't remember offhand which patch > contains the fix. It was either related to TLB emulation or to > kernel-mode/user-mode mismatch. Well, I added a few more patches and it finally boots now, but it can't mount the root FS off the RAMDISK. I'm not sure if this is a side-effect of the previous initrd problem or what, but it feels good to be getting further... >> I've only applied the elf-loader patch since I was having >> trouble applying some of the others to my Ubuntu qemu 0.8.0. > > The patches are for upstream CVS. Hmm, well I might give it a shot and see what happens. I'd rather stick with a stable version, but if it gets me somewhere it's probably worth it. Thanks very much, Chris -- Chris Boot bootc@bootc.net http://www.bootc.net/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-29 21:31 ` Chris Boot @ 2006-03-30 6:19 ` Domen Puncer 2006-03-30 8:07 ` Thiemo Seufer 0 siblings, 1 reply; 11+ messages in thread From: Domen Puncer @ 2006-03-30 6:19 UTC (permalink / raw) To: Chris Boot; +Cc: Thiemo Seufer, linux-mips On 29/03/06 22:31 +0100, Chris Boot wrote: > On 29 Mar 2006, at 17:03, Thiemo Seufer wrote: > > >On Wed, Mar 29, 2006 at 04:47:23PM +0100, Chris Boot wrote: > >[snip] > >>Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) > >>Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) > >>Memory: 128480k/131072k available (907k kernel code, 2556k reserved, > >>172k data, 96k init, 0k highmem) > >>Mount-cache hash table entries: 512 > >>Checking for 'wait' instruction... available. > >> > >>At this stage it gets stuck and I have to kill qemu. Any ideas how to > >>debug this? > > > >Familiar symptom, I fixed it but don't remember offhand which patch > >contains the fix. It was either related to TLB emulation or to > >kernel-mode/user-mode mismatch. > > Well, I added a few more patches and it finally boots now, but it > can't mount the root FS off the RAMDISK. I'm not sure if this is a > side-effect of the previous initrd problem or what, but it feels good > to be getting further... I was unable to boot userspace from initrd too. It was loaded to the wrong address or something. "Fixing" that didn't work either. OTOH initramfs worked fine for me. Maybe you can live with that. Domen > > >>I've only applied the elf-loader patch since I was having > >>trouble applying some of the others to my Ubuntu qemu 0.8.0. > > > >The patches are for upstream CVS. > > Hmm, well I might give it a shot and see what happens. I'd rather > stick with a stable version, but if it gets me somewhere it's > probably worth it. > > Thanks very much, > Chris > > -- > Chris Boot > bootc@bootc.net > http://www.bootc.net/ > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-30 6:19 ` Domen Puncer @ 2006-03-30 8:07 ` Thiemo Seufer 2006-03-30 12:48 ` Chris Boot 0 siblings, 1 reply; 11+ messages in thread From: Thiemo Seufer @ 2006-03-30 8:07 UTC (permalink / raw) To: Domen Puncer; +Cc: Chris Boot, linux-mips On Thu, Mar 30, 2006 at 08:19:50AM +0200, Domen Puncer wrote: > On 29/03/06 22:31 +0100, Chris Boot wrote: > > On 29 Mar 2006, at 17:03, Thiemo Seufer wrote: > > > > >On Wed, Mar 29, 2006 at 04:47:23PM +0100, Chris Boot wrote: > > >[snip] > > >>Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) > > >>Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) > > >>Memory: 128480k/131072k available (907k kernel code, 2556k reserved, > > >>172k data, 96k init, 0k highmem) > > >>Mount-cache hash table entries: 512 > > >>Checking for 'wait' instruction... available. > > >> > > >>At this stage it gets stuck and I have to kill qemu. Any ideas how to > > >>debug this? > > > > > >Familiar symptom, I fixed it but don't remember offhand which patch > > >contains the fix. It was either related to TLB emulation or to > > >kernel-mode/user-mode mismatch. > > > > Well, I added a few more patches and it finally boots now, but it > > can't mount the root FS off the RAMDISK. I'm not sure if this is a > > side-effect of the previous initrd problem or what, but it feels good > > to be getting further... > > I was unable to boot userspace from initrd too. It was loaded to the > wrong address or something. "Fixing" that didn't work either. It gets loaded to 0x80800000, feeding rd_start/rd_size derived from that address as kernel parameters should work. Thiemo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! 2006-03-30 8:07 ` Thiemo Seufer @ 2006-03-30 12:48 ` Chris Boot 0 siblings, 0 replies; 11+ messages in thread From: Chris Boot @ 2006-03-30 12:48 UTC (permalink / raw) To: Thiemo Seufer; +Cc: Domen Puncer, linux-mips On 30 Mar 2006, at 09:07, Thiemo Seufer wrote: >>> Well, I added a few more patches and it finally boots now, but it >>> can't mount the root FS off the RAMDISK. I'm not sure if this is a >>> side-effect of the previous initrd problem or what, but it feels >>> good >>> to be getting further... >> >> I was unable to boot userspace from initrd too. It was loaded to the >> wrong address or something. "Fixing" that didn't work either. > > It gets loaded to 0x80800000, feeding rd_start/rd_size derived from > that address as kernel parameters should work. That does the trick! Thank you so much! That made my day. Now for a few little fixups and my experiment is a success. Chris Boot messages: bootc@arcadia nsfdb $ qemu-system-mips -kernel linux-2.6.16/arch/mips/ boot/vmlinux.bin -nographic -initrd buildroot/rootfs.mips.squashfs - append "rd_start=0x80800000 rd_size=495616 console=ttyS0" (qemu) mips_r4k_init: load BIOS '/usr/share/qemu/mips_bios.bin' size 131072 Linux version 2.6.16 (bootc@arcadia) (gcc version 3.4.6) #9 Wed Mar 29 16:35:35 BST 2006 CPU revision is: 00018000 Determined physical RAM map: memory: 08000000 @ 00000000 (usable) Initial ramdisk at: 0x80800000 (495616 bytes) Built 1 zonelists Kernel command line: rd_start=0x80800000 rd_size=495616 console=ttyS0 Primary instruction cache 2kB, physically tagged, 2-way, linesize 16 bytes. Primary data cache 2kB, 2-way, linesize 16 bytes. Synthesized TLB refill handler (19 instructions). Synthesized TLB load handler fastpath (31 instructions). Synthesized TLB store handler fastpath (31 instructions). Synthesized TLB modify handler fastpath (30 instructions). PID hash table entries: 1024 (order: 10, 16384 bytes) Using 100.000 MHz high precision timer. Console: colour dummy device 80x25 Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Memory: 121116k/131072k available (907k kernel code, 9920k reserved, 172k data, 96k init, 0k highmem) Mount-cache hash table entries: 512 Checking for 'wait' instruction... available. checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd Freeing initrd memory: 484k freed Squashfs 2.1-r2 (released 2004/12/15) (C) 2002-2004 Phillip Lougher io scheduler noop registered (default) Real Time Clock Driver v1.12ac Software Watchdog Timer: 0.07 initialized. soft_noboot=0 soft_margin=60 sec (nowayout= 0) Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16450 RAMDISK driver initialized: 1 RAM disks of 1024K size 1024 blocksize RAMDISK: squashfs filesystem found at block 0 RAMDISK: Loading 482KiB [1 disk] into ram disk... done. VFS: Mounted root (squashfs filesystem) readonly. Freeing unused kernel memory: 96k freed Initializing random number generator... rm: unable to remove `/etc/ random-seed': Read-only file system urandom start: failed. done. Welcome to the Erik's uClibc development environment. (none) login: -- Chris Boot bootc@bootc.net http://www.bootc.net/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! @ 2006-03-29 6:59 ` Alexander Voropay 0 siblings, 0 replies; 11+ messages in thread From: Alexander Voropay @ 2006-03-29 6:59 UTC (permalink / raw) To: Chris Boot, linux-mips From: "Chris Boot" <bootc@bootc.net> > Can anyone post some instructions and, perhaps, a .config for 2.6.16 so > I can get some output like kernel boot messages and a login screen? I've spent some time playing with GXEmul and Linux kernel. The Linux 2.4.x under GXEemul 0.3.8 works fine. The UART, timer, VGA/pckbd and IDE are working. You could find a precompiled 2.4 kernel with built-in ramdisk there: http://www.nwpi.ru/~alec/mips/ One kernel is compiled with GCC2.9.6 while another with GCC 3.3.5. They shows different CPU frequency under emulator due to the tricky "loop optimization" in the GXEmul/mips. You could use DISK-debian image with pivot_root also to get a mips/debian with glibc and GCC. Use a -di: option to attach an IDE disk image. To run this kernels, use Malta mode: $ ./gxemul -E evbmips -e malta vmlinux_2_4_32-malta-ide-pci-ramdisk.elf.gz Wait a minute to fill GXEmul translation cache. PCI stuff in the GXEmul does not work (try lspci). Unfortunately, I still can't get Linux 2.6.x working under GXEmul. The interrupt routines in the 2.6 was massively changed and this produces IRQ16 spurious interrupt infinity loop. It's reasonable difficult to find such sort of bugs. -- -=AV=- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Emulating MIPS -- please help! @ 2006-03-29 6:59 ` Alexander Voropay 0 siblings, 0 replies; 11+ messages in thread From: Alexander Voropay @ 2006-03-29 6:59 UTC (permalink / raw) To: Chris Boot, linux-mips From: "Chris Boot" <bootc@bootc.net> > Can anyone post some instructions and, perhaps, a .config for 2.6.16 so > I can get some output like kernel boot messages and a login screen? I've spent some time playing with GXEmul and Linux kernel. The Linux 2.4.x under GXEemul 0.3.8 works fine. The UART, timer, VGA/pckbd and IDE are working. You could find a precompiled 2.4 kernel with built-in ramdisk there: http://www.nwpi.ru/~alec/mips/ One kernel is compiled with GCC2.9.6 while another with GCC 3.3.5. They shows different CPU frequency under emulator due to the tricky "loop optimization" in the GXEmul/mips. You could use DISK-debian image with pivot_root also to get a mips/debian with glibc and GCC. Use a -di: option to attach an IDE disk image. To run this kernels, use Malta mode: $ ./gxemul -E evbmips -e malta vmlinux_2_4_32-malta-ide-pci-ramdisk.elf.gz Wait a minute to fill GXEmul translation cache. PCI stuff in the GXEmul does not work (try lspci). Unfortunately, I still can't get Linux 2.6.x working under GXEmul. The interrupt routines in the 2.6 was massively changed and this produces IRQ16 spurious interrupt infinity loop. It's reasonable difficult to find such sort of bugs. -- -=AV=- ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-03-30 12:38 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-03-28 20:39 Emulating MIPS -- please help! Chris Boot 2006-03-28 22:37 ` Daniel Jacobowitz 2006-03-28 23:58 ` Thiemo Seufer 2006-03-29 15:47 ` Chris Boot 2006-03-29 16:03 ` Thiemo Seufer 2006-03-29 21:31 ` Chris Boot 2006-03-30 6:19 ` Domen Puncer 2006-03-30 8:07 ` Thiemo Seufer 2006-03-30 12:48 ` Chris Boot 2006-03-29 6:59 ` Alexander Voropay 2006-03-29 6:59 ` Alexander Voropay
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.