qemu-devel
[Top][All Lists]
Advanced

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

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


From: Halsey Pian
Subject: Re: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library
Date: Mon, 12 Jan 2015 10:18:06 +0800

Hi All,

 

I have a workaround solution to achieve this. I could just get all the object files required by specific platform executable binary by adding some codes in Makefile, and then compile them to the dynamic library.  Sorry for reading this mail thread. Please ignore it. Thanks!

 

 

 

Best Regards

Halsey Pian

 

From: Halsey Pian [mailto:address@hidden
Sent: 2015
18 12:03
To: address@hidden
Subject: RE: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library

 

Hi All,

 

During building this so library, I found that there are many functions with same name in stubs and other source file, for example,

 

There are two implement functions with same name slirp_pollfds_fill in slirp.c and main-loop.c.

 

./stubs/slirp.c:void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout)

./main-loop.c:    slirp_pollfds_fill(gpollfds, &timeout);

 

Do you know when qemustub should be used? libqemustub.a is only used for qemu-img, qemu-nbd, qemu-io, but not for qemu-system-x86_64(and other platform binary)?

 

Thanks!

 

Best Regards

Halsey Pian

 

From: Halsey Pian [mailto:address@hidden
Sent: 2015
17 16:37
To: address@hidden
Subject: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library

 

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]