Newbie - Help compiling kernel modules

Wesley Jin wesleyj22 at gmail.com
Wed Mar 4 05:49:58 CET 2009


Hi Andy,

Thanks for the reply.
I've downloaded and built the kernel:

git clone git://git.openmoko.org/git/kernel.git linux-2.6
cd linux-2.6
git checkout -b mystable origin/andy-tracking
mkdir GTA02
cp arch/arm/configs/gta02-moredrivers-defconfig GTA02/.config
cp arch/arm/configs/gta02-moredrivers-defconfig .config
./build GTA02 dummy

When I try to run the make command line that you've provided, I get the
following error:
root at notebook:~/OpenMoko2/linux-2.6# make ARCH=arm -C
/home/wesjin/OpenMoko2/linux-2.6/
KBUILD_SRC=/home/wesjin/OpenMoko2/linux-2.6/ M=`pwd`
make: Entering directory `/home/wesjin/OpenMoko2/linux-2.6'

  ERROR: Kernel configuration is invalid.
         include/linux/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump
/home/wesjin/OpenMoko2/linux-2.6/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC      kernel/bounds.s
cc1: error: include/linux/autoconf.h: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [_module_/home/wesjin/OpenMoko2/linux-2.6] Error 2

It's complaining that the kernel has not been configured. However, I've
copied the gta02_moredrivers_defconfig
file to GTA02 and to linux-2.6 directory. Do I need to do anything else? Is
there someway that I can generate
or copy autoconf.h from somewhere?

Thanks for your help.
Wesley
On Tue, Mar 3, 2009 at 2:04 AM, Andy Green <andy at openmoko.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Somebody in the thread at some point said:
>
> | I am new to the *OpenMoko* community and appreciate your patience.
> | I am trying to compile a simple "Hello World" *kernel* module.
>
> | I have downloaded the tool chain and am trying to compile the module as
> | follows:
> | /usr/local/*openmoko*/arm/bin/arm-angstrom-linux-gnueabi-gcc
> | -D__KERNEL__ -DMODULE -c hello.c
>
> You need to abandon that way of coming at it.
>
> The way that will give results is to leverage the kernel makefile to
> build the module.
>
> Here is how I did this for a hardware RNG driver I wrote as a module:
>
> Makefile:
>
> #
> # Makefile for whirlygig-rng
> #
>
> obj-m := whirlygig-rng.o
>
> clean:
> ~        rm -f *~ *.mod.c *.mod.o *.ko *.o *.symvers
>
>
> Then build something like this:
>
> export
> CROSS_COMPILE=/usr/local/openmoko/arm/bin/arm-angstrom-linux-gnueabi- ;
> make ARCH=arm -C <path to kernel source dir> KBUILD_SRC=<path to kernel
> source dir> M=`pwd`
>
> This will build the module in the current directory against the kernel
> source tree in the given directory.
>
> - -Andy
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkms1osACgkQOjLpvpq7dMrGNgCfVn+nglPJ5bDpgd1ZvraR2sPf
> F8gAn3gwXGE4zg/ZJWxdRFsOqGxLspCl
> =t39W
> -----END PGP SIGNATURE-----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/devel/attachments/20090303/5925998e/attachment-0001.htm 


More information about the devel mailing list