直接編譯hello模塊進linux內核

1. 編寫hello.c放到內核drivers/char/目錄下

2. 進入char目錄

    1). 在Kconfig文件中添加如下語句:

#add

config HELLO

tristate   "hello module"

depends  on ARM

default  m

#end add

    2). 在Makefile中添加:

#add

#obj-m += hellomodule.o

obj-$(CONFIG-HELLO) += hello.o

#end add

3. 圖形配置

make menuconfig ARM=arm  CROSS_COMPILE=arm-none-linux-gnueabi-

在Device Drivers -> Character Device 中,找到 “hello module"模塊,按 "y",表示將該模塊編進內核

4. 編譯內核

make ARM=arm  CROSS_COMPILE=arm-none-linux-gnueabi-  uImage

生成內核鏡像:uImage

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章