Environment:
Fedora 17 64-bit
Android: 4.0.1
1. Go to the android source code directory
2. Execute:
# . build/envsetup.sh
3. Execute
# choosecombo
Select parameters. In these two steps, some compilation parameters and environment variables are set. Follow the android compilation settings.
4. If this is the first compilation, You need to first compile the ADB version under Linux. Otherwise, go to step 2.
Run:
# make adb
5. Install the Linux-Windows cross-compiling environment mingw. The first step is to compile the C program, and the second step is to compile the CPP program.
Run:
# yum install mingw32-gcc# yum install mingw32-gcc-c++
4. Find the corresponding file in the android source code Directory :~ /Android_source_code/build/CORE/Combo/HOST_windows-x86.mk
Run the following code:
# TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-# HOST_C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include# HOST_GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib# HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
To:
# TOOLS_PREFIX := /usr/bin/i686-w64-mingw32-# HOST_C_INCLUDES += /usr/i686-w64-mingw32/sys-root/mingw/include# HOST_GLOBAL_LD_DIRS += -L/usr/i686-w64-mingw32/sys-root/mingw/lib# HOST_CXX := $(TOOLS_PREFIX)g++ -static-libgcc$(TOOLS_EXE_SUFFIX)
The above modification depends on the mingw version.
Last run:
# make USE_MINGW=y adb
Three unrecognized command options may be reported here. I don't know if the mingw version is correct. Currently, the following impacts are also found:
# cc: error: unrecognized command line option ‘-mfloat-abi=softfp’# cc: error: unrecognized command line option ‘-mfpu=vfpv3-d16’# cc: error: unrecognized command line option ‘-mthumb-interwork’
5. Execute:
# make USE_MINGW=y fastboot
Finally to the out/host/windows-x86/bin directory to find what you just compiled.
NOTE: If no package is installed, install the package and try again. Packages such as ncurses.
Reference: http://blog.csdn.net/wzz_momo/article/details/6577039