qemu emulator for the mini2440

scootklein
Posts: 7
Joined: Tue Feb 24, 2009 3:35 pm

Re: qemu emulator for the mini2440

Post by scootklein » Wed Feb 25, 2009 10:44 pm

scott@SCOTTKLEINUBUNTU:/share/git$ git clone git://repo.or.cz/qemu/mini2440.git qemu
Initialized empty Git repository in /share/git/qemu/.git/
remote: Counting objects: 36207, done.
remote: Compressing objects: 100% (8017/8017), done.
remote: Total 36207 (delta 28562), reused 35761 (delta 28144)
Receiving objects: 100% (36207/36207), 12.89 MiB | 3123 KiB/s, done.
Resolving deltas: 100% (28562/28562), done.
scott@SCOTTKLEINUBUNTU:/share/git$ cd qemu
scott@SCOTTKLEINUBUNTU:/share/git/qemu$ find ./ -name "*mini2440*sh*"
scott@SCOTTKLEINUBUNTU:/share/git/qemu$ ls
aes.c block-qcow.c cpu-all.h exec-all.h kqemu.h nbd.c qemu-img.texi softmmu_defs.h tests
aes.h block-raw-posix.c cpu-defs.h exec.c kvm-all.c nbd.h qemu-lock.h softmmu_exec.h texi2pod.pl
aio.c block-raw-win32.c cpu-exec.c feature_to_c.sh kvm.h net.c qemu-log.h softmmu_header.h thunk.c
alpha-dis.c block-vmdk.c cris-dis.c fpu libfdt_env.h net-checksum.c qemu-malloc.c softmmu-semi.h thunk.h
alpha.ld block-vpc.c curses.c gdbstub.c LICENSE net.h qemu-nbd.c softmmu_template.h TODO
a.out.h block-vvfat.c curses_keys.h gdbstub.h linux-user osdep.c qemu-nbd.texi sparc64.ld translate-all.c
arm-dis.c bsd-user cutils.c gdb-xml loader.c osdep.h qemu_socket.h sparc-dis.c uboot_image.h
arm.ld bswap.h d3des.c gen-icount.h m68k-dis.c pc-bios qemu-sockets.c sparc.ld usb-bsd.c
arm-semi.c bt-host.c d3des.h hostregs_helper.h m68k.ld pci-ids.txt qemu-tech.texi sysemu.h usb-linux.c
audio bt-vhci.c darwin-user host-utils.c m68k-semi.c posix-aio-compat.c qemu-timer.h sys-queue.h usb-stub.c
balloon.h buffered_file.c def-helper.h host-utils.h MAINTAINERS posix-aio-compat.h qemu-tool.c tap-win32.c VERSION
block-bochs.c buffered_file.h device_tree.c hpet.h Makefile ppc64.ld readline.c target-alpha vgafont.h
block.c cache-utils.c device_tree.h hppa-dis.c Makefile.target ppc-dis.c README target-arm vl.c
block-cloop.c cache-utils.h disas.c hppa.ld migration.c ppc.ld rules.mak target-cris vnc.c
block-cow.c Changelog disas.h hw migration-exec.c qemu-aio.h s390-dis.c target-i386 vnc.h
block-dmg.c cocoa.m dis-asm.h i386-dis.c migration.h qemu-binfmt-conf.sh s390.ld target-m68k vnchextile.h
block.h configure dma.h i386.ld migration-tcp.c qemu-char.c savevm.c target-mips vnc_keysym.h
block_int.h console.c dma-helpers.c ia64.ld mips-dis.c qemu-char.h sdl.c target-ppc x86_64.ld
block-nbd.c console.h dyngen-exec.h keymaps mipsel.ld qemu-common.h sdl_keysym.h target-sh4 x_keymap.c
block-parallels.c COPYING elf.h keymaps.c mips.ld qemu-doc.texi sh4-dis.c target-sparc
block-qcow2.c COPYING.LIB elf_ops.h kqemu.c monitor.c qemu-img.c slirp tcg
scott@SCOTTKLEINUBUNTU:/share/git/qemu$

