ºìÁªLinuxÃÅ»§
Linux°ïÖú

SCO UNIX ÏÂÉ豸Çý¶¯³ÌÐò¿ª·¢

·¢²¼Ê±¼ä:2006-03-17 00:29:56À´Ô´:ºìÁª×÷Õß:WWW
Ò».Ïà¹Ø¸ÅÄî
---- 1É豸ºÅºÍÉ豸Çý¶¯³ÌÐò
---- É豸ºÅÊÇÒ»¸öÊý×Ö£¬ËûÊÇÉ豸µÄ±êÖ¾¡£ÕâЩÉ豸ÔÚϵͳÉÏÓжÔÓ¦µÄÌØÊâÎļþ´æÔÚ¡£É豸ºÅÓÉÁ½²¿·Ö×é³É£¬¼´Ö÷É豸ºÅºÍ´ÎÉ豸ºÅ£¬¸ß×Ö½ÚΪÖ÷É豸ºÅºÍµ××Ö½ÚΪ´ÎÉ豸ºÅ.Ö÷É豸ºÅ±êÖ¾É豸µÄÀàÐÍ£¬Ëü¸æËߺËÐÄÓÐÄĸöÇý¶¯³ÌÐòÀ´´¦Àí¸ÃÉ豸µÄÇëÇ󣬴ÎÉ豸ºÅÓÉÏàÓ¦µÄÉ豸Çý¶¯³ÌÐò½âÊÍ£¬Ëü±êÖ¾×Åij¸ö¾ßÌåµÄÎïÀíÉ豸¡£
---- ex. °Ë´®¿¨£¬ËüµÄÖ÷É豸ºÅÊÇÏàͬµÄ£¬´ÎÉ豸ºÅÊDz»Í¬µÄ¡£

---- 2É豸½Úµã

---- unix °ÑÉ豸×÷ΪÌØÊâµÄÎļþ´¦Àí£¬³ÆÉ豸Îļþ£¬Ò²¼´É豸½Úµã¡£É豸½ÚµãÌṩÁËÎïÀíÉ豸ºÍËü¶ÔÓ¦µÄÇý¶¯³ÌÐòµÄ½Ó¿Ú¡£0Ìí¼ÓÉ豸½ÚµãµÄÃüÁî¸ñʽΪ

---- mknod É豸Ãû×Ö [b/c] Ö÷É豸ºÅ ´ÎÉ豸ºÅ

---- Ëü½«ÎªÉ豸Îļþ²úÉúÒ»¸öĿ¼ÏîºÍ¶ÔÓ¦µÄi½Úµã¡£

---- 3É豸Çý¶¯³ÌÐò

---- É豸Çý¶¯³ÌÐòÊÇÎïÀíÉ豸ºÍ²Ù×÷ϵͳ֮¼äµÄÈí¼þ½Ó¿Ú£¬ËüÓÉÒ»×é×Ó³ÌÐò×é³É£¬Ëû¸ºÔðÓëÎïÀíÉ豸ͨѶ£¬²¢Îª²Ù×÷ϵͳµÄºËÐÄÌṩͳһµÄ½Ó¿Ú¡£Óû§¼¶µÄ³ÌÐòͨ¹ýÉ豸ÎļþÀ´·ÃÎÊÉ豸£¬µ«Êµ¼ÊÉ豸µÄ¶ÁдÔòÓÉÉ豸Çý¶¯³ÌÐòÍê³É.

---- É豸Çý¶¯³ÌÐò·ÖÁ½Àࣺ×Ö·ûÉ豸Çý¶¯³ÌÐòºÍ¿éÉ豸Çý¶¯³ÌÐò¡£

¶þ£®UNIX ϵͳÉ豸Çý¶¯³ÌÐòµÄÉè¼ÆºÍ¿ª·¢
---- 1Çý¶¯³ÌÐòÌṩºËÐĵÄÀý³Ì£º
---- ³£¼ûµÄÓУºxxxinit(),xxxxopen(),xxxxclose(),xxxxread(),xxxxwrite(),xxxxioctl(),xxxxhalt(); µÈµÈ£¬ÒÀ´ËÀàÍÆ¡£ÕâÀïµÄxxxxÊÇÉ豸Çý¶¯³ÌÐòµÄǰ׺£¬ÓëÉ豸ÃûÏàͬ£¬ÔÚ±¾ÀýÖÐΪmytt,Õâ×éÀý³ÌΪÉ豸Çý¶¯³ÌÐòÈë¿ÚÀý³Ì£¬ÏÂÃæ·Ö±ð¶Ô¸÷¸öÀý³Ì×÷һ˵Ã÷£º

---- xxxxinit: ³õʼ»¯É豸£¬ ÓÉϵͳÔÚÆô¶¯Ê±ÓɺËÐÄ×Ô¶¯µ÷ÓÃ

