RT5370 SH4 交叉编译驱动程序错误

Vit*_*y69 3 driver

我尝试从文件2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2构建 2.5.0.3 驱动程序到 RT5370 芯片组。

在Ubuntu 10.04.4 x32下安装STLinux 2.4,在内核下make linux-sh4-2.5.32.59_stm24_0211。但我在path中写的是/opt/STM/STLinux-2.2/devkit/sources/kernel/linux-sh4-2.5.32.59_stm24_0211而不是STLinux-2.4,因为Makefile有一些缺陷:

install:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install
endif
endif
Run Code Online (Sandbox Code Playgroud)

在路径 2.4 中提到将内核构建为 2.4,在我的例子中这是一个错误。

在Makefile中写入:

PLATFORM = ST
...
LINUX_SRC = /opt/STM/STLinux-2.2/devkit/sources/kernel/linux-sh4-2.5.32.59_stm24_0211
CROSS_COMPILE = /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-
Run Code Online (Sandbox Code Playgroud)

在./os/linux/config.mk中写道:

HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
CC := sh4-linux-gcc
LD := sh4-linux-ld
Run Code Online (Sandbox Code Playgroud)

在运行 make 命令时构建。但有错误:

script/Makefile.build:49: *** CFLAGS was changed in "/home/vitaliy/drv_src/os/linux/Makefile". Fix it to use EXTRA_CFLAGS.
Run Code Online (Sandbox Code Playgroud)

在 ./os/linux/config.mk 创建字符串:

ifeq ($(PLATFORM),ST)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -Wall -O2 -Wundef -Wstrict-prototypes -Wno-trigraphs -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-aliasing -fno-common -fomit-frame-pointer -ffreestanding -m4-nofpu -o $(WFLAGS) 
export CFLAGS
endif
Run Code Online (Sandbox Code Playgroud)

并将其中的 CFLAGS 更改为 EXTRA_CFLAGS。

又报错:

sh4-linux-gcc: error: -pg and -fomit-frame-pointer are incompatible.
Run Code Online (Sandbox Code Playgroud)

好的。删除标志 -fomit-frame-pointer。

又报错:

error: cpu/cache.h: No such file or directory.
Run Code Online (Sandbox Code Playgroud)

在字符串中:

WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs
Run Code Online (Sandbox Code Playgroud)

删除标志 -DLINUX。

再次出现未知类型错误(例如:./os/linux/../../common/crypt_md5.c:638:1: error:known type name 'VOID' 等,类型为 'UCHAR'、'ULONG ' ETC)。

第二种构建方式的帮助

KBUILD_NOPEDATIC=1 不更改驱动程序的源文件。

在这种情况下也出现错误:

./os/linux/../../common/crypt_md5.c:28:23: fatal error: rt_config.h: No such file or directory.
Run Code Online (Sandbox Code Playgroud)

我的大楼出了什么问题?或者我可以修复源代码并为 SH4 平台构建驱动程序吗?

谢谢你!

jul*_*mme 5

我最近给自己买了同样的适配器,我试图为 ARM 进行交叉编译,但遇到了同样的问题。

基本上,您只需从驱动程序包的根目录添加包含文件夹即可。

我做了这些修改以使其正常工作:

在 中DRIVER_DIR/Makefile,添加:

PLATFORM = MYPLATFORM
Run Code Online (Sandbox Code Playgroud)

所有其他平台均被注释掉。

稍后在同一个文件中:

ifeq ($(PLATFORM),MYPLATFORM)
    LINUX_SRC = /DIR_TO_MY_KERNEL_SRC/freescale_mainline/linux-mainline
    CROSS_COMPILE =  /DIR_TO_MY_CROSS_COMPILER/arm-unknown-linux-uclibcgnueabi-
    CROSS_COMPILE_INCLUDE = /DRIVER_DIR/include /*Might not be necessary*/
endif
Run Code Online (Sandbox Code Playgroud)

然后在 中DRIVER_DIR/os/linux/config.mk添加:

ifeq ($(PLATFORM),MYPLATFORM)
    EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include
endif
Run Code Online (Sandbox Code Playgroud)

另外,请注意,在您的内核配置中,您需要启用几个标志:

CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
Run Code Online (Sandbox Code Playgroud)

您可以在下面找到它们Device Drivers-->Network Device Support-->Wireless LAN-->IEEE 802.11 for Host AP

我现在像这样编译它:

DRIVER_DIR$ ARCH=arm make
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!