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

linux 0.11 ÄÚºËѧϰ char_dev.c


/*
 *  linux/fs/char_dev.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <errno.h>
#include <sys/types.h> // ¶¨ÒåÁË»ù±¾µÄϵͳÊý¾ÝÀàÐÍ
#include <linux/sched.h>
#include <linux/kernel.h> // º¬ÓÐһЩÄں˳£Óú¯ÊýµÄÔ­Ðζ¨Òå
#include <asm/segment.h>
#include <asm/io.h>
/* Öж϶Á */
extern int tty_read(unsigned minor,char * buf,int count);
/* ÖжÏд */
extern int tty_write(unsigned minor,char * buf,int count);
/* ¶¨Òå×Ö·ûÉ豸¶Áдº¯ÊýÖ¸ÕëÀàÐÍ */
typedef (*crw_ptr)(int rw,unsigned minor,char * buf,int count,off_t * pos);
/* ´®¿ÚÖն˶Áд²Ù×÷º¯Êý¡£²ÎÊý £º rw¶ÁдÃüÁminorÖжÏ×ÓÉ豸ºÅ£¬buf»º³åÇø */
/* count¶ÁдµÄ×Ö½ÚÊý£¬pos¶Áд²Ù×÷µ±Ç°Ö¸Õ룬·µ»Øʵ¼Ê¶ÁдµÄ×Ö½ÚÊý  */
static int rw_ttyx(int rw,unsigned minor,char * buf,int count,off_t * pos)
{
return ((rw==READ)?tty_read(minor,buf,count):
tty_write(minor,buf,count));
}
/* Öն˶Áд²Ù×÷º¯Êý£¬Ö»ÊÇÔö¼ÓÁ˶Խø³ÌÊÇ·ñÓпØÖÆÖն˵ļì²â */
static int rw_tty(int rw,unsigned minor,char * buf,int count, off_t * pos)
{
// Èô½ø³ÌûÓжÔÓ¦µÄ¿ØÖÆÖնˣ¬Ôò·µ»Ø³ö´íºÅ
if (current->tty<0)
return -EPERM;
return rw_ttyx(rw,current->tty,buf,count,pos);
}
/* ÄÚ´æÊý¾Ý¶Áдº¯Êý£¬»¹Ã»ÊµÏÖ */
static int rw_ram(int rw,char * buf, int count, off_t *pos)
{
return -EIO;
}
/* ÄÚ´æÊý¾Ý¶Áд²Ù×÷º¯Êý¡£Î´ÊµÏÖ */
static int rw_mem(int rw,char * buf, int count, off_t * pos)
{
return -EIO;
}
/* ÄÚºËÊý¾ÝÇø¶Áдº¯Êý¡£Î´ÊµÏÖ */
static int rw_kmem(int rw,char * buf, int count, off_t * pos)
{
return -EIO;
}
/* ¶Ë¿Ú¶Áд²Ù×÷º¯Êý£¬²ÎÊý £º rw¶ÁдÃüÁbuf»º³åÇø£¬count¶Áд×Ö½ÚÊý£¬pos */
/* ¶Ë¿ÚµØÖ·£¬·µ»ØµÄÊÇʵ¼Ê¶ÁдµÄ×Ö½ÚÊý */
static int rw_port(int rw,char * buf, int count, off_t * pos)
{
int i=*pos; // ¶Ë¿ÚµØÖ·
// ¶ÔÓÚËùÒªÇó¶ÁдµÄ×Ö½ÚÊý£¬²¢ÇҶ˿ڵØַСÓÚ64k
while (count-->0 && i<65536) 
{
// ÈôÊǶÁÃüÁÔò´Ó¶Ë¿Úi ÖжÁÈ¡Ò»×Ö½ÚÄÚÈݲ¢·Åµ½Óû§»º³åÇøÖÐ
if (rw==READ)
put_fs_byte(inb(i),buf++);


Ïà¹ØÎĵµ£º

LinuxÉϹ¹ÖþiPhone OS3.1.2¿ª·¢»·¾³Ö®½âѹfirmware


LinuxÉϹ¹ÖþiPhone OS3.1.2¿ª·¢»·¾³´î½¨
½Ì³ÌµØÖ·£º  http://www.yifeiyang.net/iphone-development-introduction-3-linux-development-environment-on-the-build-iphone-os3-1-2/
#µÚÒ»²½Ã»ÓÐʲôÎÊÌâ
$ ./toolchain.sh headers
#µÚ¶þ²½Ò²Ë³Àûͨ¹ý
$ ./toolchain.sh firmware
#µÚÈý²½Ò²Í¦Ë³Àû
$ ./toolchain ......

Linux±³ºóµÄÈË

1. LinusºÍBill
    ËƺõÔÚÒ»Ò¹Ö®¼ä£¬Õâ¸öÃû×ÖͻȻ±äµÃͬÏó±È¶û¡£¸Ç´ÄÒ»ÑùµÄ¶úÊìÄÜÏê¡£µ«ÊDZȶû¡£¸Ç´Ä£¬ÄÄÅÂÉí¼ÛÓÐÊý²»Ç屶µÄ°ÙÍòÃÀ½ð£¬Ò²ÓÀÔ¶²»»á±ä³ÉLinux Torvalds¡£Õâλ29ËêµÄ·ÒÀ¼ÈË£¬¼òµ¥¶øÇ¿´óµÄLinux²Ù×÷ϵͳµÄ´´ÔìÕߣ¬³¬Ô½Á˸ǴĵÄÉñ»°¡£Ò²Óд«ÎÅ˵¸Ç´ÄÊÇÒ»¸ö׿ԽµÄ³ÌÐòÔ±£¬µ«LinusÊÇ»õÕæ¼ÛʵµÄ¸ßÊ ......

Linux erron³£Á¿

#define EPERM            1      /* Operation not permitted */
#define ENOENT           2      /* No such file or directory */
#define ESRCH&nbs ......

Linux ÏûÏ¢Öض¨Ïò°ì·¨

Linux ÏûÏ¢Öض¨Ïò°ì·¨
command > filename
°Ñ±ê×¼Êä³öÖض¨Ïòµ½Ò»¸öÖ¸¶¨ÎļþÖÐ
command 1 > fielname
°Ñ±ê×¼Êä³öÖض¨Ïòµ½Ò»¸öÖ¸¶¨ÎļþÖÐ(ͬÉÏ)
command 2 > filename
°Ñ±ê×¼´íÎóÖض¨Ïòµ½Ò»¸öÎļþÖÐ
command >! filename
°Ñ±ê×¼Êä³öÖض¨Ïòµ½Ò»¸ö
Ö¸¶¨
ÎļþÖУ¬ÈôÎļþ´æÔÚ£¬Ôò¸²¸Ç
command >&am ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