最新消息:20210917 已从crifan.com换到crifan.org

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

Cygwin crifan 3312浏览 0评论

【背景】

折腾:

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

期间,已用make xxxx_defconfig调用默认配置:

【记录】Cygwin下交叉编译Linux内核时用make xxx_defconfig去调用默认配置

此处,接着去:

make menuconfig

去确认和修改配置。

 

【折腾过程】

1.去make menuconfig,结果出现“scripts/kconfig/lxdialog/checklist.o:checklist.c:(.text+0x31): undefined reference to `wmove’”的错误:

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

2.虽然解决了上面的问题,接着又出现了“scripts/kconfig/mconf: scripts/kconfig/mconf: cannot execute binary file”的错误:

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

3.此处,可以make menuconfig之后,再去参考:

【记录】make menuconfig查看和确认已有的针对arm的xscale的pxa的内核linux-2.6.19.1的配置

去确认一下配置。

此处,还是和之前一样,什么配置都没改。使用原先别人的那个配置。

 

【总结】

此处,使用make menuconfig,出现一堆错误,其最终的解决办法还是:

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

所总结的,再次强调一遍:


此处,在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下运行,所以导致出现:

上述三个文件,无法运行的问题:

/bin/sh: scripts/basic/fixdep: cannot execute binary file

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

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

的问题了。

内部逻辑是:

cygwin下,当去运行:

scripts/basic/fixdep

scripts/kconfig/conf

scripts/kconfig/mconf

时,会自动找到,对应的

scripts/basic/fixdep.exe

scripts/kconfig/conf.exe

scripts/kconfig/mconf.exe

而此三个exe文件,都是“for MS Windows”,都是可以在Cygwin下运行的。

所以就解决了不能运行的问题。

 

(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

即可解决此类问题。

 

提示:

我此处,给对应的库,加上软连接的做法:

ln -s /usr/lib/libintl.a /usr/lib/libintl.so
ln -s /usr/lib/libncurses.a /usr/lib/libncurses.so

貌似是没有效果的,是无法解决上述问题的。


并且,此处暂时是没有改动原先的内核的配置的。

转载请注明:在路上 » 【记录】Cygwin下交叉编译Linux内核时用make menuconfig去确认和修改配置

与本文相关的文章

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.186 seconds, using 23.56MB memory