ÏàʶEmbedded LinuxµÄ»ù±¾¿´·¨
ǶÈëʽ Linux ÊÇÒ»ÖÖÔÚǶÈëʽϵͳÖÐÔËÐÐµÄ Linux ²Ù×÷ϵͳ£¬Ëü¾ßÓпªÔ´ºÍ¿É¶¨ÖƵÄÌص㣬ÆÕ±éÓ¦ÓÃÓÚÖÖÖÖǶÈëʽװ±¸ÖС£Ïàʶ Embedded Linux µÄ»ù±¾¿´·¨¹ØÓÚ´ÓÊÂǶÈëʽ¿ª·¢ÊÂÇéµÄÖ°Ô±ºÜÊÇÖ÷Òª£¬±¾ÎĽ«´Ó»ù±¾¿´·¨ÈëÊÖ£¬ÍŽáÏêϸµÄ´úÂëʾÀýÀ´ÏÈÈÝ Embedded Linux µÄÏà¹Ø֪ʶ¡£
Embedded Linux µÄ»ù±¾¿´·¨
ÄںˣºLinux ÄÚºËÊÇ Embedded Linux µÄ½¹µã²¿·Ö£¬ËüÖÎÀíÓ²¼þ×ÊÔ´¡¢ÌṩϵͳŲÓýӿڣ¬²¢ÈÏÕæµ÷ÀíºÍÖÎÀíϵͳ×ÊÔ´¡£Ç¶Èëʽװ±¸µÄÓ²¼þÖ§³ÖºÍ¹¦Ð§ÊµÏÖ¶¼ÒÀÀµÓÚ Linux Äںˡ£
Îļþϵͳ£ºÎļþϵͳÊÇǶÈëʽϵͳÖд洢ºÍÖÎÀíÎļþµÄ×éÖ¯½á¹¹£¬³£¼ûµÄ Embedded Linux Îļþϵͳ°üÀ¨ Ext2/Ext3/Ext4¡¢JFFS2¡¢UBIFS µÈ¡£ÎļþϵͳµÄÑ¡ÔñÓëǶÈëʽװ±¸µÄ´æ´¢Æ÷ÀàÐͺÍÐèÇóÏà¹Ø¡£
×°±¸Çý¶¯£º×°±¸Çý¶¯ÊÇʵÏÖÓ²¼þÓëÈí¼þÖ®¼ä½»»¥µÄÖ÷Òª²¿·Ö£¬°üÀ¨×Ö·û×°±¸Çý¶¯¡¢¿é×°±¸Çý¶¯¡¢ÍøÂçÇý¶¯µÈ¡£±àдװ±¸Çý¶¯ÐèÒªÉîÈëÏàʶӲ¼þ×°±¸µÄÊÂÇéÔÀíºÍ¼Ä´æÆ÷²Ù×÷¡£
Óû§¿Õ¼ä¹¤¾ß£ºÓû§¿Õ¼ä¹¤¾ßÊÇÔÚÓû§¿Õ¼äÔËÐеijÌÐò£¬ÓÃÓÚÉèÖÃϵͳ¡¢¼à¿ØϵͳÐÔÄÜ¡¢¾ÙÐÐÓ¦Óÿª·¢µÈ¡£³£¼ûµÄÓû§¿Õ¼ä¹¤¾ß°üÀ¨ busybox¡¢sysfsutils¡¢top µÈ¡£
Embedded Linux µÄ´úÂëʾÀý
½ÓÏÂÀ´£¬ÎÒÃǽ«Í¨¹ýÒ»¸ö¼òÆ LED ¿ØÖƵĴúÂëʾÀýÀ´ÑÝʾÔõÑùÔÚ Embedded Linux ÖбàдºÍÔËÐÐÓ¦ÓóÌÐò¡£ÎÒÃǼÙÉ迪·¢°åÉÏÅþÁ¬ÁËÒ»¸ö LED µÆ£¬²¢ÇÒÒѾ¼ÓÔØÁËÏìÓ¦µÄÄÚºËÄ£¿é¡£
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #define LED_PATH "/sys/class/leds/led0/brightness" int main() { int fd; char buf[2]; fd = open(LED_PATH, O_WRONLY); if (fd < 0) { perror("Error opening LED file"); exit(1); } // ¿ØÖÆ LED µÆÁÁ buf[0] = '1'; write(fd, buf, 1); sleep(2); // ÑÓʱ 2 Ãë // ¿ØÖÆ LED µÆÃð buf[0] = '0'; write(fd, buf, 1); close(fd); return 0; }
µÇ¼ºó¸´ÖÆ
ÔÚÕâ¸öʾÀýÖУ¬ÎÒÃÇ·¿ªÁË LED µÄ¿ØÖÆÎļþ /sys/class/leds/led0/brightness£¬È»ºóÏòÆäдÈë×Ö·û ‘1’ À´Ê¹ LED µÆÁÁÆð£¬ÑÓʱ 2 ÃëºóÔÙдÈë×Ö·û ‘0’ À´Ê¹ LED µÆϨÃð¡£×îºó¹Ø±ÕÎļþÐÎò·û²¢Í˳ö³ÌÐò¡£
×ܽá
ͨ¹ý±¾ÎĵÄÏÈÈÝ£¬ÎÒÃÇÏàʶÁË Embedded Linux µÄ»ù±¾¿´·¨£¬°üÀ¨Äںˡ¢Îļþϵͳ¡¢×°±¸Çý¶¯¡¢Óû§¿Õ¼ä¹¤¾ßµÈÄÚÈÝ£¬²¢ÍŽá´úÂëʾÀýÑÝʾÁËÔÚ Embedded Linux ÖбàдӦÓóÌÐòµÄÀú³Ì¡£ÉîÈëѧϰǶÈëʽϵͳ¿ª·¢£¬Ã÷È· Embedded Linux µÄÔÀíÓëÓ¦Óã¬ÓÐÖúÓÚÎÒÃǸüºÃµØʹÓà Linux ƽ̨¿ª·¢ÖÖÖÖǶÈëʽװ±¸¡£
ÒÔÉϾÍÊÇÏàʶEmbedded LinuxµÄ»ù±¾¿´·¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