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

ubuntuÏÂlinuxÄÚºËÄ£¿é±à³Ì module.hµÄÎÊÌâ

ÎÒÏÂÔØÁËÒ»¸ölinux-2.6.31.5µÄÄںˣ¬½øÐÐÁ˱àÒë
È»ºó¿ªÊ¼±àд×Ô¼ºµÄÐéÄâ×Ö·ûÉ豸Çý¶¯
/**
*rwbuf.h,  driver for virtual char-device
*/

#define  RWBUF_NAME  "rwbuf"        // É豸Îļþ /dev/rwbuf
#define  RWBUF_DEV      "/dev/rwbuf"  // device path
#define  RWBUF_MAJOR  60              // Ö÷É豸ºÅ
#define  RWBUF_CLEAR  0x909090    // IO Ctrl Command
ÉÏÃæÊǺêµÄÍ·Îļþ
#include "rwbuff.h"
#include <unistd.h>
#include <linux/kernel.h> //for kernel programming
#include <linux/module.h> //for kernel module struct
#include <linux/init.h>
#include <linux/fs.h> //struct file_operations
#include <sys/types.h>

static struct file_operations rwbuf_fpos = {
open: rwbuf_open,
release: rwbuf_close,
read: rwbuf_read,
write: rwbuf_write,
ioctl: rwbuf_ioctl,
};

int init_module()
{
printk("Hello world\n");
if(register_chrdev(RWBUF_MAJOR,RWBUF_NAME,&rwbuf_fpos)){
printk("register error\n");
return -1;
}
else
printk("register ok\n");
return 0;
}

void cleanup_module()
{


Ïà¹ØÎÊ´ð£º

linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ

дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

linux 2.6 Äں˵ÄÅäÖÃÎļþÔÚÄÄÀï

Á½Ì¨»úÆ÷ÐͺÅÍêÈ«Ò»Ñù

ÏëÒª°Ñһ̨»úÆ÷µÄÄÚºËÅäÖÃÎļþ¿½±´¸øÁíÍâһ̨

RT


3Q
...

.config Òþ²ØµÄ ÔÚÄãÅäÖùýÄں˺ó¾ÍÉú³ÉÁË

lsÕý½â£¬ÔÚkernelÔ´Â붥²ãĿ¼ÖÐÓиö.configÎļþ£¬ÅäÖ ......

ÓйØlinux°²×°½Å±¾kickstartµÄ±àд

ÎÒ֮ǰÖÆ×÷µÄlinux×Ô¶¯°²×°isoÒѾ­³É¹¦ÁË£¬ÏÖÔÚÏë¶ÔÆä½øÐÐһЩ¶¨ÖÆÐ޸ģ¬±ÈÈ磬¸ü¸ÄgrubͼƬµÈ¡£
ÎÒÔÚks.cfgµÄ%post¶ÎÀïÃæÊÇÕâÑùдµÄ£º
%post --nochroot
# Move the contents of the tar into their new locati ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