LeshaK
Posts: 35
Joined: Wed Jan 14, 2009 1:01 am

Re: qemu emulator for the mini2440

Post by LeshaK » Wed Feb 25, 2009 11:20 pm

Hello buserror!
I get u-boot.bin for mini2440 and put in folder for qemu,
and run:

Code: Select all

qemu-system-arm -M mini2440 -nographic -kernel uImage -m 256 -net nic -net tap,script=./up-tap0.sh
And load kernel from tftp, but sometimes get error then load kernel from tftp
and constantly then i try mount nfs...

my log:

Code: Select all

root@leshak-dev2:/home/-qemu/-root# ./-run-mini2440.sh
mini2440_reset: loaded override u-boot (size 30000)


U-Boot 1.3.2-moko12 (Feb 26 2009 - 10:12:53)

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  64 MiB
*** Warning - bad CRC or NAND, using default environment

In:    serial
Out:   serial
Err:   serial
MAC: 08:08:11:18:12:27
Hit any key to stop autoboot:  0
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'uImage'.
Load address: 0x32000000
Loading: ###############################################################checksum bad
##
         #################################################################
         #################################################################
         #################################################################
         ###########################################
done
Bytes transferred = 1548736 (17a1c0 hex)
## Booting kernel from Legacy Image at 32000000 ...
   Image Name:
   Created:      2009-02-26   7:15:37 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1548672 Bytes =  1.5 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux..................................................................................................... done, booting the kernel.
s3c_timers_write: Bad register 0x40
s3c_uart_write: UART Infra-red mode on
Linux version 2.6.29-rc6 (arm-eldk@leshak-dev2) (gcc version 4.2.2) #2 PREEMPT Thu Feb 26 10:15:31 MSK 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttySAC0,115200 root=/dev/nfs rw nfsroot=10.0.2.2:/opt/share/rootnfs noinitrd ip=10.0.2.15
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61584KB available (2868K code, 242K data, 144K init)
Calibrating delay loop... 223.64 BogoMIPS (lpj=559104)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 520 bytes
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
msgmni has been set to 120
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
nbd: registered device at major 43
usbcore: registered new interface driver ub
dm9000 Ethernet Driver, V1.31
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c4818300,c481c304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)
Driver 'sd' needs updating - please use bus_type methods
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
ohci_hcd: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
mice: PS/2 mouse device common for all mice
s3c_adc_write: Bad register 0x8
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /class/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c_mmci_readw: FIFO underrun
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
IPv4 over IPv4 tunneling driver
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: setting system clock to 2009-02-26 07:16:59 UTC (1235632619)
eth0: link up, 10Mbps, half-duplex, lpa 0x0400
IP-Config: Guessing netmask 255.0.0.0
IP-Config: Complete:
     device=eth0, addr=10.0.2.15, mask=255.0.0.0, gw=255.255.255.255,
     host=10.0.2.15, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=10.0.2.2, rootpath=
Looking up port of RPC 100003/2 on 10.0.2.2
------------[ cut here ]------------
WARNING: at net/sched/sch_generic.c:226 dev_watchdog+0x18c/0x298()
NETDEV WATCHDOG: eth0 (dm9000): transmit timed out
[<c00313e4>] (dump_stack+0x0/0x14) from [<c0047978>] (warn_slowpath+0x68/0x84)
[<c0047910>] (warn_slowpath+0x0/0x84) from [<c021833c>] (dev_watchdog+0x18c/0x298)
 r3:c3852800 r2:c02f1340
 r7:00000014 r6:00000001 r5:c3852800 r4:c0331168
