【已解决】Cygwin下交叉编译Linux内核在make menuconfig时出错:scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file

【问题】

折腾:

【记录】Cygwin下交叉编译Linux内核时用make menuconfig去确认和修改配置

期间,Cygwin下交叉编译linux时,去make menuconfig,虽然已经解决了:

【已解决】Cygwin下交叉编译Linux在make menuconfig时出错:scripts/kconfig/lxdialog/checklist.o:checklist.c: (.text+0×31): undefined reference to `wmove’

但是接着出错:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make menuconfig
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  HOSTCC  scripts/basic/docproc
scripts/basic/docproc.c: In function ‘find_export_symbols’:
scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘singfunc’:
scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘parse_file’:
scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf arch/arm/Kconfig
scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file
make[1]: *** [menuconfig] Error 126
make: *** [menuconfig] Error 2

如图:

scripts kconfig mconf cannot execute binary file

即:

scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file

【解决过程】

1.此处的问题,其实和之前的:

【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译Linux内核在配置时出错:/bin/sh: scripts/basic/fixdep: cannot execute binary file

【已解决】Cygwin下交叉编译内核在配置时出错:scripts/kconfig/conf: scripts/kconfig/conf: cannot execute binary file

完全类似。

都是属于:

make menuconfig时,编译生成的文件,是for linux的,在cygwin下无法运行。

但是注意到同时生成了对应的.exe文件,是可以在cygwin下运行的。

之前是通过改名,就可以解决了。

此处,是想要,找到根本的解决办法,比如类似于:

让makefile中可以检测到当前系统是cygwin,然后调用生成的xxx.exe文件,而不是xxx文件

即可解决此类问题。

2.现在就去想办法试试此方案是否可行。

先去看看,对应的生成的这个文件:

scripts/kconfig/mconf

所在的makefile:

linux-2.6.19.1\scripts\kconfig\Makefile

中,是然后生成对饮的exe文件的。

因为觉得,默认的linux的内核,应该不会生成exe才对。所以估计是已经检测到了cygwin然后才生成的exe。

3.先去另外一个VMWare下的Ubuntu,看看之前编译该Linux,是否生成了exe。

可见,是没有的mconf.exe的:

crifan@ubuntu:kconfig$ ls -lha
total 980K
drwxr-xr-x  4 crifan crifan 4.0K Aug 14 23:39 .
drwxr-xr-x 10 crifan crifan 4.0K Aug 15 00:35 ..
-rwxrwxr-x  1 crifan crifan  82K Aug 14 23:37 conf
-rw-r--r--  1 crifan crifan  12K Oct 17  2012 conf.c
-rw-rw-r--  1 crifan crifan  119 Aug 14 23:37 .conf.cmd
-rw-r--r--  1 crifan crifan  17K Oct 17  2012 confdata.c
-rw-rw-r--  1 crifan crifan  12K Aug 14 23:37 conf.o
-rw-rw-r--  1 crifan crifan 2.9K Aug 14 23:37 .conf.o.cmd
drwxr-xr-x  2 crifan crifan 4.0K Oct 17  2012 CVS
-rw-r--r--  1 crifan crifan  26K Oct 17  2012 expr.c
-rw-r--r--  1 crifan crifan 5.0K Oct 17  2012 expr.h
-rw-r--r--  1 crifan crifan  41K Oct 17  2012 gconf.c
-rw-r--r--  1 crifan crifan  25K Oct 17  2012 gconf.glade
-rw-r--r--  1 crifan crifan  147 Oct 17  2012 .gitignore
-rw-r--r--  1 crifan crifan 6.5K Oct 17  2012 images.c
-rw-r--r--  1 crifan crifan  644 Oct 17  2012 kconfig_load.c
-rw-r--r--  1 crifan crifan 4.0K Oct 17  2012 kxgettext.c
-rw-rw-r--  1 crifan crifan 3.0K Aug 14 23:37 kxgettext.o
-rw-rw-r--  1 crifan crifan 2.5K Aug 14 23:37 .kxgettext.o.cmd
-rw-r--r--  1 crifan crifan  55K Nov  7  2012 lex.zconf.c
-rw-r--r--  1 crifan crifan  55K Oct 17  2012 lex.zconf.c_shipped
-rw-r--r--  1 crifan crifan 3.5K Oct 17  2012 lkc.h
-rw-r--r--  1 crifan crifan 1.8K Oct 17  2012 lkc_proto.h
drwxr-xr-x  3 crifan crifan 4.0K Aug 14 23:39 lxdialog
-rw-r--r--  1 crifan crifan 8.5K Oct 17  2012 Makefile
-rwxrwxr-x  1 crifan crifan 126K Aug 14 23:39 mconf
-rw-r--r--  1 crifan crifan  25K Oct 17  2012 mconf.c
-rw-rw-r--  1 crifan crifan  330 Aug 14 23:39 .mconf.cmd
-rw-rw-r--  1 crifan crifan  28K Aug 14 23:39 mconf.o
-rw-rw-r--  1 crifan crifan 4.5K Aug 14 23:39 .mconf.o.cmd
-rw-r--r--  1 crifan crifan  11K Oct 17  2012 menu.c
-rw-r--r--  1 crifan crifan  123 Oct 17  2012 POTFILES.in
-rw-r--r--  1 crifan crifan  42K Oct 17  2012 qconf.cc
-rw-r--r--  1 crifan crifan 7.8K Oct 17  2012 qconf.h
-rw-r--r--  1 crifan crifan  18K Oct 17  2012 symbol.c
-rw-r--r--  1 crifan crifan 2.2K Oct 17  2012 util.c
-rw-r--r--  1 crifan crifan 1.4K Oct 17  2012 zconf.gperf
-rw-r--r--  1 crifan crifan  11K Nov  7  2012 zconf.hash.c
-rw-r--r--  1 crifan crifan  11K Oct 17  2012 zconf.hash.c_shipped
-rw-r--r--  1 crifan crifan 6.1K Oct 17  2012 zconf.l
-rw-r--r--  1 crifan crifan  64K Nov  7  2012 zconf.tab.c
-rw-r--r--  1 crifan crifan  64K Oct 17  2012 zconf.tab.c_shipped
-rw-rw-r--  1 crifan crifan  83K Aug 14 23:37 zconf.tab.o
-rw-rw-r--  1 crifan crifan 4.2K Aug 14 23:37 .zconf.tab.o.cmd
-rw-r--r--  1 crifan crifan  15K Oct 17  2012 zconf.y
crifan@ubuntu:kconfig$ pwd
/home/crifan/develop/crosscompile/kernel/linux-2.6.19.1/scripts/kconfig
crifan@ubuntu:kconfig$ 

而此处的cygwin下,是有mconf.exe的:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/kconfig/ -lha
total 1.4M
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Aug 23 11:04 ./
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Nov 21  2012 ../
-rw-r--r--  1 CLi            Domänen-Benutzer  117 Aug 22 17:56 .conf.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer 2.2K Aug 22 17:47 .conf.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer  147 Oct 17  2012 .gitignore
-rw-r--r--  1 CLi            Domänen-Benutzer 1.8K Aug 22 17:47 .kxgettext.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer  337 Aug 23 11:04 .mconf.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer 3.0K Aug 23 10:23 .mconf.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer 3.1K Aug 22 17:47 .zconf.tab.o.cmd
-rwxr-xr-x  1 CLi            Domänen-Benutzer 135K Aug 22 18:07 conf*
-rw-r--r--  1 CLi            Domänen-Benutzer  12K Oct 17  2012 conf.c
-rwxr-xr-x  1 CLi            Domänen-Benutzer 135K Aug 22 17:56 conf.exe_backup*
-rw-r--r--  1 CLi            Domänen-Benutzer  12K Aug 22 17:47 conf.o
-rwxr-xr-x  1 CLi            Domänen-Benutzer  75K Nov  7  2012 conf_backup*
-rw-r--r--  1 CLi            Domänen-Benutzer  17K Oct 17  2012 confdata.c
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Oct 17  2012 CVS/
-rw-r--r--  1 CLi            Domänen-Benutzer  26K Oct 17  2012 expr.c
-rw-r--r--  1 CLi            Domänen-Benutzer 5.0K Oct 17  2012 expr.h
-rw-r--r--  1 CLi            Domänen-Benutzer  41K Oct 17  2012 gconf.c
-rw-r--r--  1 CLi            Domänen-Benutzer  25K Oct 17  2012 gconf.glade
-rw-r--r--  1 CLi            Domänen-Benutzer 6.5K Oct 17  2012 images.c
-rw-r--r--  1 CLi            Domänen-Benutzer  644 Oct 17  2012 kconfig_load.c
-rw-r--r--  1 CLi            Domänen-Benutzer 4.0K Oct 17  2012 kxgettext.c
-rw-r--r--  1 CLi            Domänen-Benutzer 2.7K Aug 22 17:47 kxgettext.o
-rw-r--r--  1 CLi            Domänen-Benutzer  55K Nov  7  2012 lex.zconf.c
-rw-r--r--  1 CLi            Domänen-Benutzer  55K Oct 17  2012 lex.zconf.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer 3.5K Oct 17  2012 lkc.h
-rw-r--r--  1 CLi            Domänen-Benutzer 1.8K Oct 17  2012 lkc_proto.h
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Aug 23 10:23 lxdialog/
-rw-r--r--  1 CLi            Domänen-Benutzer 9.0K Aug 23 11:04 Makefile
-rwxr-xr-x  1 Administrators Domänen-Benutzer 8.9K Aug 22 17:55 Makefile.bak*
-rwxr-xr-x  1 CLi            Domänen-Benutzer 104K Oct 17  2012 mconf*
-rw-r--r--  1 CLi            Domänen-Benutzer  25K Oct 17  2012 mconf.c
-rwxr-xr-x  1 CLi            Domänen-Benutzer 186K Aug 23 11:04 mconf.exe*
-rw-r--r--  1 CLi            Domänen-Benutzer  28K Aug 23 10:23 mconf.o
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Oct 17  2012 menu.c
-rw-r--r--  1 CLi            Domänen-Benutzer  123 Oct 17  2012 POTFILES.in
-rw-r--r--  1 CLi            Domänen-Benutzer  42K Oct 17  2012 qconf.cc
-rw-r--r--  1 CLi            Domänen-Benutzer 7.8K Oct 17  2012 qconf.h
-rw-r--r--  1 CLi            Domänen-Benutzer  18K Oct 17  2012 symbol.c
-rw-r--r--  1 CLi            Domänen-Benutzer 2.2K Oct 17  2012 util.c
-rw-r--r--  1 CLi            Domänen-Benutzer 1.4K Oct 17  2012 zconf.gperf
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Nov  7  2012 zconf.hash.c
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Oct 17  2012 zconf.hash.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer 6.1K Oct 17  2012 zconf.l
-rw-r--r--  1 CLi            Domänen-Benutzer  64K Nov  7  2012 zconf.tab.c
-rw-r--r--  1 CLi            Domänen-Benutzer  64K Oct 17  2012 zconf.tab.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer  82K Aug 22 17:47 zconf.tab.o
-rw-r--r--  1 CLi            Domänen-Benutzer  15K Oct 17  2012 zconf.y

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$

4.所以就去分析看看,到底是如何产生的mconf.exe的。

对于

linux-2.6.19.1\scripts\kconfig\Makefile

中,和mconf有关的内容有:

menuconfig: $(obj)/mconf
	$< arch/$(ARCH)/Kconfig

# ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf:	  Used for defconfig, oldconfig and related targets
# mconf:  Used for the mconfig target.
#         Utilizes the lxdialog package
# qconf:  Used for the xconfig target
#         Based on QT which needs to be installed to compile it
# gconf:  Used for the gconfig target
#         Based on GTK which needs to be installed to compile it
# object files used by all kconfig flavours

lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o

conf-objs	:= conf.o  zconf.tab.o
mconf-objs	:= mconf.o zconf.tab.o $(lxdialog)
kxgettext-objs	:= kxgettext.o zconf.tab.o

hostprogs-y := conf qconf gconf kxgettext

ifeq ($(MAKECMDGOALS),menuconfig)
	hostprogs-y += mconf
endif

很明显,还是找不到,如何产生的mconf.exe的。

5。搜:

cygwin make menuconfig mconf.exe

找到一些资料:

http://cfw.sourceforge.net/build_html/build/config/Makefile

其中就有mconf.exe,而且还有之前就在:

【已解决】Cygwin下交叉编译内核在配置时出错:scripts/kconfig/conf: scripts/kconfig/conf: cannot execute binary file

遇到的conf.exe

6.看到:

http://crosstool-ng.org/hg/crosstool-ng/file/3c7c98b6cda9/ct-ng.comp

中提到:

Ignore more in kconfig/:

– on Cygwin, the executables are appended .exe, thus ignore mconf.exe and conf.exe

所以,想到,去kernel的根目录下面的Makefile看看,是否有根据当前系统是cygwin,去append exe。

linux-2.6.19.1\Makefile

结果里面没有exe的东西。

结果其他一些Makefile中,也没找到有关的exe或.exe的东西。

7.算了,此处,打算重新去解压原先的源码

linux-2.6.19.1.tar.bz2

然后重新配置,但是第一次就在命令行中,加上对应的ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi-

看看是否还会有类似这些cannot execute binary file问题。

重新按照:

【记录】Cygwin下用arm-xscale-linux-gnueabi交叉编译Linux内核

的操作,再操作一遍:

CLi@PC-CLI-1 ~/develop/kernel
$ ls
linux-2.6.19.1/  linux-2.6.19.1.tar.bz2*

CLi@PC-CLI-1 ~/develop/kernel
$ mv linux-2.6.19.1/ linux-2.6.19.1_old/

CLi@PC-CLI-1 ~/develop/kernel
$ tar xjf linux-2.6.19.1.tar.bz2

CLi@PC-CLI-1 ~/develop/kernel
$ ls -lha
total 47M
drwxr-xr-x+ 1 CLi            Domänen-Benutzer   0 Aug 23 13:00 ./
drwxr-xr-x+ 1 Administrators Domänen-Benutzer   0 Aug 22 13:33 ../
drwxr-xr-x+ 1 CLi            Domänen-Benutzer   0 Nov 21  2012 linux-2.6.19.1/
-rwxr-xr-x  1 CLi            Domänen-Benutzer 47M Aug 22 13:33 linux-2.6.19.1.tar.bz2*
drwxr-xr-x+ 1 CLi            Domänen-Benutzer   0 Aug 22 18:08 linux-2.6.19.1_old/

CLi@PC-CLI-1 ~/develop/kernel
$ cd linux-2.6.19.1

再修改makefile为:

#ARCH		?= $(SUBARCH)
ARCH            ?=arm
#CROSS_COMPILE	?=arm-linux-
#CROSS_COMPILE	?=arm-xscale-linux-gnu-
CROSS_COMPILE	?=arm-xscale-linux-gnueabi-

然后发现,其实,此时,已经有了这些,原先为linux编译的( for GNU/Linux),但是在Cygwin下无法运行的这些文件:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/
.gitignore  CVS/        docproc     docproc.c   fixdep      fixdep.c    Makefile

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/ -lha
total 66K
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Nov 21  2012 ./
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Nov 21  2012 ../
-rw-r--r--  1 CLi Domänen-Benutzer   29 Oct 17  2012 .gitignore
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Oct 17  2012 CVS/
-rwxr-xr-x  1 CLi Domänen-Benutzer  14K Nov  7  2012 docproc*
-rw-r--r--  1 CLi Domänen-Benutzer  10K Oct 17  2012 docproc.c
-rwxr-xr-x  1 CLi Domänen-Benutzer 9.2K Nov  7  2012 fixdep*
-rw-r--r--  1 CLi Domänen-Benutzer 9.4K Oct 17  2012 fixdep.c
-rw-r--r--  1 CLi Domänen-Benutzer  716 Oct 17  2012 Makefile

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ file scripts/basic/fixdep
scripts/basic/fixdep: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/kconfig/mconf* -lha
-rwxr-xr-x 1 CLi Domänen-Benutzer 104K Oct 17  2012 scripts/kconfig/mconf*
-rw-r--r-- 1 CLi Domänen-Benutzer  25K Oct 17  2012 scripts/kconfig/mconf.c

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ file scripts/kconfig/mconf
scripts/kconfig/mconf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ file scripts/kconfig/conf
scripts/kconfig/conf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1

所以,打算先去完全清除一下:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make help
Cleaning targets:
  clean           - remove most generated files but keep the config and
                    enough build support to build external modules
  mrproper        - remove all generated files + config + various backup files
  distclean       - mrproper + remove editor backup and patch files

Configuration targets:
  config          - Update current config utilising a line-oriented program
  menuconfig      - Update current config utilising a menu based program
  xconfig         - Update current config utilising a QT based front-end
  gconfig         - Update current config utilising a GTK based front-end
  oldconfig       - Update current config utilising a provided .config as base
  silentoldconfig - Same as oldconfig, but quietly
  randconfig      - New config with random answer to all options
  defconfig       - New config with default answer to all options
  allmodconfig    - New config selecting modules when possible
  allyesconfig    - New config where all options are accepted with yes
  allnoconfig     - New config where all options are answered with no

Other generic targets:
  all             - Build all targets marked with [*]
* vmlinux         - Build the bare kernel
* modules         - Build all modules
  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
  dir/            - Build all files in dir and below
  dir/file.[ois]  - Build specified target only
  dir/file.ko     - Build module including final link
  rpm             - Build a kernel as an RPM package
  tags/TAGS       - Generate tags file for editors
  cscope          - Generate cscope index
  kernelrelease   - Output the release version string
  kernelversion   - Output the version stored in Makefile
  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
                    (default: /home/CLi/develop/kernel/linux-2.6.19.1/usr)

Static analysers
  checkstack      - Generate a list of stack hogs
  namespacecheck  - Name space analysis on compiled kernel
  headers_check   - Sanity check on exported headers

Kernel packaging:
  rpm-pkg         - Build the kernel as an RPM package
  binrpm-pkg      - Build an rpm package containing the compiled kernel
                    and modules
  deb-pkg         - Build the kernel as an deb package
  tar-pkg         - Build the kernel as an uncompressed tarball
  targz-pkg       - Build the kernel as a gzip compressed tarball
  tarbz2-pkg      - Build the kernel as a bzip2 compressed tarball

Documentation targets:
  Linux kernel internal documentation in different formats:
  xmldocs (XML DocBook), psdocs (Postscript), pdfdocs (PDF)
  htmldocs (HTML), mandocs (man pages, use installmandocs to install)

Architecture specific targets (arm):
* zImage        - Compressed kernel image (arch/arm/boot/zImage)
  Image         - Uncompressed kernel image (arch/arm/boot/Image)
* xipImage      - XIP kernel image, if configured (arch/arm/boot/xipImage)
  bootpImage    - Combined zImage and initial RAM disk
                  (supply initrd image via make variable INITRD=<path>)
  install       - Install uncompressed kernel
  zinstall      - Install compressed kernel
                  Install using (your) ~/bin/installkernel or
                  (distribution) /sbin/installkernel or
                  install to $(INSTALL_PATH) and run lilo

  assabet_defconfig        - Build for assabet
  at91rm9200dk_defconfig   - Build for at91rm9200dk
  at91rm9200ek_defconfig   - Build for at91rm9200ek
  ateb9200_defconfig       - Build for ateb9200
  badge4_defconfig         - Build for badge4
  carmeva_defconfig        - Build for carmeva
  cerfcube_defconfig       - Build for cerfcube
  clps7500_defconfig       - Build for clps7500
  collie_defconfig         - Build for collie
  corgi_defconfig          - Build for corgi
  csb337_defconfig         - Build for csb337
  csb637_defconfig         - Build for csb637
  ebsa110_defconfig        - Build for ebsa110
  edb7211_defconfig        - Build for edb7211
  ep93xx_defconfig         - Build for ep93xx
  footbridge_defconfig     - Build for footbridge
  fortunet_defconfig       - Build for fortunet
  h3600_defconfig          - Build for h3600
  h7201_defconfig          - Build for h7201
  h7202_defconfig          - Build for h7202
  hackkit_defconfig        - Build for hackkit
  integrator_defconfig     - Build for integrator
  iop32x_defconfig         - Build for iop32x
  iop33x_defconfig         - Build for iop33x
  ixp2000_defconfig        - Build for ixp2000
  ixp23xx_defconfig        - Build for ixp23xx
  ixp4xx_defconfig         - Build for ixp4xx
  jornada720_defconfig     - Build for jornada720
  kafa_defconfig           - Build for kafa
  kb9202_defconfig         - Build for kb9202
  lart_defconfig           - Build for lart
  lpd270_defconfig         - Build for lpd270
  lpd7a400_defconfig       - Build for lpd7a400
  lpd7a404_defconfig       - Build for lpd7a404
  lubbock_defconfig        - Build for lubbock
  lusl7200_defconfig       - Build for lusl7200
  mainstone_defconfig      - Build for mainstone
  mx1ads_defconfig         - Build for mx1ads
  neponset_defconfig       - Build for neponset
  netwinder_defconfig      - Build for netwinder
  netx_defconfig           - Build for netx
  omap_h2_1610_defconfig   - Build for omap_h2_1610
  onearm_defconfig         - Build for onearm
  pleb_defconfig           - Build for pleb
  pnx4008_defconfig        - Build for pnx4008
  pxa255-idp_defconfig     - Build for pxa255-idp
  realview-smp_defconfig   - Build for realview-smp
  realview_defconfig       - Build for realview
  rpc_defconfig            - Build for rpc
  s3c2410_defconfig        - Build for s3c2410
  shannon_defconfig        - Build for shannon
  shark_defconfig          - Build for shark
  simpad_defconfig         - Build for simpad
  spitz_defconfig          - Build for spitz
  trizeps4_defconfig       - Build for trizeps4
  versatile_defconfig      - Build for versatile
  whgs_defconfig           - Build for whgs

  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
  make V=2   [targets] 2 => give reason for rebuild of target
  make O=dir [targets] Locate all output files in "dir", including .config
  make C=1   [targets] Check all c source with $CHECK (sparse by default)
  make C=2   [targets] Force check of all c source with $CHECK

Execute "make" or "make all" to build all targets marked with [*]
For further info see the ./README file

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make mrproper
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config
  CLEAN   .config include/asm .version include/linux/autoconf.h include/linux/version.h include/linux/utsrelease.h Module.symvers

然后发现,fixdep和conf,都没了:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/
.gitignore  CVS/        docproc.c   fixdep.c    Makefile

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/ -lha
total 38K
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:07 ./
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:07 ../
-rw-r--r--  1 CLi Domänen-Benutzer   29 Oct 17  2012 .gitignore
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Oct 17  2012 CVS/
-rw-r--r--  1 CLi Domänen-Benutzer  10K Oct 17  2012 docproc.c
-rw-r--r--  1 CLi Domänen-Benutzer 9.4K Oct 17  2012 fixdep.c
-rw-r--r--  1 CLi Domänen-Benutzer  716 Oct 17  2012 Makefile

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/kconfig/
.gitignore            expr.h                kxgettext.c           Makefile              qconf.cc              zconf.hash.c_shipped
conf.c                gconf.c               lex.zconf.c_shipped   mconf                 qconf.h               zconf.l
confdata.c            gconf.glade           lkc.h                 mconf.c               symbol.c              zconf.tab.c_shipped
CVS/                  images.c              lkc_proto.h           menu.c                util.c                zconf.y
expr.c                kconfig_load.c        lxdialog/             POTFILES.in           zconf.gperf

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/kconfig/ -lha
total 571K
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:07 ./
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:07 ../
-rw-r--r--  1 CLi Domänen-Benutzer  147 Oct 17  2012 .gitignore
-rw-r--r--  1 CLi Domänen-Benutzer  12K Oct 17  2012 conf.c
-rw-r--r--  1 CLi Domänen-Benutzer  17K Oct 17  2012 confdata.c
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Oct 17  2012 CVS/
-rw-r--r--  1 CLi Domänen-Benutzer  26K Oct 17  2012 expr.c
-rw-r--r--  1 CLi Domänen-Benutzer 5.0K Oct 17  2012 expr.h
-rw-r--r--  1 CLi Domänen-Benutzer  41K Oct 17  2012 gconf.c
-rw-r--r--  1 CLi Domänen-Benutzer  25K Oct 17  2012 gconf.glade
-rw-r--r--  1 CLi Domänen-Benutzer 6.5K Oct 17  2012 images.c
-rw-r--r--  1 CLi Domänen-Benutzer  644 Oct 17  2012 kconfig_load.c
-rw-r--r--  1 CLi Domänen-Benutzer 4.0K Oct 17  2012 kxgettext.c
-rw-r--r--  1 CLi Domänen-Benutzer  55K Oct 17  2012 lex.zconf.c_shipped
-rw-r--r--  1 CLi Domänen-Benutzer 3.5K Oct 17  2012 lkc.h
-rw-r--r--  1 CLi Domänen-Benutzer 1.8K Oct 17  2012 lkc_proto.h
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Oct 17  2012 lxdialog/
-rw-r--r--  1 CLi Domänen-Benutzer 8.5K Oct 17  2012 Makefile
-rwxr-xr-x  1 CLi Domänen-Benutzer 104K Oct 17  2012 mconf*
-rw-r--r--  1 CLi Domänen-Benutzer  25K Oct 17  2012 mconf.c
-rw-r--r--  1 CLi Domänen-Benutzer  11K Oct 17  2012 menu.c
-rw-r--r--  1 CLi Domänen-Benutzer  123 Oct 17  2012 POTFILES.in
-rw-r--r--  1 CLi Domänen-Benutzer  42K Oct 17  2012 qconf.cc
-rw-r--r--  1 CLi Domänen-Benutzer 7.8K Oct 17  2012 qconf.h
-rw-r--r--  1 CLi Domänen-Benutzer  18K Oct 17  2012 symbol.c
-rw-r--r--  1 CLi Domänen-Benutzer 2.2K Oct 17  2012 util.c
-rw-r--r--  1 CLi Domänen-Benutzer 1.4K Oct 17  2012 zconf.gperf
-rw-r--r--  1 CLi Domänen-Benutzer  11K Oct 17  2012 zconf.hash.c_shipped
-rw-r--r--  1 CLi Domänen-Benutzer 6.1K Oct 17  2012 zconf.l
-rw-r--r--  1 CLi Domänen-Benutzer  64K Oct 17  2012 zconf.tab.c_shipped
-rw-r--r--  1 CLi Domänen-Benutzer  15K Oct 17  2012 zconf.y

但是还是有mconf,所以再去手动删除一下:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ rm scripts/kconfig/mconf

然后,再去试试,调用默认配置:

make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- whgs_defconfig

看看是否还会有之前的这么些错误。

然后是和之前一样,出现缺少intl库的问题:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- whgs_defconfig
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  HOSTCC  scripts/basic/docproc
scripts/basic/docproc.c: In function ‘find_export_symbols’:
scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘singfunc’:
scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘parse_file’:
scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTCC  scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘strip’:
scripts/kconfig/conf.c:45:2: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/conf.c:53:2: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/conf.c: In function ‘conf_string’:
scripts/kconfig/conf.c:174:20: warning: variable ‘help’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c: In function ‘conf_sym’:
scripts/kconfig/conf.c:208:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:368:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/conf.c:283:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
  HOSTCC  scripts/kconfig/kxgettext.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:2340:0:
scripts/kconfig/confdata.c: In function ‘conf_expand_value’:
scripts/kconfig/confdata.c:57:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/confdata.c: In function ‘conf_read_simple’:
scripts/kconfig/confdata.c:238:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/confdata.c: In function ‘conf_split_config’:
scripts/kconfig/confdata.c:608:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
In file included from scripts/kconfig/zconf.tab.c:2343:0:
scripts/kconfig/menu.c: In function ‘menu_add_prop’:
scripts/kconfig/menu.c:131:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/menu.c:133:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
In file included from scripts/kconfig/zconf.tab.c:2338:0:
scripts/kconfig/zconf.tab.c: At top level:
scripts/kconfig/lex.zconf.c:1620:16: warning: ‘input’ defined but not used [-Wunused-function]
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x33): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x47): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0xd56): undefined reference to `libintl_gettext'
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: scripts/kconfig/conf.o: bad reloc address 0x70 in section `.rdata'
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/kconfig/conf] Error 1
make: *** [whgs_defconfig] Error 2

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$

所以参考之前的:

【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译Linux内核在配置时出错:scripts/kconfig /conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext’

(和后来的:

【已解决】Cygwin下交叉编译Linux在make menuconfig时出错:scripts/kconfig/lxdialog/checklist.o:checklist.c: (.text+0×31): undefined reference to `wmove’

)去,本来打算是去修改:

