編輯:Android開發教程
hello module source:
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
printk(KERN_ALERT "Hello,world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
compile hello.ko module Makefile code:
obj-m := hello.o
all:
make ARCH=arm EXTRA_CFLAGS="-D_CONFIG_ARM_ -fno-pic" -C $(KDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) cleanhe
Make hello.ko function:
make CROSS_COMPILE=arm-linux-androideabi- KDIR=/opt/hackandroid/goldfish_0228
NOTE: KDIR is kernel path. what's kernel path??? please refer to :http://blog.csdn.net/yygydjkthh/article/details/20172023
tested on android emulator:
run android emulator:
emulator -avd Android4.2.2 -kernel arch/arm/boot/zImage
push hello.ko to emulator:
testhello$ adb push hello.ko /data/local
60 KB/s (2648 bytes in 0.042s)
NOTE: what is zImage? How get the zImage??? please refer to : http://blog.csdn.net/yygydjkthh/article/details/20172023
testhello$ adb shell
root@android:/# cd data/local/
root@android:/data/local # ls
hello.ko
root@android:/data/local # insmod hello.ko
root@android:/data/local # dmesg -c
<1>Hello,world
root@android:/data/local # lsmod
hello 702 0 - Live 0x00000000 (PO)
root@android:/data/local # rmmod hello
root@android:/data/local # dmesg -c
<1>Goodbye, cruel world
root@android:/data/local # lsmod
root@android:/data/local #
<1>Hello,world
so, that's ok, good night :_).
查看本欄目更多精彩內容:http://www.bianceng.cn/OS/extra/
上節已經在openfire服務器中建立了組,這節繼續看怎樣獲取好友列表,通過connection對象得到roster,從而可以使用roster.getGroups()得到
引路蜂二維圖形畫筆(Pen)示例含有四個示例,Lines ,Dashes ,LineJoin 和LineCap。打算采用Option Menu(主菜單) 的方式來選擇不同
如果想要添加OpenCV的依賴庫, 則需要把OpenCV的"D:\OpenCV-2.4.9-android-sdk\sdk\java"文件夾復制到An
Android和iOS誰更強?看到這個問題兩大陣營的用戶們估計又要吵翻天了。但誰都不能否認的是,這兩款操作系統都具備著超強的實力,才能夠取得如今的成績。在最近,Andro