[<c02181b0>] (dev_watchdog+0x0/0x298) from [<c0051f78>] (run_timer_softirq+0x194/0x254)
[<c0051de4>] (run_timer_softirq+0x0/0x254) from [<c004d018>] (__do_softirq+0x68/0x104)
[<c004cfb0>] (__do_softirq+0x0/0x104) from [<c004d384>] (irq_exit+0x44/0x60)
[<c004d340>] (irq_exit+0x0/0x60) from [<c002c058>] (__exception_text_start+0x58/0x6c)
[<c002c000>] (__exception_text_start+0x0/0x6c) from [<c002ca58>] (__irq_svc+0x38/0xc8)
Exception stack(0xc02fbf38 to 0xc02fbf80)
bf20:                                                       f4100000 00000032
bf40: f4100000 60000013 c02fa000 c002e620 c002e620 c0317b68 30025004 41129200
bf60: 30024fd0 c02fbf8c c02fbf80 c02fbf80 c002e680 c002e68c 60000013 ffffffff
 r5:f4000000 r4:ffffffff
[<c002e620>] (default_idle+0x0/0x78) from [<c002e548>] (cpu_idle+0x40/0x74)
[<c002e508>] (cpu_idle+0x0/0x74) from [<c027f818>] (rest_init+0x74/0x88)
 r7:c02fdca0 r6:c0026ea4 r5:c0317724 r4:c02fa000
[<c027f7a4>] (rest_init+0x0/0x88) from [<c0008bb8>] (start_kernel+0x27c/0x2e0)
 r4:c031fca8
[<c000893c>] (start_kernel+0x0/0x2e0) from [<30008034>] (0x30008034)
 r6:c00272a8 r5:c0317bcc r4:c0007175
---[ end trace 21f947910a215f16 ]---
My qq2440 page
Sorry, it's russian, but you can use http://translate.google.com/ (ru > en/...)

LeshaK
Posts: 35
Joined: Wed Jan 14, 2009 1:01 am

Re: qemu emulator for the mini2440

Post by LeshaK » Wed Feb 25, 2009 11:59 pm

scootklein wrote: scott@SCOTTKLEINUBUNTU:/share/qemu_test$ qemu-system-arm -kernel /share/git/linux/mini2440/arch/arm/boot/uImage -initrd mini2440_nand.bin
qemu: fatal: Trying to execute code outside RAM or ROM at 0x30008000

R00=00000000 R01=00000113 R02=00000100 R03=00000000
I use option:
-mtdblock mini2440_nand.bin

And everything work ok,
nand read and write!
My qq2440 page
Sorry, it's russian, but you can use http://translate.google.com/ (ru > en/...)

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Thu Feb 26, 2009 12:32 am

Scott is right, the mini2440 file is not in the public git yet, only in my branch ! (my bad)
But as LeshaK pointed out, it only contains:

Code: Select all

./arm-softmmu/qemu-system-arm \
	-M mini2440 -m 130 \
	-kernel /tftpboot/uImage \
	-mtdblock mini2440_nand.bin \
	-serial stdio \
	-net nic,vlan=0 \
	-net tap,vlan=0,ifname=tap0
LeshaK, yes, the DM9000 doesn't work very well, I'm going to work on that today to try to make it work properly to use NFS. Great stuff having got all that going already! If you want to help feel free :D
BTW the graphics /should/ work -- it starts in 640x480 but will resize to whatever you put in the LCD registers during boot...

Fun isn't it ? :D

scootklein
Posts: 7
Joined: Tue Feb 24, 2009 3:35 pm

Re: qemu emulator for the mini2440

Post by scootklein » Thu Feb 26, 2009 6:47 am

do i need to specifcy a different target other than arm-linux-user in the target list for configure?

