linux ±à³ÌÖ®¿âµÄʹÓã¨Ñ§Ï°±Ê¼Ç£©
1.¿â¸ÅÊö
¿â¿ÉÒÔ·ÖΪ¾²Ì¬¿âºÍ¶¯Ì¬¿â£¬¾²Ì¬¿â±àÒëʱ±ØÐë´æÔÚ£¬³ÌÐòÔËÐÐʱ²»ÐèÒª¡£
¶¯Ì¬¿âÒ²³Æ¹²Ïí¿â£¬Æä´úÂë²»»áÁ´½Óµ½Ä¿±êÎļþÖ®ÖУ¬Ö»Óе±¶¯Ì¬¿â¿É·ÃÎÊʱ£¬Ó¦ÓóÌÐò²ÅÄÜÕýÈ·µØÖ´Ðж¯Ì¬¿âº¯Êý¡£Ö´Ðж¯Ì¬¿âÓÐÁ½ÖÖ·½Ê½£ºÒþʽµ÷ÓúÍÏÔʾµ÷Óá£Òþʽµ÷ÓÃÒ²³Æ¹²Ïí¿âµÄ¾²Ì¬¼ÓÔØ£¬¶¯Ì¬¿âº¯ÊýÔÚÓ¦ÓóÌÐò¿ªÊ¼Ö´ÐÐʱ»á×Ô¶¯ÔØÈëÄڴ棬½ø³Ì½áÊøÊ±ÓÖ×Ô¶¯Ð¶ÔØ¡£±àÒ뷽ʽÓ뾲̬¿âÒ»Ö¡£ÏÔʾµ÷ÓÃÒ²³Æ¹²Ïí¿âµÄ¶¯Ì¬¼ÓÔØ£¬µ÷ÓÃʱ±ØÐë×ñÊØdlopenµÈº¯ÊýµÄ¹æÔòʵÏÖµ÷Óá£
ÔÚUnixÖУ¬Ê¹ÓÃarÃüÁî¿ÉÒÔ´´½¨»ò²Ù×÷¾²Ì¬¿â£¬Æä¸ñʽΪ£º
ar [drqtpmx] [option] archivefile objfile ….
²ÎÊý
ÒâÒå
-r
½«objfileÎļþ²åÈ뾲̬¿âβ»òÌæ»»¾²Ì¬¿âÖÐͬÃûÎļþ
-x
´Ó¾²Ì¬¿âÎļþÖгéÈ¡Îļþobjfile
-t
´òÓ¡¾²Ì¬¿âµÄ³ÉÔ±ÎļþÁбí
-d
´Ó¾²Ì¬¿âÎļþÖÐɾ³ýÎļþobjfile
-s
ÖØÖþ²Ì¬¿âÎļþË÷Òý
-v
´´½¨ÎļþÈßÓàÐÅÏ¢
-c
´´½¨¾²Ì¬¿âÎļþ
Àý×Ó£º³éÈ¡¾²Ì¬¿â/usr/lib/lic.aÖеÄÎļþ
# ar –x /usr/lib/libc.a
Àý×Ó£º×éÖ¯Îļþxcvt.oºÍxstat.o´´½¨¾²Ì¬¿âlibccc.a¡£
# ar –r libccc.a xcvt.o xstat.o
2. ¾²Ì¬¿â±à³Ì
2.1 Éè¼Æ¿âÔ´Âë
/******pr1.c*****/
void pirnt1()
{
printf(“this is the first lib src\n”);
}
/*******pr2.c***********/
void print2()
{
printf(“this is the second lib src\n”);
}
2.2. ±àÒëÉú³É¿âÎļþ
gcc –O –c pr1.c pr2.c
·Ö±ð²úÉúpr1.o, pr2.oÎļþ
Á´½Ó¾²Ì¬¿â
ar –rsv libpr.a pr1.o pr2.o
2.3 ²âÊÔ³ÌÐòÔ´Âë
/********main.c************/
int main()
{
print1();
print2();
}
2.4 ±àÒëÔËÐÐ
gcc –O –o main main.c –L./ -lpr
3. ¶¯Ì¬¿â±à³Ì
3.1 ¿âÔ´Âë
/*******pr1.c********/
int p=2;
void print()
{
printf(“This is the first dll src!\n”);
}
/*******pr2.c*********/
int p = 3;
void print()
{
printf(“This is the second dll src!\n”);
}
3.2 ±àÒëÉú³É¶¯Ì¬¿â
gcc –O –fpic –shared &n
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
¹¦ÄÜÃèÊö£º
»ñÈ¡»òÕßÉèÖÃ
Óëij¸öÌ×½Ó×Ö¹ØÁªµÄÑ¡ ÏѡÏî¿ÉÄÜ´æÔÚÓÚ¶à²ãÐÒé
ÖУ¬ËüÃÇ×Ü»á³öÏÖÔÚ×îÉÏÃæµÄÌ×½Ó×ֲ㡣µ±²Ù×÷Ì×½Ó×ÖÑ¡Ïîʱ£¬Ñ¡ÏîλÓڵIJãºÍÑ¡ÏîµÄÃû³Æ±ØÐë¸ø³ö¡£ÎªÁ˲Ù×÷Ì×½Ó×Ö²ãµÄÑ¡ÏӦ¸Ã ½«²ãµÄÖµÖ¸¶¨ÎªSOL_SOCKET¡£ÎªÁ˲Ù×÷ÆäËü²ãµÄÑ¡Ï¿ØÖÆÑ¡ÏîµÄºÏÊÊÐ ......
linuxĿ¼˵Ã÷
¡¡
/bin
ÕâÊÇ·ÅÀýÈ磺 ls, mv, rm, mkdir, rmdir, gzip, tar, telnet, ¼° ftp µÈµÈ³£ÓÃ
µÄÖ´ÐеµµÄµØ·½£¨ÕâЩִÐеµµÄÖ´Ðз½·¨»áÔÚºóÃæÌáµ½£©£¬ÓÐʱºòÕâ¸öĿ¼µÄÄÚÈÝ
Óë /usr/bin ÊÇÒ»ÑùµÄ£¨ÓÐʱºòÉõÖÁ»áʹÓÃÁ¬½áµµÁ¨£©£¬ÊǸøÒ»°ãʹÓÃÕßʹÓõÄÖ´
ÐгÌÐò·ÅÖõÄËùÔÚ£¡
/boot
û´í£¬ÕâÀï¾ÍÊÇ·ÅÖÃÄã Linu ......
ÔÚlinuxÖÐÓû§·ÖΪÁ½Àࣺ1¡¢root³¬¼¶Óû§ 2¡¢ÆÕͨÓû§
/bin
¡¡¡¡Òýµ¼Æô¶¯ËùÐèµÄÃüÁî»òÆÕͨÓû§¿ÉÄÜÓõÄÃüÁî(¿ÉÄÜÔÚÒýµ¼Æô¶¯ºó)¡£
¡¡¡¡/sbin
¡¡¡¡ÀàËÆ/bin £¬µ«²»¸øÆÕͨÓû§Ê¹Óã¬ËäÈ»Èç¹û±ØÒªÇÒÔÊÐíʱ¿ÉÒÔʹÓá£
¡¡¡¡/etc
¡¡¡¡Ìض¨µÄÅ ......