Hello all! I am new to this forum and Linux Programming. I have an assignment that is frustrating me and am enlisting the help of all that may assist.
When I run my makefile I get
Makefile: 10 *** mixed implicit and normal rules: deprecated syntax
How do I correct this error?
Makefile
Code:
obj-m += Bdayass.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
unload:
sudo rmmod Bdayass
load:
sudo insmod Bdayass.ko
clear:
sudo dmesg -c
view:
dmesg
Bdayass.c
Code:
#include<linux/list.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/types.h>
#include<linux/slab.h>
struct birthday {
struct list_head list;
int day;
int month;
int year;
};
static LIST_HEAD(birthday_list);
int simple_init(void) {
struct birthday *ptr;
int i;
for(i = 0; i < 5; i++) {
struct birthday *person;
person = kmalloc(sizeof(*person), GFP_KERNEL);
person->day = 22;
person->month = 11;
person->year = 1981;
INIT_LIST_HEAD(&person->list);
list_add_tail(&person->list, &birthday_list);
}
list_for_each_entry(ptr, &birthday_list, list) {
printk(KERN_INFO "%d, %d %d", ptr->month, ptr->day, ptr->year);
}
return 0;
}
void simple_exit(void) {
struct birthday *ptr, *next;
list_for_each_entry_safe(ptr, next, &birthday_list, list) {
// delete structs and return memory
list_del(&ptr->list);
kfree(ptr);
}
}
module_init(simple_init);
module_exit(simple_exit);