---- xxxxhalt: ϵͳ¹Ø±ÕʱºËÐĵ÷ÓÃÒԹرÕÉ豸

---- xxxxopen: »ñµÃ¶ÔÒ»¸öÉ豸µÄ´æÈ¡£¬µ±Ò»Óû§½ø³Ìµ÷ÓÃÎļþϵͳµ÷ÓÃopen ʱ£¬ºËÐĵ÷ÓÃÒÔ´ËÀý³Ì

---- xxxxclose:È¡Ïû¶ÔÒ»¸öÉ豸µÄ´æÈ¡£¬µ±Ò»Óû§½ø³Ìµ÷ÓÃÎļþϵͳÀý³Ìcloseʱ£¬ºËÐĵ÷ÓôËÀý³Ì

---- xxxxread: ´ÓÉ豸ÖжÁÈ¡Êý¾Ý£¬µ±Óû§½ø³Ìµ÷ÓÃÎļþϵͳÀý³Ìreadʱ£¬ºËÐĵ÷ÓôËÀý³Ì£¬ÊµÏÖÊý ¾Ý´ÓϵͳµØÖ·¿Õ¼äµ½Óû§µØÖ·¿Õ¼äµÄ´«µÝ¡£

---- xxxxwrite: ÏòÉ豸дÊý¾Ý£¬µ±Óû§½ø³Ìµ÷ÓÃÎļþϵͳÀý³Ìwrite ʱ£¬ºËÐĵ÷ÓôËÀý³Ì£¬ÊµÏÖÊý¾Ý´ÓÓû§µØÖ·¿Õ¼äÏòϵͳµØÖ·¿Õ¼äµÄ´«µÝ,²¢·¢Ë͵½ÎïÀíÉ豸¡£

---- xxxxintr: ´¦ÀíÉ豸Öжϣ¬µ±É豸Ïòϵͳ·¢³öÖжÏÇëÇóʱ£¬ºËÐĵ÷ÓôËÀý³ÌÀ´´¦ÀíÖжÏ

---- xxxxstart: Æô¶¯Ò»¸öÇý¶¯³ÌÐòµÄ´æÈ¡£¬¸ÃÀý³ÌҲϵͳÆô¶¯ÆÚ¼äÓɺËÐÄ×Ô¶¯µ÷ÓᣠÓëxxinitÀý³ÌµÄÇø±ðÊÇ£ºxxinitÀý³ÌÔÚϵͳ³õÆôʱ¼´±»ºËÐÄÓ㬶øxxstartÀý³ÌµÄµ÷ÓÃÔòÔÚϵͳÖжÏϵͳÒѳõʼ»¯ÍêÖ®ºó²Åµ÷Óá£

---- xxxxioct1: ¿ØÖÆ×Ö·ûÉ豸£¬Óû§½ø³Ìµ÷ÓÃÎļþϵͳÓÃioct1ʱ£¬ºËÐĵ÷ÓôËÀý³Ì

---- ÕâЩÀý³Ì¶¼ÊÇ¿ÉÑ¡µÄ¡£

---- 2Çý¶¯³ÌÐòµÄ²ÎÊý´«µÝ£º

---- ϵͳºËÐÄΪÿ¸ö½ø³Ì·ÖÅäºÍά»¤Ò»¸öºËÐÄÊý¾Ý½á¹¹USER£¬¸Ã½á¹¹°üº¬½ø³ÌÔËÐÐʱËùÐèµÄÈ«²¿ÐÅÏ¢¡£±äÁ¿uÊǵ±Ç°»î¶¯½ø³ÌµÄUSERÊý¾Ý½á¹¹£¬Ëü°üº¬µÄÐÅÏ¢½öΪºËÐÄ˽ÓУ¬Çý¶¯³ÌÐò»áƵ·±Ê¹ÓÃÆäÖеĺܶàÔªËØ£¬½Ï³£ÓõÄÓУº

---- u.u_base: Óû§Êý¾ÝÇøµÄµØÖ·£¬º¬ÓÐÒª´«Ë͵ĶÁ/дÊý¾Ý¡£µ±Óû§µ÷ÓÃÎļþ¶Á/дϵͳ¹¦ÄÜʱ£¬µØÖ·²ÎÊý¾Í´æÔڸõ¥ÔªÖС£

---- u.u_offset:´«µÝµÄÊý¾ÝÎļþµÄÆðʼµØÖ·

---- u.u_count: °üº¬´«µÝµÄ×Ö½ÚÊý

---- u.u_error: Îļþϵͳµ÷Ó÷µ»ØʱµÄÈ«¾Ö±äÁ¿errnoµÄÖµ

---- Óû§Êý¾ÝÇøµÄÊý¾Ýͨ¹ýºËÐÄÀý³Ì£¬passc(),cpass(),copyin(),copyout()À´´«µÝ£¬passc(),cpass()Äܹ»×Ô¶¯Î¬»¤u½á¹¹£¬copyin(),copyout()±ØÐëÊÖ¶¯Î¬»¤u½á¹¹¡£