linux-2.6.19.1\scripts\kconfig\Makefile

为:

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)
ifeq ($(IS_CYGWIN),yes)
	HOST_LOADLIBES += -lintl -lcurses
endif

的。

不过,倒是后来,参考了:

cygwin 下编译linux内核

发现,其实用另外的办法,估计也是可以的:

由于是没有找到对应的库的.so文件,所以去建立对应的库的软链接,应该是可以的。

所以,此处,不去修改makefile了,去试试此种办法,给intl和ncurses,都加上软链接:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls /usr/lib/libncurses* -lha
-rw-r--r-- 1 CLi Domänen-Benutzer 307K Jan  2  2010 /usr/lib/libncurses.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 368K Jan  2  2010 /usr/lib/libncurses.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  939 Jan  2  2010 /usr/lib/libncurses.la
-rw-r--r-- 1 CLi Domänen-Benutzer 118K Jan  2  2010 /usr/lib/libncurses++.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 175K Jan  2  2010 /usr/lib/libncurses++.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer 1.1K Apr 26  2012 /usr/lib/libncurses++.la
-rw-r--r-- 1 CLi Domänen-Benutzer 118K Jan  3  2010 /usr/lib/libncurses++w.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 175K Jan  3  2010 /usr/lib/libncurses++w.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer 1.1K Apr 26  2012 /usr/lib/libncurses++w.la
-rw-r--r-- 1 CLi Domänen-Benutzer 376K Jan  3  2010 /usr/lib/libncursesw.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 433K Jan  3  2010 /usr/lib/libncursesw.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  944 Jan  3  2010 /usr/lib/libncursesw.la

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ln -s /usr/lib/libncurses.a /usr/lib/libncurses.
libncurses.a      libncurses.dll.a  libncurses.la

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ln -s /usr/lib/libncurses.a /usr/lib/libncurses.so

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls /usr/lib/libncurses* -lha
-rw-r--r-- 1 CLi Domänen-Benutzer 307K Jan  2  2010 /usr/lib/libncurses.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 368K Jan  2  2010 /usr/lib/libncurses.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  939 Jan  2  2010 /usr/lib/libncurses.la
lrwxrwxrwx 1 CLi Domänen-Benutzer   21 Aug 23 13:18 /usr/lib/libncurses.so -> /usr/lib/libncurses.a
-rw-r--r-- 1 CLi Domänen-Benutzer 118K Jan  2  2010 /usr/lib/libncurses++.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 175K Jan  2  2010 /usr/lib/libncurses++.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer 1.1K Apr 26  2012 /usr/lib/libncurses++.la
-rw-r--r-- 1 CLi Domänen-Benutzer 118K Jan  3  2010 /usr/lib/libncurses++w.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 175K Jan  3  2010 /usr/lib/libncurses++w.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer 1.1K Apr 26  2012 /usr/lib/libncurses++w.la
-rw-r--r-- 1 CLi Domänen-Benutzer 376K Jan  3  2010 /usr/lib/libncursesw.a
-rwxr-xr-x 1 CLi Domänen-Benutzer 433K Jan  3  2010 /usr/lib/libncursesw.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  944 Jan  3  2010 /usr/lib/libncursesw.la

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls /usr/lib/libintl* -lha
-rw-r--r-- 1 CLi Domänen-Benutzer 176K Oct 16  2011 /usr/lib/libintl.a
-rwxr-xr-x 1 CLi Domänen-Benutzer  35K Oct 16  2011 /usr/lib/libintl.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  942 Oct 16  2011 /usr/lib/libintl.la

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ln -s /usr/lib/libintl.a /usr/lib/libintl.so

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls /usr/lib/libintl* -lha
-rw-r--r-- 1 CLi Domänen-Benutzer 176K Oct 16  2011 /usr/lib/libintl.a
-rwxr-xr-x 1 CLi Domänen-Benutzer  35K Oct 16  2011 /usr/lib/libintl.dll.a*
-rw-r--r-- 1 CLi Domänen-Benutzer  942 Oct 16  2011 /usr/lib/libintl.la
lrwxrwxrwx 1 CLi Domänen-Benutzer   18 Aug 23 13:19 /usr/lib/libintl.so -> /usr/lib/libintl.a

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$

