Hola gente, el problema que tengo (en realidad lo tiene mi hermana) es el siguiente, les dejo la descripción que me dio:
Necesito programar un modulo del kernel de Linux que avise cada media hora la hora, tipo cucu.
Cuando intento compilar un ejemplo q saque de Internet y me tira error, es decir, no se como compilarlo.
Example 2-1. hello-1.c
/*
* hello-1.c - The simplest kernel module.
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
Example 2-2. Makefile for a basic kernel module
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Cuando hago el make dice como q no encontro el directorio.. o algo asi.
Gracias
este (http://www.faqs.org/docs/kernel/x204.html) es el mismo pero tiene
distinto makefile
TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc-3.0
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf {TARGET}.o
pega los errores textuales para que tengamos una idea
Debe ser un problema al copiar el texto del makefile del navegador.
Fijate que abajo del all: tiene que haber 2 tabs
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
o copialo de acá (http://pastebin.ca/raw/1024263)
Gracias a los dos, ahora le digo que pruebe eso y aviso los resultados.