---- 3Çý¶¯³ÌÐòµÄµ÷ÊÔ£º

---- 1£©Í¨¹ýprintfÓï¾ä£¬½«Òª¹Û²ìµÄ±äÁ¿µÈ´òÓ¡³öÀ´

---- 2£©×Ô¼º±àд²âÊÔ³ÌÐòµ÷ÊÔ£¬Ò»¸ö¼òµ¥µÄ¶ÁдÖÕ¶ËÉ豸µÄ³ÌÐò

---- 3£©ºËÐijö´íʱ£¬¿ÉÒÔÓÃcrash

#ж³öÄÚ´æÓ³Ïó
#ldsysdump filename
# crash -d filename

---- 4É豸Çý¶¯³ÌÐòµÄ°²×°£º

---- É豸Çý¶¯³ÌÐòµÄ°²×°£¬Í¨³£×ñÑ­Èçϲ½Ö裺

---- 1) »ñÈ¡¿ÉÓÃÖ÷É豸ºÅ£¬ÃüÁîΪ£º

/etc/conf/cf.d/configure - j NEXTMAJOR
·µ»Ø - Ö÷É豸ºÅ£¬Èç120 ¡£

---- 2) ½¨Á¢É豸Îļþ½Úµã£¬ÃüÁîΪ£º
mknod /dev/mytt c 120 0
"/dev/mytt" Ö¸ÎÒËù×öµÄÉ豸Îļþ£¬"c"
Ö¸×Ö·ûÉ豸£¬"120" Ö¸Ö÷É豸ºÅ£¬"0" Ö¸´ÎÉ豸ºÅ¡£

---- 3) ÅäÖÃϵͳ £¬ÃüÁîΪ£º

cd/etc/conf/cf.d
./configure -m 120 -c -14 -T2 -v
4 -a myttinit myttopen myttclose\
myttread myttwrite myttioct1

option:
l4 ÖжÏÓÅÏȼ¶
T2 É豸ʹÓõÄÖжÏģʽ£¨0-3£©
V4 ÐèÒªÖжÏÏàÁ¿


---- 4) ¼ì²éÉ豸myttÊÇ·ñÒѼÓÈëϵͳ£¬ÃüÁîΪ£º

./configure -j mytt

---- Èç·µ»Ø120 Ôò±íʾmytt ÒѼÓÈëϵͳ£¬ÇÒÖ÷É豸Ϊ120 ¡£ Èç·µ»ØÐÅϢΪ"no sueh device " ÔòϵͳÖÐûÓÐÃûΪmytt µÄÉ豸£¬ÉÏÊöÃüÁîÒ²¿ÉÒÔÔÚÅäÖÃϵͳ֮ǰ¼ì²éÒ»ÏÂϵͳÖÐÊÇ·ñͬÃûÉ豸´æÔÚ¡£ÈçÓеĻ°£¬¿ÉÒÔÏȽ«¸ÃÉ豸ɾ³ý£¬È»ºóÔÙ¼ÓÈëÐÂÉ豸¡£ Ҫɾ³ýÒ»Ö¸¶¨É豸£¬Ôò±ØÐëÖªµÀÆäÖ÷É豸ºÅ¡£ È¡Ö÷É豸ºÅÃüÁîÈçÉÏÃæËùʾ£¬²½ÖèÈçÏ£º

./configure -j mytt
./configure -m 120 -c -d
Ôò´ÓºËÐÄÖÐɾ³ýÉ豸 mytt


---- 5) ±àÒëÇý¶¯³ÌÐòÔ´´úÂ룬½«Éú³ÉµÄ.o Îļþ¿½Èë/etc/conf/pack.d Ŀ¼

---- ±àÒëÇý¶¯³ÌÐòÔ´´úÂëÃüÁîÐУº

cc -c -D_INKERNEL mytt.c

mkdir /etc/conf/pack.d/mytt

cp mytt.o /etc/conf/pack.d/mytt/Driver.o


---- 6) ÖؼüºËÐÄ

cd/etc/conf/cf.d

./link_unix


---- »Ø´ðÁ½¸öY,ÔòÔÚ¸ùĿ¼ÏÂÉú³ÉÒ»¸öеĺËÐÄunix£¬¾ÉµÄºËÐÄÎļþ±»±£´æΪunix.o1d Çý¶¯³ÌÐòÒÑ°²×°Íê±Ï£¬ÐèÖØÐÂÆô¶¯unixϵͳ£¬É豸Çý¶¯³ÌÐò²ÅÄÜÓÐЧÕâʱϵͳ×Ô¶¯Ö´ÐÐmyttinit(),ÔÚÖ÷¿Ø̨ÏÔʾÐÅÏ¢£¬±íʾÉ豸Çý¶¯³ÌÐòÒÑ°²×°¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