2

I am trying to achieve something similar to this https://github.com/volatilityfoundation/volatility/wiki/Android#initialize-the-android-build-environment. Below is the environment I am using:

Ubuntu 14.04, Android Studio 2.3, Android NDK r14, emulator -api22.

I am facing difficulties at step Cross Compile the Kernel. I am targeting the goldfish kernel 3.10 following are the step I followed. Any help would be really appreciated.

method 1:

export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/android-ndk/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-

The tutorial suggesting that we have to run the next command as

make goldfish_armv7_defconfig

but when I checked the directory "android-source/arch/arm/configs/" there is no such config file there. Some tutorials suggesting that we can just copy and paste the file from kernel 2.6, so I did the same thing, and after that add

CONFIG_MODULES=y
CONFIG_MODULES_UNLOAD=y
CONFIG_MODULES_FORCE_UNLOAD=y

But futher

$ make

results in error:

arch/arm/mm/mmu.c: In function 'build_mem_type_table':
arch/arm/mm/mmu.c:470:18: error: 'L_PTE_MT_VECTORS' undeclared (first use in this function)
   vecs_pgprot |= L_PTE_MT_VECTORS;
                  ^
arch/arm/mm/mmu.c:470:18: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/mm/mmu.c: At top level:
arch/arm/mm/mmu.c:637:23: warning: 'early_pte_alloc_and_install' defined but not used [-Wunused-function]
 static pte_t * __init early_pte_alloc_and_install(pmd_t *pmd,
                       ^
make[1]: *** [arch/arm/mm/mmu.o] Error 1
make: *** [arch/arm/mm] Error

methos 2:

Everything is same as in method 1, I just changed single variable

export ARCH=arm64

And run

make ranchu_deconfig

But I got the same error.

method 3:

$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=~/android-ndk/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
$ make ranchu_defconfig
$ vim .config # added this to .config file

CONFIG_MODULES=y
CONFIG_MODULES_UNLOAD=y
CONFIG_MODULES_FORCE_UNLOAD=y

$ make

This command run successfully: zImage found.

But when I run the emulator using the below command

root@ubuntu:~/Android/Sdk/tools# ./emulator -avd Nexus5x22 -kernel ~/android-source2/android-source/arch/arm/boot/zImage -show-kernel –verbose

I am getting the error of "Linux kernel too old to run ram disk": ram disk error

Alexander L. Hayes
  • 3,892
  • 4
  • 13
  • 34
  • Be sure your `CROSS_COMPILE=arm-linux-androideabi-` and your `PATH` contains `$HOME/android-ndk/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin`. (This is just first step) – 0andriy Mar 20 '17 at 11:29

1 Answers1

0

Google's Android Kernel is messed up. They forgot to define L_PTE_MT_VECTORS when they back ported this patch.

The solution is to just add it here.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
user3353209
  • 23
  • 1
  • 3