qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Makefile] Compiling Qemu to dynamic library


From: Halsey Pian
Subject: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library
Date: Wed, 7 Jan 2015 16:36:39 +0800

Dear All,

 

Recently, I would try to compile qemu to a so in order to call qemu internal functions in my program, I’m trying to do this by steps,

 

1.       Add rules in qemu-2.1.2/ rules.mak

 

%.so:

$(call quiet-command,rm -f $@ && $(LINKPROG) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC -shared -DBUILD_DSO  $(CFLAGS) $(address@hidden) $(LDFLAGS) $(LIBS)   -o $@ $^,"  GEN    $(TARGET_DIR)$@")

 

2.       Add target in qemu-2.1.2/Makefile

 

qemu-kvm-obj = vl.o blockdev.o migration.o migration-unix.o qtest.o migration-fd.o ioport.o savevm.o cpus.o

qemu-kvm-obj +=  net/net.o net/queue.o

qemu-kvm-obj += ui/console.o

qemu-kvm-obj += qom/object.o

qemu-kvm-obj += hw/usb/bus.o

qemu-kvm-obj += pixman/pixman/pixman-bits-image.o pixman/pixman/pixman-utils.o

qemu-kvm-obj += qapi/qapi-visit-core.o

 

libqemu.so : $(block-obj-y) $(util-obj-y) qemu-img.o  vmstate.o qemu-file.o $(qemu-kvm-obj) vl.o qapi-event.o migration.o  blockdev.o migration-unix.o qtest.o migration-fd.o

 

as you know, the main entrance for final binary qemu-system-x86_64 is located in vl.c, I just want it and qemu-img.o to be included in the so library, so  it seems that there are many dependent objects above should have to be included,  that would be suffering problem to be fixed below during doing this,

 

There are many platform dependent source code i.e. cpus.c memory.c, how to compile them into so for specific platform? Is there some guidance for building qemu to so? could you give help on this?

 

Thanks a lot!

 

Best Regards

Halsey Pian

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]