Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

±àÒëÒ»¸ölinuxÄÚºËÄ£¿é

¿´Ô´´úÂë¡£
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
printk("Hello, I'm kernel\n");
return 0;
}
void cleanup_module()
{
printk("I'm kernel, bye\n");
}

ÔÙÀ´¿´ makefileµÄд·¨
TARGET = hello
OBJS = hello.o
MDIR = drivers/misc
EXTRA_CFLAGS = -DEXPORT_SYMTAB
CURRENT = $(shell uname -r)
KDIR = /lib/modules/$(CURRENT)/build
PWD = $(shell pwd)
DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR)
obj-m      := $(TARGET).o
default:
 make -C $(KDIR) SUBDIRS=$(PWD) modules
$(TARGET).o: $(OBJS)
 $(LD) $(LD_RFLAG) -r -o $@ $(OBJS)
ifneq (,$(findstring 2.4.,$(CURRENT)))
install:
 echo $(DEST) $(LD_RFLAG)
 su -c "cp -v $(TARGET).o $(DEST) && /sbin/depmod -a"
else
install:
 su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a"
endif
clean:
 -rm -f *.o *.ko .*.cmd .*.flags *.mod.c
-include $(KDIR)/Rules.make
ºÃÁË ·ÅÈ뵽λÖÃÔËÐÐmakefile¼´¿É
²åÈëÄ£¿éµÄÃüÁîÊÇÕâÑùµÄ
$insmod hello.ko£¨PS£º¾¡¹ÜÄã¿´²»µ½ÓÐ.koÕâÑùµÄÎļþ£¬µ«ÊǵÄÈ·ÊÇÕâôÀ´×öµÄ£©
Óà dmesg ¾Í¿ÉÒÔ¿´µ½ Êä³öÀ²¡£¡£¡£¡£
²¹³äÒ»¸ö´íÎó£º
./linux/include/asm/elf.h: In function `start_ia32_thread':
./linux/include/asm/elf.h:153: warning: implicit declaration of function `load_g
s_index'
./linux/include/asm/elf.h: In function `elf_common_init':
./linux/include/asm/elf.h:166: error: structure has no member named `r8'
./linux/include/asm/elf.h:166: error: structure has no member named `r9'
./linux/include/asm/elf.h:166: error: structure has no member named `r10'
./linux/include/asm/elf.h:166: error: structure has no member named `r11'
./linux/include/asm/elf.h:167: error: structure has no member named `r12'
./linux/include/asm/elf.h:167: error: structure has no member named `r13'
./linux/include/asm/elf.h:167: error: structure has no member named `r14'
./linux/include/asm/elf.h:167: erro


Ïà¹ØÎĵµ£º

Linux iptableÎĵµ

×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......

Linux½ø³Ì¼äͨѶ֮¹²ÏíÄÚ´æ

¹²ÏíÄÚ´æ:
ʹÓù²ÏíÄÚ´æºÍʹÓÃmalloc()À´·ÖÅäÄÚ´æÇøÓòºÜÏàËÆ¡£Ê¹Óù²ÏíÄÚ´æµÄ·½·¨ÊÇ£º
    1 ¶ÔÒ»¸ö½ø³Ì/Ïß³ÌʹÓÃshmget()·ÖÅäÄÚ´æÇøÓò¡£
    2 ʹÓÃshmat()·ÅÖÃÒ»¸ö»ò¶à¸ö½ø³Ì/Ïß³ÌÔÚ¹²ÏíÄÚ´æÖУ¬Ò²¿ÉÒÔÓÃshmctl()À´»ñÈ¡ÐÅÏ¢»òÕß¿ØÖƹ²ÏíÇøÓò¡£
    3 ʹÓÃshmdt()´Ó¹²Ïí ......

linuxѧϰ±Ê¼Ç

linuxĿ¼¼Ü¹¹
/       ¸ùĿ¼
/bin         ³£ÓõÄÃüÁî   binary   file   µÄÄ¿錄
/boot       ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ   (kernel)   ÔÚÄÚ
          /boot/grub/menu.lst   &n ......

linux¹ÜÀí

ʹÓÃdfºÍduÃüÁîÀ´¼à¿ØÎļþϵͳµÄÓÐЧ¿Õ¼äµÄ´óС
ͨ¹ýÇå³ý²»ÓõÄÎļþºÍcoreÎļþÀ´ÇåÀíÎļþϵͳ¿Õ¼ä
ͨ¹ýÐÞ¼ôÈÕÖ¾ÎļþÀ´ÇåÀí/varÎļþϵͳ
´ÓÃüÁîÐÐÀ©Õ¹Ò»¸ö¾í×é
´ÓÃüÁîÐÐÀ©Õ¹Ò»¸öÂß¼­¾í
´ÓÃüÁîÐÐÀ©Õ¹Ò»¸öÎļþϵͳ
1.¼à¿Ø´ÅÅÌʹÓÃÇé¿ö
ʹÓÃdf ÃüÁî¼ì²éÎļþϵͳµÄÓÐЧ¿Õ¼ä¡£
# df -k
Filesystem kbytes used avai ......

Linux Find ÃüÁָͨÄÏ

ת×Ô£ºhttp://www.oracle.com/technology/global/cn/pub/articles/calish-find.html
Linux find
ÃüÁîÊÇËùÓÐ Linux ÃüÁîÖÐ×îÓÐÓõÄÒ»¸ö£¬Í¬Ê±Ò²ÊÇ×î»ìÂÒµÄÒ»¸ö¡£ËüºÜÄÑ£¬ÒòΪËüµÄÓï·¨ÓëÆäËû
Linux ÃüÁîµÄ±ê×¼Óï·¨²»Í¬¡£µ«ÊÇ£¬ËüºÜÇ¿´ó£¬ÒòΪËüÔÊÐíÄú°´ÎļþÃû¡¢ÎļþÀàÐÍ¡¢Óû§ÉõÖÁÊÇʱ¼ä´Á²éÕÒÎļþ¡£Ê¹Óà find

̟産 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