{"id":1007,"date":"2011-08-17T17:27:09","date_gmt":"2011-08-17T09:27:09","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1007"},"modified":"2011-08-17T17:27:09","modified_gmt":"2011-08-17T09:27:09","slug":"android%e6%a8%a1%e6%8b%9f%e5%99%a8%e9%95%9c%e5%83%8f%e6%96%87%e4%bb%b6%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1007","title":{"rendered":"Android\u6a21\u62df\u5668\u955c\u50cf\u6587\u4ef6\u4ecb\u7ecd"},"content":{"rendered":"<p>.\u00a0Android\u6a21\u62df\u5668\u91c7\u7528\u7684\u662f\u5f00\u6e90\u5de5\u7a0bQemu\uff0cQemu\u662fLinux \u4e0b\u7684\u8457\u540d\u6a21\u62df\u5668<\/p>\n<p>2. kernel-qemu\u662f\u5185\u6838\u955c\u50cf<\/p>\n<p>3. ramdisk.img\u662f\u6587\u4ef6\u7cfb\u7edf\uff0c\u5982\u679c\u4f60\u81ea\u5df1\u7f16\u8bd1\u4e86android\u7684\u6e90\u4ee3\u7801\uff0c\u5b83\u7684\u5185\u5bb9\u4e3a<br \/>\nout\/debug\/target\/product\/generic\/root\uff0cmount\u5230android\u7684\/<\/p>\n<p>4. system.img\u4e3b\u8981\u5b58\u653e\u7cfb\u7edf\u6570\u636e\uff0candroid\u542f\u52a8\u540emount\u5230\/system<br \/>\n\u5b83\u5305\u542b\u7684\u5185\u5bb9\u4e3aout\/debug\/target\/product\/generic\/system<\/p>\n<p>5. \u4e00\u822c\u6765\u8bf4\u6211\u4eec\u4e0d\u76f4\u63a5\u4f7f\u7528userdata.img\uff0c\u800c\u662f\u4f7f\u7528userdata_qemu.data\uff0c\u7528\u6765\u5b58\u653e\u7528\u6237\u6570\u636e\uff0c\u53ef\u8bfb\u5199\uff0candroid\u542f\u52a8\u540emount\u5230 \/data\u3002\u53ea\u6709\u4f7f\u7528-wipe-data\u53c2\u6570\u542f\u52a8\u6a21\u62df\u5668\u662f\u65f6\u5019\u624d\u4f1a\u7528\u5230userdata.img\uff0c\u5b83\u4f1a\u4f7f\u7528userdata.img\u7684\u5185\u5bb9\u8986\u76d6 userdata-qemu.img<br \/>\nuserdata.img\u7684\u5185\u5bb9\u4e3aout\/debug\/target\/product\/generic\/system<\/p>\n<p>6. \u5982\u679c\u60a8\u6ca1\u6709\u7f16\u8bd1android\u7684\u6e90\u4ee3\u7801\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u77e5\u9053ramdisk.img\u3001system.img\u548cuserdata.img\u7684\u5185\u5bb9\u3002<br \/>\n1). \u67e5\u770bramdisk.img\u5185\u5bb9<br \/>\nterminal\u4e2d\u8fdb\u5165sdk\u7684images\u76ee\u5f55\uff0c\u6267\u884cfile *<\/p>\n<div><img decoding=\"async\" src=\"http:\/\/www.devdiv.com\/attachment\/201005\/22\/1_1274512347yIee.png\" alt=\"\" \/><br \/>\n\u6211\u770b\u53ef\u4ee5\u770b\u5230ramdisk\u662f\u4e00\u4e2agzip\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u89e3\u538b\u8fd9\u4e2agzip\u6587\u4ef6\uff0c\u89e3\u538b\u524d\u5148\u5907\u4efd\u4e00\u4e0b<br \/>\n\u7136\u540e\u5728terminal\u4e2d\u8fd0\u884c<br \/>\nlocalhost:images wuvincent$ gzip -d -S .img ramdisk.img<br \/>\n\u7136\u540e\u8fd0\u884c<br \/>\nlocalhost:images wuvincent$ file ramdisk<br \/>\n\u6267\u884c\u540e\u4f1a\u663e\u793a\u8fd9\u4e2a\u6587\u4ef6\u662f\u4e00\u4e2acpio\u6587\u4ef6\uff0c\u4e8e\u662f\u6211\u4eec\u53ef\u4ee5\u628a\u5b83\u89e3\u538b\u5230\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u4f9d\u6b21\u6267\u884c\u5982\u4e0b\u547d\u4ee4<br \/>\nlocalhost:images wuvincent$ mkdir ramdiskdir<br \/>\nlocalhost:images wuvincent$ cd ramdiskdir<br \/>\nlocalhost:ramdiskdir wuvincent$ cpio -idmv &lt;..\/ramdisk<br \/>\n\u6211\u4eec\u5c31\u53ef\u4ee5\u8fdb\u5165ramdiskdir\u770b\u5230ramdisk.img\u7684\u5185\u5bb9\u4e86\u3002<br \/>\n\u5176\u4e2d\u6700\u4e3b\u8981\u7684\u51e0\u4e2a\u6587\u4ef6\u65f6init init.rc init.goldfish.rc<br \/>\n2). \u67e5\u770bsystem.img\u548cuserdata-qemu.img\u5167\u5bb9<br \/>\nterminal\u4e2d\u9032\u5165sdk\u7684tools\u76ee\u9304\u4e0b\u904b\u884cadb shell<br \/>\nlocalhost:tools wuvincent$ adb shell<br \/>\nadb server is out of date.\u00a0\u00a0killing&#8230;<br \/>\n* daemon started successfully *<br \/>\n#<br \/>\n\u7136\u5f8c\u904b\u884ccd \/\u548cls -l\uff0c\u57f7\u884c\u7d50\u679c\u5982\u4e0b\uff1a<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div><img decoding=\"async\" src=\"http:\/\/www.devdiv.com\/attachment\/201005\/22\/1_1274512391ICHE.png\" alt=\"\" \/><br \/>\n\u6211\u5011\u53ef\u4ee5\u770b\u5230ramdisk.img mount\u5230\/\uff0cinit init.rc init.goldfish.rc\u90fd\u5728\/\u76ee\u9304\u4e0b\u3002<br \/>\n\u800c\/system\u5c31\u662fsystem.img mount\u5f8c\u7684\u76ee\u9304\uff0c\/data \u5c31\u662fuserdata-qemu.img mount\u5f8c\u7684\u76ee\u9304\uff0c\u5927\u5bb6\u53ef\u4ee5\u9032\u5165\u770b\u770b\u5167\u5bb9\u3002<\/p>\n<p>\u6211\u5011\u4e5f\u53ef\u4ee5\u5728terminal\u4e2d\u904b\u884cmount\u547d\u4ee4\u67e5\u770b\u6587\u4ef6\u7cfb\u7d71mount\u60c5\u6cc1\u3002<\/p>\n<p>\u539f\u6587\uff1a<a href=\"http:\/\/www.devdiv.com\/home.php?mod=space&amp;uid=1&amp;do=blog&amp;id=1488\">http:\/\/www.devdiv.com\/home.php?mod=space&amp;uid=1&amp;do=blog&amp;id=1488<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>.\u00a0Android\u6a21\u62df\u5668\u91c7\u7528\u7684\u662f\u5f00\u6e90\u5de5\u7a0bQemu\uff0cQemu\u662fLinux \u4e0b\u7684\u8457\u540d\u6a21\u62df\u5668 2. kernel-qemu\u662f\u5185\u6838\u955c\u50cf 3. ramdisk.img\u662f\u6587\u4ef6\u7cfb\u7edf\uff0c\u5982\u679c\u4f60\u81ea\u5df1\u7f16\u8bd1\u4e86android\u7684\u6e90\u4ee3\u7801\uff0c\u5b83\u7684\u5185\u5bb9\u4e3a out\/debug\/target\/product\/generic\/root\uff0cmount\u5230android\u7684\/ 4. system.img\u4e3b\u8981\u5b58\u653e\u7cfb\u7edf\u6570\u636e\uff0candroid\u542f\u52a8\u540emount\u5230\/system \u5b83\u5305\u542b\u7684\u5185\u5bb9\u4e3aout\/debug\/target\/product\/generic\/system 5. \u4e00\u822c\u6765\u8bf4\u6211\u4eec\u4e0d\u76f4\u63a5\u4f7f\u7528userdata.img\uff0c\u800c\u662f\u4f7f\u7528userdata_qemu.data\uff0c\u7528\u6765\u5b58\u653e\u7528\u6237\u6570\u636e\uff0c\u53ef\u8bfb\u5199\uff0candroid\u542f\u52a8\u540emount\u5230 \/data\u3002\u53ea\u6709\u4f7f\u7528-wipe-data\u53c2\u6570\u542f\u52a8\u6a21\u62df\u5668\u662f\u65f6\u5019\u624d\u4f1a\u7528\u5230userdata.img\uff0c\u5b83\u4f1a\u4f7f\u7528userdata.img\u7684\u5185\u5bb9\u8986\u76d6 userdata-qemu.img userdata.img\u7684\u5185\u5bb9\u4e3aout\/debug\/target\/product\/generic\/system 6. \u5982\u679c\u60a8\u6ca1\u6709\u7f16\u8bd1android\u7684\u6e90\u4ee3\u7801\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u77e5\u9053ramdisk.img\u3001system.img\u548cuserdata.img\u7684\u5185\u5bb9\u3002 1). \u67e5\u770bramdisk.img\u5185\u5bb9 terminal\u4e2d\u8fdb\u5165sdk\u7684images\u76ee\u5f55\uff0c\u6267\u884cfile * \u6211\u770b\u53ef\u4ee5\u770b\u5230ramdisk\u662f\u4e00\u4e2agzip\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u89e3\u538b\u8fd9\u4e2agzip\u6587\u4ef6\uff0c\u89e3\u538b\u524d\u5148\u5907\u4efd\u4e00\u4e0b \u7136\u540e\u5728terminal\u4e2d\u8fd0\u884c localhost:images wuvincent$ gzip -d -S .img ramdisk.img \u7136\u540e\u8fd0\u884c localhost:images wuvincent$ file ramdisk \u6267\u884c\u540e\u4f1a\u663e\u793a\u8fd9\u4e2a\u6587\u4ef6\u662f\u4e00\u4e2acpio\u6587\u4ef6\uff0c\u4e8e\u662f\u6211\u4eec\u53ef\u4ee5\u628a\u5b83\u89e3\u538b\u5230\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u4f9d\u6b21\u6267\u884c\u5982\u4e0b\u547d\u4ee4 localhost:images wuvincent$ mkdir ramdiskdir localhost:images wuvincent$ cd ramdiskdir localhost:ramdiskdir wuvincent$ cpio -idmv &lt;..\/ramdisk \u6211\u4eec\u5c31\u53ef\u4ee5\u8fdb\u5165ramdiskdir\u770b\u5230ramdisk.img\u7684\u5185\u5bb9\u4e86\u3002 \u5176\u4e2d\u6700\u4e3b\u8981\u7684\u51e0\u4e2a\u6587\u4ef6\u65f6init init.rc init.goldfish.rc 2). \u67e5\u770bsystem.img\u548cuserdata-qemu.img\u5167\u5bb9 &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1007\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Android\u6a21\u62df\u5668\u955c\u50cf\u6587\u4ef6\u4ecb\u7ecd<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[205],"class_list":["post-1007","post","type-post","status-publish","format-standard","hentry","category-android","tag-android"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1007"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1007\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}