1: [[!meta title="NetBSD/evbarm under QEMU"]]
2:
3: This page attempts to document running NetBSD/evbarm under the
4: [QEMU](http://www.qemu.org/) open source processor emulator.
5: This can be extremely useful for development and testing.
6:
7: # Introduction
8: QEMU emulates ARM's Integrator/CP board. You can run NetBSD under it.
9: Older NetBSD had the problem to run under QEMU's emulated Integrator/CP
10: board.
11: Sergio López had created the patch for NetBSD current and had posted
12: to port-arm mailing list in [6 Febrary, 2013](http://mail-index.NetBSD.org/port-arm/2013/02/06/msg001739.html).
13:
14: # Requirements
15: * pkgsrc/emulators/qemu 1.6.2 and 1.7.0
16: * INTEGRATOR_CP kernel of NetBSD/evbearm 6.99.28 or later
17: (some provious versions should work, but not tested)
18:
19: ## Preparing QEMU
20: You can install latest qemu with the following commands.
21: It is assumed that your pkgsrc tree is in /usr/pkgsrc directory.
22:
23: # cd /usr/pkgsrc/emulators/qemu
24: # make install
25:
26: ## Preparing NetBSD userland and kernel
27: You can create INTEGRATOR_CP kernel, and kernel/userland tarball with
28: the following commands.
29: It is assumed that your NetBSD src tree is in /usr/src directory.
30:
31: $ cd /usr/src
32: $ ./build.sh -U -T /usr/tools/evbearm-el -O /usr/obj/evbearm-el \
33: -D /usr/NewWorld/evbearm-el -R /usr/release/evbearm-el \
34: -m evbearm release
35: $ ./build.sh -U -T /usr/tools/evbearm-el -O /usr/obj/evbearm-el \
36: -D /usr/NewWorld/evbearm-el -R /usr/release/evbearm-el \
37: -m evbearm kernel=INTEGRATOR_CP
38:
39: # Booting
40: INTEGRATOR_CP kernel has no disk drive support.
41: You should setup netboot environment.
42:
43: ## Setting up netboot environment
44: You can use existing NetBSD or other Unix like operating system environment
45: for host netboot.
46: You can also utilize qemu-system-amd64 or qemu-system-i386 to host
47: netboot.
48:
49: tftp is not needed, kernel is specified in commandline of qemu-system-arm.
50: Only NFS root is needed.
51: In detail see [Diskless NetBSD howto's Setting up the NFS server section](http://www.netbsd.org/docs/network/netboot/nfs.html).
52:
53:
54: # Booting INTEGRATOR_CP kernel
55: You can boot INTEGRATOR_CP kernel with the following commandline.
56: It is assumed that the host machine uses bge0 to connect to your network.
57:
58: # ifconfig bridge0 create
59: # brconfig bridge0 add bge0
60: # ifconfig bridge0 up
61: # ifconfig tap0 create
62: # ifconfig tap0 0.0.0.0 up
63: # brconfig bridge0 add tap0
64: $ cp /usr/obj/evbearm-el/sys/arch/evbarm/compile/INTEGRATOR_CP/netbsd.gz.ub .
65: $ qemu-system-arm -M integratorcp -cpu arm1136 -m 512m -kernel netbsd.gz.ub -serial stdio -net nic -net tap,fd=3 3<>/dev/tap0
66:
67: # After booted
68: You will get the following boot messages.
69:
70: Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
71: 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
72: The NetBSD Foundation, Inc. All rights reserved.
73: Copyright (c) 1982, 1986, 1989, 1991, 1993
74: The Regents of the University of California. All rights reserved.
75:
76: NetBSD 6.99.28 (INTEGRATOR_CP) #0: Sat Jan 11 23:47:15 UTC 2014
77: ryo_on@bismuth.elements.tetera.org:/usr/obj/evbearm-el/sys/arch/evbarm/compile/INTEGRATOR_CP
78: total memory = 255 MB
79: avail memory = 246 MB
80: sysctl_createv: sysctl_create(machine_arch) returned 17
81: timecounter: Timecounters tick every 10.000 msec
82: mainbus0 (root)
83: cpu0 at mainbus0 core 0: ARM1136J-S r1p3 (ARM11J V6J core)
84: cpu0: DC enabled IC enabled WB disabled EABT
85: cpu0: isar: [0]=0x140011 [1]=0x12002111 [2]=0x11231111 [3]=0x1102131, [4]=0x141, [5]=0
86: cpu0: mmfr: [0]=0x1130003 [1]=0x10030302 [2]=0x1222110 [3]=0
87: cpu0: pfr: [0]=0x111 [1]=0x1
88: cpu0: 4KB/32B 4-way L1 Instruction cache
89: cpu0: 64KB/32B 4-way write-through L1 Data cache
90: vfp0 at cpu0: VFP11
91: vfp0: mvfr: [0]=0x11111111 [1]=0
92: ifpga0 at mainbus0: Build 0, Rev A, Manufacturer Unknown, ASB, Little-endian,
93: ifpga0: FPGA unknown, SYSCLK 2.00MHz
94: ifpga0: vendor 0x0000 product 0x0000 (miscellaneous prehistoric)
95: pci_configure_bus done
96: sm0 at ifpga0 addr 0xb8000000 irq 27
97: sm0: SMC91C111, revision 1, buffer size: 8192
98: sm0: MAC address 52:54:00:12:34:56, default media MII (internal PHY)
99: plcom0 at ifpga0 addr 0x6000000 irq 1
100: plcom0: console
101: plcom1 at ifpga0 addr 0x7000000 irq 2
102: plrtc0 at ifpga0 addr 0x5000000
103: pci0 at ifpga0 bus 0
104: pci0: i/o space, memory space enabled
105: timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
106: clock: hz=100 stathz = 100 profhz = 500
107: timecounter: Timecounter "ifpga" frequency 62500 Hz quality 100
108: boot device: <unknown>
109: root device: sm0
110: dump device:
111: file system (default generic):
112: root on sm0
113: nfs_boot: trying DHCP/BOOTP
114: nfs_boot: DHCP next-server: 192.168.81.249
115: nfs_boot: my_domain=elements.tetera.org
116: nfs_boot: my_addr=192.168.81.167
117: nfs_boot: my_mask=255.255.255.0
118: nfs_boot: gateway=192.168.81.1
119: root on 192.168.81.249:/exports/integratorcp
120: root file system type: nfs
121: init path (default /sbin/init):
122: init: trying /sbin/init
123:
124:
125: You will see many error messages from src/sys/arch/evbarm/ifpga/ifpga_clock.c.
126:
127: statclockhandler: Statclock overrun
128:
129: After NetBSD is booted, you can setup sm0 network interface with dhcpcd command.
130:
131: # dhcpcd sm0
132:
133: # Using QEMU to debug the kernel
134: - there is info elsewhere on the wiki about this; maybe adapt to ARM
135: and link?
136:
137: # Additional links
138:
139: # What works
140:
141: # What needs work
142:
143: # more info
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb