自己编译的模块调用了uboot_envtools的函数fw_env_open等函数,系统启动执行返回如下错误:
can't load library 'crc32.o'
Makfile中添加调用代码如下:
AM_CFLAGS += \
@IFXOS_INCLUDE_PATH@/../../../root-lantiq/usr/include
AM_CFLAGS += \
@IFXOS_LIBRARY_PATH@/../../root-lantiq/usr/lib
onu_LDADD += -lenv
奇怪的是:生成的是静态库libenv.a,为什么出错提示感觉像动态库的处理一样
所幸的是,在前一个版本中,这个依赖关系是完全正常的,比较了两个uboot_envtools下的文件
crc32.c完全一样,但是生成crc32.o大小相差近一倍,正常的2.9K,出错的5K(fw_env.c也有一样的问题)
比较编译输出,两者相差的仅仅是出错的编译命令多了4个-I选项:
mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/target-mips_r2_uClibc-0.9.33.2_falcon/usr/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/target-mips_r2_uClibc-0.9.33.2_falcon/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include -shared -fPIC crc32.c -o crc32.o
mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -Wall -shared -fPIC -c -o crc32.o crc32.c
解决:按照正常工作的Makefile修改编译语句,问题解决,自己的模块可以正常修改env变量。
但是-I选项会影响编译结果也还是搞不懂的问题