Нахожусь в большом затруднении: Беру пример программы:
/* hello.c * * "Hello, world" - версия модуля ядра. */ #include < linux/kernel.h > /* Для выполнения работы в ядре */ #include < linux/module.h > /* Для создания модуля */ /* Точка входа - инициализация модуля */ int init_module(void) { printk("(1)Hello, world\n"); /* Если код возврата не нуль, то функция init_module завершилась неудачно и модуль ядра не будет загружен */ return 0; } /* Деинициализация модуля */ void cleanup_module(void) { printk("Goodbye, cruel world\n"); }
Делаю make файл:
# Makefile для модуля "Hello, world" CC = gcc CFLAGS := -Wall -DMODULE -D__KERNEL__ hello.o: hello.c $(CC) $(CFLAGS) -c hello.c echo insmod hello.o to install echo rmmod to delete
Запускаю:
make gcc -Wall -DMODULE -D__KERNEL__ -c -o hello.o hello.c hello.c:21:2: warning: no newline at end of file In file included from hello.c:7: /usr/include/linux/module.h:60: parse error before `atomic_t' /usr/include/linux/module.h:60: warning: no semicolon at end of struct or union /usr/include/linux/module.h:60: warning: no semicolon at end of struct or union /usr/include/linux/module.h:62: parse error before `}' /usr/include/linux/module.h:62: warning: data definition has no type or storage class /usr/include/linux/module.h:91: parse error before `}' hello.c: In function `init_module': hello.c:12: warning: implicit declaration of function `printk' make: *** [hello.o] Ошибка 1
Что мне бедному несчастному делать?