看看是否可以解决问题。

待会再验证。

8.另外,由于同时,此处没有出现:

【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译Linux内核在配置时出错:/bin/sh: scripts/basic/fixdep: cannot execute binary file

所以,此时,也去看看对应的那个scripts/basic/fixdep文件:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/fixdep* -lha
-rw-r--r-- 1 CLi Domänen-Benutzer 9.4K Oct 17  2012 scripts/basic/fixdep.c
-rwxr-xr-x 1 CLi Domänen-Benutzer  61K Aug 23 13:11 scripts/basic/fixdep.exe*

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/basic/ -lha
total 174K
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:11 ./
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Aug 23 13:07 ../
-rw-r--r--  1 CLi Domänen-Benutzer 2.1K Aug 23 13:11 .docproc.cmd
-rw-r--r--  1 CLi Domänen-Benutzer 2.7K Aug 23 13:11 .fixdep.cmd
-rw-r--r--  1 CLi Domänen-Benutzer   29 Oct 17  2012 .gitignore
drwxr-xr-x+ 1 CLi Domänen-Benutzer    0 Oct 17  2012 CVS/
-rw-r--r--  1 CLi Domänen-Benutzer  10K Oct 17  2012 docproc.c
-rwxr-xr-x  1 CLi Domänen-Benutzer  64K Aug 23 13:11 docproc.exe*
-rw-r--r--  1 CLi Domänen-Benutzer 9.4K Oct 17  2012 fixdep.c
-rwxr-xr-x  1 CLi Domänen-Benutzer  61K Aug 23 13:11 fixdep.exe*
-rw-r--r--  1 CLi Domänen-Benutzer  716 Oct 17  2012 Makefile

