Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 312 → Rev 313

/linux/hello-module/hello-module.c
0,0 → 1,55
/****************************************************************************
*
* Kernel version of hello-world, basically, a super simple module.
*
****************************************************************************/
 
/* ---- Include Files ---------------------------------------------------- */
 
#include <linux/module.h>
 
/* ---- Public Variables ------------------------------------------------- */
/* ---- Private Constants and Types -------------------------------------- */
/* ---- Private Variables ------------------------------------------------ */
/* ---- Private Function Prototypes -------------------------------------- */
/* ---- Functions -------------------------------------------------------- */
 
/****************************************************************************
*
* hello_init
*
* Initialization function called when the module is loaded.
*
****************************************************************************/
 
static int __init hello_init( void )
{
printk( "hello_init called\n" );
 
return 0;
 
} // hello_init
 
/****************************************************************************
*
* hello_exit
*
* Called to perform module cleanup when the module is unloaded.
*
****************************************************************************/
 
static void __exit hello_exit( void )
{
printk( "hello_exit called\n" );
 
} // hello_exit
 
/****************************************************************************/
 
module_init(hello_init);
module_exit(hello_exit);
 
MODULE_AUTHOR("Dave Hylands");
MODULE_DESCRIPTION("Hello World Module");
MODULE_LICENSE("GPL");
 
/linux/hello-module/Makefile
0,0 → 1,43
#############################################################################
#
# Makefile for building the hello-module sample module
#
#############################################################################
 
ifeq ($(DEBUG),y)
EXTRA_CFLAGS += -O -g # -O is need to expand inlines
else
EXTRA_CFLAGS += -O2
endif
 
ifneq ($(KERNELRELEASE),)
 
#----------------------------------------------------------------------------
# call from kernel build system
 
obj-m := hello-module.o
 
#
#----------------------------------------------------------------------------
else
#----------------------------------------------------------------------------
#
 
PWD := $(shell pwd)
 
GUMSTIX_BUILDROOT = $(PWD)/../gumstix-buildroot
BUILD_ARM = $(wildcard $(GUMSTIX_BUILDROOT)/build_arm*)
KERNELDIR ?= $(wildcard $(BUILD_ARM)/linux-*)
CROSS_COMPILE = $(BUILD_ARM)/staging_dir/bin/arm-linux-
 
kernel-module:
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
 
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.symvers
 
#
#----------------------------------------------------------------------------
endif