Simply following Google's official online documentation can't build the android kernel source easily, here are some notes to build it succeed, all is from my own experiments and testing.
1. "elf XXX" error as below:
The solution is about adding a "elf. H" file, and some slight changes on another 2 files:
Step 1: Add a file: "elf. H" to/kernel repository/scripts/MoD/
Step 2: change # include <elf. h> to # include "elf. H" in the following files in/kernel repository/scripts/MoD/: mk_elfconfig.c and modpost. h
2. toolchan issue, the Google's doc says we shocould use"Export Path = $ (PWD)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin: $ path
"Before building, but it doesn't say it is for Linux :) Luckly, if you look into the source code folder structure" prebuilts ", you'll find something about" Darwin ", that's about Mac OS !!!, So we shoshould Replace the "linux-x86" with "darwin-x86 ".
Finally the compiler is happy, and we get the goldfish emulator work with my kernel: