sizeofÃæÊÔÌâÑ¡ Linux C±à³Ìʵս
½á¹¹ÌåºÍ¹²ÓÃÌåµÄÄÚ´æ·ÖÅäÊÇCÓïÑÔµÄÒ»¸öÄѵ㣬ҲÊÇÃæÊÔÌâÖеÄÈȵ㡣
ʾÀý1£º
Union data1
{
double d;
int i;
char c1;
char c2[9];
};
sizeof(union data1)µÄֵΪ16.ÔÚ±àÒëÆ÷ĬÈÏÉèÖõÄÇé¿öÏ£¬¸Ã¹²ÓÃÌå×î´ó»ù±¾ÀàÐÍΪdouble,ËüÕ¼8×Ö½Ú£¬ËùÒԴ˹²ÓÃÌåÒÔ8À´¶ÔÆë¡£×Ö·ûÊý×éc2Õ¼9¸ö×Ö½Ú£¬ÄÇôÕû¸ö¹²ÓÃÌåÓ¦¸ÃÕ¼9¸ö×Ö½Ú£¬µ«°´ÕÕ¶ÔÆëÔÔò£¬Êµ¼Ê·ÖÅä¸øËüµÄÄÚ´æΪ16×Ö½Ú¡£
Èç¹ûÊÇ£º
struct data1
{
double d;
int i;
char c1;
char c2[9];
};
sizeof(struct data1)µÄֵΪ24£¬Ê×ÏÈ°´ÕÕ´æ´¢´óС£¬¸Ã½á¹¹ÌåËùÕ¼´æ´¢¿Õ¼äΪ£º8+4+1+9=22×Ö½Ú£¬Õâ¸ö½á¹¹ÌåÒ²ÊÇÒÔ8¶ÔÆ룬Òò´Ëʵ¼Ê·ÖÅäµÄÊÇ24×Ö½Ú¡£
ʾÀý2£º
Union data2
{
int i;
char c1;
char c2[9];
};
sizeof(union data2)µÄֵΪ12£¬¸Ã¹²ÓÃÌåÕ¼ÄÚ´æ¿Õ¼ä×î´óµÄ»ù±¾Êý¾ÝÀàÐÍΪint,Æ䳤¶ÈΪ4£¬ËùÒԸù²ÓÃÌåÒÔ4À´¶ÔÆë¡£¸Ã¹²ÓÃÌåµÄ³¤¶ÈÈ¡¾öÓÚ×Ö·ûc2£¬Æ䳤¶ÈΪ9£¬9²»ÊÇ4µÄ±¶Êý£¬Òª½øÐжÔÆ룬Òò´Ëʵ¼Ê·ÖÅäµÄ´æ´¢¿Õ¼äΪ12.
struct data2
{
int i;
char c1;
char c2[9];
};
sizeof(struct data2)µÄֵΪ16£¬ÓëÉÏÃæ¹²ÓÃÌåÒ»Ñù£¬¸Ã½á¹¹ÌåÒÔ4¶ÔÆë¡£°´ÕÕ´æ´¢´óС£¬¸Ã½á¹¹ÌåËùÕ¼´æ´¢¿Õ¼äΪ£º4+1+9=14£¬14²»ÊÇ4µÄ±¶Êý£¬½øÐжÔÆ룬¶ÔÆëºóµÄֵΪ16.
ʾÀý3£º
Union data3
{
char c1;
char c2[3];
};
sizeof(union data3)µÄֵΪ3£¬¸Ã¹
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
¾ÙÀýÀ´Ëµ£¬Ó²Å̵ÄÎļþÃû³Æ¼´Îª /dev/hd[a-d] £¬ÆäÖУ¬ À¨ºÅÄÚµÄ×ÖĸΪ a-d µ±ÖеÄÈκÎÒ»¸ö£¬Ò༴ÓÉ /dev/hda, /dev/hdb, /dev/hdc, ¼° /dev/hdd ÕâËĸöµµ°¸µÄÒâ˼ (×¢£ºÕâÖÖÐÍʽµÄ±íʾ·¨ÔÚºóÃæµÄÕ½ڵ±ÖлáʹÓõúÜƵ·±£¬ÇëÌرðÁôÒâ)¡£ ÄÇô¹âÇýÓëÈíÅÌÄØ£¿·Ö±ðÊÇ /dev/cdrom, /dev/fd0 啰£¡ ºÃÁË£¬ÆäËüµÄ½Ó¿ÚÉ豸ÄØ£¿ ......
¼¶±ð£º Öм¶ M. Tim Jones, ¹ËÎʹ¤³Ìʦ, Emulex 2007 Äê 1 Ô 15 ÈÕ ÐéÄ⻯µÄº¬Òå·á¸»£¬Ó¦Óù㷺¡£Ä¿Ç°ÐéÄ⻯¼¼ÊõÖ÷Òª¹Ø×¢ÓÚ·þÎñÆ÷ÐéÄ⻯£¬¼´ÔÚÒ»¸öËÞÖ÷¼ÆËã»úÉÏÌṩ¶à¸ö¶ÀÁ¢²Ù×÷ϵͳ¡£±¾ÎĽ«Ì½Ë÷ÐéÄ⻯±³ºóµÄ˼Ï룬ȻºóÌÖÂÛʵÏÖÐéÄ⻯µÄһЩ¼¼Êõ¡£ÎÒÃÇ»¹½«Á˽âÏÖÓеÄÆäËûһЩÐéÄ⻯¼¼Êõ£¬ÀýÈç Linux ÉϲÙ×÷ϵͳµÄÐéÄ⻯ ......
Äں˱àÒëÍê³Éºó»áÉú³ÉzImageÄں˾µÏñÎļþ¡£¹ØÓÚbootloader¼ÓÔØzImageµ½Äںˣ¬²¢ÇÒÌøתµ½zImage¿ªÊ¼µØÖ·ÔËÐÐzImageµÄ¹ý³Ì£¬ÏàÐÅ´ó¼Ò¶¼ºÜÈÝÒ×Àí½â¡£µ«¶ÔÓÚzImageÊÇÈçºÎ½âѹµÄ¹ý³Ì£¬¾Í²»ÊÇÄÇôºÃÀí½âÁË¡£±¾ÎĽ«½áºÏ²¿·Ö¹Ø¼ü´úÂ룬½²½âzImageµÄ½âѹ¹ý³Ì¡£
¡¡¡¡ÏÈ¿´¿´zImageµÄ×é³É°É¡£ÔÚÄں˱àÒëÍê³Éºó»áÔÚarch/arm/boot/ÏÂÉú ......
»°ËµÔÚlinuxÄں˳õʼ»¯ÍêÄÚºËÁÙʱҳ±íÀ´Ó³ÉäÇ°8MBÄÚ´æºó£¬ÔÚÓûÍûµÄÇýʹÏ£¬linux¿ªÊ¼×ÅÊÖÇÀÕ¼
896MBÒÔϵÄÄÚ´æÁË¡£È»¶øÇÀ¶áÕâ896MBÄÚ´æ¾ø·ÇÒ×Ê¡£linux»¹ÓÐÐí¶àÂé·³µÄÊÂÒª×ö¡£±ÈÈç˵½ø¹¥ºÍÕ¼ÁìÒÁÀ¿ËµÈµÈ¡£ÓÚÊÇ
setup_memoryº¯Êý¿ªÊ¼Îªlinux²ß»®ºÍ³ï±¸´ËÊ¡£Ö÷ÒªÈÎÎñÊǽ¨Á¢Ò»ÕÅÓëÎïÀíÄÚ´æÒ³¿òºÅ¶ÔÓ¦µÄλͼ¡£Èç¹û¸ÃÒ³¿ò±»Õ ......