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) $($@-cflags) $(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