ÉèÖÃLinuxϵͳÒÔÖ§³ÖÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¿ª·¢
ÉèÖÃlinuxϵͳÒÔÖ§³ÖÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¿ª·¢
ÔÚLinux²Ù×÷ϵͳÖУ¬ÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯ÊǺÜÊÇÖ÷ÒªµÄ×é³É²¿·Ö£¬ËüÃÇΪ²Ù×÷ϵͳµÄÕý³£ÔËÐкÍÊý¾Ý´æ´¢ÌṩÁËÐëÒªµÄÖ§³Ö¡£ÎªÁ˾ÙÐÐÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯µÄ¿ª·¢ÊÂÇ飬ÎÒÃÇÐèÒª¶ÔLinuxϵͳ¾ÙÐÐÏìÓ¦µÄÉèÖᣱ¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃlinuxϵͳÒÔÖ§³ÖÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¿ª·¢£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢×°ÖÃLinuxϵͳ
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚÅÌËã»úÉÏ×°ÖÃLinuxϵͳ¡£Ñ¡ÔñºÏÊʵÄLinux¿¯Ðа棬ÈçUbuntu¡¢CentOSµÈ£¬²¢Æ¾Ö¤¹Ù·½Îĵµ»òÏòµ¼µÄÖ¸Òý¾ÙÐÐ×°Öá£×°ÖÃÍê³Éºó£¬ÏµÍ³»á×Ô¶¯ÉèÖúûù±¾µÄÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¡£
¶þ¡¢Ñ¡ÔñÊʺϵĿª·¢ÇéÐÎ
ÔÚ¾ÙÐÐÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯µÄ¿ª·¢ÊÂÇé֮ǰ£¬ÎÒÃÇÐèҪѡÔñÊʺϵĿª·¢ÇéÐΡ£ÒÔÏÂÊǼ¸¸ö³£ÓõĿª·¢ÇéÐÎÑ¡Ôñ£º
ÍâµØ¿ª·¢ÇéÐΣºÔÚ×Ô¼ºµÄÅÌËã»úÉϴһ¸ö¿ª·¢ÇéÐΣ¬Àû±ã¾ÙÐÐÎļþϵͳºÍÇý¶¯³ÌÐòµÄ±àдºÍµ÷ÊÔ¡£
ÐéÄâ»ú¿ª·¢ÇéÐΣºÍ¨¹ýÐéÄâ»úÈí¼þ£¬ÈçVirtualBox¡¢VMwareµÈ£¬ÔÚÅÌËã»úÉϽ¨ÉèÒ»¸öÐéÄâ»ú£¬½«LinuxϵͳװÖÃÔÚÆäÖоÙÐпª·¢¡£
Ô¶³Ì¿ª·¢ÇéÐΣºÍ¨¹ýSSHµÈÔ¶³ÌµÇ¼·½·¨£¬ÔÚÔ¶³ÌLinuxЧÀÍÆ÷ÉϾÙÐпª·¢£¬Êʺ϶àÈËÐ×÷»òÐèҪǿʢÅÌËãÄÜÁ¦µÄ³¡¾°¡£
ƾ֤ÏÖʵÐèÇó£¬Ñ¡ÔñÊʺÏ×Ô¼ºµÄ¿ª·¢ÇéÐΡ£
Èý¡¢ÉèÖÃÎļþϵͳ
ÎļþϵͳÇý¶¯±àÒë
ÔÚ¾ÙÐÐÎļþϵͳ¿ª·¢Ö®Ç°£¬ÎÒÃÇÐèÒªÌáÇ°±àÒëºÃÏìÓ¦µÄÎļþϵͳÇý¶¯¡£ÒÔext4ÎļþϵͳΪÀý£¬Ê×ÏÈÐèÒª»ñÈ¡²¢±àÒëext4ÎļþϵͳµÄÔ´Âë¡£ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
$ git clone https://github.com/tytso/ext4.git $ cd ext4 $ make
µÇ¼ºó¸´ÖÆ
±àÒëÍê³Éºó£¬»áÌìÉúÒ»¸öÃûΪext4.koµÄÇý¶¯Îļþ¡£
¼ÓÔØÎļþϵͳÇý¶¯
±àÒëÍê³Éºó£¬ÎÒÃÇÐèÒª½«ÎļþϵͳÇý¶¯¼ÓÔص½ÄÚºËÖС£ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
$ sudo insmod ext4.ko
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉÏÊöÏÂÁÎÒÃÇÀֳɽ«ext4ÎļþϵͳÇý¶¯¼ÓÔص½ÁËLinuxÄÚºËÖС£
ËÄ¡¢ÉèÖô洢װ±¸Çý¶¯
´æ´¢×°±¸Çý¶¯±àÒë
¹ØÓÚ´æ´¢×°±¸Çý¶¯¿ª·¢£¬ÎÒÃÇͬÑùÐèÒªÌáÇ°±àÒëºÃÏìÓ¦µÄÇý¶¯³ÌÐò¡£ÒÔSATAÓ²ÅÌÇý¶¯ÎªÀý£¬Ê×ÏÈÐèÒª»ñÈ¡²¢±àÒëSATAÓ²ÅÌÇý¶¯µÄÔ´Âë¡£ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
$ git clone https://github.com/torvalds/linux.git $ cd linux $ make menuconfig
µÇ¼ºó¸´ÖÆ
ÔÚmake menuconfigÏÂÁîÖ´Ðк󣬻᷿ªÒ»¸öͼÐνçÃ棬¿ÉÒÔÔÚÆäÖÐÑ¡ÔñºÍÉèÖòî±ðµÄÇý¶¯ºÍ¹¦Ð§¡£ÎÒÃÇÐèÒªÕÒµ½SATAÓ²ÅÌÇý¶¯Ïà¹ØµÄÉèÖÃÏ½«ÆäÑ¡Öв¢ÉúÑÄ¡£
½Ó×Å£¬Ö´ÐÐÒÔÏÂÏÂÁî¾ÙÐбàÒ룺
$ make
µÇ¼ºó¸´ÖÆ
±àÒëÍê³Éºó£¬»áÌìÉúÒ»¸öÃûΪsata.koµÄÇý¶¯Îļþ¡£
¼ÓÔØ´æ´¢×°±¸Çý¶¯
±àÒëÍê³Éºó£¬ÎÒÃÇÐèÒª½«´æ´¢×°±¸Çý¶¯¼ÓÔص½ÄÚºËÖС£ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
$ sudo insmod sata.ko
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉÏÊöÏÂÁÎÒÃÇÀֳɽ«SATAÓ²ÅÌÇý¶¯¼ÓÔص½ÁËLinuxÄÚºËÖС£
Îå¡¢±àдʾÀý´úÂë
ÔÚÉèÖúÃÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯ºó£¬ÎÒÃÇ¿ÉÒÔ×îÏȾÙÐÐÏìÓ¦µÄ¿ª·¢ÊÂÇéÁË¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý´úÂ룬ÑÝʾÔõÑùÔÚLinuxÖжÁÈ¡Îļþ£º
#include <stdio.h> #include <stdlib.h> int main() { FILE *fp; char ch; fp = fopen("test.txt", "r"); if(fp == NULL) { printf("File open failed. "); exit(1); } while((ch = fgetc(fp)) != EOF) printf("%c", ch); fclose(fp); return 0; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂëͨ¹ýfopenº¯Êý·¿ªÒ»¸öÃûΪtest.txtµÄÎļþ£¬²¢Ñ»·¶ÁÈ¡ÎļþÖеÄÿ¸ö×Ö·û²¢Êä³öµ½ÖÕ¶ËÖУ¬Ö±µ½Îļþ¿¢Ê¡£×îºóͨ¹ýfcloseº¯Êý¹Ø±ÕÎļþ¡£
Áù¡¢×ܽá
ͨ¹ý¶ÔLinuxϵͳ¾ÙÐÐÏìÓ¦µÄÉèÖã¬ÎÒÃÇ¿ÉÒÔÖ§³ÖÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯µÄ¿ª·¢ÊÂÇé¡£±¾ÎÄÒÔÎļþϵͳºÍSATAÓ²ÅÌÇý¶¯ÎªÀý£¬ÏÈÈÝÁËÏêϸµÄÉèÖÃÀú³Ì²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Ï£ÍûÄܶԳõѧÕßÔÚÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¿ª·¢ÁìÓòÓÐÒ»¶¨µÄ×ÊÖú¡£
ÒÔÉϾÍÊÇÉèÖÃLinuxϵͳÒÔÖ§³ÖÎļþϵͳºÍ´æ´¢×°±¸Çý¶¯¿ª·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