--- wikisrc/ports/evbarm/qemu_arm.mdwn 2014/01/11 23:04:46 1.3 +++ wikisrc/ports/evbarm/qemu_arm.mdwn 2014/01/12 00:26:13 1.4 @@ -4,22 +4,130 @@ This page attempts to document running N [QEMU](http://wiki.qemu.org/Main_Page) open source processor emulator. This can be extremely useful for development and testing. -This is a placeholder until useful information gets added; once that -is done, it should be linked to the port/evbarm page. - # Introduction - - general notes for what works and what doesn't go here. +QEMU emulates ARM's Integrator/CP board. You can run NetBSD under it. +Older NetBSD had the problem to run under QEMU's emulated Integrator/CP +board. +Sergio López had created the patch for NetBSD current and had posted +to port-arm mailing list in [6 Febrary, 2013](http://mail-index.NetBSD.org/port-arm/2013/02/06/msg001739.html). # Requirements - - information on what is needed (QEMU versions known to work or not, - pointers to how to install via pkgsrc or whatever) - - also information on which evbarm kernels are known to be able to boot - under QEMU. - -# Booting and Installation - - maybe some information about how to actually boot a kernel, first - - how to get networking/etc working - - what kinds of userland are supported and how to get there. +* pkgsrc/emulators/qemu 1.6.2 and 1.7.0 +* INTEGRATOR_CP kernel of NetBSD/evbearm 6.99.28 or later +(some provious versions should work, but not tested) + +## Preparing QEMU +You can install latest qemu with the following commands. +It is assumed that your pkgsrc tree is in /usr/pkgsrc directory. + + # cd /usr/pkgsrc/emulators/qemu + # make install + +## Preparing NetBSD userland and kernel +You can create INTEGRATOR_CP kernel, and kernel/userland tarball with +the following commands. +It is assumed that your NetBSD src tree is in /usr/src directory. + + $ cd /usr/src + $ ./build.sh -U -T /usr/tools/evbearm-el -O /usr/obj/evbearm-el \ + -D /usr/NewWorld/evbearm-el -R /usr/release/evbearm-el \ + -m evbearm release + $ ./build.sh -U -T /usr/tools/evbearm-el -O /usr/obj/evbearm-el \ + -D /usr/NewWorld/evbearm-el -R /usr/release/evbearm-el \ + -m evbearm kernel=INTEGRATOR_CP + +# Booting +INTEGRATOR_CP kernel has no disk drive support. +You should setup netboot environment. + +## Setting up netboot environment +You can use existing NetBSD or other Unix like operating system environment +for host netboot. +You can also utilize qemu-system-amd64 or qemu-system-i386 to host +netboot. + +tftp is not needed, kernel is specified in commandline of qemu-system-arm. +Only NFS root is needed. +In detail see [Diskless NetBSD howto's Setting up the NFS server section](http://www.netbsd.org/docs/network/netboot/nfs.html). + + +# Booting INTEGRATOR_CP kernel +You can boot INTEGRATOR_CP kernel with the following commandline. +It is assumed that the host machine uses bge0 to connect to your network. + + # ifconfig bridge0 create + # brconfig bridge0 add bge0 + # ifconfig bridge0 up + # ifconfig tap0 create + # ifconfig tap0 0.0.0.0 up + # brconfig bridge0 add tap0 + $ qemu-system-arm -M integratorcp -cpu arm1136 -m 512m -kernel netbsd.gz.ub -serial stdio -net nic -net tap,fd=3 3<>/dev/tap0 + +# After booted +You will get the following boot messages. + + Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 + The NetBSD Foundation, Inc. All rights reserved. + Copyright (c) 1982, 1986, 1989, 1991, 1993 + The Regents of the University of California. All rights reserved. + + NetBSD 6.99.28 (INTEGRATOR_CP) #0: Sat Jan 11 23:47:15 UTC 2014 + ryo_on@bismuth.elements.tetera.org:/usr/obj/evbearm-el/sys/arch/evbarm/compile/INTEGRATOR_CP + total memory = 255 MB + avail memory = 246 MB + sysctl_createv: sysctl_create(machine_arch) returned 17 + timecounter: Timecounters tick every 10.000 msec + mainbus0 (root) + cpu0 at mainbus0 core 0: ARM1136J-S r1p3 (ARM11J V6J core) + cpu0: DC enabled IC enabled WB disabled EABT + cpu0: isar: [0]=0x140011 [1]=0x12002111 [2]=0x11231111 [3]=0x1102131, [4]=0x141, [5]=0 + cpu0: mmfr: [0]=0x1130003 [1]=0x10030302 [2]=0x1222110 [3]=0 + cpu0: pfr: [0]=0x111 [1]=0x1 + cpu0: 4KB/32B 4-way L1 Instruction cache + cpu0: 64KB/32B 4-way write-through L1 Data cache + vfp0 at cpu0: VFP11 + vfp0: mvfr: [0]=0x11111111 [1]=0 + ifpga0 at mainbus0: Build 0, Rev A, Manufacturer Unknown, ASB, Little-endian, + ifpga0: FPGA unknown, SYSCLK 2.00MHz + ifpga0: vendor 0x0000 product 0x0000 (miscellaneous prehistoric) + pci_configure_bus done + sm0 at ifpga0 addr 0xb8000000 irq 27 + sm0: SMC91C111, revision 1, buffer size: 8192 + sm0: MAC address 52:54:00:12:34:56, default media MII (internal PHY) + plcom0 at ifpga0 addr 0x6000000 irq 1 + plcom0: console + plcom1 at ifpga0 addr 0x7000000 irq 2 + plrtc0 at ifpga0 addr 0x5000000 + pci0 at ifpga0 bus 0 + pci0: i/o space, memory space enabled + timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0 + clock: hz=100 stathz = 100 profhz = 500 + timecounter: Timecounter "ifpga" frequency 62500 Hz quality 100 + boot device: + root device: sm0 + dump device: + file system (default generic): + root on sm0 + nfs_boot: trying DHCP/BOOTP + nfs_boot: DHCP next-server: 192.168.81.249 + nfs_boot: my_domain=elements.tetera.org + nfs_boot: my_addr=192.168.81.167 + nfs_boot: my_mask=255.255.255.0 + nfs_boot: gateway=192.168.81.1 + root on 192.168.81.249:/exports/integratorcp + root file system type: nfs + init path (default /sbin/init): + init: trying /sbin/init + + +You will see many error messages from src/sys/arch/evbarm/ifpga/ifpga_clock.c. + + statclockhandler: Statclock overrun + +After NetBSD is booted, you can setup sm0 network interface with dhcpcd command. + + # dhcpcd sm0 # Using QEMU to debug the kernel - there is info elsewhere on the wiki about this; maybe adapt to ARM