이전 Linux 커널에서 이더넷 드라이버를 크로스 컴파일할 때 발생하는 문제

이전 Linux 커널에서 이더넷 드라이버를 크로스 컴파일할 때 발생하는 문제

현재 버전 2.6.27.7의 이전 Linux 커널에 대해 네트워크 드라이버를 크로스 컴파일하려고 하는데 컴파일이 실패하고 다음이 인쇄됩니다.

make[1]: entering directory « /home/johann/Desktop/linux-2.6.27.7 »
Building modules, stage 2.
MODPOST 0 modules
make[1]: leaving directory « /home/johann/Desktop/linux-2.6.27.7 »

내가 실행한 명령은 다음 소스가 포함된 readme 파일에서 가져왔습니다.

make KSRC=<source> KDIR=<build>

다음과 같습니다.

#
# Makefile to build the be2net network driver
#

# find a source path that exists among the possible paths
ver = $(shell uname -r)
paths := /lib/modules/$(ver)/source /lib/modules/$(ver)/build
exists = $(shell [ -e $(path)/include/linux ] && echo $(path))
paths := $(foreach path, $(paths), $(exists))
ifeq (,$(KSRC))
    KSRC := $(firstword $(paths))
endif

# ************** Header checks ********************
ifneq (,$(shell grep -o alloc_etherdev_mqs $(KSRC)/include/linux/etherdevice.h))
    EXTRA_CFLAGS += -DALLOC_ETHDEV_MQS_defined
endif

ifneq (,$(shell grep -o alloc_etherdev_mq $(KSRC)/include/linux/etherdevice.h))
    EXTRA_CFLAGS += -DALLOC_ETHDEV_MQ_defined
endif

ifneq (,$(shell grep -o netif_set_real_num_rx_queues $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DNETIF_SET_REAL_NUM_RX_QS_defined
endif

ifneq (,$(shell grep -o PCI_DEV_FLAGS_ASSIGNED $(KSRC)/include/linux/pci.h))
    EXTRA_CFLAGS += -DPCI_FLAGS_ASSIGNED_defined
endif

ifneq (,$(shell grep -o skb_frag_set_page $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DSKB_FRAG_API_defined
endif

ifneq (,$(shell grep -o skb_frag_size $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DSKB_FRAG_SIZE_defined
endif

ifneq (,$(shell grep -o netdev_alloc_skb_ip_align $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DALLOC_SKB_IP_ALIGN_defined
endif

ifneq (,$(shell grep -o skb_record_rx_queue $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DSKB_RECORD_RX_QUEUE_defined
endif

ifneq (,$(shell grep -o rxhash $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DRXHASH_defined
endif

#GRO is usable only when full implementation is available
ifneq (,$(shell grep -o napi_get_frags $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DGRO_defined
endif

ifneq (,$(shell grep -o netdev_alloc_skb $(KSRC)/include/linux/skbuff.h))
    EXTRA_CFLAGS += -DALLOC_SKB_defined
endif

ifneq (,$(shell grep -o dev_mc_list $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DDEV_MC_LIST_defined
endif

ifneq (,$(shell grep -o pcie_set_readrq $(KSRC)/include/linux/pci.h))
    EXTRA_CFLAGS += -DPCIE_SET_READRQ_defined
endif

ifneq (,$(shell grep -so vlan_group_set_device $(KSRC)/include/linux/if_vlan.h $(KSRC)/net/8021q/vlan.h))
    EXTRA_CFLAGS += -DVLAN_GRP_SET_DEV_defined
endif

ifneq (,$(shell grep -o "struct vlan_group" $(KSRC)/include/linux/if_vlan.h))
    EXTRA_CFLAGS += -DVLAN_GRP_defined
endif

ifeq (,$(shell grep -o "vlan_hwaccel_receive_skb" $(KSRC)/include/linux/if_vlan.h))
    EXTRA_CFLAGS += -DUSE_NEW_VLAN_MODEL
endif

ifneq (,$(shell grep -o ndo_set_vf_mac $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DNDO_VF_CFG_defined
endif

ifneq (,$(shell grep -o ndo_set_features $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DNDO_SET_FEATURES_defined
endif

ifneq (,$(shell grep -so "ethtool_cmd_speed_set" $(KSRC)/include/linux/ethtool.h \
                        $(KSRC)/include/uapi/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_CMD_SPEED_SET_defined
endif

ifneq (,$(shell grep -so "ethtool_cmd_speed" $(KSRC)/include/linux/ethtool.h \
                    $(KSRC)/include/uapi/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_CMD_SPEED_defined
endif

ifneq (,$(shell grep -o "ethtool_phys_id_state" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DPHYS_ID_STATE_defined
endif

ifneq (,$(shell grep -o "flash_device" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_FLASH_defined
endif

ifneq (,$(shell grep -o "get_sset_count" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_SSET_COUNT_defined
endif

ifneq (,$(shell grep -o "set_dump" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_SET_DUMP_defined
endif

ifneq (,$(shell grep -o "ethtool_ops_ext" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_OPS_EXT_defined
endif

ifneq (,$(shell grep -o "pci_enable_pcie_error_reporting" $(KSRC)/include/linux/aer.h))
    EXTRA_CFLAGS += -DAER_REPORTING_defined
endif

ifneq (,$(shell grep -o "pci_physfn" $(KSRC)/include/linux/pci.h))
    EXTRA_CFLAGS += -DPCI_PHYSFN_defined
endif

ifneq (,$(shell grep -o "set_rxnfc" $(KSRC)/include/linux/ethtool.h))
    EXTRA_CFLAGS += -DETHTOOL_RXNFC_OPS_defined
endif

ifneq (,$(shell grep -o ndo_get_stats64 $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DNDO_GET_STATS64_defined
endif

ifneq (,$(shell grep -o txq_trans_update $(KSRC)/include/linux/netdevice.h))
    EXTRA_CFLAGS += -DTXQ_TRANS_UPDATE_defined
endif
# ************* End header checks *****************

# ************* Targets ***************************
ifeq ($(KERNELRELEASE),)
ifeq ($(KDIR),)
    KDIR ?= /lib/modules/`uname -r`/build
endif   
default:
    @$(MAKE) -C$(KDIR) M=$$PWD
clean:
    @$(MAKE) -C$(KDIR) M=$$PWD clean
else
obj-$(CONFIG_BE2NET) += be2net.o
be2net-y :=  be_main.o be_cmds.o be_ethtool.o be_compat.o be_misc.o inet_lro.o
endif
# ************* End Targets ************************

예를 들어, 사용하기 전에 선언된 $(CONFIG_BE2NET) 변수가 표시되지 않습니다.

답변1

한 가지 가능한 해결책은 교체하는 것입니다. obj-$(CONFIG_BE2NET) += be2net.o 그리고 obj-m += be2net.o

답변2

mkdir /usr/src <--This directory may already exists
cd usr/src
wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.7.tar.gz 
tar -xvf linux-2.6.27.7.tar.gz 
ln -s /usr/src/linux-2.6.27.7 /usr/src/linux
cd /usr/src/linux
tar -xvf <nameofdriverdownload>.tar.gz <--If all goes well, this should inject the driver you downloaded into the kernel source 
make menuconfig <-- Select Desired options Here
make install
make modules_install
make initrd

정확한 답변을 위해서는 운전자의 이름과 정보를 어디서 얻었는지 알아야 합니다.

관련 정보