scott@SCOTTKLEINUBUNTU:/share/git/qemu$ qemu-system-arm -M ?
Supported machines are:
integratorcp ARM Integrator/CP (ARM926EJ-S) (default)
versatilepb ARM Versatile/PB (ARM926EJ-S)
versatileab ARM Versatile/AB (ARM926EJ-S)
realview ARM RealView Emulation Baseboard (ARM926EJ-S)
akita Akita PDA (PXA270)
spitz Spitz PDA (PXA270)
borzoi Borzoi PDA (PXA270)
terrier Terrier PDA (PXA270)
cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
lm3s811evb Stellaris LM3S811EVB
lm3s6965evb Stellaris LM3S6965EVB
connex Gumstix Connex (PXA255)
verdex Gumstix Verdex (PXA270)
mainstone Mainstone II (PXA27x)

scootklein
Posts: 7
Joined: Tue Feb 24, 2009 3:35 pm

Re: qemu emulator for the mini2440

Post by scootklein » Thu Feb 26, 2009 7:44 am

scott@SCOTTKLEINUBUNTU:/share/qemu_test$ qemu-system-arm -m 130 -kernel uImage -mtdblock mini2440_nand.bin
qemu: fatal: Trying to execute code outside RAM or ROM at 0x30008000

R00=00000000 R01=00000113 R02=00000100 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=30008000
PSR=400001d3 -Z-- A svc32
s00=00000000( 0) s01=00000000( 0) d00=0000000000000000( 0)
s02=00000000( 0) s03=00000000( 0) d01=0000000000000000( 0)
s04=00000000( 0) s05=00000000( 0) d02=0000000000000000( 0)
s06=00000000( 0) s07=00000000( 0) d03=0000000000000000( 0)
s08=00000000( 0) s09=00000000( 0) d04=0000000000000000( 0)
s10=00000000( 0) s11=00000000( 0) d05=0000000000000000( 0)
s12=00000000( 0) s13=00000000( 0) d06=0000000000000000( 0)
s14=00000000( 0) s15=00000000( 0) d07=0000000000000000( 0)
s16=00000000( 0) s17=00000000( 0) d08=0000000000000000( 0)
s18=00000000( 0) s19=00000000( 0) d09=0000000000000000( 0)
s20=00000000( 0) s21=00000000( 0) d10=0000000000000000( 0)
s22=00000000( 0) s23=00000000( 0) d11=0000000000000000( 0)
s24=00000000( 0) s25=00000000( 0) d12=0000000000000000( 0)
s26=00000000( 0) s27=00000000( 0) d13=0000000000000000( 0)
s28=00000000( 0) s29=00000000( 0) d14=0000000000000000( 0)
s30=00000000( 0) s31=00000000( 0) d15=0000000000000000( 0)
FPSCR: 00000000
Aborted





Do we need to use mkimage to generate the uImage? I used the following command to make the uImage.
mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008000 -n linux2.6 -d /share/git/linux/mini2440/arch/arm/boot/Image uImage

Also, do we need to write u-boot.bin to mini2440_nand.bin file?
dd if=u-boot.bin of=mini2440_nand.bin

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Fri Feb 27, 2009 3:09 am

Scott, you are not building the right source somehow, the -M \? should return a mini2440 machine.

To build qemu for just the bit you want (quicker!) do :

./configure --target-list=arm-softmmu
make -j4

I'm going to push my own "work in progress" branch dev-mini2440-buserror -- I'm still working on the dm9000 -- I need to replace the whole FIFO handling but hopefully it will make it work better !

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Fri Feb 27, 2009 10:05 am

I just pushed my own -buserror branch in. it's not very clean, but the dm9000 works a lot better, tftp works for the kernel in u-boot. No nfsroot tho, still investigating...

LeshaK
Posts: 35
Joined: Wed Jan 14, 2009 1:01 am

Re: qemu emulator for the mini2440

Post by LeshaK » Fri Feb 27, 2009 10:11 am

thank you!
My qq2440 page
Sorry, it's russian, but you can use http://translate.google.com/ (ru > en/...)

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Fri Feb 27, 2009 10:43 am

Well it's only partial success. I just fixed the wrong IRQ I was using, but I can't get dhcp/nfs to work somehow, it's bizare.. there must be one small mistake left !

(push the IRQ fix, it solves the kernel oops at boot)

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests