Есть программулина, собирающая модуль к ядру: вот ее Makefile:
MODULE_NAME = upg_lib
APP_NAME=afl_lib
OBJS = main.o lib_upg.o
obj-m := $(MODULE_NAME).o
$(MODULE_NAME)-objs := $(OBJS)
### Xenomai directory, xeno-config and library directory ###########
XENO_CONFIG = $(XENO_DIR)/bin/xeno-config
XENO_VER = $(shell $(XENO_CONFIG) --version)
ifeq ($(findstring 2.4,$(XENO_VER)),2.4)
LXRT_CFLAGS = $(shell $(XENO_CONFIG) --xeno-cflags)
else
ifeq ($(findstring 2.5,$(XENO_VER)),2.6)
LXRT_CFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
endif
endif
### General configuration stuff ####################################
CC = $(CROSS_COMPILE)gcc
PWD := $(shell pwd)
VERSION_SUPPORT := -DMOD_NAME=\"$(APP_NAME)\" \
-DMOD_VERSION=\"$(_MOD_VERSION)\" \
-DCOMMIT_REV=\"$(_COMMIT_REV)\" \
-DTRUNK_REV=\"$(_TRUNK_REV)\" \
-DBUILD_DATE=\"$(_BUILD_DATE)\"
EXTRA_CFLAGS := $(LXRT_CFLAGS) $(VERSION_SUPPORT)
default:
@echo $(VERSION_SUPPORT)
$(MAKE) -C $(KERNELSOURCEDIR) SUBDIRS=$(PWD) modules
clean:
rm -frv $(MODULE_NAME).ko $(OBJS) $(MODULE_NAME).mod.* .*.cmd $(MODULE_NAME).o Module.symvers .*.tmp .$(MODULE_NAME).*.cmd .tmp_versions
rm -f *.order
XENO_DIR=/mnt/filestore/boiler/xenomai-2.6.0-bin
KERNELSOURCEDIR=/mnt/filestore/boiler/linux-2.6.38.8
и
ifeq ($(findstring 2.6,$(XENO_VER)),2.6)
LXRT_CFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
endif
splinter@vniir-ds1:/mnt/filestore/boiler/AFL/UPG_main$ make CROSS_COMPILE=$CROSS
make -C /mnt/filestore/boiler/linux-2.6.38.8 SUBDIRS=/mnt/filestore/boiler/AFL/UPG_main modules
make[1]: Вход в каталог `/mnt/filestore/boiler/linux-2.6.38.8'
CC [M] /mnt/filestore/boiler/AFL/UPG_main/main.o
cc1: error: unrecognized command line option "-m64"
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option "-maccumulate-outgoing-args"
make[2]: *** [/mnt/filestore/boiler/AFL/UPG_main/main.o] Ошибка 1
make[1]: *** [_module_/mnt/filestore/boiler/AFL/UPG_main] Ошибка 2
make[1]: Выход из каталога `/mnt/filestore/boiler/linux-2.6.38.8'
make: *** [default] Ошибка 2