可见,没有对应的

scripts/basic/fixdep

了,只有对应的exe:

scripts/basic/fixdep.exe

了。

9.此处,继续去配置,看看是否正常。

结果是错误依旧:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- whgs_defconfig
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  HOSTCC  scripts/basic/docproc
scripts/basic/docproc.c: In function ‘find_export_symbols’:
scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘singfunc’:
scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘parse_file’:
scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x33): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x47): undefined reference to `libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0xd56): undefined reference to `libintl_gettext'
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: scripts/kconfig/conf.o: bad reloc address 0x70 in section `.rdata'
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/kconfig/conf] Error 1
make: *** [whgs_defconfig] Error 2

表明,此处只是单独的加上对应的intl的软链接,是无法解决问题的。

难道是/usr/lib路径没加进去?

觉得不太可能吧。。。

scripts/kconfig/

下面看看对应的Makefile:

linux-2.6.19.1\scripts\kconfig\Makefile

看了半天,也没找到,比较合适的,添加-L /usr/lib的地方。

算了,还是直接修改为,我们之前的形式,加上对应的库吧:

即, 从:

HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

HOST_EXTRACFLAGS += -DLOCALE

改为:

HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)
ifeq ($(IS_CYGWIN),yes)
	HOST_LOADLIBES += -lintl -lcurses
endif

HOST_EXTRACFLAGS += -DLOCALE

再去配置,就可以正常配置了:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- whgs_defconfig
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  HOSTCC  scripts/basic/docproc
scripts/basic/docproc.c: In function ‘find_export_symbols’:
scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘singfunc’:
scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘parse_file’:
scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTLD  scripts/kconfig/conf
*
* Linux Kernel Configuration
*
*
* Code maturity level options
*
Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] y
*
* General setup
*
......

对应的,再去看看那个mconf.exe,结果是没有此文件:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ ls scripts/kconfig/ -lha
total 864K
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Aug 23 13:39 ./
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Aug 23 13:07 ../
-rw-r--r--  1 CLi            Domänen-Benutzer  135 Aug 23 13:39 .conf.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer 2.2K Aug 23 13:11 .conf.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer  147 Oct 17  2012 .gitignore
-rw-r--r--  1 CLi            Domänen-Benutzer 1.8K Aug 23 13:11 .kxgettext.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer 3.1K Aug 23 13:11 .zconf.tab.o.cmd
-rw-r--r--  1 CLi            Domänen-Benutzer  12K Oct 17  2012 conf.c
-rwxr-xr-x  1 CLi            Domänen-Benutzer 135K Aug 23 13:39 conf.exe*
-rw-r--r--  1 CLi            Domänen-Benutzer  12K Aug 23 13:11 conf.o
-rw-r--r--  1 CLi            Domänen-Benutzer  17K Oct 17  2012 confdata.c
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Oct 17  2012 CVS/
-rw-r--r--  1 CLi            Domänen-Benutzer  26K Oct 17  2012 expr.c
-rw-r--r--  1 CLi            Domänen-Benutzer 5.0K Oct 17  2012 expr.h
-rw-r--r--  1 CLi            Domänen-Benutzer  41K Oct 17  2012 gconf.c
-rw-r--r--  1 CLi            Domänen-Benutzer  25K Oct 17  2012 gconf.glade
-rw-r--r--  1 CLi            Domänen-Benutzer 6.5K Oct 17  2012 images.c
-rw-r--r--  1 CLi            Domänen-Benutzer  644 Oct 17  2012 kconfig_load.c
-rw-r--r--  1 CLi            Domänen-Benutzer 4.0K Oct 17  2012 kxgettext.c
-rw-r--r--  1 CLi            Domänen-Benutzer 2.7K Aug 23 13:11 kxgettext.o
-rw-r--r--  1 CLi            Domänen-Benutzer  55K Aug 23 13:11 lex.zconf.c
-rw-r--r--  1 CLi            Domänen-Benutzer  55K Oct 17  2012 lex.zconf.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer 3.5K Oct 17  2012 lkc.h
-rw-r--r--  1 CLi            Domänen-Benutzer 1.8K Oct 17  2012 lkc_proto.h
drwxr-xr-x+ 1 CLi            Domänen-Benutzer    0 Oct 17  2012 lxdialog/
-rw-r--r--  1 CLi            Domänen-Benutzer 8.7K Aug 23 13:38 Makefile
-rwxr-xr-x  1 Administrators Domänen-Benutzer 8.7K Aug 23 13:37 Makefile.bak*
-rw-r--r--  1 CLi            Domänen-Benutzer  25K Oct 17  2012 mconf.c
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Oct 17  2012 menu.c
-rw-r--r--  1 CLi            Domänen-Benutzer  123 Oct 17  2012 POTFILES.in
-rw-r--r--  1 CLi            Domänen-Benutzer  42K Oct 17  2012 qconf.cc
-rw-r--r--  1 CLi            Domänen-Benutzer 7.8K Oct 17  2012 qconf.h
-rw-r--r--  1 CLi            Domänen-Benutzer  18K Oct 17  2012 symbol.c
-rw-r--r--  1 CLi            Domänen-Benutzer 2.2K Oct 17  2012 util.c
-rw-r--r--  1 CLi            Domänen-Benutzer 1.4K Oct 17  2012 zconf.gperf
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Aug 23 13:11 zconf.hash.c
-rw-r--r--  1 CLi            Domänen-Benutzer  11K Oct 17  2012 zconf.hash.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer 6.1K Oct 17  2012 zconf.l
-rw-r--r--  1 CLi            Domänen-Benutzer  64K Aug 23 13:11 zconf.tab.c
-rw-r--r--  1 CLi            Domänen-Benutzer  64K Oct 17  2012 zconf.tab.c_shipped
-rw-r--r--  1 CLi            Domänen-Benutzer  82K Aug 23 13:11 zconf.tab.o
-rw-r--r--  1 CLi            Domänen-Benutzer  15K Oct 17  2012 zconf.y

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$

然后才想起来,还没有去menuconfig呢。

所以再去用:

make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- menuconfig

配置,然后就可以了,此处,啥都没改,先保存一下,完整的log为:

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$ make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- menuconfig
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  HOSTCC  scripts/basic/docproc
scripts/basic/docproc.c: In function ‘find_export_symbols’:
scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘singfunc’:
scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c: In function ‘parse_file’:
scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
scripts/kconfig/lxdialog/checklist.c: In function ‘dialog_checklist’:
scripts/kconfig/lxdialog/checklist.c:206:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
scripts/kconfig/lxdialog/menubox.c: In function ‘dialog_menu’:
scripts/kconfig/lxdialog/menubox.c:292:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]
scripts/kconfig/lxdialog/menubox.c:299:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
scripts/kconfig/lxdialog/textbox.c: In function ‘print_line’:
scripts/kconfig/lxdialog/textbox.c:323:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/lxdialog/textbox.c:323:6: warning: variable ‘y’ set but not used [-Wunused-but-set-variable]
  HOSTCC  scripts/kconfig/lxdialog/util.o
scripts/kconfig/lxdialog/util.c: In function ‘first_alpha’:
scripts/kconfig/lxdialog/util.c:464:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf arch/arm/Kconfig
#
# configuration written to .config
#


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.


CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1
$

至此,make menuconfig,算是OK了。

截个图,以看看效果:

linux kernel configuration ok when make menuconfig

【总结】

此处,在Cygwin下,交叉编译Linux内核时,在make menuconfig时候出现:

scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file

的错误时,

原因是:

之前的linux源码linux-2.6.19.1.tar.bz2,是别人已经在别的某个Linux平台下,交叉编译OK之后的。

所以,此处解压后,得到的源码,其中包含了,之前别人在其Linux下,

make whgs_defconfig

(此处,应该和是否加ARCH和CROSS_COMPILE是无关的,即,

make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- whgs_defconfig

也会遇到同样的问题)

时候,所生成的

scripts/basic/fixdep

scripts/kconfig/conf

以及:

make menuconfig

(此处,应该和是否加ARCH和CROSS_COMPILE是无关的,即,

make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnueabi- menuconfig

也会遇到同样的问题)

时候,所生成的

scripts/kconfig/mconf

这些文件,都是“for GNU/Linux”的,无法在当前的Cygwin下运行,所以导致出现:

上述三个文件,无法运行的问题,其中包括此处的"scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file"

 

解决办法是:

1.对于原先的源码linux-2.6.19.1.tar.bz2,解压后,先去坐一次彻底清除:

make mrproper

然后手动再删除make mrproper没有删除掉的scripts/kconfig/mconf

然后,后续的:

make whgs_defconfig

make menuconfig

就不会出现:

scripts/xxx/xxx: scripts/xxx/xxx: cannot execute binary file

的问题了。

2.而对于另外的问题:

scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext’

和:

scripts/kconfig/lxdialog/checklist.o:checklist.c:(.text+0×31): undefined reference to `wmove’

原因是:

分别缺少了对应的库文件:intl和ncurses

解决办法是:

修改

linux-2.6.19.1\scripts\kconfig\Makefile

加上对应的库,即,从:

HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

HOST_EXTRACFLAGS += -DLOCALE

改为:

HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)
ifeq ($(IS_CYGWIN),yes)
	HOST_LOADLIBES += -lintl -lcurses
endif

HOST_EXTRACFLAGS += -DLOCALE

即可解决此类问题。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量