{"id":53340,"date":"2023-06-13T09:38:12","date_gmt":"2023-06-13T01:38:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=53340"},"modified":"2023-06-13T09:38:12","modified_gmt":"2023-06-13T01:38:12","slug":"linux-root-file","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-root-file.html","title":{"rendered":"Linux\u6839\u6587\u4ef6\u5236\u4f5c"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6839\u6587\u4ef6\u7cfb\u7edf\u9996\u5148\u662f\u5185\u6838\u542f\u52a8\u65f6\u6240mount\u7684\u7b2c\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u5185\u6838\u4ee3\u7801\u6620\u50cf\u6587\u4ef6\u4fdd\u5b58\u5728\u6839\u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u800c\u7cfb\u7edf\u5f15\u5bfc\u542f\u52a8\u7a0b\u5e8f\u4f1a\u5728\u6839\u6587\u4ef6\u7cfb\u7edf\u6302\u8f7d\u4e4b\u540e\u4ece\u4e2d\u628a\u4e00\u4e9b\u57fa\u672c\u7684\u521d\u59cb\u5316\u811a\u672c\u548c\u670d\u52a1\u7b49\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u53bb\u8fd0\u884c\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1.\u6839\u6587\u4ef6\u7cfb\u7edf<\/strong><\/div>\n

\u6587\u4ef6\u7cfb\u7edf\u662f\u5305\u62ec\u5728\u4e00\u4e2a\u78c1\u76d8\uff08\u5305\u62ec\u5149\u76d8\u3001\u8f6f\u76d8\u3001\u95ea\u76d8\u53ca\u5176\u5b83\u5b58\u50a8\u8bbe\u5907\uff09\u6216\u5206\u533a\u7684\u76ee\u5f55\u7ed3\u6784\uff1b\u4e00\u4e2a\u53ef\u5e94\u7528\u7684\u78c1\u76d8\u8bbe\u5907\u53ef\u4ee5\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff1b\u5982\u679c\u60a8\u60f3\u8fdb\u5165\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u9996\u5148\u60a8\u8981\u505a\u7684\u662f\u6302\u8f7d\uff08mount\uff09\u6587\u4ef6\u7cfb\u7edf\uff1b\u4e3a\u4e86\u6302\u8f7d\uff08mount\uff09\u6587\u4ef6\u7cfb\u7edf\uff0c\u60a8\u5fc5\u987b\u6307\u5b9a\u4e00\u4e2a\u6302\u8f7d\u70b9\u3002<\/p>\n

\u6ce8\uff1a\u5bf9\u4e8e\u6211\u4eec\u5e94\u7528\u5f00\u53d1\u6765\u8bf4\uff0c\u8d2d\u4e70\u5f00\u53d1\u677f\u7684\u65f6\u5019\uff0c\u5382\u5bb6\u4f1a\u63d0\u4f9b\u597d\u73b0\u6210\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\u548cBootLoader\u7b49\uff0c\u5982\u679c\u9700\u8981\uff0c\u6211\u4eec\u53ef\u4ee5\u6539\u53d8\u5176\u4e2d\u7684\u547d\u4ee4\u800c\u65e0\u9700\u4ece\u5934\u5f00\u59cb\u5236\u4f5c\u4e00\u4e2a\u65b0\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\u3002\u4e0d\u8fc7\u8fd9\u513f\u7684\u5236\u4f5c\u8fc7\u7a0b\u53ef\u4ee5\u8ba9\u6211\u4eec\u66f4\u6df1\u4e00\u70b9\u7406\u89e3Linux\u7684\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n

2.\u4e3b\u8981\u7684\u6839\u6587\u4ef6\u7cfb\u7edf<\/strong><\/div>\n

* Linux \u4e2d\uff0crootfs \u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002PC \u4e0a\u4e3b\u8981\u5b9e\u73b0\u6709 ramdisk \u548c\u76f4\u63a5\u6302\u8f7d HD\uff08Harddisk\uff0c\u786c\u76d8\uff09\u4e0a\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\uff1b\u5d4c\u5165\u5f0f\u4e2d\u4e00\u822c\u4e0d\u4ece HD \u542f\u52a8\uff0c\u800c\u662f\u4ece Flash \u542f\u52a8\uff0c\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u5c06 rootfs load \u5230 RAM \u7684RAMDisk\uff0c\u7a0d\u590d\u6742\u7684\u5c31\u662f\u76f4\u63a5\u4eceFlash \u8bfb\u53d6\u7684 Cramfs\uff0c\u66f4\u590d\u6742\u7684\u662f\u5728 Flash \u4e0a\u5206\u533a\uff0c\u5e76\u6784\u5efa JFFS2 \u7b49\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n

* RAMDisk \u5c06\u5236\u4f5c\u597d\u7684 rootfs \u538b\u7f29\u540e\u5199\u5165 Flash\uff0c\u542f\u52a8\u7684\u65f6\u5019\u7531 Bootloader load \u5230RAM\uff0c\u89e3\u538b\u7f29\uff0c\u7136\u540e\u6302\u8f7d\u5230 \/\u3002\u8fd9\u79cd\u65b9\u6cd5\u64cd\u4f5c\u7b80\u5355\uff0c\u4f46\u662f\u5728 RAM \u4e2d\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0d\u662f\u538b\u7f29\u7684\uff0c\u56e0\u6b64\u9700\u8981\u5360\u7528\u8bb8\u591a\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\u7a00\u6709\u8d44\u6e90 RAM\u3002<\/p>\n

ramdisk \u5c31\u662f\u7528\u5185\u5b58\u7a7a\u95f4\u6765\u6a21\u62df\u51fa\u786c\u76d8\u5206\u533a,ramdisk\u901a\u5e38\u4f7f\u7528\u78c1\u76d8\u6587\u4ef6\u7cfb\u7edf\u7684\u538b\u7f29\u5b58\u653e\u5728flash\u4e2d,\u5728\u7cfb\u7edf\u521d\u59cb\u5316\u65f6,\u89e3\u538b\u7f29\u5230SDRAM\u5e76\u6302\u8f7d\u6839\u6587\u4ef6\u7cfb\u7edf, \u5728linux\u7cfb\u7edf\u4e2d,ramdisk\u6709\u4e8c\u79cd,\u4e00\u79cd\u5c31\u662f\u53ef\u4ee5\u683c\u5f0f\u5316\u5e76\u52a0\u8f7d,\u5728linux\u5185\u68382.0\/2.2\u5c31\u5df2\u7ecf\u652f\u6301,\u5176\u4e0d\u8db3\u4e4b\u5904\u662f\u5927\u5c0f\u56fa\u5b9a;\u53e6\u4e00\u79cd\u662f 2.4\u7684\u5185\u6838\u624d\u652f\u6301,\u901a\u8fc7,ramfs\u6765\u5b9e\u73b0,\u4ed6\u4e0d\u80fd\u88ab\u683c\u5f0f\u5316,\u4f46\u7528\u8d77\u6765\u65b9\u4fbf,\u5176\u5927\u5c0f\u968f\u6240\u9700\u8981\u7684\u7a7a\u95f4\u589e\u52a0\u6216\u51cf\u5c11,\u662f\u76ee\u524dlinux\u5e38\u7528\u7684ramdisk\u6280 \u672f\u3002<\/p>\n

* initrd \u662f RAMDisk \u7684\u683c\u5f0f\uff0ckernel 2.4 \u4e4b\u524d\u90fd\u662f image-initrd\uff0cKernel 2.5 \u5f15\u5165\u4e86 cpio-initrd\uff0c\u5927\u5927\u7b80\u5316\u4e86 Linux \u7684\u542f\u52a8\u8fc7\u7a0b\uff0c\u9644\u5408 Linux \u7684\u57fa\u672c\u54f2\u5b66\uff1aKeep it simple, stupid(KISS). \u4e0d\u8fc7cpio-initrd \u4f5c\u4e3a\u65b0\u7684\u683c\u5f0f\uff0c\u8fd8\u6ca1\u6709\u7ecf\u8fc7\u5e7f\u6cdb\u6d4b\u8bd5\uff0c\u5d4c\u5165\u5f0f Linux \u4e2d\u4e3b\u8981\u91c7\u7528\u7684\u8fd8\u662f image-initrd\u3002<\/p>\n

* Cramfs \u662f Linus \u5199\u7684\u5f88\u7b80\u5355\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u6709\u5f88\u597d\u7684\u538b\u7f29\u7eff\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4ece Flash \u4e0a\u8fd0\u884c\uff0c\u4e0d\u987b load \u5230 RAM \u4e2d\uff0c\u56e0\u6b64\u8282\u7ea6\u4e86 RAM\u3002\u4f46\u662f Cramfs \u662f\u53ea\u8bfb\u7684\uff0c\u5bf9\u4e8e\u9700\u8981\u8fd0\u884c\u65f6\u4fee\u6539\u7684\u76ee\u5f55\uff08\u5982\uff1a \/etc, \/var, \/tmp\uff09\u591a\u6709\u4e0d\u4fbf\uff0c\u56e0\u6b64\uff0c\u4e00\u822c\u5c06\u8fd9\u4e9b\u76ee\u5f55\u505a\u6210ramfs \u7b49\u53ef\u5199\u7684 fs\u3002<\/p>\n

* SquashFS \u662f\u5bf9 Cramfs \u7684\u589e\u5f3a\u3002\u7a81\u7834\u4e86 Cramfs \u7684\u4e00\u4e9b\u9650\u5236\uff0c\u5728 Flash \u548c RAM \u7684\u4f7f\u7528\u91cf\u65b9\u9762\u4e5f\u5177\u6709\u4f18\u52bf\u3002\u4e0d\u8fc7\uff0c\u636e\u5f00\u53d1\u8005\u4ecb\u7ecd\uff0c\u5728\u6027\u80fd\u4e0a\u53ef\u80fd\u4e0d\u5982 Cramfs\u3002\u8fd9\u4e5f\u662f\u4e00\u79cd\u65b0\u65b9\u6cd5\uff0c\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u91c7\u7528\u4e4b\u524d\uff0c\u9700\u8981\u7ecf\u8fc7\u66f4\u591a\u7684\u6d4b\u8bd5\u3002<\/p>\n

3.Ramdisk\u5236\u4f5c<\/strong><\/div>\n

RAMDisk\u7684\u5236\u4f5c\u65b9\u6cd5\u5982\u4e0b\uff1a
\n(1) \u5728PC\u673a\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u4e0b\uff0c\u751f\u6210\u53ef\u4ee5\u865a\u62df\u6210\u5757\u8bbe\u5907\u7684\u6587\u4ef6\uff0c\u5047\u8bbe\u6587\u4ef6\u540d\u4e3ainit.img\u3002<\/p>\n

$ dd if=\/dev\/zero of=init.img bs=4096 count=1024<\/pre>\n

\u5176\u4e2dbs*count\u4e3a\u5757\u8bbe\u5907\u5927\u5c0f\uff08\u5355\u4f4d\uff1a\u5b57\u8282\uff09\uff0c\u751f\u6210init.img\u6587\u4ef6\u4ee5\u540e\uff0c\u8fd8\u5fc5\u987b\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u683c\u5f0f\u5316\u3002<\/p>\n

$ mke2fs \u2013m0 \u2013F init.img<\/pre>\n

(2) \u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939ram\uff0c\u5e76\u5c06init.img\u6302\u63a5\u5230ram\u76ee\u5f55\u3002<\/p>\n

$ mkdir ram\r\n$ mount init.img ram\/ -o loop<\/pre>\n

\u8fd9\u65f6\uff0c\u8bfb\u5199ram\u76ee\u5f55\uff0c\u7b49\u6548\u4e8e\u8bfb\u5199init.img\u6587\u4ef6\u3002\u7528\u6237\u53ef\u4ee5\u5c06\u6839\u6587\u7cfb\u7edf\u6240\u9700\u7684\u6587\u4ef6\u5199\u5165\u5230ram\u76ee\u5f55\u4e2d\u3002\u5f80ram\u76ee\u5f55\u5199\u5b8c\u6587\u4ef6\u4ee5\u540e\uff0c\u8fd8\u9700\u8981\u4f7f\u7528umount ram\u547d\u4ee4\u5378\u8f7dinit.img\uff0c\u624d\u80fd\u5c06\u5df2\u5199\u5165\u7684\u6587\u4ef6\u4fdd\u5b58\u5230init.img\u4e2d\u3002<\/p>\n

\uff083\uff09\u6dfb\u52a0\u5b8c\u6bd5\uff0c\u9700\u8981umount ram<\/p>\n

4.Cramfs\u5236\u4f5c<\/strong><\/div>\n

CramFS(Compressed Rom File System)\u662fLinux Torvalds\u5728Transmeta\u4efb\u804c\u65f6\uff0c\u6240\u53c2\u4e0e\u5f00\u53d1\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5b83\u662f\u9488\u5bf9Linux\u5185\u68382.4\u4e4b\u540e\u7684\u7248\u672c\u6240\u8bbe\u8ba1\u7684\u4e00\u79cd\u65b0\u578b\u53ea\u8bfb\u6587\u4ef6\u7cfb\u7edf\uff0c\u91c7\u7528\u4e86zlib \u538b\u7f29\uff0c\u538b\u7f29\u6bd4\u4e00\u822c\u53ef\u4ee5\u8fbe\u52301\uff1a2\uff0c\u4f46\u4ecd\u53ef\u4ee5\u4f5c\u5230\u9ad8\u6548\u7684\u968f\u673a\u8bfb\u53d6\uff0cLinux\u7cfb\u7edf\u4e2d\uff0c\u901a\u5e38\u628a\u4e0d\u9700\u8981\u7ecf\u5e38\u4fee\u6539\u7684\u76ee\u5f55\u538b\u7f29\u5b58\u653e\uff0c\u5e76\u5728\u7cfb\u7edf\u5f15\u5bfc\u7684\u65f6\u5019\u518d\u5c06\u538b\u7f29\u6587\u4ef6 \u89e3\u5f00\u3002\u56e0\u4e3aCramfs\u4e0d\u4f1a\u5f71\u54cd\u7cfb\u7edf\u7684\u8bfb\u53d6\u6587\u4ef6\u7684\u901f\u5ea6\uff0c\u800c\u4e14\u662f\u4e00\u4e2a\u9ad8\u5ea6\u538b\u7f29\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u56e0\u6b64\u975e\u5e38\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\u3002<\/p>\n

\u5728\u5d4c\u5165\u5f0f\u7684 \u73af\u5883\u4e4b\u4e0b\uff0c\u5185\u5b58\u548c\u5916\u5b58\u8d44\u6e90\u90fd\u9700\u8981\u8282\u7ea6\u4f7f\u7528\u3002\u5982\u679c\u4f7f\u7528RAMDISK\u65b9\u5f0f\u6765\u4f7f\u7528\u6587\u4ef6\u7cfb\u7edf\uff0c\u90a3\u4e48\u5728\u7cfb\u7edf\u8fd0\u884c\u4e4b\u540e\uff0c\u9996\u5148\u8981\u628aFlash\u4e0a\u7684\u6620\u50cf\u6587\u4ef6\u89e3\u538b\u7f29\u5230\u5185\u5b58 \u4e2d\uff0c\u6784\u9020\u8d77RAMDISK\u73af\u5883\uff0c\u624d\u53ef\u4ee5\u5f00\u59cb\u8fd0\u884c\u7a0b\u5e8f\u3002\u4f46\u662f\u5b83\u4e5f\u6709\u5f88\u81f4\u547d\u7684\u5f31\u70b9\u3002\u5728\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u540c\u6837\u7684\u4ee3\u7801\u4e0d\u4ec5\u5728Flash\u4e2d\u5360\u636e\u4e86\u7a7a\u95f4(\u4ee5\u538b\u7f29\u540e\u7684\u5f62\u5f0f\u5b58 \u5728)\uff0c\u800c\u4e14\u8fd8\u5728\u5185\u5b58\u4e2d\u5360\u7528\u4e86\u66f4\u5927\u7684\u7a7a\u95f4(\u4ee5\u89e3\u538b\u7f29\u4e4b\u540e\u7684\u5f62\u5f0f\u5b58\u5728)\uff0c\u8fd9\u8fdd\u80cc\u4e86\u5d4c\u5165\u5f0f\u73af\u5883\u4e0b\u5c3d\u91cf\u8282\u7701\u8d44\u6e90\u7684\u8981\u6c42\u3002<\/p>\n

\u4f7f\u7528CramFS\u6587\u4ef6 \u7cfb\u7edf\u5c31\u662f\u4e00\u79cd\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u5f0f\u3002CramFS\u662f\u4e00\u4e2a\u538b\u7f29\u683c\u5f0f\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u5b83\u5e76\u4e0d\u9700\u8981\u4e00\u6b21\u6027\u5730\u5c06\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u90fd\u89e3\u538b\u7f29\u5230\u5185\u5b58\u4e4b\u4e2d\uff0c\u800c\u53ea\u662f\u5728\u7cfb\u7edf\u9700 \u8981\u8bbf\u95ee\u67d0\u4e2a\u4f4d\u7f6e\u7684\u6570\u636e\u7684\u65f6\u5019\uff0c\u9a6c\u4e0a\u8ba1\u7b97\u51fa\u8be5\u6570\u636e\u5728CramFS\u4e2d\u7684\u4f4d\u7f6e\uff0c\u5c06\u5b83\u5b9e\u65f6\u5730\u89e3\u538b\u7f29\u5230\u5185\u5b58\u4e4b\u4e2d\uff0c\u7136\u540e\u901a\u8fc7\u5bf9\u5185\u5b58\u7684\u8bbf\u95ee\u6765\u83b7\u53d6\u6587\u4ef6\u7cfb\u7edf\u4e2d\u9700\u8981\u8bfb\u53d6\u7684\u6570 \u636e\u3002CramFS\u4e2d\u7684\u89e3\u538b\u7f29\u4ee5\u53ca\u89e3\u538b\u7f29\u4e4b\u540e\u7684\u5185\u5b58\u4e2d\u6570\u636e\u5b58\u653e\u4f4d\u7f6e\u90fd\u662f\u7531CramFS\u6587\u4ef6\u7cfb\u7edf\u672c\u8eab\u8fdb\u884c\u7ef4\u62a4\u7684\uff0c\u7528\u6237\u5e76\u4e0d\u9700\u8981\u4e86\u89e3\u5177\u4f53\u7684\u5b9e\u73b0\u8fc7\u7a0b\uff0c\u56e0\u6b64\u8fd9\u79cd\u65b9 \u5f0f\u589e\u5f3a\u4e86\u900f\u660e\u5ea6\uff0c\u5bf9\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u65e2\u65b9\u4fbf\uff0c\u53c8\u8282\u7701\u4e86\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n

\u4f46\u662fCramfs\u4e5f\u6709\u5176\u7f3a\u70b9\uff1a\u5ef6\u8fdf\u3001\u5c0f\u4e8e16MB\u3001\u4e0d\u652f\u6301\u5199\uff0c\u53ea\u652f\u6301PAGE_CREATE_SIZE=4096\u7684\u5185\u6838\u3002<\/p>\n

\u5236\u4f5c\u7684\u547d\u4ee4\uff1a\uff08root\u6587\u4ef6\u5939\u4e2d\u5b58\u653e\u7740\u6587\u4ef6\u7cfb\u7edf\uff09<\/p>\n

#mkcramfs root cramfs.img<\/pre>\n
5.\u5176\u4ed6\u6839\u6587\u4ef6\u7cfb\u7edf\u7684\u5236\u4f5c<\/strong><\/div>\n
\u5236\u4f5cyaffs\u6587\u4ef6\u7cfb\u7edf\uff1a mkyaffsimage myroots myroots.img\r\n\u5236\u4f5csquashfs\uff1a mksquashfs $(FS_DIR) $(FS_NAME) -noappend -be -lzma -no-fragments \u2013noI<\/pre>\n
6.BusyBox\u7f16\u8bd1\u5236\u4f5c<\/strong><\/div>\n

\u5efa\u7acb\u76ee\u6807\u677f\u7a7a\u6839\u76ee\u5f55\u6587\u4ef6\u5939\u53ca\u6839\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u5939\uff1a<\/p>\n

[root@190 friendly-arm]# mkdir myroots\r\n[root@190 friendly-arm]#pwd\r\n\/friendly-arm\/myroots\r\n[root@190 friendly-arm]#cd myroots\r\n[root@190 myroots]# mkdir bin sbin usr lib dev mnt opt root etc home proc tmp var\r\n[root@190 myroots]# mkdir etc\/init.d<\/pre>\n

\u8fdb\u5165etc\/init.d\u76ee\u5f55\u4e0b\uff0c\u5efa\u7acb\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u5e76\u547d\u540d\u4e3arcS\uff0c\u7528gedit\u6253\u5f00\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n

#! \/bin\/sh\r\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local\/bin:\r\nrunlevel=S\r\nprevlevel=N\r\numask 022\r\nexport PATH runlevel prevlevel\r\n#\r\n# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.\r\n#\r\ntrap \":\" INT QUIT TSTP<\/pre>\n

\u521b\u5efa dev \u4e2d\u7684\u8282\u70b9<\/strong>
\n\u5982\u679c\u4f7f\u7528\u201clinux 2.6.xx\u201d\u7684\u5185\u6838\uff0c\u5e94\u8be5\u4e8b\u5148\u521b\u5efa\u8282\u70b9\u201cconsole\u201d\u3001\u201cnull\u201d\u3002\u5426\u5219\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u5185\u5bb9\u4f1a\u63d0\u793a\u4ee5\u4e0b\u9519\u8bef\uff1a<\/p>\n

Warning: unable to open an initial console.\r\nKernel panic - not syncing: Attempted to kill init!<\/pre>\n

\u521b\u5efa\u8282\u70b9\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/strong><\/p>\n

# mknod dev\/console c 5 1\r\n# mknod dev\/null c 1 3 \u79fb\u690dBusybox\uff1a<\/pre>\n

\u8fdb\u5165\u5230\u538b\u7f29\u6587\u4ef6\u5b58\u653e\u7684\u76ee\u5f55\u4e0b\uff0c\u5e76\u89e3\u538b\u3002\u7136\u540e\u8fdb\u5165\u89e3\u538b\u540e\u7684busybox\u76ee\u5f55\u6587\u4ef6\u5939\uff0c\u968f\u540e\u914d\u7f6ebusybox \u3002<\/p>\n

[root@190 busybox-1.2.0]# make menuconfig<\/pre>\n

\u7531\u4e8e\u6bcf\u4e2a\u7248\u672c\u7684\u914d\u7f6e\u9009\u9879\u7ec4\u7ec7\u6709\u6240\u4e0d\u540c\u3002\u4e0d\u7ba1\u600e\u6837\uff0c\u6211\u4eec\u6ce8\u610f\u4ee5\u4e0b\u9009\u9879\u5c31\u884c\u4e86\uff1a<\/p>\n

1) Support for devfs\r\n2) Build BusyBox as a static binary ( no shared libs ) \/\/\u5c06busybox\u7f16\u8bd1\u6210\u9759\u6001\u94fe\u63a5\r\n3) Do you want to build busybox with a Cross Compile?\r\n(\/usr\/local\/arm\/3.3.2\/bin\/arm-linux-) Cross Compile prefix \/\/\u6307\u5b9a\u4ea4\u53c9\u7f16\u8bd1\u5668\r\n4) init\r\n5) Support reading an inittab file \/\/\u652f\u6301init\u8bfb\u53d6\/etc\/inittab \u914d\u7f6e\u6587\u4ef6\r\n6) (X) ash\u9009\u4e2dash \/\/\u5efa\u7acb\u7684rcS\u811a\u672c\u624d\u80fd\u6267\u884c\r\n7\uff09ash\r\n8\uff09cp cat ls mkdir mv \/\/\u53ef\u6267\u884c\u547d\u4ee4\u5de5\u5177\u7684\u9009\u62e9\uff0c\u81ea\u5df1\u770b\u7740\u529e\u5427\uff0c\u9700\u8981\u7528\u5230\u7684\u5c31\u9009\u4e0a\r\n9) mount\r\n10) umount\r\n11) Support loopback mounts\r\n12) Support for the old \/etc\/mtab file\r\n13) insmod\r\n14) Support version 2.2.x to 2.4.x Linux kernels\r\n15) Support version 2.6.x Linux kernels\r\n16) vi\r\n17)don\u2019t use user<\/pre>\n

