Kernel内核的裁剪及移植(三)

c)修改 gspca Makefile

[root@localhost media]# cd gspca

[root@localhost gspca]# pwd

/root/2410-s/linux-2.6.24.4/drivers/usb/media/gspca

[root@localhost gspca]# vi Makefile

gspca-objs := gspca_core.o decoder/gspcadecoder.o

obj-$(CONFIG_USB_SPCA5XX) += gspca.o

 

clean:

        rm -r -f *.o decoder/.gspcadecoder.o.cmd decoder/*.o \

        .gspca.o.cmd  *.o *.ko *.mod.* .[a-z]* core *.i \

        *.symvers *.err

        rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c

        rm -rf .tmp_versions

要让编译出来的摄像头程序用Linux-2.6.24.4的内核,如下修改,指定编译平台,编译连接配置,及变编译器

KERNELDIR := /root/2410-s/linux-2.6.24.4

CROSS_COMPILE=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux/bin/arm-softfloat-linux-

CC=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux/bin/arm-softfloat-linux-gcc

default:

$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) CC=$(CC) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules

2.编译后,可能会提示gspca_core.c的一些轻微错误,稍作修改即可:

//static const char gspca_version[] = GSPCA_VERSION;

static const char gspca_version[] = "00.60.00";

[root@localhost gspca]# vi gspca_core.c

drivers/built-in.o(.init.text+0x4710): In function `fb_invert_cmaps':

drivers/video/fbcmap.c:314: undefined reference to `__this_module'

drivers/built-in.o(.data+0x93d8): In function `fbcon_getxy':

drivers/video/console/fbcon.c:2744: undefined reference to `__this_module'

drivers/built-in.o(.data+0x93fc):drivers/video/console/fbcon.c:2747: undefined reference to `__this_module'

make: *** [.tmp_vmlinux1] Error 1

/root/2410-s/linux-2.6.24.4/drivers/usb/media/gspca/Makefile下的

#EXTRA_CFLAGS += $(DEFINES)注释掉

 

你可能感兴趣的:(linux,职场,kernel,休闲,内核烧写)