{"id":1971,"date":"2016-09-13T12:13:27","date_gmt":"2016-09-13T04:13:27","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1971"},"modified":"2016-09-13T12:45:37","modified_gmt":"2016-09-13T04:45:37","slug":"%e8%ae%a4%e8%af%86linux-initrd","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1971","title":{"rendered":"\u8ba4\u8bc6Linux initrd"},"content":{"rendered":"<p>\u4e00\u3001 Ramdisk<\/p>\n<p>RamDisk \u5c31\u662f\u5c06\u5185\u5b58\u4e2d\u7684\u4e00\u5757\u533a\u57df\u4f5c\u4e3a\u7269\u7406\u78c1\u76d8\u6765\u4f7f\u7528\u7684\u4e00\u79cd\u6280\u672f\u3002\u4f7f\u7528\u65f6\u5185\u6838\u914d\u7f6e\uff1a\u4e24\u4e2a\u9009\u9879\uff1a\u7b2c\u4e00\u4e2a\u8bbe\u5b9aRamdisk\u4e2a\u6570\uff0c\u9ed8\u8ba416\u4e2a\uff1b\u7b2c\u4e8c\u4e2a\u662f\u8bbe\u5b9aRamdisk\u7684\u5927\u5c0f\uff0c\u8bbe\u5b9a16M<\/p>\n<p>Device Drivers  &#8212;><br \/>\n[*] Block devices  &#8212;><br \/>\n<*>   RAM block device support<br \/>\n(16)    Default number of RAM disks<br \/>\n(16384) Default RAM disk size (kbytes)<\/p>\n<p>\u53e6\u5916\uff1a<\/p>\n<h2>\u8bbe\u7f6einitramfs\/initrd\u7684\u652f\u6301<\/h2>\n<p>General setup  &#8212;><br \/>\n[*] Initial RAM filesystem and RAM disk (initramfs\/initrd) support<\/p>\n<p>\u4e8c\u3001 initrd<\/p>\n<p>initrd\u5168\u79f0\u662f initial RAM disk \uff0c\u5b83\u63d0\u4f9b\u4e00\u79cd\u8ba9Kernel\u53ef\u4ee5\u7b80\u5355\u4f7f\u7528Ramdisk\u7684\u80fd\u529b\uff0c\u7b80\u5355\u7684\u8bf4\uff0c\u8fd9\u4e9b\u80fd\u529b\u5305\u62ec\uff1a<br \/>\n\u683c\u5f0f\u5316\u4e00\u4e2aRamdisk\uff1b<br \/>\n\u52a0\u8f7d\u6587\u4ef6\u7cfb\u7edf\u5185\u5bb9\u5230Ramdisk\uff1b<br \/>\n\u5c06Ramdisk\u4f5c\u4e3a\u6839\u6587\u4ef6\u7cfb\u7edf\uff1b <\/p>\n<p>\u800cLinux\u542f\u52a8\u9636\u6bb5\u7684Ramdisk\u76f8\u5f53\u4e8e\u4e00\u4e2a\u672a\u683c\u5f0f\u5316\u7684\u786c\u76d8\u5206\u533a\uff0cKernel\u53ef\u4ee5\u76f4\u63a5\u5c06initrd\u7684\u5185\u5bb9\u91ca\u653e\u5230\u4e00\u4e2a\u672a\u521d\u59cb\u5316\u7684Ramdisk\u91cc\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u4e0eGhost\u6062\u590d\u4e00\u4e2a\u5206\u533a\u7684\u8fc7\u7a0b\u5341\u5206\u76f8\u4f3c\u3002\u4e8e\u662f\uff0c\u76f8\u5e94\u7684\u5185\u5bb9\u88ab\u52a0\u8f7d\u5230\u76f8\u5e94\u7684Ramdisk\u4e2d\uff0c\u540c\u65f6\uff0c\u8fd9\u4e2aRamdisk\u4e5f\u88ab\u683c\u5f0f\u5316\u6210\u67d0\u79cd\u7531initrd\u683c\u5f0f\u6240\u8868\u8fbe\u7684\u5206\u533a\u683c\u5f0f\u3002 <\/p>\n<p>initrd\u652f\u6301\u7684\u683c\u5f0f<br \/>\n\u00b7  Romfs\u6587\u4ef6\u7cfb\u7edf\uff1b<br \/>\n\u00b7  Ext2\u6587\u4ef6\u7cfb\u7edf\uff1b<br \/>\n\u00b7  cramfs\u6587\u4ef6\u7cfb\u7edf\uff1b<br \/>\n\u00b7  minix\u6587\u4ef6\u7cfb\u7edf\uff1b<\/p>\n<p>\u4e09\u3001Gzip\u652f\u6301<\/p>\n<p>\u5982\u679cKernel\u9009\u62e9\u4e86Gzip\u652f\u6301\uff08\u901a\u5e38\u8fd9\u662f\u9ed8\u8ba4\u7684\uff0c\u5728init\/do_mounts_rd.c\u4e2d\u5b9a\u4e49\u7684BUILD_CRAMDISK\u5b8f\uff09\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528Gzip\u538b\u7f29\u7684initrd\u3002\u76f8\u5173\u7684\u4ee3\u7801\u53ef\u4ee5\u5728\u6838\u5fc3\u6e90\u7801 drivers\/block\/rd.c:identify_ramdisk_image \u4e2d\u627e\u5230\u3002<\/p>\n<p>\u56db\u3001\u5236\u4f5cinitrd<\/p>\n<p>initrd\u6709\u4e24\u79cd\u683c\u5f0f\uff0cinitrd-image\u548cinitrd-cpio\u3002<\/p>\n<p>\u529e\u6cd5\u4e00\uff1a<br \/>\n\u901a\u8fc7ramdisk\u6765\u5236\u4f5c\u7684\u65b9\u6cd5\u6bd4\u8f83\u7b80\u5355(\u4ee5ext2\u6587\u4ef6\u7cfb\u7edf\u4e3a\u4f8b)\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\n# mkfs.ext2 \/dev\/ram0<br \/>\n# mount \/dev\/ram0 \/mnt\/rd<br \/>\n# cp _what_you_like_ \/mnt\/rd # \u628a\u9700\u8981\u7684\u6587\u4ef6\u590d\u5236\u8fc7\u53bb<br \/>\n# dd if=\/dev\/ram0 of=\/tmp\/initrd<br \/>\n# gzip -9 \/tmp\/initrd<\/p>\n<p>\u8fd9\u4e2a\u8fc7\u7a0b\u4e5f\u6700\u80fd\u591f\u89e3\u91cainitrd\u7684\u672c\u8d28\uff0c\u5bf9\u4e8eLinux\u6765\u8bf4\uff0cRamdisk\u7684\u4e00\u4e2a\u5757\u8bbe\u5907\uff0c\u800cinitrd\u662f\u8fd9\u4e2a\u5757\u8bbe\u5907\u4e0a\u6240\u6709\u5185\u5bb9\u7684\u201c\u514b\u9686\u201d\uff08\u7531<br \/>\n\u547d\u4ee4dd\u6765\u5b8c\u6210\uff09\u800c\u751f\u6210\u7684\u6587\u4ef6\u3002\u6838\u5fc3\u4e2d\u52a0\u8f7dinitrd\u76f8\u5173\u7684\u4ee3\u7801\u5219\u7528\u4e8e\u5b8c\u6210\u76f8\u53cd\u7684\u8fc7\u7a0b\uff0c\u5373\u5c06\u8fd9\u4e00\u4e2a\u6587\u4ef6\u6062\u590d\u5230Ramdisk\u4e2d\u53bb\u3002<\/p>\n<p>\u529e\u6cd5\u4e8c\uff1a<\/p>\n<p>\u901a\u8fc7loop\u8bbe\u5907\u6765\u5236\u4f5cinitrd\u7684\u8fc7\u7a0b\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\n# dd if=\/dev\/zero of=\/tmp\/initrd bs=1024 count=4096 # \u5236\u4f5c\u4e00\u4e2a4M\u7684\u7a7a\u767d\u6587\u4ef6<br \/>\n# losetup \/dev\/loop0 \/tmp\/initrd # \u6620\u5c04\u5230loop\u8bbe\u5907\u4e0a\uff1b<br \/>\n# mkfs.ext2 \/dev\/loop0 # \u521b\u5efa\u6587\u4ef6\u7cfb\u7edf\uff1b<br \/>\n# mount \/dev\/loop0 \/mnt\/rd<br \/>\n# cp _what_you_like_ \/mnt\/rd # \u590d\u5236\u9700\u8981\u7684\u6587\u4ef6\uff1b<br \/>\n# umount \/mnt\/rd<br \/>\n# losetup -d \/dev\/loop0<br \/>\n# gzip -9 \/tmp\/initrd<\/p>\n<p>\u529e\u6cd5\u4e09\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\nbash# dd if=\/dev\/zero of=..\/initrd.img bs=512k count=5<br \/>\nbash# mkfs.ext2 -F -m0 ..\/initrd.img<br \/>\nbash# mount -t ext2 -o loop ..\/initrd.img   \/mnt<br \/>\nbash# cp -r   * \/mnt<br \/>\nbash# umount \/mnt<br \/>\nbash# gzip -9 ..\/initrd.img<\/p>\n<p>\u529e\u6cd5\u56db\uff1a\uff08\u65b0\u5f0fINITRD\uff1acpio-initrd\u7684\u5236\u4f5c)<\/p>\n<pre class=\"prettyprint linenums\" >\n# find . | cpio -c -o > ..\/initrd.img<br \/>\n# gzip ..\/initrd.img<\/p>\n<p>\u89e3\u538binitrd\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\ngunzip initrd.img.gz<\/p>\n<p>\u5373\u4f7f\u60a8\u7684 initrd \u6620\u50cf\u6587\u4ef6\u4e0d\u662f\u4ee5 .gz \u7ed3\u5c3e\uff0c\u5b83\u4e5f\u53ef\u80fd\u662f\u4e00\u4e2a\u538b\u7f29\u6587\u4ef6\uff0c<br \/>\n\u53ef\u4ee5\u7ed9\u8fd9\u4e2a\u6587\u4ef6\u6dfb\u52a0\u4e0a .gz\u540e\u7f00\uff0c\u7136\u540e\u518d\u4f7f\u7528 gunzip \u5bf9\u5176\u8fdb\u884c\u89e3\u538b\u3002<\/p>\n<p>cpio \u5f52\u6863\u6587\u4ef6<br \/>\n# mkdir temp ; cd temp<br \/>\n# cp \/boot\/initrd-2.6.14.2.img initrd-2.6.14.2.img.gz \u3000\u3000<br \/>\n# gunzip initrd-2.6.14.2.img.gz \u3000\u3000<br \/>\n#cpio -ivmd < initrd-2.6.14.2.img\n\n\u4e94\u3001\u542f\u52a8\uff1a\n\nRedboot\u542f\u52a8\n\n\u4e0b\u8f7dinitrd\n0x01000000-0x01258831\n\n\u4e0b\u8f7dzImage\n0x00100000-0x002f82f7\n\n\u542f\u52a8\u547d\u4ee4\nexec -r 0x1000000 -s 0x258831 -c \"root=\/dev\/ram rw console=ttymxc0,115200\"\n\n\u516d\u3001\u7ed3\u679c\uff1a\n\n\u7528\u529e\u6cd5\u4e09\u5236\u4f5c\uff0c initrd-image\u53ef\u4ee5\u6210\u529f\u542f\u52a8log\uff1a\n\n\n\n<pre class=\"prettyprint linenums\" >\n<p>Kernel command line: root=\/dev\/ram rw console=ttymxc0,115200<\/p>\n<p>checking if image is initramfs...it isn't (no cpio magic); looks like an initrd<\/p>\n<p>Freeing initrd memory: 2402K<\/p>\n<p>RAMDISK: Compressed image found at block 0<\/p>\n<p>RAMDISK: ran out of compressed data<\/p>\n<p>out of input data<\/p>\n<p>VFS: Mounted root (ext2 filesystem).<\/p>\n<p>Freeing init memory: 140K<\/p>\n<p>Mounting \/proc and \/sys<\/p>\n<p>Starting the hotplug events dispatcher udevd<\/p>\n<p>Synthesizing initial hotplug events<\/p>\n<p>Setting the hostname to aigo_R&D<\/p>\n<p>Mounting filesystems<\/p>\n<p>\u7528initrd-cpio\u65e0\u6cd5\u542f\u52a8\uff1a<\/p>\n<pre class=\"prettyprint linenums\" >\nKernel command line: root=\/dev\/ram rw console=ttymxc0,115200<\/p>\n<p>checking if image is initramfs...it isn't (out of input data); looks like an initrd<\/p>\n<p>Freeing initrd memory: 2376K<\/p>\n<p>RAMDISK: Compressed image found at block 0<\/p>\n<p>RAMDISK: ran out of compressed data<\/p>\n<p>out of input data<\/p>\n<p>List of all partitions:<\/p>\n<p>1f00            2048 mtdblock0 (driver?)<\/p>\n<p>1f01            4096 mtdblock1 (driver?)<\/p>\n<p>1f02            2048 mtdblock2 (driver?)<\/p>\n<p>1f03           16384 mtdblock3 (driver?)<\/p>\n<p>1f04            8192 mtdblock4 (driver?)<\/p>\n<p>1f05            4096 mtdblock5 (driver?)<\/p>\n<p>1f06          786432 mtdblock6 (driver?)<\/p>\n<p>1f07         3371008 mtdblock7 (driver?)<\/p>\n<p>No filesystem could mount root, tried:  ext2 cramfs vfat msdos<\/p>\n<p>Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)<\/p>\n<p>initrd\u548cinitramfs\u7684\u533a\u522b<\/p>\n<p>\u539f\u6587\uff1ahttps:\/\/www.linux.com\/learn\/linux-training\/92607-the-kernel-newbie-corner-qinitrdq-and-qinitramfsq-whats-up-with-that<\/p>\n<p>initrd\uff1ainitial ramdisk<br \/>\ninitramfs\uff1ainitial ram filesystem<\/p>\n<p>Linux\u5185\u6838\u5728\u521d\u59cb\u5316\u4e4b\u540e\u4f1a\u6267\u884cinit\u8fdb\u7a0b\uff0c\u800cinit\u8fdb\u7a0b\u4f1a\u6302\u8f7d\u6211\u4eec\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\uff0c\u4f46\u7531\u4e8einit\u7a0b\u5e8f\u4e5f\u662f\u5728\u6839\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\uff0c\u6240\u4ee5\u8fd9\u5c31\u6709\u4e86\u6096\u8bba\u3002Linux\u91c7\u7528\u4e24\u6b65\u8d70\u7684\u65b9\u6cd5\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002Linux2.6\u7248\u4ee5\u524d\u7684\u65b9\u6cd5\u662f\uff1a\u9664\u4e86\u5185\u6838vmlinuz\u4e4b\u5916\u8fd8\u6709\u4e00\u4e2a\u72ec\u7acb\u7684initrd.img\u6620\u50cf\u6587\u4ef6\uff0c\u5176\u5b9e\u5b83\u5c31\u662f\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\u6620\u50cf\uff0clinux\u5185\u6838\u5728\u521d\u59cb\u5316\u540e\u4f1amount initrd.img\u4f5c\u4e3a\u4e00\u4e2a\u4e34\u65f6\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\uff0c\u800cinit\u8fdb\u7a0b\u5c31\u662f\u5728initrd.img\u91cc\u7684\uff0c\u7136\u540einit\u8fdb\u7a0b\u4f1a\u6302\u8f7d\u771f\u6b63\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\uff0c\u7136\u540eumount initrd.img\u3002\u4f46Linux2.6\u5185\u6838\u7684\u5b9e\u73b0\u65b9\u5f0f\u5374\u4e0d\u592a\u4e00\u6837\uff0c\u867d\u7136\u5b8c\u6210\u7684\u529f\u80fd\u662f\u4e00\u6837\u7684\u3002Linux2.6\u91c7\u7528initramfs\u3002initramfs\uff1ainit ram filesystem\uff0c\u5b83\u662f\u4e00\u4e2acpio\u683c\u5f0f\u7684\u5185\u5b58\u6587\u4ef6\u7cfb\u7edf\uff0c\u5236\u4f5c\u7684\u65b9\u6cd5\u6709\u4e24\u4e2a\uff0c\u4e00\u4e2a\u662fhttp:\/\/blog.csdn.net\/htttw\/article\/details\/7215858\u4ecb\u7ecd\u7684\uff0c\u4f46\u8fd9\u6837\u505a\u51fa\u6765\u7684initramfs\u662f\u548c\u5185\u6838vmlinuz\u5206\u5f00\u7684\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u5728grub\u91cc\u5199\u4e0ainitramfs\u7684\u8def\u5f84\u3002\u800c\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u628a\u5185\u6838\u548cinitramfs\u5236\u4f5c\u5728\u4e00\u8d77\u6210\u4e3a\u4e00\u4e2a\u6587\u4ef6\uff0c\u65b9\u6cd5\u662f\u5728linux\u6e90\u7801make menuconfig\uff0c\u7136\u540eGeneral setup-->\u9009\u62e9Initial RAM filesystem and RAM disk (initramfs\/initrd) support\uff0c\u7136\u540e\u5728Initramfs source file(s)\u91cc\u8f93\u5165\u6211\u4eec\u7684initramfs\u76ee\u5f55\uff0c\u7136\u540emake bzImage\u3002\u8fd9\u79cd\u65b9\u6cd5\u505a\u51fa\u6765\u7684\u5185\u6838\u5c31\u53ea\u6709\u4e00\u4e2a\u6587\u4ef6\uff0c\u4e0d\u9700\u8981\u6307\u5b9ainitramfs\u4e86\u3002<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u4f9d\u6b21\u4ecb\u7ecd\uff1a<br \/>\n\u5b9e\u9a8c\u4e00\uff1a\u5236\u4f5c\u4f20\u7edf\u7684initrd<\/p>\n<p>1.<br \/>\n\u9759\u6001\u7f16\u8bd1Busybox\uff0c\u751f\u6210_install\u76ee\u5f55\uff0c\u5177\u4f53\u7f16\u8bd1\u65b9\u6cd5\u53c2\u8003\uff1ahttp:\/\/blog.csdn.net\/htttw\/article\/details\/7215858\u7684\u524d\u534a\u90e8\u5206<\/p>\n<p>2.<br \/>\nmkdir ~\/ramdisk<br \/>\ncd ramdisk<br \/>\n\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u6620\u50cf\uff0c\u4ed6\u5c31\u662f\u6700\u7ec8\u7684initrd\uff1a<br \/>\ndd if=\/dev\/zero of=ramdisk bs=1k count=8000<br \/>\n\u4ee5\u4e0a\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a8M\u7684ramdisk\u6620\u50cf<\/p>\n<p>3.<br \/>\n\u7136\u540e\u683c\u5f0f\u5316\u6210ext3\u683c\u5f0f\uff1a<br \/>\nmkfs.ext2 -j ramdisk<br \/>\n\u7136\u540e\u6309\u201cy\u201d<\/p>\n<p>4.<br \/>\n\u7136\u540e\u6302\u8f7d\uff1asudo mount ramdisk \/mnt -o loop<\/p>\n<p>5.<br \/>\n\u7136\u540e\u590d\u5236busybox\u4e0b\u7684_install\u76ee\u5f55\u5230\/mnt\u4e0b<br \/>\nsudo cp -R busybox\/_install \/mnt<\/p>\n<p>6.<br \/>\n\u7136\u540e\u521b\u5efa\u5fc5\u8981\u7684\u76ee\u5f55\uff0c\u540e\u9762\u5c31\u548chttp:\/\/blog.csdn.net\/htttw\/article\/details\/7215858\u7684\u201c\u4e0a\u9762\u53ea\u662f\u51c6\u5907\u5de5\u4f5c\uff0c\u4e0b\u9762\u624d\u5f00\u59cb\u597d\u73a9\u4e86\u201d\u540e\u9762\u662f\u4e00\u6837\u7684\uff0c\u4e00\u76f4\u5230\u521b\u5efainit\u94fe\u63a5\uff1aln -sv bin\/busybox init\u4e4b\u540e<br \/>\n\u6ce8\u610f\uff1a\u73b0\u5728\u6211\u4eec\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u662f\u5728\/mnt\u91cc\u8fdb\u884c\u7684\uff0c\u5373\u5728\u7b2c\u4e8c\u6b65\u751f\u6210\u7684ramdisk\u91cc<\/p>\n<p>6.<br \/>\n\u5378\u8f7dramdisk\uff1a<br \/>\nsudo umount \/mnt<\/p>\n<p>7.<br \/>\ncopy\u5230\/boot\u4e0b\uff0c\u51c6\u5907\u6d4b\u8bd5<br \/>\nsudo cp ramdisk \/boot\/ramdisk<\/p>\n<p>8.\u91cd\u542f\uff0c\u8fdb\u5165grub\u547d\u4ee4\u6a21\u5f0f\uff0c\u6307\u5b9alinux\u548cinitrd\u8fdb\u884c\u6d4b\u8bd5\uff0c\u5177\u4f53\u53c2\u8003\uff1ahttp:\/\/blog.csdn.net\/htttw\/article\/details\/7215858\u7684\u6700\u3002\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u6700\u540e\u6211\u4eec\u4f1a\u8fdb\u5165Busybox\u3002<\/p>\n<p>\u5b9e\u9a8c\u4e8c\uff1a\u5236\u4f5c\u73b0\u4ee3\u7684initramfs\uff1a<br \/>\n\u4e0a\u9762\u8bf4\u8fc7\u4e86\uff0c\u5236\u4f5c\u73b0\u4ee3\u7684initramfs\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u7b2c\u4e00\u79cd\u5c31\u662fhttp:\/\/blog.csdn.net\/htttw\/article\/details\/7215858\u4ecb\u7ecd\u7684\uff0c\u4e0b\u9762\u4ecb\u7ecd\u7b2c\u4e8c\u79cd\uff0c\u5373\u5728make menuconfig\u91cc\u6307\u5b9a\uff1a<\/p>\n<p>1.\u51c6\u5907\u597d_install\u76ee\u5f55\uff0c\u7136\u540e\u521b\u5efa\u5fc5\u8981\u7684\u6587\u4ef6\uff0c\u5047\u8bbe\u662framfs\u76ee\u5f55<\/p>\n<p>2.\u5728make menuconfig\u91cc\u6307\u5b9aInitramfs source file(s)\u7684\u8def\u5f84\u662f\u7b2c\u4e00\u6b65\u7684ramfs\uff0c\u7136\u540e\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\uff1amake bzImage<\/p>\n<p>3.\u6d4b\u8bd5\uff0c\u548c\u4e0a\u9762\u65b9\u6cd5\u662f\u4e00\u6837\u7684\uff0c\u4e0d\u8fc7\u4e0d\u7528\u6307\u5b9ainitrd\u4e86\uff0c\u56e0\u4e3a\u5185\u6838\u548cinitramfs\u662f\u7f16\u8bd1\u5728\u4e00\u8d77\u7684\uff0c\u6700\u540e\u6211\u4eec\u4f1a\u8fdb\u5165Busybox\u3002<br \/>\n\u8fd9\u91cc\u63d2\u4e00\u53e5\uff0c\u6211\u4eec\u5b8c\u5168\u53ef\u4ee5\u81ea\u5df1\u5199init\u8fdb\u7a0b\uff0c\u53ea\u8981\u66ff\u6362_install\u76ee\u5f55\u91cc\u7684init\u5c31\u53ef\u4ee5\u4e86\uff5e\uff5e<br \/>\n\u53e6\u5916\uff0c\u8fd9\u91cc\u591a\u52a0\u4e00\u4e2a\u5c0f\u5b9e\u9a8c\uff0c\u6a21\u62dframfs\u7684\u6302\u8f7d\u4e0e\u5378\u8f7d\u8fc7\u7a0b\uff1a<br \/>\n\u9996\u5148\u51c6\u5907\u597d\u4e00\u4e2abusybox\u7684ramdisk\uff0c\u6211\u4eec\u628a\u5b83\u4f5c\u4e3a\u771f\u6b63\u7684\u6839\u6587\u4ef6\u7cfb\u7edf<br \/>\n\u7136\u540e\u628a\u5b83copy\u5230\u6211\u4eec\u81ea\u5df1\u505a\u7684ramfs\u7684\/root\/\u4e0b\uff0c\u5e76\u4fee\u6539ramfs\u7684etc\/init.d\/rcS\u5982\u4e0b\uff1a<\/p>\n<p>#!\/bin\/sh<br \/>\nmount -a<br \/>\nmount \/root\/ramdisk \/mnt<br \/>\nexec switch_root \/mnt \/sbin\/init<\/p>\n<p>\u8fd9\u6837\u6700\u7ec8\u5c31mount\u8fdb\u6211\u4eec\u7684\u6839\u6587\u4ef6\u7cfb\u7edf\u91cc\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001 Ramdisk RamDisk \u5c31\u662f\u5c06\u5185\u5b58\u4e2d\u7684\u4e00\u5757\u533a\u57df\u4f5c\u4e3a\u7269\u7406\u78c1\u76d8\u6765\u4f7f\u7528\u7684\u4e00\u79cd\u6280\u672f\u3002\u4f7f\u7528\u65f6\u5185\u6838\u914d\u7f6e\uff1a\u4e24\u4e2a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1971","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1971"}],"version-history":[{"count":3,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1971\/revisions"}],"predecessor-version":[{"id":1974,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1971\/revisions\/1974"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1971"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}