title: How do you build a Linux Kernel for Android from the AOSP?
body: <p>I've found that AOSP <code>build.sh dist</code> creates:</p>
  <ul>
  <li><p>XML files:</p>
  <pre><code>./out/soong/.intermediates/kernel/configs/q/android-4.19/kernel_config_q_4.19/gen/conditional.xml
  ./out/soong/.intermediates/kernel/configs/q/android-4.19/kernel_config_q_4.19/matrix.xml
  </code></pre>
  <p>from the kernel config files:</p>
  <pre><code>kernel/configs/q/
  ├── android-4.14
  │   ├── android-base-conditional.xml
  │   ├── android-base.config
  │   ├── Android.bp
  │   ├── android-recommended-arm64.config
  │   ├── android-recommended-arm.config
  │   ├── android-recommended.config
  │   └── android-recommended-x86.config
  ├── android-4.19
  │   ├── android-base-conditional.xml
  ... ...
  </code></pre>
  </li>
  <li><p>A whole copy of the Linux kernel directory in:</p>
  <pre><code>out/target/product/sdm660_64/obj/kernel/msm-4.14
  </code></pre>
  </li>
  </ul>
  <p>This newly-created <code>msm-4.14</code> includes a <code>.config</code> file which looks like normal kernel configuration.</p>
  <p>How can I compile this kernel for <code>aarch64</code>?</p>
  <p>When I use <code>make</code> it prompts to regenerate an <code>x86_64</code> config file, as <code>.config</code> correctly contains Aarch64 settings.</p>
  <p>Perhaps I'm trying the wrong thing, but <code>mm</code> in <code>kernel/msm-4.14</code> ignored changes to kernel configs, and <code>build.sh dist</code> took hours.</p>
  <p>I want to be able to change kernel configuration and source code, and build new kernels in just a few minutes, as I can for desktop machines.</p>
  <p>How should I do this for Android?</p>