Hi Javier,
I have been trying to cross compile alsa-driver-1.0.22 for my arm-linux board. After the configuration and make process, there are some *.o object files generated in the "modules" directory. But the desired *.ko kernel module files are not generated. When I tried to insert these object files into the running kernel via insmod command, the insmod command returns -1 and complains "Invalid module format!".
Here is my configure command:
CC=gcc ./configure --with-cross=arm-linux- --with-kernel=/work/63/ipcam/Kernel/linux-2.6.19.2-in-use --with-build=/work/63/ipcam/Kernel/linux-2.6.19.2-in-use --with-debug=full --enable-dynamic-minors --host=arm-linux --build=i386-linux --with-redhat=no --with-suse=no --prefix=/work/63/ipcam/tmp
The configure outputs are as follows:
checking for arm-linux-gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... yes checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for arm-linux-ranlib... arm-linux-ranlib checking for a BSD-compatible install... /usr/bin/install -c checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking whether time.h and sys/time.h may both be included... yes checking whether gcc needs -traditional... no checking for current directory... /work/63/ipcam/Filesystem/rootfs/mx27ipcam-alsa/ipcam-alsa-driver-1.0.22 checking cross compile... arm-linux- checking for directory with kernel source... /work/63/ipcam/Kernel/linux-2.6.19.2-in-use checking for directory with kernel build... /work/63/ipcam/Kernel/linux-2.6.19.2-in-use checking for kernel linux/version.h... yes checking for kernel linux/autoconf.h... yes checking for kernel version... 0.0.0 checking for GCC version... Kernel compiler: Used compiler: arm-linux-gcc (GCC) 4.1.1
*** NO PREDEFINED KERNEL COMPILER IS DETECTED *** Assuming the same compiler is used with the current system compiler.
*** Please make sure that the same compiler version was used for building kernel.
checking for built-in ALSA... unknown checking for existing ALSA module... unknown checking for Red Hat kernel... no checking for SUSE kernel... no checking for updating alsa-kernel version.h... yes checking for CONFIG_EXPERIMENTAL... yes checking for directory to store kernel modules... /lib/modules/0.0.0/misc checking for verbose procfs... on checking for verbose printk... on checking for debug level... full checking for processor type... unknown checking for kernel linux/config.h... no Creating <linux/config.h>... checking for deprecated linux/config.h... checking to modify of kernel linux/kmod.h... no checking for kernel linux/utsrelease.h... yes checking for kernel linux/compiler.h... yes checking for kernel linux/pm.h... yes checking for kernel linux/spinlock.h... yes checking for kernel linux/irq.h... yes checking for kernel linux/threads.h... yes checking for kernel linux/rwsem.h... yes checking for kernel linux/gameport.h... yes checking for kernel media/v4l2-dev.h... yes checking for kernel linux/devfs_fs_kernel.h... no Creating a dummy <linux/devfs_fs_kernel.h>... checking for kernel linux/highmem.h... yes checking for kernel linux/workqueue.h... yes checking for kernel linux/dma-mapping.h... yes checking for kernel asm/hw_irq.h... yes checking for kernel linux/device.h... yes checking for kernel linux/platform_device.h... yes checking for kernel linux/isa.h... yes checking for kernel linux/jiffies.h... yes checking for kernel linux/compat.h... yes checking for kernel linux/log2.h... no Creating a dummy <linux/log2.h>... checking for kernel linux/adb.h... yes checking for kernel linux/cuda.h... yes checking for kernel linux/pmu.h... yes checking for kernel linux/io.h... yes checking for kernel linux/moduleparam.h... yes checking for kernel linux/syscalls.h... yes checking for kernel linux/firmware.h... yes checking for kernel linux/err.h... yes checking for kernel linux/bitmap.h... yes checking for kernel linux/mutex.h... yes checking for kernel linux/pm_qos_params.h... no Creating <linux/pm_qos_params.h>... checking for kernel linux/kthread.h... yes checking for kernel asm/irq_regs.h... yes checking for kernel linux/seq_file.h... yes checking for kernel linux/debugfs.h... yes checking for kernel linux/gpio.h... no Creating a dummy <linux/gpio.h>... checking for kernel linux/bug.h... no Creating a dummy <linux/bug.h>... checking for kernel linux/math64.h... no Creating <linux/math64.h>... checking for kernel linux/regulator/consumer.h... no checking for kernel linux/dmi.h... yes checking for kernel linux/bitrev.h... no Creating a dummy <linux/bitrev.h>... checking for kernel linux/hrtimer.h... yes checking for exported symbol dump_stack... grep: /work/63/ipcam/Kernel/linux-2.6.19.2-in-use/kernel/ksyms.c: No such file or directory no checking for kernel module symbol versions... unknown checking for has ioport support... unknown checking for PCI support in kernel... unknown checking for I2C driver in kernel... unknown checking for firmware loader... unknown checking for SMP... unknown checking for ISA PnP driver in kernel... yes checking for PnP driver in kernel... yes checking for Kernel ISA-PnP support... unknown checking for Kernel ISA-PnP module support... unknown checking for strlcpy... yes checking for snprintf... yes checking for vsnprintf... yes checking for scnprintf... yes checking for sscanf... yes checking for vmalloc_to_page... yes checking for old kmod... no checking for PDE... yes checking for pci_set_consistent_dma_mask... no checking for pci_dev_present... no checking for msleep... yes checking for msleep_interrupt... yes checking for msecs_to_jiffies... yes checking for tty->count is the atomic type... no checking for io_remap_pfn_range... yes checking for kcalloc... yes checking for kstrdup... yes checking for kstrndup... no checking for kzalloc... yes checking for pci_ioremap_bar... no checking for saved_config_space in pci_dev... yes checking for new pci_save_state... yes checking for register_sound_special_device... yes checking for old kill_fasync... no checking for dma_addr_t... yes checking for MUTEX macros... no checking for driver extra-version... checking for driver version... 1.0.22 checking for dynamic minor numbers... yes checking for sequencer support... yes checking for OSS/Free emulation... yes checking for OSS PCM plugin system inclusion... yes checking for RTC support... unknown checking for HPET support... unknown checking for Procfs support... unknown checking for USB support... unknown checking for USB module support... unknown checking for gfp_t... yes checking for GFP_DMA32... yes checking for page_to_pfn... yes checking for init_utsname... yes checking for is_power_of_2... no checking for __ffs... yes checking for PnP suspend/resume... yes checking for builtin _Bool support... yes checking for x86-compatible PC... unknown checking for kernel PCMCIA checking for PCMCIA support... unknown checking for PCMCIA module support... unknown checking for PC9800 support in kernel... unknown checking for parallel port support... unknown checking for parallel port module support... unknown checking for power management... unknown checking for cards to compile driver for... all checking for additonal options to compile driver for... all configure: creating ./config.status config.status: creating version config.status: creating Makefile.conf config.status: WARNING: Makefile.conf.in seems to ignore the --datarootdir setting config.status: creating snddevices config.status: creating utils/alsa-driver.spec config.status: creating utils/buildrpm config.status: creating toplevel.config config.status: creating utils/alsasound config.status: creating utils/alsasound.posix config.status: creating include/pci_ids_compat.h config.status: creating include/i2c-id_compat.h config.status: creating include/config.h config.status: include/config.h is unchanged config.status: creating include/config1.h config.status: include/config1.h is unchanged config.status: creating include/version.h config.status: include/version.h is unchanged config.status: creating include/autoconf-extra.h config.status: include/autoconf-extra.h is unchanged
And the generated Makefile.conf is:
# # Configuration Makefile for ALSA driver # Copyright (c) 1994-98 by Jaroslav Kysela perex@perex.cz #
NEW_KBUILD =
mainsrcdir = . MAINSRCDIR = /work/63/ipcam/Filesystem/rootfs/mx27ipcam-alsa/ipcam-alsa-driver-1.0.22
CROSS_COMPILE ?= arm-linux- ARCH ?= ifdef NEW_KBUILD CC = $(CROSS_COMPILE)gcc CPP = $(CROSS_COMPILE)gcc -E export CROSS_COMPILE ARCH else AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld CC = $(CROSS_COMPILE)gcc CPP = $(CROSS_COMPILE)gcc -E AR = $(CROSS_COMPILE)ar MODFLAGS = -DMODULE=1 CFLAGS_KERNEL = GENKSYMS = /sbin/genksyms -k 0.0.0 endif
prefix = /work/63/ipcam/tmp exec_prefix = ${prefix} sysconfdir = ${prefix}/etc bindir = ${exec_prefix}/bin sbindir = ${exec_prefix}/sbin mandir = ${prefix}/share/man moddir = /lib/modules/0.0.0/misc moddir_tree = c_opts = -O2 -Wdeclaration-after-statement -Wno-pointer-sign -DLINUX m_opts = processor = unknown msmp = kaversion = 0.0.0 kversion = 0 kpatchlevel = 0 ksublevel = 0 kextraversion =
CONFIG_SND_VERSION = 1.0.22 CONFIG_SND_KERNELDIR = /work/63/ipcam/Kernel/linux-2.6.19.2-in-use CONFIG_MODULES = y CONFIG_SND_MVERSION = CONFIG_ISAPNP_KERNEL = y CONFIG_PNP_KERNEL = y CONFIG_PROC_FS = CONFIG_PM = CONFIG_AC97_BUS = CONFIG_HAS_DMA = y
ifndef NEW_KBUILD INCLUDE = -I$(TOPDIR)/include -I/work/63/ipcam/Kernel/linux-2.6.19.2-in-use/include -I/work/63/ipcam/Kernel/linux-2.6.19.2-in-use/include CFLAGS = $(MODFLAGS) $(INCLUDE) $(c_opts) -Wall -Wstrict-prototypes \ -fomit-frame-pointer -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common \ -pipe -DALSA_BUILD -nostdinc -iwithprefix include ifdef CONFIG_SND_MVERSION CFLAGS += -DMODVERSIONS -include $(CONFIG_SND_KERNELDIR)/include/linux/modversions.h endif CPPFLAGS = $(MODFLAGS) $(INCLUDE) $(c_opts) -DALSA_BUILD -nostdinc -iwithprefix include MAKE += $(m_opts) SNDVERSIONS = $(TOPDIR)/include/sndversions.h DEXPORT = $(TOPDIR)/include/modules else # 2.6 kbuild EXTRA_CFLAGS += -DALSA_BUILD LINUXINCLUDE := -I$(MAINSRCDIR)/include $(LINUXINCLUDE) CPPFLAGS := -I$(MAINSRCDIR)/include $(CPPFLAGS) KBUILD_CPPFLAGS := -I$(MAINSRCDIR)/include $(KBUILD_CPPFLAGS) # 2.6.24 complains this override... # CFLAGS := -I$(MAINSRCDIR)/include $(CFLAGS) MAKE_ADDS = endif
-------------------------------------------------------------------------------------
From the above outputs, it seems that the configure script can't
determine the correct kernel version of my target kernel, and this will prevent the "NEW_KBUILD" variable from being defined in Makefile.conf. Also in Makefile.conf, the "ARCH" variable is not set.
What's the correct way to configure and cross-compile alsa-driver to generate the desired *.ko kernel modules? Am I missing anything?
Regards, Jie Jiang