Now, our building environments for Android are almost x86_64 Ubuntu, but we still have low-end products based on armv7 kernel. For analyze ramdump under armv7, let’s build it on Ubuntu 18.04 (should be same for others).

Step0: install essential build tools

sudo apt-get install build-essential

Step1: download crash source code

git clone  https://github.com/crash-utility/crash.git

Step2: make for ARM

make target=ARM

note that:

  • it’s not cross compiling, we will use the crash tool in current enviroment(x86_64).
  • we will get gdb-7.6.tar.gz after this step

install termcap library

met below error:

configure: error: no termcap library found

download termcap-1.3.1.tar.gz from https://ftp.gnu.org/gnu/termcap/

./configure
make
make install

install gcc-multilib

met below errors:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: cannot find libgcc_s.so.1
sudo apt-get install gcc-multilib

install lib32ncurses5-dev

met below error:

/usr/bin/ld: cannot find libncurses.so.5
sudo apt-get install lib32ncurses5-dev 

install lib32z1-dev

met below errors:

/usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
sudo apt-get install lib32z1-dev

Step4: check crash

tj@tj-X230:~/tools/crash$ ./crash --version

crash 7.2.8++
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.

GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-elf-linux".

We can see This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-elf-linux".

The --host means the crash tool is used on.