{"id":10021309,"date":"2026-03-14T21:47:36","date_gmt":"2026-03-14T13:47:36","guid":{"rendered":"https:\/\/itmax.cn\/?p=10021309"},"modified":"2026-03-14T21:47:36","modified_gmt":"2026-03-14T13:47:36","slug":"rootfs%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10021309","title":{"rendered":"RootFS\u6587\u4ef6\u7cfb\u7edf"},"content":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u826f\u8bb8\u3002<\/p>\n<p>\u6700\u8fd1\u5728\u505a\u5d4c\u5165\u5f0fLinux\u9879\u76ee\u7684\u65f6\u5019\uff0c\u7ecf\u5e38\u6709\u670b\u53cb\u95ee\u6211\u5173\u4e8eRootFS\u7684\u95ee\u9898\u3002<\/p>\n<p>\u6bd4\u5982&#8221;\u4e3a\u4ec0\u4e48\u6211\u7684\u677f\u5b50\u542f\u52a8\u4e0d\u4e86\uff1f&#8221;&#8221;\u6587\u4ef6\u7cfb\u7edf\u600e\u4e48\u5236\u4f5c\uff1f&#8221;&#8221;initramfs\u548crootfs\u6709\u4ec0\u4e48\u533a\u522b\uff1f&#8221;\u7b49\u7b49\u3002<\/p>\n<p>\u4eca\u5929\u6211\u5c31\u7cfb\u7edf\u5730\u7ed9\u5927\u5bb6\u8bb2\u8bb2RootFS\u6587\u4ef6\u7cfb\u7edf\uff0c\u4ece\u539f\u7406\u5230\u5b9e\u8df5\uff0c\u8ba9\u4f60\u5f7b\u5e95\u641e\u61c2\u8fd9\u4e2a\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u4e2d\u7684\u6838\u5fc3\u6982\u5ff5\u3002<\/p>\n<h2>1. \u4ec0\u4e48\u662fRootFS<\/h2>\n<h3>1.1 RootFS\u7684\u57fa\u672c\u6982\u5ff5<\/h3>\n<p>RootFS\uff0c\u5168\u79f0Root File System\uff0c\u5373\u6839\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n<p>\u5b83\u662fLinux\u7cfb\u7edf\u542f\u52a8\u540e\u6302\u8f7d\u7684\u7b2c\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u4e5f\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u6811\u7684\u6839\u8282\u70b9\u3002<\/p>\n<p>\u6240\u6709\u5176\u4ed6\u7684\u6587\u4ef6\u7cfb\u7edf\u90fd\u4f1a\u6302\u8f7d\u5728RootFS\u7684\u67d0\u4e2a\u76ee\u5f55\u4e0b\uff0c\u5f62\u6210\u4e00\u4e2a\u7edf\u4e00\u7684\u76ee\u5f55\u6811\u7ed3\u6784\u3002<\/p>\n<p>\u5728\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u4e2d\uff0cRootFS\u7684\u5730\u4f4d\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<p>\u5b83\u5305\u542b\u4e86\u7cfb\u7edf\u542f\u52a8\u6240\u9700\u7684\u6240\u6709\u57fa\u672c\u6587\u4ef6\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u7cfb\u7edf\u521d\u59cb\u5316\u7a0b\u5e8f\uff08\u5982init\u3001systemd\u7b49\uff09<\/li>\n<li>\u57fa\u672c\u7684\u7cfb\u7edf\u547d\u4ee4\u548c\u5de5\u5177\uff08\u5982ls\u3001cp\u3001cat\u7b49\uff09<\/li>\n<li>\u7cfb\u7edf\u5e93\u6587\u4ef6\uff08\u5982libc.so\u7b49\uff09<\/li>\n<li>\u8bbe\u5907\u6587\u4ef6\uff08\/dev\u76ee\u5f55\u4e0b\u7684\u8bbe\u5907\u8282\u70b9\uff09<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6\uff08\/etc\u76ee\u5f55\u4e0b\u7684\u5404\u79cd\u914d\u7f6e\uff09<\/li>\n<li>\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u4f9d\u8d56<\/li>\n<\/ul>\n<h3>1.2 RootFS\u5728\u7cfb\u7edf\u542f\u52a8\u4e2d\u7684\u4f5c\u7528<\/h3>\n<p>\u5f53Linux\u5185\u6838\u542f\u52a8\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u5c1d\u8bd5\u6302\u8f7dRootFS\uff0c\u7136\u540e\u6267\u884cRootFS\u4e2d\u7684\u7b2c\u4e00\u4e2a\u7528\u6237\u7a7a\u95f4\u7a0b\u5e8f\uff08\u901a\u5e38\u662f\/sbin\/init\u6216\/init\uff09\u3002<\/p>\n<p>\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u7cfb\u7edf\u4ece\u5185\u6838\u7a7a\u95f4\u8fc7\u6e21\u5230\u7528\u6237\u7a7a\u95f4\u7684\u5173\u952e\u6b65\u9aa4\u3002<\/p>\n<p>\u5185\u6838\u542f\u52a8\u7684\u5927\u81f4\u6d41\u7a0b\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<ol>\n<li>Bootloader\u52a0\u8f7d\u5185\u6838\u5230\u5185\u5b58\u5e76\u542f\u52a8<\/li>\n<li>\u5185\u6838\u521d\u59cb\u5316\u786c\u4ef6\u3001\u5185\u5b58\u7ba1\u7406\u3001\u8fdb\u7a0b\u8c03\u5ea6\u7b49<\/li>\n<li>\u5185\u6838\u6302\u8f7dRootFS<\/li>\n<li>\u5185\u6838\u542f\u52a8init\u8fdb\u7a0b\uff08PID\u4e3a1\uff09<\/li>\n<li>init\u8fdb\u7a0b\u6839\u636e\u914d\u7f6e\u542f\u52a8\u5176\u4ed6\u7cfb\u7edf\u670d\u52a1\u548c\u5e94\u7528\u7a0b\u5e8f<\/li>\n<\/ol>\n<p>\u5982\u679cRootFS\u6302\u8f7d\u5931\u8d25\uff0c\u5185\u6838\u4f1apanic\uff0c\u7cfb\u7edf\u65e0\u6cd5\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n<p>\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u5f88\u591a\u521d\u5b66\u8005\u5728\u79fb\u690dLinux\u65f6\uff0c\u7ecf\u5e38\u9047\u5230&#8221;Kernel panic &#8211; not syncing: VFS: Unable to mount root fs&#8221;\u8fd9\u6837\u7684\u9519\u8bef\u3002<\/p>\n<h2>2. RootFS\u7684\u7c7b\u578b<\/h2>\n<h3>2.1 \u57fa\u4e8e\u5b58\u50a8\u4ecb\u8d28\u7684\u5206\u7c7b<\/h3>\n<p>\u6839\u636e\u5b58\u50a8\u4ecb\u8d28\u7684\u4e0d\u540c\uff0cRootFS\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u51e0\u79cd\u7c7b\u578b\uff1a<\/p>\n<p><strong>2.1.1 \u57fa\u4e8eFlash\u7684RootFS<\/strong><\/p>\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u6700\u5e38\u89c1\u7684\u662f\u5c06RootFS\u5b58\u50a8\u5728Flash\u4e2d\u3002<\/p>\n<p>\u6839\u636eFlash\u7c7b\u578b\u7684\u4e0d\u540c\uff0c\u53c8\u53ef\u4ee5\u7ec6\u5206\u4e3a\uff1a<\/p>\n<ul>\n<li><strong>NOR Flash RootFS<\/strong>\uff1a\u9002\u5408\u5c0f\u5bb9\u91cf\u7cfb\u7edf\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728Flash\u4e0a\u6267\u884c\u4ee3\u7801\uff08XIP\uff09\uff0c\u4f46\u5bb9\u91cf\u5c0f\u3001\u4ef7\u683c\u8d35\u3002<\/li>\n<li><strong>NAND Flash RootFS<\/strong>\uff1a\u5bb9\u91cf\u5927\u3001\u4ef7\u683c\u4fbf\u5b9c\uff0c\u4f46\u9700\u8981\u6587\u4ef6\u7cfb\u7edf\u652f\u6301\u574f\u5757\u7ba1\u7406\uff0c\u5e38\u7528\u7684\u6709JFFS2\u3001YAFFS2\u3001UBIFS\u7b49\u3002<\/li>\n<li><strong>eMMC\/SD\u5361 RootFS<\/strong>\uff1a\u7c7b\u4f3c\u4e8ePC\u7684\u786c\u76d8\uff0c\u53ef\u4ee5\u4f7f\u7528ext2\/ext3\/ext4\u7b49\u4f20\u7edf\u6587\u4ef6\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<p><strong>2.1.2 \u57fa\u4e8eRAM\u7684RootFS<\/strong><\/p>\n<p>\u6709\u4e9b\u573a\u666f\u4e0b\uff0cRootFS\u4f1a\u88ab\u52a0\u8f7d\u5230RAM\u4e2d\u8fd0\u884c\uff0c\u8fd9\u79cd\u65b9\u5f0f\u79f0\u4e3ainitramfs\u6216ramfs\u3002<\/p>\n<p>\u4f18\u70b9\u662f\u8bfb\u5199\u901f\u5ea6\u5feb\uff0c\u7f3a\u70b9\u662f\u6389\u7535\u6570\u636e\u4e22\u5931\uff0c\u4e14\u5360\u7528\u5b9d\u8d35\u7684RAM\u8d44\u6e90\u3002<\/p>\n<p><strong>2.1.3 \u57fa\u4e8e\u7f51\u7edc\u7684RootFS<\/strong><\/p>\n<p>\u901a\u8fc7NFS\uff08Network File System\uff09\u6302\u8f7d\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684\u76ee\u5f55\u4f5c\u4e3aRootFS\uff0c\u5e38\u7528\u4e8e\u5f00\u53d1\u8c03\u8bd5\u9636\u6bb5\uff0c\u65b9\u4fbf\u5feb\u901f\u66f4\u65b0\u6587\u4ef6\u7cfb\u7edf\u5185\u5bb9\u3002<\/p>\n<h3>2.2 \u57fa\u4e8e\u6587\u4ef6\u7cfb\u7edf\u683c\u5f0f\u7684\u5206\u7c7b<\/h3>\n<p><strong>2.2.1 \u4f20\u7edf\u6587\u4ef6\u7cfb\u7edf<\/strong><\/p>\n<ul>\n<li><strong>ext2\/ext3\/ext4<\/strong>\uff1aLinux\u4e0b\u6700\u5e38\u7528\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u9002\u5408eMMC\u3001SD\u5361\u7b49\u5757\u8bbe\u5907\u3002<\/li>\n<li><strong>FAT32<\/strong>\uff1a\u517c\u5bb9\u6027\u597d\uff0c\u4f46\u4e0d\u652f\u6301Linux\u6743\u9650\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<p><strong>2.2.2 Flash\u4e13\u7528\u6587\u4ef6\u7cfb\u7edf<\/strong><\/p>\n<ul>\n<li><strong>JFFS2\uff08Journaling Flash File System 2\uff09<\/strong>\uff1a\u8f83\u65e9\u7684Flash\u6587\u4ef6\u7cfb\u7edf\uff0c\u652f\u6301\u538b\u7f29\u548c\u78e8\u635f\u5747\u8861\u3002<\/li>\n<li><strong>YAFFS2\uff08Yet Another Flash File System 2\uff09<\/strong>\uff1a\u4e13\u4e3aNAND Flash\u8bbe\u8ba1\uff0c\u6027\u80fd\u8f83\u597d\u3002<\/li>\n<li><strong>UBIFS\uff08Unsorted Block Image File System\uff09<\/strong>\uff1a\u76ee\u524d\u6700\u6d41\u884c\u7684Flash\u6587\u4ef6\u7cfb\u7edf\uff0c\u914d\u5408UBI\u5c42\u4f7f\u7528\uff0c\u6027\u80fd\u548c\u53ef\u9760\u6027\u90fd\u5f88\u597d\u3002<\/li>\n<\/ul>\n<p><strong>2.2.3 \u53ea\u8bfb\u538b\u7f29\u6587\u4ef6\u7cfb\u7edf<\/strong><\/p>\n<ul>\n<li><strong>SquashFS<\/strong>\uff1a\u9ad8\u538b\u7f29\u6bd4\u7684\u53ea\u8bfb\u6587\u4ef6\u7cfb\u7edf\uff0c\u5e38\u7528\u4e8e\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4ee5\u8282\u7701\u5b58\u50a8\u7a7a\u95f4\u3002<\/li>\n<li><strong>CramFS<\/strong>\uff1a\u8f83\u65e9\u7684\u538b\u7f29\u6587\u4ef6\u7cfb\u7edf\uff0c\u5df2\u9010\u6e10\u88abSquashFS\u53d6\u4ee3\u3002<\/li>\n<\/ul>\n<h2>3. RootFS\u7684\u76ee\u5f55\u7ed3\u6784<\/h2>\n<p>\u4e00\u4e2a\u6807\u51c6\u7684Linux RootFS\u9075\u5faaFHS\uff08Filesystem Hierarchy Standard\uff09\u89c4\u8303\uff0c\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u76ee\u5f55\uff1a<\/p>\n<h3>3.1 \u6838\u5fc3\u76ee\u5f55<\/h3>\n<ul>\n<li><strong>\/bin<\/strong>\uff1a\u5b58\u653e\u57fa\u672c\u7684\u7528\u6237\u547d\u4ee4\uff0c\u5982ls\u3001cp\u3001cat\u7b49\uff0c\u8fd9\u4e9b\u547d\u4ee4\u5728\u5355\u7528\u6237\u6a21\u5f0f\u4e0b\u4e5f\u9700\u8981\u4f7f\u7528\u3002<\/li>\n<li><strong>\/sbin<\/strong>\uff1a\u5b58\u653e\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\uff0c\u5982ifconfig\u3001reboot\u7b49\uff0c\u901a\u5e38\u53ea\u6709root\u7528\u6237\u624d\u80fd\u6267\u884c\u3002<\/li>\n<li><strong>\/lib<\/strong>\uff1a\u5b58\u653e\u7cfb\u7edf\u5e93\u6587\u4ef6\u548c\u5185\u6838\u6a21\u5757\uff0c\u5982libc.so\u3001ld-linux.so\u7b49\u3002<\/li>\n<li><strong>\/etc<\/strong>\uff1a\u5b58\u653e\u7cfb\u7edf\u914d\u7f6e\u6587\u4ef6\uff0c\u5982inittab\u3001fstab\u3001network\u914d\u7f6e\u7b49\u3002<\/li>\n<li><strong>\/dev<\/strong>\uff1a\u5b58\u653e\u8bbe\u5907\u6587\u4ef6\uff0c\u5982\/dev\/ttyS0\u3001\/dev\/mtdblock0\u7b49\u3002<\/li>\n<\/ul>\n<h3>3.2 \u53ef\u9009\u76ee\u5f55<\/h3>\n<ul>\n<li><strong>\/usr<\/strong>\uff1a\u5b58\u653e\u7528\u6237\u7a0b\u5e8f\u548c\u6570\u636e\uff0c\u5305\u542b\/usr\/bin\u3001\/usr\/lib\u3001\/usr\/share\u7b49\u5b50\u76ee\u5f55\u3002<\/li>\n<li><strong>\/var<\/strong>\uff1a\u5b58\u653e\u7ecf\u5e38\u53d8\u5316\u7684\u6587\u4ef6\uff0c\u5982\u65e5\u5fd7\u6587\u4ef6\u3001\u4e34\u65f6\u6587\u4ef6\u7b49\u3002<\/li>\n<li><strong>\/tmp<\/strong>\uff1a\u5b58\u653e\u4e34\u65f6\u6587\u4ef6\uff0c\u901a\u5e38\u6302\u8f7d\u4e3atmpfs\uff08\u57fa\u4e8eRAM\uff09\u3002<\/li>\n<li><strong>\/proc<\/strong>\uff1a\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\uff0c\u63d0\u4f9b\u5185\u6838\u548c\u8fdb\u7a0b\u4fe1\u606f\u7684\u63a5\u53e3\u3002<\/li>\n<li><strong>\/sys<\/strong>\uff1a\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\uff0c\u63d0\u4f9b\u8bbe\u5907\u548c\u9a71\u52a8\u4fe1\u606f\u7684\u63a5\u53e3\u3002<\/li>\n<li><strong>\/home<\/strong>\uff1a\u7528\u6237\u4e3b\u76ee\u5f55\u3002<\/li>\n<li><strong>\/root<\/strong>\uff1aroot\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002<\/li>\n<li><strong>\/mnt<\/strong>\uff1a\u4e34\u65f6\u6302\u8f7d\u70b9\u3002<\/li>\n<li><strong>\/opt<\/strong>\uff1a\u53ef\u9009\u5e94\u7528\u7a0b\u5e8f\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u4e3a\u4e86\u8282\u7701\u7a7a\u95f4\uff0c\u901a\u5e38\u4f1a\u7cbe\u7b80\u76ee\u5f55\u7ed3\u6784\u3002<\/p>\n<p>\u6bd4\u5982\u5c06\/usr\/bin\u94fe\u63a5\u5230\/bin\uff0c\u5c06\/usr\/lib\u94fe\u63a5\u5230\/lib\u7b49\u3002<\/p>\n<h2>4. \u5236\u4f5cRootFS\u7684\u65b9\u6cd5<\/h2>\n<h3>4.1 \u4f7f\u7528BusyBox\u5236\u4f5c\u6700\u5c0fRootFS<\/h3>\n<p>BusyBox\u662f\u5d4c\u5165\u5f0fLinux\u4e2d\u6700\u5e38\u7528\u7684\u5de5\u5177\u96c6\uff0c\u5b83\u5c06\u6570\u767e\u4e2a\u5e38\u7528\u547d\u4ee4\u96c6\u6210\u5230\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\uff0c\u5927\u5927\u51cf\u5c0f\u4e86\u6587\u4ef6\u7cfb\u7edf\u7684\u4f53\u79ef\u3002<\/p>\n<p><strong>4.1.1 \u7f16\u8bd1BusyBox<\/strong><\/p>\n<pre><code class=\"bash\"># \u4e0b\u8f7dBusyBox\u6e90\u7801\nwget https:\/\/busybox.net\/downloads\/busybox-1.35.0.tar.bz2\ntar -xjf busybox-1.35.0.tar.bz2\ncd busybox-1.35.0\n\n# \u914d\u7f6eBusyBox\nmake menuconfig\n# \u5728\u914d\u7f6e\u754c\u9762\u4e2d\u9009\u62e9\uff1a\n# Settings -&gt; Build Options -&gt; Build BusyBox as a static binary (\u9009\u4e2d)\n# Settings -&gt; Installation Options -&gt; \u8bbe\u7f6e\u5b89\u88c5\u8def\u5f84\n\n# \u7f16\u8bd1\u5e76\u5b89\u88c5\nmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-\nmake install<\/code><\/pre>\n<p><strong>4.1.2 \u521b\u5efa\u57fa\u672c\u76ee\u5f55\u7ed3\u6784<\/strong><\/p>\n<pre><code class=\"bash\">cd \/path\/to\/rootfs\nmkdir -p bin sbin etc dev proc sys tmp lib usr\/bin usr\/sbin usr\/lib var home root mnt\n\n# \u590d\u5236BusyBox\ncp -a \/path\/to\/busybox\/_install\/* .\n\n# \u521b\u5efa\u8bbe\u5907\u8282\u70b9\uff08\u9700\u8981root\u6743\u9650\uff09\nsudo mknod dev\/console c 5 1\nsudo mknod dev\/null c 1 3<\/code><\/pre>\n<p><strong>4.1.3 \u6dfb\u52a0\u542f\u52a8\u811a\u672c<\/strong><\/p>\n<p>\u521b\u5efa\/etc\/inittab\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"bash\">::sysinit:\/etc\/init.d\/rcS\n::respawn:\/bin\/sh\n::ctrlaltdel:\/sbin\/reboot\n::shutdown:\/bin\/umount -a -r<\/code><\/pre>\n<p>\u521b\u5efa\/etc\/init.d\/rcS\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"bash\">#!\/bin\/sh\n\n# \u6302\u8f7dproc\u548csys\u6587\u4ef6\u7cfb\u7edf\nmount -t proc none \/proc\nmount -t sysfs none \/sys\nmount -t tmpfs none \/tmp\n\n# \u6302\u8f7ddevtmpfs\nmount -t devtmpfs none \/dev\n\n# \u8bbe\u7f6e\u4e3b\u673a\u540d\nhostname myboard\n\n# \u914d\u7f6e\u7f51\u7edc\uff08\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\uff09\nifconfig eth0 192.168.1.100 netmask 255.255.255.0 up\nroute add default gw 192.168.1.1\n\necho &quot;System initialization completed&quot;<\/code><\/pre>\n<p>\u8bb0\u5f97\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650\uff1a<\/p>\n<pre><code class=\"bash\">chmod +x etc\/init.d\/rcS<\/code><\/pre>\n<h3>4.2 \u4f7f\u7528Buildroot\u5236\u4f5c\u5b8c\u6574RootFS<\/h3>\n<p>Buildroot\u662f\u4e00\u4e2a\u81ea\u52a8\u5316\u6784\u5efa\u5de5\u5177\uff0c\u53ef\u4ee5\u81ea\u52a8\u4e0b\u8f7d\u3001\u7f16\u8bd1\u3001\u5b89\u88c5\u5404\u79cd\u8f6f\u4ef6\u5305\uff0c\u751f\u6210\u5b8c\u6574\u7684RootFS\u3002<\/p>\n<pre><code class=\"bash\"># \u4e0b\u8f7dBuildroot\ngit clone https:\/\/github.com\/buildroot\/buildroot.git\ncd buildroot\n\n# \u9009\u62e9\u9884\u914d\u7f6e\uff08\u4ee5\u6811\u8393\u6d3e\u4e3a\u4f8b\uff09\nmake raspberrypi3_defconfig\n\n# \u6216\u8005\u81ea\u5b9a\u4e49\u914d\u7f6e\nmake menuconfig\n\n# \u5f00\u59cb\u6784\u5efa\nmake\n\n# \u751f\u6210\u7684\u6587\u4ef6\u7cfb\u7edf\u5728output\/images\u76ee\u5f55\u4e0b<\/code><\/pre>\n<p>Buildroot\u7684\u4f18\u70b9\u662f\u529f\u80fd\u5f3a\u5927\u3001\u8f6f\u4ef6\u5305\u4e30\u5bcc\uff0c\u7f3a\u70b9\u662f\u9996\u6b21\u7f16\u8bd1\u65f6\u95f4\u8f83\u957f\uff0c\u9700\u8981\u4e0b\u8f7d\u5927\u91cf\u6e90\u7801\u5305\u3002<\/p>\n<h3>4.3 \u4f7f\u7528Yocto\u5236\u4f5cRootFS<\/h3>\n<p>Yocto\u662f\u66f4\u52a0\u4e13\u4e1a\u7684\u5d4c\u5165\u5f0fLinux\u6784\u5efa\u7cfb\u7edf\uff0c\u9002\u5408\u5927\u578b\u9879\u76ee\u548c\u4ea7\u54c1\u5316\u5f00\u53d1\u3002<\/p>\n<p>\u5b83\u4f7f\u7528BitBake\u4f5c\u4e3a\u6784\u5efa\u5f15\u64ce\uff0c\u652f\u6301\u5c42\uff08Layer\uff09\u7684\u6982\u5ff5\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u4e0d\u540c\u7684\u914d\u7f6e\u548c\u8f6f\u4ef6\u5305\u3002<\/p>\n<pre><code class=\"bash\"># \u4e0b\u8f7dPoky\uff08Yocto\u7684\u53c2\u8003\u53d1\u884c\u7248\uff09\ngit clone git:\/\/git.yoctoproject.org\/poky\ncd poky\n\n# \u521d\u59cb\u5316\u6784\u5efa\u73af\u5883\nsource oe-init-build-env\n\n# \u7f16\u8f91\u914d\u7f6e\u6587\u4ef6conf\/local.conf\uff0c\u8bbe\u7f6e\u76ee\u6807\u673a\u5668\n# MACHINE = &quot;qemuarm&quot;\n\n# \u6784\u5efa\u6700\u5c0f\u955c\u50cf\nbitbake core-image-minimal\n\n# \u6216\u6784\u5efa\u5b8c\u6574\u955c\u50cf\nbitbake core-image-full-cmdline<\/code><\/pre>\n<h2>5. RootFS\u7684\u6253\u5305\u548c\u70e7\u5199<\/h2>\n<h3>5.1 \u5236\u4f5c\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf<\/h3>\n<p>\u6839\u636e\u76ee\u6807\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\u7684\u4e0d\u540c\uff0c\u6253\u5305\u65b9\u6cd5\u4e5f\u4e0d\u540c\u3002<\/p>\n<p><strong>5.1.1 \u5236\u4f5cext4\u955c\u50cf<\/strong><\/p>\n<pre><code class=\"bash\"># \u521b\u5efa\u7a7a\u955c\u50cf\u6587\u4ef6\uff08\u5927\u5c0f\u4e3a100MB\uff09\ndd if=\/dev\/zero of=rootfs.ext4 bs=1M count=100\n\n# \u683c\u5f0f\u5316\u4e3aext4\nmkfs.ext4 rootfs.ext4\n\n# \u6302\u8f7d\u955c\u50cf\nsudo mkdir \/mnt\/rootfs\nsudo mount -o loop rootfs.ext4 \/mnt\/rootfs\n\n# \u590d\u5236\u6587\u4ef6\u7cfb\u7edf\u5185\u5bb9\nsudo cp -a \/path\/to\/rootfs\/* \/mnt\/rootfs\/\n\n# \u5378\u8f7d\nsudo umount \/mnt\/rootfs<\/code><\/pre>\n<p><strong>5.1.2 \u5236\u4f5cUBIFS\u955c\u50cf<\/strong><\/p>\n<pre><code class=\"bash\"># \u521b\u5efaUBIFS\u955c\u50cf\nmkfs.ubifs -r \/path\/to\/rootfs -m 2048 -e 126976 -c 1024 -o rootfs.ubifs\n\n# \u521b\u5efaUBI\u955c\u50cf\nubinize -o rootfs.ubi -m 2048 -p 128KiB ubinize.cfg<\/code><\/pre>\n<p>\u5176\u4e2dubinize.cfg\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre><code>[ubifs]\nmode=ubi\nimage=rootfs.ubifs\nvol_id=0\nvol_size=50MiB\nvol_type=dynamic\nvol_name=rootfs\nvol_flags=autoresize<\/code><\/pre>\n<p><strong>5.1.3 \u5236\u4f5cSquashFS\u955c\u50cf<\/strong><\/p>\n<pre><code class=\"bash\">mksquashfs \/path\/to\/rootfs rootfs.squashfs -comp xz<\/code><\/pre>\n<h3>5.2 \u70e7\u5199\u5230\u76ee\u6807\u677f<\/h3>\n<p><strong>5.2.1 \u4f7f\u7528U-Boot\u70e7\u5199<\/strong><\/p>\n<p>\u901a\u8fc7TFTP\u4e0b\u8f7d\u955c\u50cf\u5e76\u70e7\u5199\u5230Flash\uff1a<\/p>\n<pre><code class=\"bash\"># \u5728U-Boot\u547d\u4ee4\u884c\u4e2d\ntftp 0x80000000 rootfs.ubi\nnand erase.part rootfs\nnand write 0x80000000 rootfs ${filesize}<\/code><\/pre>\n<p><strong>5.2.2 \u4f7f\u7528dd\u547d\u4ee4\u70e7\u5199\u5230SD\u5361<\/strong><\/p>\n<pre><code class=\"bash\">sudo dd if=rootfs.ext4 of=\/dev\/sdb2 bs=1M\nsync<\/code><\/pre>\n<p><strong>5.2.3 \u4f7f\u7528fastboot\u70e7\u5199<\/strong><\/p>\n<pre><code class=\"bash\">fastboot flash rootfs rootfs.ext4<\/code><\/pre>\n<h2>6. \u5e38\u89c1\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848<\/h2>\n<h3>6.1 \u5185\u6838\u65e0\u6cd5\u6302\u8f7dRootFS<\/h3>\n<p><strong>\u95ee\u9898\u73b0\u8c61<\/strong>\uff1a\u7cfb\u7edf\u542f\u52a8\u65f6\u51fa\u73b0&#8221;Kernel panic &#8211; not syncing: VFS: Unable to mount root fs&#8221;\u9519\u8bef\u3002<\/p>\n<p><strong>\u53ef\u80fd\u539f\u56e0<\/strong>\uff1a<\/p>\n<ol>\n<li>\u5185\u6838\u914d\u7f6e\u4e2d\u6ca1\u6709\u7f16\u8bd1\u5bf9\u5e94\u7684\u6587\u4ef6\u7cfb\u7edf\u652f\u6301<\/li>\n<li>\u5185\u6838\u542f\u52a8\u53c2\u6570\u4e2droot\u8bbe\u5907\u6307\u5b9a\u9519\u8bef<\/li>\n<li>\u6587\u4ef6\u7cfb\u7edf\u635f\u574f<\/li>\n<li>\u8bbe\u5907\u9a71\u52a8\u672a\u6b63\u786e\u52a0\u8f7d<\/li>\n<\/ol>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>\uff1a<\/p>\n<ul>\n<li>\u68c0\u67e5\u5185\u6838\u914d\u7f6e\uff0c\u786e\u4fdd\u7f16\u8bd1\u4e86\u5bf9\u5e94\u7684\u6587\u4ef6\u7cfb\u7edf\u652f\u6301\uff08\u5982ext4\u3001ubifs\u7b49\uff09<\/li>\n<li>\u68c0\u67e5U-Boot\u4f20\u9012\u7ed9\u5185\u6838\u7684bootargs\u53c2\u6570\uff0c\u786e\u4fddroot=\/dev\/xxx\u6b63\u786e<\/li>\n<li>\u91cd\u65b0\u5236\u4f5c\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf<\/li>\n<li>\u68c0\u67e5\u5b58\u50a8\u8bbe\u5907\u9a71\u52a8\u662f\u5426\u6b63\u5e38\u5de5\u4f5c<\/li>\n<\/ul>\n<h3>6.2 init\u8fdb\u7a0b\u542f\u52a8\u5931\u8d25<\/h3>\n<p><strong>\u95ee\u9898\u73b0\u8c61<\/strong>\uff1a\u5185\u6838\u6210\u529f\u6302\u8f7dRootFS\uff0c\u4f46\u65e0\u6cd5\u542f\u52a8init\u8fdb\u7a0b\u3002<\/p>\n<p><strong>\u53ef\u80fd\u539f\u56e0<\/strong>\uff1a<\/p>\n<ol>\n<li>\/sbin\/init\u6216\/init\u6587\u4ef6\u4e0d\u5b58\u5728\u6216\u6ca1\u6709\u6267\u884c\u6743\u9650<\/li>\n<li>init\u7a0b\u5e8f\u4f9d\u8d56\u7684\u5e93\u6587\u4ef6\u7f3a\u5931<\/li>\n<li>init\u7a0b\u5e8f\u67b6\u6784\u4e0e\u5185\u6838\u4e0d\u5339\u914d\uff08\u5982\u5185\u6838\u662fARM\uff0c\u4f46init\u662fx86\uff09<\/li>\n<\/ol>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>\uff1a<\/p>\n<pre><code class=\"bash\"># \u68c0\u67e5init\u6587\u4ef6\u662f\u5426\u5b58\u5728\nls -l \/sbin\/init\n\n# \u68c0\u67e5\u4f9d\u8d56\u5e93\narm-linux-gnueabihf-readelf -d \/sbin\/init | grep NEEDED\n\n# \u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u5e93\u90fd\u5728\/lib\u76ee\u5f55\u4e0b<\/code><\/pre>\n<h3>6.3 \u8bbe\u5907\u8282\u70b9\u65e0\u6cd5\u8bbf\u95ee<\/h3>\n<p><strong>\u95ee\u9898\u73b0\u8c61<\/strong>\uff1a\u65e0\u6cd5\u8bbf\u95ee\/dev\u4e0b\u7684\u8bbe\u5907\u8282\u70b9\uff0c\u5982\u4e32\u53e3\u3001\u7f51\u5361\u7b49\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>\uff1a<\/p>\n<ul>\n<li>\u786e\u4fdd\u5185\u6838\u914d\u7f6e\u4e2d\u542f\u7528\u4e86devtmpfs<\/li>\n<li>\u5728\u542f\u52a8\u811a\u672c\u4e2d\u6302\u8f7ddevtmpfs\uff1a<\/li>\n<\/ul>\n<pre><code class=\"bash\">mount -t devtmpfs none \/dev<\/code><\/pre>\n<ul>\n<li>\u6216\u8005\u4f7f\u7528mdev\uff08BusyBox\u63d0\u4f9b\uff09\u52a8\u6001\u521b\u5efa\u8bbe\u5907\u8282\u70b9\uff1a<\/li>\n<\/ul>\n<pre><code class=\"bash\">echo \/sbin\/mdev &gt; \/proc\/sys\/kernel\/hotplug\nmdev -s<\/code><\/pre>\n<h3>6.4 \u6587\u4ef6\u7cfb\u7edf\u7a7a\u95f4\u4e0d\u8db3<\/h3>\n<p><strong>\u95ee\u9898\u73b0\u8c61<\/strong>\uff1a\u7cfb\u7edf\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u51fa\u73b0&#8221;No space left on device&#8221;\u9519\u8bef\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>\uff1a<\/p>\n<ul>\n<li>\u589e\u5927\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf\u7684\u5927\u5c0f<\/li>\n<li>\u6e05\u7406\/tmp\u3001\/var\/log\u7b49\u76ee\u5f55\u4e0b\u7684\u4e34\u65f6\u6587\u4ef6<\/li>\n<li>\u5c06\/tmp\u6302\u8f7d\u4e3atmpfs\uff0c\u907f\u514d\u5360\u7528Flash\u7a7a\u95f4\uff1a<\/li>\n<\/ul>\n<pre><code class=\"bash\">mount -t tmpfs -o size=10M tmpfs \/tmp<\/code><\/pre>\n<ul>\n<li>\u4f7f\u7528\u53ea\u8bfb\u6587\u4ef6\u7cfb\u7edf\uff08\u5982SquashFS\uff09+ \u53ef\u5199\u5206\u533a\uff08\u5982UBIFS\uff09\u7684\u7ec4\u5408\u65b9\u6848<\/li>\n<\/ul>\n<h2>7. RootFS\u4f18\u5316\u6280\u5de7<\/h2>\n<h3>7.1 \u51cf\u5c0f\u6587\u4ef6\u7cfb\u7edf\u4f53\u79ef<\/h3>\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u5b58\u50a8\u7a7a\u95f4\u901a\u5e38\u6bd4\u8f83\u7d27\u5f20\uff0c\u56e0\u6b64\u9700\u8981\u5c3d\u53ef\u80fd\u51cf\u5c0fRootFS\u7684\u4f53\u79ef\u3002<\/p>\n<p><strong>7.1.1 \u7cbe\u7b80BusyBox<\/strong><\/p>\n<p>\u5728\u914d\u7f6eBusyBox\u65f6\uff0c\u53ea\u9009\u62e9\u5fc5\u9700\u7684\u547d\u4ee4\u548c\u529f\u80fd\u3002<\/p>\n<p>\u6bd4\u5982\u5982\u679c\u4e0d\u9700\u8981\u7f51\u7edc\u529f\u80fd\uff0c\u53ef\u4ee5\u53bb\u6389ping\u3001wget\u7b49\u547d\u4ee4\u3002<\/p>\n<p><strong>7.1.2 \u88c1\u526a\u5e93\u6587\u4ef6<\/strong><\/p>\n<p>\u4f7f\u7528strip\u547d\u4ee4\u53bb\u9664\u5e93\u6587\u4ef6\u548c\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u7684\u8c03\u8bd5\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"bash\">arm-linux-gnueabihf-strip lib\/*.so\narm-linux-gnueabihf-strip bin\/*\narm-linux-gnueabihf-strip sbin\/*<\/code><\/pre>\n<p><strong>7.1.3 \u4f7f\u7528\u538b\u7f29\u6587\u4ef6\u7cfb\u7edf<\/strong><\/p>\n<p>\u4f7f\u7528SquashFS\u7b49\u538b\u7f29\u6587\u4ef6\u7cfb\u7edf\uff0c\u53ef\u4ee5\u5c06\u6587\u4ef6\u7cfb\u7edf\u4f53\u79ef\u538b\u7f29\u5230\u539f\u6765\u76841\/3\u751a\u81f3\u66f4\u5c0f\u3002<\/p>\n<p><strong>7.1.4 \u5220\u9664\u4e0d\u5fc5\u8981\u7684\u6587\u4ef6<\/strong><\/p>\n<p>\u5220\u9664\u6587\u6863\u3001\u793a\u4f8b\u3001\u5934\u6587\u4ef6\u7b49\u5f00\u53d1\u76f8\u5173\u7684\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"bash\">rm -rf usr\/share\/doc\nrm -rf usr\/share\/man\nrm -rf usr\/include<\/code><\/pre>\n<h3>7.2 \u63d0\u9ad8\u542f\u52a8\u901f\u5ea6<\/h3>\n<p><strong>7.2.1 \u4f7f\u7528\u5e76\u884c\u542f\u52a8<\/strong><\/p>\n<p>\u5728init\u811a\u672c\u4e2d\uff0c\u5c06\u4e00\u4e9b\u4e0d\u76f8\u4e92\u4f9d\u8d56\u7684\u670d\u52a1\u5e76\u884c\u542f\u52a8\uff1a<\/p>\n<pre><code class=\"bash\">service1 &amp;\nservice2 &amp;\nservice3 &amp;\nwait<\/code><\/pre>\n<p><strong>7.2.2 \u5ef6\u8fdf\u52a0\u8f7d\u975e\u5173\u952e\u670d\u52a1<\/strong><\/p>\n<p>\u5c06\u4e00\u4e9b\u975e\u5173\u952e\u670d\u52a1\u5ef6\u8fdf\u5230\u7cfb\u7edf\u542f\u52a8\u5b8c\u6210\u540e\u518d\u52a0\u8f7d\uff0c\u4f18\u5148\u4fdd\u8bc1\u6838\u5fc3\u529f\u80fd\u53ef\u7528\u3002<\/p>\n<p><strong>7.2.3 \u4f7f\u7528initramfs<\/strong><\/p>\n<p>\u5c06RootFS\u6253\u5305\u6210initramfs\uff0c\u76f4\u63a5\u52a0\u8f7d\u5230RAM\u4e2d\u8fd0\u884c\uff0c\u53ef\u4ee5\u5927\u5e45\u63d0\u9ad8\u542f\u52a8\u901f\u5ea6\u548c\u8fd0\u884c\u6027\u80fd\u3002<\/p>\n<h3>7.3 \u63d0\u9ad8\u7cfb\u7edf\u53ef\u9760\u6027<\/h3>\n<p><strong>7.3.1 \u4f7f\u7528\u53ea\u8bfb\u6839\u6587\u4ef6\u7cfb\u7edf<\/strong><\/p>\n<p>\u5c06RootFS\u6302\u8f7d\u4e3a\u53ea\u8bfb\uff0c\u53ef\u4ee5\u9632\u6b62\u610f\u5916\u65ad\u7535\u5bfc\u81f4\u6587\u4ef6\u7cfb\u7edf\u635f\u574f\uff1a<\/p>\n<pre><code class=\"bash\">mount -o remount,ro \/<\/code><\/pre>\n<p>\u9700\u8981\u5199\u5165\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528tmpfs\u6216\u5355\u72ec\u7684\u53ef\u5199\u5206\u533a\u3002<\/p>\n<p><strong>7.3.2 \u4f7f\u7528UBIFS\u7684\u539f\u5b50\u64cd\u4f5c<\/strong><\/p>\n<p>UBIFS\u652f\u6301\u539f\u5b50\u64cd\u4f5c\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u5728\u65ad\u7535\u65f6\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<p>\u5728\u5173\u952e\u6570\u636e\u5199\u5165\u540e\uff0c\u8c03\u7528sync\u786e\u4fdd\u6570\u636e\u5df2\u5199\u5165Flash\uff1a<\/p>\n<pre><code class=\"c\">int fd = open(&quot;\/data\/config.txt&quot;, O_WRONLY | O_CREAT | O_TRUNC, 0644);\nwrite(fd, data, len);\nfsync(fd);  \/\/ \u786e\u4fdd\u6570\u636e\u5199\u5165\u5b58\u50a8\u8bbe\u5907\nclose(fd);\nsync();     \/\/ \u540c\u6b65\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf<\/code><\/pre>\n<p><strong>7.3.3 \u5b9e\u73b0\u770b\u95e8\u72d7\u673a\u5236<\/strong><\/p>\n<p>\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5b9e\u73b0\u770b\u95e8\u72d7\u529f\u80fd\uff0c\u5b9a\u671f\u5582\u72d7\uff0c\u9632\u6b62\u7cfb\u7edf\u6b7b\u673a\uff1a<\/p>\n<pre><code class=\"c\">#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;fcntl.h&gt;\n#include &lt;unistd.h&gt;\n#include &lt;sys\/ioctl.h&gt;\n#include &lt;linux\/watchdog.h&gt;\n\nint main() {\n    int fd = open(&quot;\/dev\/watchdog&quot;, O_WRONLY);\n    if (fd &lt; 0) {\n        perror(&quot;open watchdog failed&quot;);\n        return -1;\n    }\n    \n    \/\/ \u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u4e3a30\u79d2\n    int timeout = 30;\n    ioctl(fd, WDIOC_SETTIMEOUT, &amp;timeout);\n    \n    while (1) {\n        \/\/ \u6267\u884c\u4e1a\u52a1\u903b\u8f91\n        do_business();\n        \n        \/\/ \u5582\u72d7\n        ioctl(fd, WDIOC_KEEPALIVE, 0);\n        \n        sleep(10);  \/\/ \u6bcf10\u79d2\u5582\u4e00\u6b21\u72d7\n    }\n    \n    close(fd);\n    return 0;\n}<\/code><\/pre>\n<h2>8. \u603b\u7ed3<\/h2>\n<p>RootFS\u662f\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u7684\u6838\u5fc3\u7ec4\u6210\u90e8\u5206\uff0c\u7406\u89e3\u548c\u638c\u63e1RootFS\u7684\u5236\u4f5c\u3001\u4f18\u5316\u548c\u8c03\u8bd5\u6280\u5de7\uff0c\u5bf9\u4e8e\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p>\u672c\u6587\u4eceRootFS\u7684\u57fa\u672c\u6982\u5ff5\u51fa\u53d1\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u4e86RootFS\u7684\u7c7b\u578b\u3001\u76ee\u5f55\u7ed3\u6784\u3001\u5236\u4f5c\u65b9\u6cd5\u3001\u6253\u5305\u70e7\u5199\u4ee5\u53ca\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u6700\u540e\u7ed9\u51fa\u4e86\u4e00\u4e9b\u5b9e\u7528\u7684\u4f18\u5316\u6280\u5de7\u3002<\/p>\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6839\u636e\u5177\u4f53\u7684\u786c\u4ef6\u5e73\u53f0\u3001\u5e94\u7528\u573a\u666f\u548c\u6027\u80fd\u8981\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\u548c\u5236\u4f5c\u65b9\u6cd5\u3002<\/p>\n<p>\u5bf9\u4e8e\u521d\u5b66\u8005\uff0c\u5efa\u8bae\u4eceBusyBox\u5f00\u59cb\uff0c\u624b\u52a8\u5236\u4f5c\u4e00\u4e2a\u6700\u5c0f\u7684RootFS\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u6df1\u5165\u5730\u7406\u89e3Linux\u7cfb\u7edf\u7684\u542f\u52a8\u8fc7\u7a0b\u548c\u6587\u4ef6\u7cfb\u7edf\u7684\u7ec4\u7ec7\u7ed3\u6784\u3002<\/p>\n<p>\u968f\u7740\u7ecf\u9a8c\u7684\u79ef\u7d2f\uff0c\u518d\u9010\u6b65\u4f7f\u7528Buildroot\u3001Yocto\u7b49\u81ea\u52a8\u5316\u5de5\u5177\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<p>\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u5927\u5bb6\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528RootFS\uff0c\u5728\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u7684\u9053\u8def\u4e0a\u5c11\u8d70\u5f2f\u8def\u3002<\/p>\n<p>\u5982\u679c\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u4ea4\u6d41\uff01<\/p>\n<p><strong>\u66f4\u591a\u7f16\u7a0b\u5b66\u4e60\u8d44\u6e90<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=%2FTZ4B%2FUxOjg8likP0zC23g%3D%3D.DOXL%2FEqUfrSVDS0%2BQ%2FZ3BpcoeYQf35%2FLxfQ1LcqrWWAkjoqFCc3%2BB7bLXUj86SSmFr7cPUIUH7FoMz%2F8blr1UA%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">C\u8bed\u8a00\u96f6\u57fa\u7840\u5165\u95e8\u7535\u5b50\u4e66-2026\u6700\u65b0\u7248<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=QddNZAea0sLYQk%2BfCog5qA%3D%3D.6f9SoE4xc7XB3QXsEnjTzb2SCAA7nMPxD9HlMydSM%2BwjbWvoNF0RZ0tD1dWZc8Y7gHX1JLjDBSVAu98%2B7%2B497Q%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">STM32\u96f6\u57fa\u7840\u5165\u95e8\u7535\u5b50\u4e66-2026\u6700\u65b0\u7248<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=xKVuw1lDiqYdfjM3LHtMiQ%3D%3D.oTnfzLePe3HjSPUjb7nDUjnKm2RHg0vLTLyMVomJh8lixT87GIZHEUTrzXblC4aWZAReRT3N9ABiQNAQN0MP%2F4D5jPGwlUzryf1VCszSwBc%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">FreeRTOS\u96f6\u57fa\u7840\u5165\u95e8\u7535\u5b50\u4e66-2026\u6700\u65b0\u7248<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=OpWgOkvXDpJ2Fb1ziZzp5A%3D%3D.FWHr5%2FCEv%2BZbcLUgRoW81a%2BoeLD1hwGhyXtq%2BeZ3yZ%2B2xJKXFL5s1lNV5957X8K5PylvdKgepeoVGCtr7lBxbw%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">C++ \u96f6\u57fa\u7840\u5165\u95e8\u7535\u5b50\u4e66-2026\u6700\u65b0\u7248<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=KgjASOptJiWXTgpGEba5rg%3D%3D.LEje%2B38TL%2BzgtdZrY8v2GNO8km76BiFEMO1pVAkV7gk2NJ1NCoUkv62Cr%2FeAVU1IV%2ByVEVr3g%2Bb5q0zAoE9PRA%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">51\u5355\u7247\u673a\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=QGOQ2xoX2Ug3wLIeKXrsng%3D%3D.gDeJu7GaxdSkSclqeiYsQEspds6ezIpcq6pV9jpNvycPa7al39OjMqh%2B%2Fek8OK3ayNWNc3FUiXLtkUtleWXstw%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">AD\u753b\u677f\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=sevbVJ91tEcfPS%2FVPzqYvA%3D%3D.YFAHYs2%2B%2FOGDTjEzi7O9wqYmBAEpuGZcZZxx72vPOVKbccWiFzEzM41QeS6hPh5MfwaYV6D42q%2B2YkGcJ8oEPA%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">C\u8bed\u8a00\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=wfLjn3IGwERIUVwOypskvg%3D%3D.mRidcHMFCA5qDPXJWvJsEy7%2BAD6Cfu6PV94ND3B%2B7r2E3yeqDdeZo5bsh1O49ZfrqY1cmFF%2Be92XREarRIeo4A%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">C++\u8bed\u8a00\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=3t4X9uPjC29sIE1tD3FmMg%3D%3D.sR7P5XtuWJ5Tm2t5483a5IWEh0gBIORf1XC0KpZRzvvjzS88qzoICNrSZX7JaAaQnkURuy6muwifnhq64900NxRdwuLx%2BJpno4jFSQbO%2F38%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">ESP32\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=I0DwARztdYdCOHjLb6mxGA%3D%3D.mz3mMFrtYLOvpRstI%2FV2CjYt4YY%2FZim%2Ft7VdNOKYo%2BfnChXobJxC%2BXJU7JCSrI8QIhjY6zuP5yGDbGEkV5l%2BJJ2aHKzukMp7qofvdtU35xI%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">FreeRTOS\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=B1rCiZ8C0JNvdyKCujPSIA%3D%3D.UH5EvnYdffaPqrnJ3Z3UOzfBPYrYa1hEruLW1O1hhoI8pT327tlWYWSzB8eXnKxBYYD1H3NsrnhpjfWKWjzpil3Q%2BAzLpTDDMy9dAr8uyjg%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Linux\u5e94\u7528\u5f00\u53d1\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=dCh1puIqbRCeH2XspPsXaA%3D%3D.Jw1enb29YDKK5cVYeKpUcTTcOwvP7SOKO%2FDPGiLs7vUvziEtJx7E89SyloVweVb52A8MGxa%2B0mu2%2B%2Bwr6BAk5219c3qXLqXtyHOMNnHXc64%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Linux\u5e95\u5c42\u5f00\u53d1\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=AQ4F5i5Y%2BiQStBWNTZgvRQ%3D%3D.DDrtkKkPsksW4%2BxUtV0Wzuiqj72PNIhcGaTV3NKAhlYJo2ewfI4veOEHPYGuwuug2eppUS%2BoNmmHZePOnGmxBA%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">LVGL\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=ReHFM95pNPw0LGU2OxiLPQ%3D%3D.33smzlviUWEw8K1ftBHLEI%2FdEV8POM2EYiAFwCizgYhO3RrftUVmx0L%2FCjl24VYuwNj%2F05WhXx0UC502YCQ9sQ%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">QT\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=Y3vbj%2FRzzAz12SAEON9vpg%3D%3D.4YbH0ipqSBpKEcqa8pSuzfMrMoU62m%2FeunjZO0QGKCYeWRPXMQlNuoGwJ64yXYFq7h3X7ndWr6vbS%2FaWetcBBsTgHFrR808TE%2FShLFWcyIs%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">STM32\u96f6\u57fa\u7840\u5165\u95e8\u5b66\u4e60\u8def\u7ebf<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000047652632\">https:\/\/segmentfault.com\/a\/1190000047652632<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u826f\u8bb8\u3002 \u6700\u8fd1\u5728\u505a\u5d4c\u5165\u5f0fLinux\u9879\u76ee\u7684\u65f6\u5019\uff0c\u7ecf\u5e38\u6709\u670b\u53cb\u95ee\u6211\u5173\u4e8eRootFS\u7684\u95ee\u9898\u3002 \u6bd4\u5982&#038;#822 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10021309","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10021309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10021309"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10021309\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10021309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10021309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10021309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}