开发者

Errors compiling Linux Kernel mode program

I wish to access some registers of my ARM Cortex-A8 board which are by default in a non-accessible state. Ubuntu 9.10 runs on this board. So, to access them I have to in-turn change 1 other register settings (Allow-access-开发者_如何学JAVAregister) first. To change this Allow-access-register, I found out that I must do it only in Kernel mode and not in the user mode.

So, I referred how to program in Kernel mode and I got to this wonderful tutorial. I wrote this small hello world program and a make file. Note that I'm still running this program on my x86 Desktop (Ubutnu 10.04) and not YET on my ARM processor. Not until I get a hang over Kernel level programming.

I get these errors. Whats going wrong here?

Help!


Errors I get on my i.MX515 board

ubuntu@ubuntu-desktop:~/Documents/Kernel_Programming$ make
make -C /lib/modules/2.6.31-203-gee1fdae/build M=/home/ubuntu/Documents/Kernel_Programming modules
make[1]: Entering directory `/usr/src/linux'
make[1]: *** No rule to make target `modules'.  Stop.
make[1]: Leaving directory `/usr/src/linux'
make: *** [all] Error 2

Errors I get

ubuntu@ubuntu-desktop:~/Documents$ make
make -C /lib/modules/2.6.32-23-generic/build M=/home/ubuntu/Documents modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-23-generic'
make[2]: *** No rule to make target `/home/ubuntu/Documents/hello-1.c', 
needed by `/home/ubuntu/Documents/hello-1.o'.  Stop.
make[1]: *** [_module_/home/ubuntu/Documents] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-23-generic'
make: *** [all] Error 2

Program

#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
    printk(KERN_INFO "\nHello World! I'm programming in Kernel Mode\n");

    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "\nBye Bye blue bird\n");
}

makefile

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


I don't know if it's just the formatting of your post or not, but the kernel build scripts are looking for "Makefile" and you have "makefile" (difference in case). Could that really be the problem? Plus, is your username "ubuntu"?


There is a typo in your make command like:

It should be:

make -C /lib/modules/2.6.32-23-generic/build M=/home/ubuntu/Documents modules   

not

make -C /lb/modules/2.6.32-23-generic/build M=/home/ubuntu/Documents modules   
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