# mkdir etc dev mnt\n# mkdir -p etc\/init.d\/\n# vim etc\/fstab\nproc \/proc proc defaults 0 0\ntemps \/tmp rpoc defaults 0 0\nnone \/tmp ramfs defaults 0 0\nsysfs \/sys sysfs defaults 0 0\nmdev \/dev ramfs defaults 0 0\n# vim etc\/init.d\/rcS\nmkdir -p \/proc\nmkdir -p \/tmp\nmkdir -p \/sys\nmkdir -p \/mnt\n\/bin\/mount -a\nmkdir -p \/dev\/pts\nmount -t devpts devpts \/dev\/pts\necho \/sbin\/mdev > \/proc\/sys\/kernel\/hotplug\nmdev -s\n# chmod 755 etc\/init.d\/rcS\n# vim etc\/inittab\n::sysinit:\/etc\/init.d\/rcS\n::respawn:-\/bin\/sh\n::askfirst:-\/bin\/sh\n::cttlaltdel:\/bin\/umount -a -r\n# chmod 755 etc\/inittab\n# cd dev\n# mknod console c 5 1\n# mknod null c 1 3\n# mknod tty1 c 4 1 <\/code><\/pre>\n<\/p>\n\u8fd9\u6837\u4e00\u4e2a\u6700\u5c0f\u7684\u3001\u5b8c\u6574\u7684\u53ef\u4ee5\u88ab\u5185\u6838\u542f\u52a8\u7684\u6587\u4ef6\u7cfb\u7edf\u5c31\u9f50\u6d3b\u5566\u3002<\/p>\n
<\/p>\n
\u5236\u505a\u6839\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf\u6587\u4ef6\u3002<\/p>\n
\u601d\u8def\uff1a<\/p>\n
1.\u5148\u5236\u505a\u4e00\u4e2a\u7a7a\u7684\u955c\u50cf\u6587\u4ef6\uff1b<\/p>\n
2.\u4e4b\u540e\u628a\u6b64\u955c\u50cf\u6587\u4ef6\u4f4e\u683c\u4e3aext3\u683c\u5f0f\uff1b<\/p>\n
3.\u4e4b\u540e\u628a\u6b64\u955c\u50cf\u6587\u4ef6\u6302\u8f7d\uff0c\u5e76\u628a\u6839\u6587\u4ef6\u7cfb\u7edf\u590d\u5236\u5230\u6302\u8f7d\u76ee\u5f55\uff1b<\/p>\n
4.\u5378\u8f7d\u8be5\u955c\u50cf\u6587\u4ef6\u3002<\/p>\n
5.\u6253\u6210gzip\u5305\u3002<\/p>\n
\n
#!\/bin\/bash\nrm -rf rootfs.ext3\nrm -rf fs\ndd if=\/dev\/zero of=.\/rootfs.ext3 bs=1M count=32\nmkfs.ext3 rootfs.ext3\nmkdir fs\nmount -o loop rootfs.ext3 .\/fs\ncp -rf .\/_install\/* .\/fs\numount .\/fs\ngzip --best -c rootfs.ext3 > rootfs.img.gz <\/code><\/pre>\n<\/p>\n\u6700\u7ec8\u751f\u6210\u7684\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf\u540d\u5b50\u4e3a\uff1arootfs.img.gz<\/p>\n
\u6253\u7b97\u597d\u4e86\u5185\u6838\u548c\u6587\u4ef6\u7cfb\u7edf\u955c\u50cflinux\u57f9\u8bad\u73ed\uff0c\u5e78\u798f\u7684\u4e00\u523b\u9a6c\u4e0a\u5c06\u81f3\u4e86\uff1a<\/p>\n
\u901a\u8fc7qemu\u6a21\u62df\u5668\u542f\u52a8\u6211\u4eec\u81ea\u5df1\u7f16\u8bd1\u7684\u5185\u6838\u548c\u6587\u4ef6\u7cfb\u7edf\uff1a<\/p>\n
\n
# qemu-system-x86_64 \n -kernel .\/linux-4.9.229\/arch\/x86_64\/boot\/bzImage \n -initrd .\/busybox-1.30.0\/rootfs.img.gz \n -append \"root=\/dev\/ram init=\/linuxrc\" \n -serial file:output.txt<\/code><\/pre>\n<\/p>\n\u8fd9\u6837\u4e00\u4e2a\u5b8c\u6574\u7684\u6700\u5c0flinux\u7cfb\u7edf\u5c31\u4e0a\u53bb\u5566\uff1a<\/p>\n
<\/p>\n
\u597d\u4e86\uff0c\u7ecf\u8fc7\u4ee5\u4e0a\u7684\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u81ea\u5df1\u7f16\u8bd1\u4e00\u4e2a\u5185\u6838\u548c\u6587\u4ef6\u7cfb\u7edf\u3002\u6709\u4e86\u8fd9\u6837\u7684\u57fa\u7840\uff0c\u4f60\u5728\u4ee5\u540e\u5c31\u53ef\u4ee5\u81ea\u7531\u7684\u66f4\u6539linux\u5185\u6838\u4ee3\u7801\u5e76run\u4e0a\u53bb\u8fdb\u884c\u9a8c\u8bc1\u5566\u3002<\/p>\n
\u8bb0\u5f97\u5173\u6ce8\u201c\u6280\u672f\u7b80\u8bf4\u201d\uff0c\u6301\u7eed\u5206\u4eablinux\u5185\u6838\u77e5\u8bc6\uff0c\u8ba9\u4f60\u4e00\u6b65\u4e00\u6b65\u6210\u4e3alinux\u5185\u6838\u5927\u4fa0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u8981\u5b66\u4e60linux\u5185\u6838\uff0c\u5148\u8981\u80fd\u591f\u7f16\u8bd1\u5185\u6838\uff0c\u8fd8\u9700\u8981\u4e86\u89e3\u5185\u6838\u5982\u4f55\u542f\u52a8\u6839\u6587\u4ef6\u7cfb\u7edf\u3002\u4e0b\u8f7dlinux\u5e76\u7f16\u8bd1linux\u5185\u6838\u6e90\u7801qemu\u542f\u52a8\u4f60\u7f16\u8bd1\u597d\u7684\u5185\u6838\u548c\u6839\u6587\u4ef6\u7cfb\u7edf\u5728\u8fd9\u91cc\u6211\u4eec\u628abusybox\u914d\u7f6e\u4e3a\u9759\u6001\u7f16\u8bd1\uff0c\u8fd9\u6837busybox\u5728\u8fd0\u884c\u7684\u65f6\u5019\u5c31\u4e0d\u9700\u8981\u989d\u5916\u7684\u52a8\u6001\u94fe\u63a5\u5e93\u4e86\u3002\u901a\u8fc7qemu\u6a21\u62df\u5668\u542f\u52a8\u6211\u4eec\u81ea\u5df1\u7f16\u8bd1\u7684\u5185\u6838\u548c\u6587\u4ef6\u7cfb\u7edf\uff1a\u597d\u4e86\uff0c\u7ecf\u8fc7\u4ee5\u4e0a\u7684\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u81ea\u5df1\u7f16\u8bd1\u4e00\u4e2a\u5185\u6838\u548c\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n","protected":false},"author":1,"featured_media":284680,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-284679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/284679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=284679"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/284679\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/284680"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=284679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=284679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=284679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}