{"id":6726,"date":"2022-02-25T17:58:42","date_gmt":"2022-02-25T09:58:42","guid":{"rendered":"https:\/\/www.wangonc.com\/?p=6726"},"modified":"2025-05-26T17:58:24","modified_gmt":"2025-05-26T09:58:24","slug":"compilate-aosp","status":"publish","type":"post","link":"https:\/\/www.wangonc.com\/index.php\/2022\/02\/25\/compilate-aosp\/","title":{"rendered":"AOSP\u7684\u7f16\u8bd1"},"content":{"rendered":"<h2>\u524d\u8a00<\/h2>\n<p>\u63a8\u8350\u4f7f\u7528\u6d77\u5916\u670d\u52a1\u5668\u8fdb\u884c\u7f16\u8bd1\uff0c\u8282\u7ea6\u65f6\u95f4\uff0c\u8282\u7ea6\u751f\u547d\uff01<\/p>\n<p>\u5e76\u4e14\uff0c\u5b98\u65b9\u63a8\u8350\u4f7f\u7528Ubuntu LTS\u8fdb\u884c\u7f16\u8bd1\uff0c\u7b97\u4e0a\u8f93\u51fa\u7269\u9700\u8981500+G\u7684\u7a7a\u95f4\u3002<\/p>\n<p>\u5b98\u65b9\u6587\u6863\u89c1<a href=\"https:\/\/source.android.com\/setup\/build\/downloading\">\u4e0b\u8f7d\u6e90\u4ee3\u7801 | Android \u5f00\u6e90\u9879\u76ee | Android Open Source Project<\/a>\u548c<a href=\"https:\/\/source.android.com\/setup\/build\/building\"> Building Android | Android Open Source Project<\/a><\/p>\n<p>\u672c\u6587\u793a\u4f8b\u7f16\u8bd1\u7248\u672c\u4e3aandroid-8.1.0_r39<\/p>\n<h2>\u7f16\u8bd1\u8fc7\u7a0b<\/h2>\n<h3>\u73af\u5883\u914d\u7f6e<\/h3>\n<p>\u9996\u5148\u53c2\u8003<a href=\"https:\/\/source.android.com\/source\/initializing?hl=zh-cn\" title=\"\u642d\u5efa\u7f16\u8bd1\u73af\u5883 \u00a0|\u00a0 Android Open Source Project\">\u642d\u5efa\u7f16\u8bd1\u73af\u5883 \u00a0|\u00a0 Android Open Source Project<\/a>\u8bf4\u660e\u6765\u642d\u5efa\u914d\u7f6e\u73af\u5883<\/p>\n<p>\u6ce8\u610f\uff0c\u4e0a\u8ff0\u8bf4\u660e\u4e2d\u662f\u57fa\u4e8eUbuntu14\u6765\u8fdb\u884c\u7684\uff0c\u5728\u76ee\u524d\u6700\u65b0\u7684LTS 24.04\u7248\u672c\u4e2d\uff0cgit-core\u5373\u662fgit\uff0clib32z-dev\u5373\u662flib32z1-dev\u3002<\/p>\n<p>\u5e76\u4e14lib32ncurses5-dev\u5df2\u7ecf\u88ab\u5220\u9664\u4e86\uff0c\u5219\u662f\u9700\u8981\u5982\u4e0b\u64cd\u4f5c<\/p>\n<pre><code class=\"language-bash\">sudo dpkg --add-architecture i386\nsudo apt-get update\nsudo apt-get install libncurses5-dev:i386<\/code><\/pre>\n<p>\u5269\u4e0b\u7684\u90fd\u53ef\u4ee5\u6b63\u5e38\u5b89\u88c5\u3002<\/p>\n<p>\u7136\u540e\u5c31\u662f\u5b89\u88c5git\u548crepo\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"language-bash\">sudo apt install git repo<\/code><\/pre>\n<p>repo\u5b89\u88c5\u540e\u8fd0\u884c\u53ef\u80fd\u4f1aline 78\uff0c\u8fd9\u65f6\u9700\u8981\u628a\u7cfb\u7edf\u7684python2\u548c\/bin\/python\u5220\u6389\uff0c\u7136\u540e\u5efa\u7acb\u5efa\u7acbpython3\u7684\u8f6f\u8fde\u63a5\u5230\/bin\/python\uff0crepo\u5c31\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u4e86<\/p>\n<pre><code class=\"language-bash\">ln -s \/usr\/bin\/python3 \/usr\/bin\/python<\/code><\/pre>\n<h3>\u521d\u59cb\u5316\u4ed3\u5e93<\/h3>\n<p>\u4e3b\u5206\u652f<\/p>\n<pre><code class=\"language-bash\">repo init -u https:\/\/android.googlesource.com\/platform\/manifest\n\nrepo init -u https:\/\/android.googlesource.com\/platform\/manifest -b master<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u4f7f\u7528\u6e05\u534e\u7684\u955c\u50cf,\u6839\u636e\u8bf4\u660e\uff0c\u7531\u4e8e\u786c\u76d8 I\/O \u8d44\u6e90\u6709\u9650\uff0cGit \u670d\u52a1\u5668\u6bcf IP \u9650\u5236 5 \u4e2a\u5e76\u53d1\u8fde\u63a5\u3002repo sync \u547d\u4ee4\u9ed8\u8ba4\u4f7f\u7528 4 \u4e2a\u5e76\u53d1\u8fde\u63a5\uff0c\u8bf7\u52ff\u4f7f\u7528 -j \u53c2\u6570\u589e\u52a0\u5e76\u53d1\u8fde\u63a5\u6570\u3002<\/p>\n<pre><code class=\"language-bash\">repo init -u https:\/\/mirrors.tuna.tsinghua.edu.cn\/git\/AOSP\/platform\/manifest\n\nrepo init -u https:\/\/mirrors.tuna.tsinghua.edu.cn\/git\/AOSP\/platform\/manifest -b master<\/code><\/pre>\n<p>\u5176\u4ed6\u5206\u652f\uff0c\u5728b\u540e\u9762\u6dfb\u52a0\u5206\u652f \u5206\u652f\u5217\u8868\u89c1<a href=\"https:\/\/source.android.com\/setup\/start\/build-numbers#source-code-tags-and-builds\" title=\"\u4ee3\u53f7\u3001\u6807\u8bb0\u548c build \u53f7 \u00a0|\u00a0 Android Open Source Project\">\u4ee3\u53f7\u3001\u6807\u8bb0\u548c build \u53f7 \u00a0|\u00a0 Android Open Source Project<\/a>\uff0c\u4f8b\u5982<code>repo init -b android-14.0.0_r25<\/code><\/p>\n<h3>\u540c\u6b65\u6e90\u7801<\/h3>\n<pre><code class=\"language-bash\">repo sync -c -j8<\/code><\/pre>\n<p>\u5176\u4e2d-c\u4e3a\u5f53\u524d\u5206\u652f\uff0c-j8\u610f\u4e3a\u4f7f\u75288\u4e2a\u7ebf\u7a0b\u3002\u5982\u679c\u4f7f\u7528\u955c\u50cf\uff0c\u53ef\u80fd\u9700\u8981\u51cf\u5c11\u5e76\u53d1\u3002<\/p>\n<h3>\u5b89\u88c5\u9a71\u52a8<\/h3>\n<p>\u6839\u636e\u60f3\u8981\u5237\u5199\u7684\u8bbe\u5907\u5b89\u88c5\u76f8\u5e94\u9a71\u52a8\uff0c\u9a71\u52a8\u5217\u8868\u89c1<a href=\"https:\/\/developers.google.com\/android\/drivers\" title=\"Nexus \u548c Pixel \u8bbe\u5907\u7684\u9a71\u52a8\u7a0b\u5e8f\u4e8c\u8fdb\u5236\u6587\u4ef6 \u00a0|\u00a0 Google Play services \u00a0|\u00a0 Google for Developers\">Nexus \u548c Pixel \u8bbe\u5907\u7684\u9a71\u52a8\u7a0b\u5e8f\u4e8c\u8fdb\u5236\u6587\u4ef6 \u00a0|\u00a0 Google Play services \u00a0|\u00a0 Google for Developers<\/a><\/p>\n<p>\u4e0b\u8f7d\u540e\u6267\u884c\u811a\u672c\u5373\u53ef\u5b89\u88c5\uff0c\u6ce8\u610f\u8981\u5728\u6e90\u7801\u76ee\u5f55\u4e0b\u6267\u884c<\/p>\n<p>\u5bf9\u4e8eLneageOS\u53ef\u4ee5\u4f7f\u7528<code>.\/extract-files.sh<\/code>\uff08\u6216\u8005<code>.\/extract-files.py<\/code>\uff09\u3002\u8fd9\u9700\u8981\u624b\u52a8\u514b\u9686\u8bbe\u5907\uff0c\u5373<code>git clone https:\/\/github.com\/LineageOS\/android_device_google_coral device\/google\/coral<\/code><\/p>\n<p>\u7136\u540e\u8fdb\u5165\u5230<code>device\/google\/coral<\/code>\uff0c\u6267\u884c<code>.\/extract-files.py<\/code>\u3002\u8fd9\u6709\u53ef\u80fd\u9700\u8981zsh\u73af\u5883\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6848<\/p>\n<pre><code class=\"language-shell\">cd device\/google\/coral\/coral\n\n# \u521b\u5efa\u5305\u88c5\u811a\u672c\ncat &gt; run_extract.sh &lt;&lt; &#039;EOF&#039;\n#!\/bin\/bash\ncd ~\/Source\/LineageOS\/device\/google\/coral\/coral\nPYTHONPATH=..\/..\/..\/..\/tools\/extract-utils python3 extract-files.py &quot;$@&quot;\nEOF\n\n# \u8bbe\u7f6e\u6267\u884c\u6743\u9650\nchmod +x run_extract.sh\n\n# \u6267\u884c\u5305\u88c5\u811a\u672c\n.\/run_extract.sh<\/code><\/pre>\n<blockquote>\n<p>\u4e0a\u8ff0\u811a\u672c\u6267\u884c\u9700\u8981python 3.9\u4ee5\u4e0a\u7684\u73af\u5883\uff0c\u5728\u8001\u7248\u672cUbuntu\u4e2d\u53ef\u80fd\u9700\u8981\u624b\u52a8\u7f16\u8bd1<\/p>\n<\/blockquote>\n<p>\u6216\u8005\u5982\u679c\u662f\u5728wsl\u6216\u8005vps\u4e2d\uff0c\u4e0d\u65b9\u4fbf\u8fde\u63a5\u8bbe\u5907\u6216\u8005\u8bbe\u5907\u6ca1\u6709root\uff0c\u53ef\u4ee5\u5148\u624b\u52a8\u6302\u5728\u5e76\u63d0\u53d6ventor.img\u4e2d\u7684\u6587\u4ef6\u81f3\u9a71\u52a8\u76ee\u5f55\uff0c\u5373<\/p>\n<pre><code># \u91ca\u653epayload.bin\n\n# \u4e0b\u8f7dpayload-dumper-go\nwget https:\/\/github.com\/ssut\/payload-dumper-go\/releases\/download\/1.3.0\/payload-dumper-go_1.3.0_linux_amd64.tar.gz\ntar -xvf payload-dumper-go_1.2.2_linux_amd64.tar.gz\n\nrm README.md LICENSE\nchmod +x payload-dumper-go\n\n# \u91ca\u653e\n.\/payload-dumper-go \/path\/to\/payload.bin\n\n# \u6302\u8f7d\nmkdir -p ~\/vendor_mount\nsudo mount -o loop,ro vendor.img ~\/vendor_mount\n\n# \u590d\u5236\ncd [lineageos\u6e90\u7801\u6839\u76ee\u5f55]\nmkdir -p vendor\/google\/corcal\nsudo cp -r ~\/vendor_mount\/* vendor\/google\/corcal\n<\/code><\/pre>\n<p>\u7136\u540e\u518d\u6267\u884c<code>setup-makefiles.py<\/code>\u5373\u53ef<\/p>\n<blockquote>\n<p>\u5f53\u7136\u4e3a\u4e86\u65b9\u4fbf\u548c\u51c6\u786e\uff0c\u8fd8\u662f\u5efa\u8bae\u4f7f\u7528<code>.\/extract-files.py<\/code>\u4e00\u952e\u5b8c\u6210\u3002\u56e0\u4e3a\u8fd9\u91cc\u4f7f\u7528\u4e86env -S\uff0c\u6240\u4ee5\u9700\u8981\u66f4\u65b0coreutils\u52308.30\u4ee5\u4e0a<\/p>\n<\/blockquote>\n<p>\u66f4\u591a\u7684\u53ef\u4ee5\u53c2\u8003https:\/\/wiki.lineageos.org\/extracting_blobs_from_zips<\/p>\n<p>\u4ea6\u6216\u8005\u662f\u76f4\u63a5\u901a\u8fc7\u4ed3\u5e93<a href=\"https:\/\/github.com\/TheMuppets\/proprietary_vendor_google_coral\" title=\"TheMuppets \/ proprietary_vendor_google_coral\">TheMuppets \/ proprietary_vendor_google_coral<\/a>\u83b7\u5f97<\/p>\n<h3>\u8bbe\u7f6e\u73af\u5883<\/h3>\n<pre><code class=\"language-bash\">source build\/envsetup.sh # \u6216 . build\/envsetup.sh<\/code><\/pre>\n<h3>\u8bbe\u7f6e\u7f16\u8bd1\u76ee\u6807<\/h3>\n<p>\u683c\u5f0f\u4e3a<code>lunch product_name-build_variant<\/code>\uff0c\u4f8b\u5982<code>lunch aosp_coral-userdebug<\/code><\/p>\n<p>\u5176\u4e2d\u6784\u5efa\u6a21\u5f0f\u5982\u4e0b<\/p>\n<table>\n<thead>\n<tr>\n<th>\u6784\u5efa\u7c7b\u578b<\/th>\n<th>\u4f7f\u7528\u60c5\u51b5<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>user<\/td>\n<td>\u6743\u9650\u53d7\u9650\uff1b\u9002\u7528\u4e8e\u751f\u4ea7\u73af\u5883<\/td>\n<\/tr>\n<tr>\n<td>userdebug<\/td>\n<td>\u4e0e\u201cuser\u201d\u7c7b\u4f3c\uff0c\u4f46\u5177\u6709 root \u6743\u9650\u548c\u8c03\u8bd5\u529f\u80fd\uff1b\u662f\u8fdb\u884c\u8c03\u8bd5\u65f6\u7684\u9996\u9009\u7f16\u8bd1\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td>eng<\/td>\n<td>\u5177\u6709\u989d\u5916\u8c03\u8bd5\u5de5\u5177\u7684\u5f00\u53d1\u914d\u7f6e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0d\u540c\u8bbe\u5907\u7684\u6784\u5efa\u76ee\u6807\u89c1<a href=\"https:\/\/source.android.com\/setup\/build\/running#selecting-device-build\">\u5237\u5199\u8bbe\u5907 | Android \u5f00\u6e90\u9879\u76ee | Android Open Source Project<\/a><\/p>\n<p>\u5bf9\u4e8eLineageOS\u6765\u8bf4\uff0c\u662f<code>breakfast coral<\/code><\/p>\n<h3>\u901a\u8fc7repo\u7ba1\u7406\u4f9d\u8d56<\/h3>\n<p>\u5bf9\u4e8e\u9700\u8981\u67d0\u4e9b\u5176\u4ed6\u4f9d\u8d56\u7684\u60c5\u51b5\uff0c\u4f8b\u5982\u4e0a\u9762\u9700\u8981\u7684\u8bbe\u5907\u9a71\u52a8\u4ee5\u53ca\u5185\u6838\uff0c\u9700\u8981\u624b\u52a8\u6dfb\u52a0\uff0c\u53ef\u4ee5\u5728<code>.repo\\local_manifests<\/code>\u76ee\u5f55\u4e0b\u7f16\u8bd1xml\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u4f8b\u5982\u5982\u679c\u6dfb\u52a0\u4e00\u4e2a\u8c37\u6b4c\u7684\u5185\u6838\u4ed3\u5e93\uff0c\u5219\u5c31\u662f<\/p>\n<pre><code class=\"language-xml\">&lt;project path=&quot;kernel\/google\/msm-4.14&quot; remote=&quot;github&quot; name=&quot;LineageOS\/android_kernel_google_msm-4.14&quot; \/&gt;<\/code><\/pre>\n<p>\u8fd9\u91cc\u9700\u8981\u4e3b\u4e49\u7684\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4e86\u955c\u50cf\u6e90\uff0c\u4f8b\u5982\u6e05\u534e\uff0c\u8fd9\u91cc\u7684github\u4f1a\u88ab\u66ff\u6362\u6210\u6e05\u534e\u7684\u955c\u50cf\u4ed3\u5e93\uff0c\u4f46\u662f\u67d0\u4e9b\u5185\u5bb9\u5176\u662f\u6ca1\u6709\u7684\uff0c\u8fd9\u662f\u5c31\u9700\u8981\u624b\u52a8\u6307\u5b9a\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5982\u4e0b\u6dfb\u52a0\u4e86\u4e00\u4e2aGitHub\u4e0a\u5206\u4eab\u7684\u8bbe\u5907\u9a71\u52a8<\/p>\n<pre><code class=\"language-xml\">&lt;remote name=&quot;the-muppets&quot; fetch=&quot;https:\/\/github.com\/&quot; \/&gt;\n  &lt;project name=&quot;TheMuppets\/proprietary_vendor_google_coral&quot; path=&quot;vendor\/google\/coral&quot; remote=&quot;the-muppets&quot; groups=&quot;muppets,muppets_coral&quot; clone-depth=&quot;1&quot; revision=&quot;lineage-22.1&quot; \/&gt;<\/code><\/pre>\n<p>\u8fd9\u65f6\u518d<code>repo sync<\/code>\u5373\u53ef\u3002<\/p>\n<p>\u6216\u8005bu&#8217;ti\u4e0d\u6dfb\u52a0revision=&quot;lineage-22.1&quot;\u6807\u7b7e\uff0c\u4f7f\u5176\u7248\u672c\u4f7f\u7528\u4e3b\u4ed3\u5e93\u7684\u7248\u672c<\/p>\n<h3>\u6784\u5efa<\/h3>\n<p>\u6267\u884c<code>m<\/code>\u5373\u53ef\u3002\u53ef\u4ee5\u4f7f\u7528<code>m -jN<\/code>\u6765\u6307\u5b9a\u7ebf\u7a0b\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u5219\u4f1a\u9ed8\u8ba4\u9009\u62e9\u6700\u4f18\u7684\u7ebf\u7a0b\u6765\u8fdb\u884c\u7f16\u8bd1\u3002<\/p>\n<h2>\u62a5\u9519\u89e3\u51b3<\/h2>\n<pre><code class=\"language-bash\">prebuilts\/clang\/host\/linux-x86\/clang-4053586\/bin\/clang++.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory\n\napt install libncurses5\n\nFile build\/tools\/merge-event-log-tags.py, line 51\nexcept getopt.GetoptError, err:\n^\nSyntaxError: invalid syntax<\/code><\/pre>\n<p>python\u7248\u672c\u95ee\u9898\uff0c\u5e94\u5f53\u7528python2\uff0c\u800c\u4e0d\u662fpython3\uff08\u540c\u6b65\u6e90\u7801\u5374\u8981\u7528python3.\u3002\u3002\uff09<\/p>\n<p>\u5220\u6389\u539f\u5148\u7684\u8f6f\u8fde\u63a5\uff0c\u5b89\u88c5python2\uff0c\u521b\u5efapython2\u7684\u8f6f\u8fde\u63a5<\/p>\n<hr \/>\n<pre><code class=\"language-bash\">ln -s \/bin\/pyton2 \/bin\/python\n\nSSL error when connecting to the Jack server. Try \\&#039;jack-diagnose\\&#039;<\/code><\/pre>\n<p>\u5c06 \\$HOME\/.jack-settings\u548c \\$HOME\/.jack-server\/config.properties\u4e0b\u9762\u7684\u4e24\u4e2a\u7aef\u53e3\u6539\u4e3a\u5176\u4ed6\u4e24\u4e2a\u5c31\u884c\uff0c\u6ce8\u610f\u4e24\u4e2a\u6587\u4ef6\u8981\u76f8\u540c<\/p>\n<hr \/>\n<pre><code class=\"language-bash\">flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? \u2018cnt &lt; (sizeof (_nl_value_type_LC_TIME) \/ sizeof (_nl_value_type_LC_TIME[0]))\u2019 ???\nAborted (core dumped)<\/code><\/pre>\n<p>\u5728\uff5e\/.bashrc\u6700\u540e\u6dfb\u52a0export LC_ALL=C<br \/>\n\u7136\u540e source \uff5e\/.bashrc<\/p>\n<p>\u6dfb\u52a0export LC_ALL=C\u662f\u53bb\u9664\u672c\u5730C\u5316\uff0c\u4f7f\u5f97Android\u7684\u7f16\u8bd1\u5de5\u5177\u4e0e\u672c\u5730\u5de5\u5177\u4e0d\u51b2\u7a81<\/p>\n<hr \/>\n<pre><code class=\"language-bash\">Out of memory error (version 1.3-rc7 \\&#039;Douarn\\&#039; (445000 d7be3910514558d6715ce455ce0861ae2f56925a \u2026\u2026<\/code><\/pre>\n<p>\u5185\u5b58\u4e0d\u591f\u4e86,\u589e\u52a0\u5185\u5b58\uff0c\u589e\u52a0\u7684\u5927\u5c0f\u6839\u636e\u7f16\u8bd1\u73af\u5883\u6765<\/p>\n<pre><code class=\"language-bash\">export JACK_SERVER_VM_ARGUMENTS= -Xmx6g<\/code><\/pre>\n<hr \/>\n<h2>\u6dfb\u52a0KernelSU<\/h2>\n<p>\u8fd9\u91cc\u5176\u5b9e\u4e3b\u8981\u662f\u9488\u5bf9\u975eGKI\u5185\u6838\u6765\u8bf4\u7684\uff0cGKI\u5185\u6838\u5b8c\u5168\u6ca1\u6709\u5fc5\u8981\u901a\u8fc7\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u7684\u65b9\u5f0f\u6765\u6784\u5efa\uff0c\u76f4\u63a5\u5237\u5b98\u65b9\u7f16\u8bd1\u597d\u7684gki\u5c31\u5b8c\u4e8b\u4e86\u3002<\/p>\n<p>\u6839\u636eKernelSU\u7684\u8bf4\u660e\uff0c\u53ea\u9700\u8981\u5728\u5185\u6838\u539f\u540d\u4ee3\u7801\u76ee\u5f55\uff0c\u6267\u884c<code>curl -LSs \"https:\/\/raw.githubusercontent.com\/tiann\/KernelSU\/main\/kernel\/setup.sh\" | bash - <code>\u5373\u53ef\u3002\uff08\u5bf9\u4e8e\u975eGKI\u8bbe\u5907\uff0c\u76ee\u524d\u7684\u652f\u6301\u505c\u7559\u5728\u4e860.95\u7248\u672c\uff0c\u4e5f\u5c31\u662f<\/code>curl -LSs \"https:\/\/raw.githubusercontent.com\/tiann\/KernelSU\/main\/kernel\/setup.sh\" | bash -s v0.9.5<\/code>\uff09<\/p>\n<p>\u5bf9\u4e8eKernelSU Next\u6765\u8bf4\u4e5f\u662f\u4e00\u6837\uff0c\u5176\u5bf9\u975eGKI\u5185\u6838\u4e00\u76f4\u90fd\u6709\u652f\u6301\uff0c\u4e5f\u662f\u7c7b\u4f3c\u7684\u64cd\u4f5c,\u5728\u5185\u6838\u6e90\u4ee3\u7801\u76ee\u5f55\u6267\u884c<code>curl -LSs &quot;https:\/\/raw.githubusercontent.com\/rifsxd\/KernelSU-Next\/next\/kernel\/setup.sh&quot; | bash -<\/code><\/p>\n<p>\u7136\u540e\u518d\u6267\u884c\u5e38\u89c4\u7684\u7f16\u8bd1\u64cd\u4f5c\u5373\u53ef\u3002<\/p>\n<p>\u5982\u679c\u53ea\u7f16\u8bd1\u5185\u6838\uff0c\u5177\u4f53\u6765\u8bf4<\/p>\n<pre><code class=\"language-shell\">export ARCH=arm64\nexport SUBARCH=arm\nexport O=out # \u8bbe\u5b9a\u67b6\u6784\u548c\u8f93\u51fa\u76ee\u5f55\n\ncd kernel\/google\/msm-4.14\/ # \u5176\u4ed6\u8bbe\u5907\u53ef\u80fd\u4e0d\u4e00\u6837\n\nmake defconfig floral_defconfig\n\nmake menuconfig\n\nmake savedefconfig\n\ncp defconfig arch\/arm64\/configs\/floral_defconfig\n\nmake mrproper # \u6e05\u7406<\/code><\/pre>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cshell\u811a\u672c\u6267\u884c\u5b8c\u6bd5\uff0c\u64cd\u4f5c\u6267\u884c\u5b8c\u6bd5\uff0c\u9700\u8981\u901a\u8fc7git\u63d0\u4ea4\u4ee5\u4e0b\uff0c\u5373<\/p>\n<pre><code class=\"language-shell\">git add .\ngit commit -m &quot;Add KernelSU support&quot;<\/code><\/pre>\n<p>\u6700\u540e\u4f7f\u7528<code>mka bootimage<\/code> \u5373\u53ef\u7f16\u8bd1\u51fa\u76f4\u63a5\u53ef\u4ee5\u4f7f\u7528\u7684\u5185\u6838\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u7f16\u8bd1kernelsu\u540e\u7f16\u8bd1kernelsu next\u6216\u8005\u5176\u4ed6\u7684\uff0c\u53ea\u9700\u8981\u6267\u884c<code>curl -LSs &quot;https:\/\/raw.githubusercontent.com\/tiann\/KernelSU\/main\/kernel\/setup.sh&quot; | bash -s -- --cleanup<\/code>\u8fdb\u884c\u6e05\u7406\u5373\u53ef<\/p>\n<h2>\u7f16\u8bd1strace<\/h2>\n<p>\u5728\u6e90\u4ee3\u7801\u6839\u76ee\u5f55\u4e0b<code>mmma -j6 external\/strace<\/code>\u5373\u53ef<\/p>\n<h2>\u4e00\u4e9b\u8c03\u6574<\/h2>\n<h3>\u4fee\u6539\u8fde\u63a5\u9a8c\u8bc1\u670d\u52a1\u5668<\/h3>\n<p>\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7\u70e7\u5199\u4e4b\u540e\uff0c\u4f7f\u7528adb\u4fee\u6539\uff0c\u5982\u4e0b\uff0c\u4fee\u6539\u6210\u5c0f\u7c73\u7684<\/p>\n<pre><code class=\"language-shell\">adb shell settings put global captive_portal_https_url https:\/\/connect.rom.miui.com\/generate_204\nadb shell settings put global captive_portal_http_url http:\/\/connect.rom.miui.com\/generate_204<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6e90\u4ee3\u7801\u4fee\u6539\uff0c<code>packages\/modules\/NetworkStack\/res\/values\/config.xml<\/code>\u540c\u6837\u4fee\u6539\u4e3a\u5c0f\u7c73\u7684<\/p>\n<pre><code class=\"language-xml\">&lt;!-- HTTP URL for network validation, to use for detecting captive portals. --&gt;\n&lt;string name=&quot;default_captive_portal_http_url&quot; translatable=&quot;false&quot;&gt;https:\/\/connect.rom.miui.com\/generate_204&lt;\/string&gt;\n\n&lt;!-- HTTPS URL for network validation, to use for confirming internet connectivity. --&gt;\n&lt;string name=&quot;default_captive_portal_https_url&quot; translatable=&quot;false&quot;&gt;https:\/\/connect.rom.miui.com\/generate_204&lt;\/string&gt;\n\n&lt;!-- List of fallback URLs to use for detecting captive portals. --&gt;\n&lt;string-array name=&quot;default_captive_portal_fallback_urls&quot; translatable=&quot;false&quot;&gt;\n    &lt;item&gt;https:\/\/connect.rom.miui.com\/generate_204&lt;\/item&gt;\n    &lt;item&gt;https:\/\/connect.rom.miui.com\/generate_204&lt;\/item&gt;\n&lt;\/string-array&gt;<\/code><\/pre>\n<h3>\u4fee\u6539\u6388\u65f6\u670d\u52a1<\/h3>\n<p>\u4e5f\u662f\u53ef\u4ee5\u5237\u5199\u540e\u901a\u8fc7adb\u4fee\u6539,\u8fd9\u91cc\u6539\u4e3a\u4e2d\u79d1\u9662\u56fd\u5bb6\u6388\u65f6\u4e2d\u5fc3\u7684NTP<\/p>\n<pre><code class=\"language-shell\">adb shell settings put global ntp_server ntp.ntsc.ac.cn<\/code><\/pre>\n<p>\u6216\u8005\u5728\u6e90\u4ee3\u7801\u4e2d\u4fee\u6539\uff0c\u5728<code>device\/vendor\/device\/gps\/etc\/gps.conf<\/code>\uff08vendor\u548cdevice\u662f\u5bf9\u5e94\u7684\u5382\u5bb6\u548c\u8bbe\u5907\uff09<\/p>\n<pre><code class=\"language-ini\">#NTP server\nNTP_SERVER=ntp.ntsc.ac.cn<\/code><\/pre>\n<h2>\u540e\u8bb0<\/h2>\n<ol>\n<li>\n<p>\u6700\u540e\u5410\u69fd\u4e00\u4e0b\u7f51\u4e0a\u7684\u67d0\u4e9b\u6587\u6863\uff0c\u6267\u884c\u7684\u64cd\u4f5c\u4e1c\u897f\u4e71\u4e03\u516b\u7cdf\u4e0d\u660e\u4e0d\u767d\uff0c\u540c\u6b65\u6e90\u7801\u5fc5\u987b\u5148\u66f4\u65b0\u7cfb\u7edf\uff1f\u7f16\u8bd1aosp\u9700\u8981htop\uff1f\u79bb\u8c31\uff0c\u591a\u770b\u5b98\u65b9\u6587\u6863\uff0c\u6df1\u7231\u751f\u547d\uff0c\u8fdc\u79bb\u5783\u573e\u6587\u6863<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u8981\u539f\u5c01\u4e0d\u52a8\u7684\u590d\u5236\u7f51\u4e0a\u7684\u547d\u4ee4\uff0c\u7814\u7a76\u4e00\u4e0b\u662f\u5e72\u561b\u7684\uff0c\u7136\u540e\u6839\u636e\u9700\u8981\u6216\u8005\u5b9e\u9645\u60c5\u51b5\u4fee\u6539<\/p>\n<\/li>\n<li>\n<p>\u4fee\u597d\u4e86\u95ee\u9898\u53ef\u80fd\u9700\u8981clean\u540e\u518dmake<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u8bb0\u5f55\u4e00\u4e0b\u8fd9\u4e2a\u56f0\u6270\u4e86\u6211\u591a\u5e74\u7684\u95ee\u9898\uff0c\u91cd\u6253\u5305boot.img\uff0c\u4fee\u6539\u5176\u4e2d\u7684<code>default.prop<\/code>\uff0c\u5f00\u542f\u4e4b\u540e\u4f3c\u4e4e\u6ca1\u6709\u4efb\u4f55\u53d8\u5316\u3002<\/p>\n<p>\u9664\u6b64\u4e4b\u5916\u8fd8\u5e94\u8be5\u4fee\u6539system.img\u4e2d\u7684build.prop\u4e2d\u7684\u5bf9\u5e94\u5b57\u6bb5\u3002system.img\u540e\u6302\u8f7d\u4f1a\u8986\u76d6\u4e0a\u8ff0\u8bbe\u5b9a\u3002\u4fee\u6539\u540e\u5237\u5165system.img\u5c31\u80fd\u5b9e\u73b0\u6b63\u5e38\u7684\u6548\u679c\u4e86\u3002\u5237\u5165system.img\u4e0d\u4f1a\u5f71\u54cd\u4efb\u4f55\u73b0\u6709\u6570\u636e\u3002<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u63a8\u8350\u4f7f\u7528\u6d77\u5916\u670d\u52a1\u5668\u8fdb\u884c\u7f16\u8bd1\uff0c\u8282\u7ea6\u65f6\u95f4\uff0c\u8282\u7ea6\u751f\u547d\uff01 \u5e76\u4e14\uff0c\u5b98\u65b9\u63a8\u8350\u4f7f\u7528Ubuntu LTS\u8fdb\u884c\u7f16\u8bd1\uff0c\u7b97\u4e0a\u8f93 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,8],"tags":[118,120,119],"series":[],"class_list":["post-6726","post","type-post","status-publish","format-standard","hentry","category-study-notes","category-android-reverse-engineering","tag-aosp","tag-120","tag-119"],"_links":{"self":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/6726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/comments?post=6726"}],"version-history":[{"count":17,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/6726\/revisions"}],"predecessor-version":[{"id":7987,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/6726\/revisions\/7987"}],"wp:attachment":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/media?parent=6726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/categories?post=6726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/tags?post=6726"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/series?post=6726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}