cross compiling qemu


marovada

Member
Joined
Oct 13, 2009
Messages
109
Qemu needs zlib header and libraries to configure. This was easy on the device itself. I just compiled and installed zlib from source.


I then tried to compile qemu on the device but it ran out of memory :blink:


I then set up the cross compiling tools on ubuntu. Qemu will not configure because it can't find zlib :angry: Zlib compiles fine and I can manually copy the libs and header into include and lib folders in the cross compilation folders.


However, qemu insists on searching for zlib in the system include and lib folders no matter what I do :angry:


The config file doesn't recognise --host and --prefix and --interp-prefix don't help. Even manually changing the include for zlib.h in the config file doesn't work because qemu can't find the zlib libraries.


This is driving me crazy. <_<


I looked here but the fix doesn't work for me: some blog


Anyone have any ideas??
 
Have you tried copying the zlib dev files to the systems include and lib directories?
 
Have you tried copying the zlib dev files to the systems include and lib directories?

That was tempting but there are already some zlib files there and it is very dangerous to do this. I think there are warnings everywhere about mixing system files with files compiled for other architectures.


I've created a swap file on my sd card and I'll try and compile again on the device hopefully without running out of memory ;)
 
Last edited by a moderator:
Hmm, it really ought to be possible, but it sounds like you've tried everything I would suggest. I wouldn't propose mixing ARM and linux-x86 libraries in the same place, as you say. Looks like you've already found what looks like the cross-compiler's lib and inc folders.


I think that blog's a red herring - it's describing building something with a GNU toolchain on Windows using mingw - no cross compilation involved, just porting. I'm afraid the only cross compilation I've done is Linux to Windows on x86, so I can't be much help here.
 
I'm guessing your using djwillis toolchain to cross compile, if not, then this is your first step.


I've edited it's configure script a bit :



Code:
grep -n armv7 configure

174:  armv7)

175:	cpu="armv7"

891:  armv7|armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)

1927:  armv4b|armv4l|armv7)



I've used this command-line :



Code:
./configure --prefix=/mnt/utmp/qemu --cross-prefix=${CROSSTOOL}- --cpu=armv7



And here is a part of my current environnement-setup file :



Code:
export SDK_PATH=/usr/local/angstrom/arm TARGET_SYS=arm-angstrom-linux-gnueabi

export CONFIG_SITE=$SDK_PATH/site-config

export PATH=$SDK_PATH/bin:$PATH:$SDK_PATH/$TARGET_SYS/usr/bin

export LIBTOOL_SYSROOT_PATH=$SDK_PATH/$TARGET_SYS

export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS

export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS/usr/lib/pkgconfig

export CPATH="$SDK_PATH/$TARGET_SYS/usr/include:$CPATH" CFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant" CXXFLAGS="-I$SDK_PATH/$TARGET_SYS/usr/include" LDFLAGS="-L$SDK_PATH/$TARGET_SYS/usr/lib -Wl,-rpath,$SDK_PATH/$TARGET_SYS/usr/lib"


export CROSSTOOL="$SDK_PATH/bin/$TARGET_SYS"

export CXX=$CROSSTOOL-g++ CC=$CROSSTOOL-gcc AR=$CROSSTOOL-ar AS=$CROSSTOOL-as RANLIB=$CROSSTOOL-ranlib


zlib is part of the base system, no need to rebuild it : opkg-target install libz-dev.


I've checked (using make V=1) and the build commands seems right. I'll let you finish wht you started :)
 
I'm guessing your using djwillis toolchain to cross compile, if not, then this is your first step.


I've edited it's configure script a bit :



Code:
grep -n armv7 configure

174:  armv7)

175:	cpu="armv7"

891:  armv7|armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)

1927:  armv4b|armv4l|armv7)



I've used this command-line :



Code:
./configure --prefix=/mnt/utmp/qemu --cross-prefix=${CROSSTOOL}- --cpu=armv7



And here is a part of my current environnement-setup file :



Code:
export SDK_PATH=/usr/local/angstrom/arm TARGET_SYS=arm-angstrom-linux-gnueabi

export CONFIG_SITE=$SDK_PATH/site-config

export PATH=$SDK_PATH/bin:$PATH:$SDK_PATH/$TARGET_SYS/usr/bin

export LIBTOOL_SYSROOT_PATH=$SDK_PATH/$TARGET_SYS

export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS

export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS/usr/lib/pkgconfig

export CPATH="$SDK_PATH/$TARGET_SYS/usr/include:$CPATH" CFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant" CXXFLAGS="-I$SDK_PATH/$TARGET_SYS/usr/include" LDFLAGS="-L$SDK_PATH/$TARGET_SYS/usr/lib -Wl,-rpath,$SDK_PATH/$TARGET_SYS/usr/lib"


export CROSSTOOL="$SDK_PATH/bin/$TARGET_SYS"

export CXX=$CROSSTOOL-g++ CC=$CROSSTOOL-gcc AR=$CROSSTOOL-ar AS=$CROSSTOOL-as RANLIB=$CROSSTOOL-ranlib


zlib is part of the base system, no need to rebuild it : opkg-target install libz-dev.


I've checked (using make V=1) and the build commands seems right. I'll let you finish wht you started :)

Thanks Sebt3 and others. With the swap file I managed to compile on the device no problem, although it took about 10 hours :huh:


I have had many problems since. My compiled Qemu boots cd images without issue but it refuses to read hard drive images. I even made an image on my pc with qemu-img, installed windows 98 and booted it on my pc with qemu compiled for windows. I copied the hard drive image to the Pandora and, to my horror, qemu still refused to read it. In fact, even if I tried an iso image as hda instead of cdrom, it refused to read it :angry: There must be a bug in my compiled qemu.


I then tried to compile Bochs but there were so many missing libraries that I gave up.


I've now found a maemo version of bochs that works and am in the middle of experimenting with it. I ran into a keyboard buffer overrun but have persevered in trying to install windows 98. Mouse doesn't seem to work so I may try a usb mouse later on.


I may try to compile an earlier version of the qemu source as an older one worked on maemo but it was so much slower on the Pandora than mine so compiling specifically for the Pandora would work much better.


For some reason I am absolutely obsessed with this stuff :blink:


I'll report more later :D
 
Back
Top