\u4ee5\u4e0a\u5185\u5bb9\u5fc5\u987b\u9009\u4e0a\uff0c\u5176\u4ed6\u53ef\u6309\u9ed8\u8ba4\u503c\uff1b\u5982\u679c\u8981\u652f\u6301\u5176\u4ed6\u529f\u80fd\uff0c\u5982\u7f51\u7edc\u652f\u6301\u7b49\uff0c\u53ef\u6309\u9700\u9009\u62e9\uff0c\u82f1\u8bed\u4e0d\u662f\u5f88\u70c2\u7684\u8bdd\uff0c\u8fd9\u4e9b\u90fd\u6ca1\u6709\u95ee\u9898\u3002
\n\u914d\u7f6e\u597d\u4e4b\u540e\uff0c\u4fdd\u5b58\u9000\u51fa\u3002\u7136\u540e\u5bf9\u5176\u7f16\u8bd1\u548c\u5b89\u88c5\u5230\u521a\u624d\u5efa\u7acb\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\u76ee\u5f55\u4e0b\uff1a<\/p>\n

[root@190 busybox-1.2.0] make TARGET_ARCH=arm CROSS=arm-linux- \\ PREFIX=\/friendly-arm\/myroots\/ all install<\/pre>\n

\u5b89\u88c5\u597d\u4e4b\u540e\uff0c\u5c06\u76f8\u5e94\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u62f7\u8d1d\u5230\u6839\u6587\u4ef6\u7cfb\u7edf\u76f8\u5e94\u7684\u76ee\u5f55\u4e0b\uff1a
\n\u62f7\u8d1d\u4e00\u4e9b\u7ba1\u7406\u5458\u63a7\u5236\u7a0b\u5e8f\u5230\/sbin\u76ee\u5f55\u4e0b\uff0c\u6700\u91cd\u8981\u7684\u5c31\u662f\u8981\u5305\u542b\u4e00\u4e2ainit\u547d\u4ee4\uff1b
\n\u62f7\u8d1d\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\u65f6\u6240\u9700\u8981\u7684\u5e93\u5230\/lib\uff0c\u5e93\u6587\u4ef6\u53ef\u4ee5\u4ecePC\u673a\u4e0a\u7684\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\u5b89\u88c5\u76ee\u5f55\u4e0b\u62f7\u8d1d\uff0c\u5982libc-2.2.2.so\u3001libcryt-2.2.2.so\u3001libm-2.2.2.so\u3001libutil-2.2.2.so\u7b49\uff0c\u4e3a\u90e8\u5206\u76f8\u5e94\u5e93\u5efa\u7acb\u5feb\u6377\u65b9\u5f0f\uff0c\u63d0\u4f9b\u4e00\u4e9b\u5e94\u7528\u7a0b\u5e8f\u6309\u5feb \u6377\u65b9\u5f0f\u540d\u79f0\u8c03\u7528\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662fC\u5e93\u8981\u91c7\u7528C\u5e93\u7684\u7248\u672cglibc, glibc\u4f4d\u4e8e\/lib\/libc.so.6<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/blog.chinaunix.net\/uid-26524139-id-3051914.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/linux-root-file.html<\/a>\u7f16\u8f91\uff1a\u738b\u663e\u707f\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u6839\u6587\u4ef6\u7cfb\u7edf\u9996\u5148\u662f\u5185\u6838\u542f\u52a8\u65f6\u6240mount\u7684\u7b2c\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u5185\u6838\u4ee3\u7801\u6620\u50cf\u6587\u4ef6\u4fdd\u5b58\u5728\u6839\u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u800c\u7cfb\u7edf\u5f15\u5bfc\u542f […]<\/p>\n","protected":false},"author":402,"featured_media":53342,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-53340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/53340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/402"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=53340"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/53340\/revisions"}],"predecessor-version":[{"id":274849,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/53340\/revisions\/274849"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/53342"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=53340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=53340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=53340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}