debuggers.hg

view tools/ioemu/Makefile.target @ 10959:4c2fab8f8c34

[qemu] Use xenstore to configure ioemu block devices.
- read ioemu block device config from xenstore
- don't require the ioemu: prefix on block devices any longer
- allow change of media associated with cdrom drives
- replace cdrom= option by :cdrom suffix on regular block device config:
'file:/root/mytest.iso,hdc:cdrom,r'
- don't create default cdrom drive anymore - to create default empty
cdrom drive use: ',hdc:cdrom,r'

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author chris@kneesaa.uk.xensource.com
date Thu Aug 03 18:28:29 2006 +0100 (2006-08-03)
parents b450f21472a0
children 08a11694b109
line source
1 include config.mak
3 XEN_ROOT=../../..
4 include $(XEN_ROOT)/tools/Rules.mk
6 TARGET_BASE_ARCH:=$(TARGET_ARCH)
7 ifeq ($(TARGET_ARCH), x86_64)
8 TARGET_BASE_ARCH:=i386
9 endif
10 ifeq ($(TARGET_ARCH), ppc64)
11 TARGET_BASE_ARCH:=ppc
12 endif
13 ifeq ($(TARGET_ARCH), sparc64)
14 TARGET_BASE_ARCH:=sparc
15 endif
16 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)$(TARGET_SUB)
17 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
18 DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
19 DEFINES+= -I$(XEN_ROOT)/tools/libxc
20 DEFINES+= -I$(XEN_ROOT)/tools/xenstore
21 ifdef CONFIG_USER_ONLY
22 VPATH+=:$(SRC_PATH)/linux-user
23 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
24 endif
25 CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
26 SSE2 := $(call test-gcc-flag,$(CC),-msse2)
27 ifeq ($(SSE2),-msse2)
28 CFLAGS += -DUSE_SSE2=1 -msse2
29 endif
30 CFLAGS+= $(LOCAL_CFLAGS)
31 #CFLAGS+=-Werror
32 LDFLAGS=-g
33 LIBS=
34 HELPER_CFLAGS=$(CFLAGS)
35 DYNGEN=../dyngen$(EXESUF)
36 # user emulator name
37 TARGET_ARCH2=$(TARGET_ARCH)
38 ifeq ($(TARGET_ARCH),arm)
39 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
40 TARGET_ARCH2=armeb
41 endif
42 endif
43 ifeq ($(TARGET_ARCH),mips)
44 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
45 TARGET_ARCH2=mipsel
46 endif
47 endif
48 QEMU_USER=qemu-$(TARGET_ARCH2)
49 # system emulator name
50 ifdef CONFIG_SOFTMMU
51 ifeq ($(TARGET_ARCH), i386)
52 QEMU_SYSTEM=qemu$(EXESUF)
53 else
54 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
55 endif
56 else
57 QEMU_SYSTEM=qemu-fast
58 endif
60 QEMU_SYSTEM=qemu-dm
62 ifdef CONFIG_USER_ONLY
63 PROGS=$(QEMU_USER)
64 else
65 PROGS+=$(QEMU_SYSTEM)
66 ifndef CONFIG_SOFTMMU
67 CONFIG_STATIC=y
68 endif
69 endif # !CONFIG_USER_ONLY
71 ifdef CONFIG_STATIC
72 LDFLAGS+=-static
73 endif
75 ifeq ($(ARCH),i386)
76 CFLAGS+=-fomit-frame-pointer
77 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
78 ifeq ($(HAVE_GCC3_OPTIONS),yes)
79 OP_CFLAGS+= -falign-functions=0 -fno-gcse
80 else
81 OP_CFLAGS+= -malign-functions=0
82 endif
84 ifdef TARGET_GPROF
85 USE_I386_LD=y
86 endif
87 ifdef CONFIG_STATIC
88 USE_I386_LD=y
89 endif
90 ifdef USE_I386_LD
91 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
92 else
93 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
94 # that the kernel ELF loader considers as an executable. I think this
95 # is the simplest way to make it self virtualizable!
96 LDFLAGS+=-Wl,-shared
97 endif
98 endif
100 ifeq ($(ARCH),x86_64)
101 OP_CFLAGS=$(CFLAGS) -falign-functions=0
102 LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
103 endif
105 ifeq ($(ARCH),ppc)
106 CFLAGS+= -D__powerpc__
107 OP_CFLAGS=$(CFLAGS)
108 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
109 endif
111 ifeq ($(ARCH),s390)
112 OP_CFLAGS=$(CFLAGS)
113 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
114 endif
116 ifeq ($(ARCH),sparc)
117 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
118 LDFLAGS+=-m32
119 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
120 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
121 # -static is used to avoid g1/g3 usage by the dynamic linker
122 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
123 endif
125 ifeq ($(ARCH),sparc64)
126 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
127 LDFLAGS+=-m64
128 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
129 endif
131 ifeq ($(ARCH),alpha)
132 # -msmall-data is not used because we want two-instruction relocations
133 # for the constant constructions
134 OP_CFLAGS=-Wall -O2 -g
135 # Ensure there's only a single GP
136 CFLAGS += -msmall-data
137 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
138 endif
140 ifeq ($(ARCH),ia64)
141 CFLAGS += -mno-sdata
142 OP_CFLAGS=$(CFLAGS)
143 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
144 endif
146 ifeq ($(ARCH),arm)
147 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
148 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
149 endif
151 ifeq ($(ARCH),m68k)
152 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
153 LDFLAGS+=-Wl,-T,m68k.ld
154 endif
156 ifeq ($(HAVE_GCC3_OPTIONS),yes)
157 # very important to generate a return at the end of every operation
158 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
159 endif
161 ifeq ($(CONFIG_DARWIN),yes)
162 OP_CFLAGS+= -mdynamic-no-pic
163 LIBS+=-lmx
164 endif
166 #########################################################
168 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
169 LIBS+=-lm
170 LIBS+=-L../../libxc -lxenctrl -lxenguest
171 LIBS+=-L../../xenstore -lxenstore
172 LIBS+=-lpthread
173 ifndef CONFIG_USER_ONLY
174 LIBS+=-lz
175 endif
176 ifdef CONFIG_WIN32
177 LIBS+=-lwinmm -lws2_32 -liphlpapi
178 endif
179 ifdef CONFIG_SOLARIS
180 LIBS+=-lsocket -lnsl -lresolv
181 endif
183 # profiling code
184 ifdef TARGET_GPROF
185 LDFLAGS+=-p
186 main.o: CFLAGS+=-p
187 endif
189 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
190 ifeq ($(TARGET_ARCH), i386)
191 OBJS+= vm86.o
192 endif
193 ifeq ($(TARGET_ARCH), arm)
194 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
195 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
196 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
197 endif
198 SRCS:= $(OBJS:.o=.c)
199 OBJS+= libqemu.a
201 # cpu emulator library
202 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
203 translate.o op.o
204 ifdef CONFIG_SOFTFLOAT
205 LIBOBJS+=fpu/softfloat.o
206 else
207 LIBOBJS+=fpu/softfloat-native.o
208 endif
209 DEFINES+=-I$(SRC_PATH)/fpu
211 ifeq ($(TARGET_ARCH), i386)
212 LIBOBJS+=helper.o helper2.o
213 ifeq ($(ARCH), i386)
214 LIBOBJS+=translate-copy.o
215 endif
216 endif
218 ifeq ($(TARGET_ARCH), x86_64)
219 LIBOBJS+=helper.o helper2.o
220 endif
222 ifeq ($(TARGET_BASE_ARCH), ppc)
223 LIBOBJS+= op_helper.o helper.o
224 endif
226 ifeq ($(TARGET_ARCH), mips)
227 LIBOBJS+= op_helper.o helper.o
228 endif
230 ifeq ($(TARGET_BASE_ARCH), sparc)
231 LIBOBJS+= op_helper.o helper.o
232 endif
234 ifeq ($(TARGET_BASE_ARCH), arm)
235 LIBOBJS+= op_helper.o helper.o
236 endif
238 ifeq ($(TARGET_BASE_ARCH), sh4)
239 LIBOBJS+= op_helper.o helper.o
240 endif
242 # NOTE: the disassembler code is only needed for debugging
243 LIBOBJS+=disas.o
244 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
245 USE_I386_DIS=y
246 endif
247 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
248 USE_I386_DIS=y
249 endif
250 ifdef USE_I386_DIS
251 LIBOBJS+=i386-dis.o
252 endif
253 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
254 LIBOBJS+=alpha-dis.o
255 endif
256 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
257 LIBOBJS+=ppc-dis.o
258 endif
259 ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
260 LIBOBJS+=mips-dis.o
261 endif
262 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
263 LIBOBJS+=sparc-dis.o
264 endif
265 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
266 LIBOBJS+=arm-dis.o
267 endif
268 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
269 LIBOBJS+=m68k-dis.o
270 endif
271 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
272 LIBOBJS+=sh4-dis.o
273 endif
275 ifdef CONFIG_GDBSTUB
276 OBJS+=gdbstub.o
277 endif
279 # qemu-dm objects
280 LIBOBJS=helper2.o exec-dm.o i8259-dm.o
282 all: $(PROGS)
284 $(QEMU_USER): $(OBJS)
285 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
286 ifeq ($(ARCH),alpha)
287 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
288 # the address space (31 bit so sign extending doesn't matter)
289 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
290 endif
292 # must use static linking to avoid leaving stuff in virtual address space
293 VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o
294 VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
295 ifdef CONFIG_WIN32
296 VL_OBJS+=tap-win32.o
297 endif
299 SOUND_HW = sb16.o es1370.o
300 AUDIODRV = audio.o noaudio.o wavaudio.o
301 ifdef CONFIG_SDL
302 AUDIODRV += sdlaudio.o
303 endif
304 ifdef CONFIG_OSS
305 AUDIODRV += ossaudio.o
306 endif
307 ifdef CONFIG_COREAUDIO
308 AUDIODRV += coreaudio.o
309 endif
310 ifdef CONFIG_ALSA
311 AUDIODRV += alsaaudio.o
312 LIBS += -lasound
313 endif
314 ifdef CONFIG_DSOUND
315 AUDIODRV += dsoundaudio.o
316 LIBS += -lole32 -ldxguid
317 endif
318 ifdef CONFIG_FMOD
319 AUDIODRV += fmodaudio.o
320 audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
321 LIBS += $(CONFIG_FMOD_LIB)
322 endif
323 ifdef CONFIG_ADLIB
324 SOUND_HW += fmopl.o adlib.o
325 endif
327 # USB layer
328 VL_OBJS+= usb.o usb-hub.o usb-uhci.o usb-linux.o usb-hid.o
330 # PCI network cards
331 VL_OBJS+= ne2000.o rtl8139.o
333 ifeq ($(TARGET_BASE_ARCH), i386)
334 # Hardware support
335 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
336 VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
337 VL_OBJS+= cirrus_vga.o mixeng.o parallel.o
338 VL_OBJS+= piix4acpi.o
339 VL_OBJS+= xenstore.o
340 DEFINES += -DHAS_AUDIO
341 endif
342 ifeq ($(TARGET_BASE_ARCH), ppc)
343 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
344 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
345 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
346 DEFINES += -DHAS_AUDIO
347 endif
348 ifeq ($(TARGET_ARCH), mips)
349 VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
350 #VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
351 endif
352 ifeq ($(TARGET_BASE_ARCH), sparc)
353 ifeq ($(TARGET_ARCH), sparc64)
354 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o
355 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
356 VL_OBJS+= cirrus_vga.o parallel.o
357 else
358 VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t59.o slavio_intctl.o
359 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o
360 endif
361 endif
362 ifeq ($(TARGET_BASE_ARCH), arm)
363 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
364 VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
365 endif
366 ifeq ($(TARGET_BASE_ARCH), sh4)
367 VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
368 endif
369 ifdef CONFIG_GDBSTUB
370 VL_OBJS+=gdbstub.o
371 endif
372 ifdef CONFIG_SDL
373 VL_OBJS+=sdl.o
374 endif
375 VL_OBJS+=vnc.o
376 ifdef CONFIG_COCOA
377 VL_OBJS+=cocoa.o
378 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
379 ifdef CONFIG_COREAUDIO
380 COCOA_LIBS+=-framework CoreAudio
381 endif
382 endif
383 ifdef CONFIG_SLIRP
384 DEFINES+=-I$(SRC_PATH)/slirp
385 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
386 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
387 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
388 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
389 endif
391 VL_LDFLAGS=
392 # specific flags are needed for non soft mmu emulator
393 ifdef CONFIG_STATIC
394 VL_LDFLAGS+=-static
395 endif
396 ifndef CONFIG_SOFTMMU
397 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
398 endif
399 ifndef CONFIG_DARWIN
400 ifndef CONFIG_WIN32
401 ifndef CONFIG_SOLARIS
402 VL_LIBS=-lutil
403 endif
404 endif
405 endif
406 ifdef TARGET_GPROF
407 vl.o: CFLAGS+=-p
408 VL_LDFLAGS+=-p
409 endif
411 ifeq ($(ARCH),ia64)
412 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
413 endif
415 ifdef CONFIG_WIN32
416 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
417 endif
419 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
420 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
422 cocoa.o: cocoa.m
423 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
425 sdl.o: sdl.c keymaps.c sdl_keysym.h
426 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
428 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
429 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
431 sdlaudio.o: sdlaudio.c
432 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
434 depend: $(SRCS)
435 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
437 vldepend: $(VL_OBJS:.o=.c)
438 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
440 # libqemu
442 libqemu.a: $(LIBOBJS)
443 rm -f $@
444 $(AR) rcs $@ $(LIBOBJS)
446 translate.o: translate.c gen-op.h opc.h cpu.h
448 translate-all.o: translate-all.c opc.h cpu.h
450 translate-op.o: translate-all.c op.h opc.h cpu.h
452 op.h: op.o $(DYNGEN)
453 $(DYNGEN) -o $@ $<
455 opc.h: op.o $(DYNGEN)
456 $(DYNGEN) -c -o $@ $<
458 gen-op.h: op.o $(DYNGEN)
459 $(DYNGEN) -g -o $@ $<
461 op.o: op.c
462 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
464 helper.o: helper.c
465 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
467 ifeq ($(TARGET_BASE_ARCH), i386)
468 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
469 endif
471 ifeq ($(TARGET_ARCH), arm)
472 op.o: op.c op_template.h
473 pl110.o: pl110_template.h
474 endif
476 ifeq ($(TARGET_BASE_ARCH), sparc)
477 op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
478 magic_load.o: elf_op.h
479 endif
481 ifeq ($(TARGET_BASE_ARCH), ppc)
482 op.o: op.c op_template.h op_mem.h
483 op_helper.o: op_helper_mem.h
484 translate.o: translate.c translate_init.c
485 endif
487 ifeq ($(TARGET_ARCH), mips)
488 op.o: op.c op_template.c op_mem.c
489 op_helper.o: op_helper_mem.c
490 endif
492 loader.o: loader.c elf_ops.h
494 ifeq ($(TARGET_ARCH), sh4)
495 op.o: op.c op_mem.c cpu.h
496 op_helper.o: op_helper.c exec.h cpu.h
497 helper.o: helper.c exec.h cpu.h
498 sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
499 shix.o: shix.c sh7750_regs.h sh7750_regnames.h
500 sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
501 tc58128.o: tc58128.c
502 endif
504 %.o: %.c
505 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
507 %.o: %.S
508 $(CC) $(DEFINES) -c -o $@ $<
510 clean:
511 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
513 distclean: clean
514 rm -rf config.mak config.h
516 install: all
517 mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
518 ifneq ($(PROGS),)
519 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
520 endif
521 install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
522 install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
524 ifneq ($(wildcard .depend),)
525 include .depend
526 endif
528 ifeq (1, 0)
529 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
530 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
531 CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
532 endif