Skip to content

adelva1984/androdeb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adeb

adeb (also known as androdeb) provides a powerful Linux shell environment where one can run popular and mainstream Linux tracing, compiling, editing and other development tools on an existing Android device. All the commands typically available on a modern Linux system are supported in adeb.

Usecases

  1. Powerful development environment with all tools ready to go (editors, compilers, tracers, perl/python etc) for your on-device development.

  2. No more cross-compiler needed: Because it comes with gcc and clang, one can build target packages natively without needing to do any cross compilation. We even ship git, and have support to run apt-get to get any missing development packages from the web.

  3. Using these one can run popular tools such as BCC that are difficult to run in an Android environment due to lack of packages, dependencies and cross-compilation needed for their operation. Check BCC on Android using adeb for more information on that.

  4. No more crippled tools: Its often a theme to build a static binary with features disabled, because you couldn't cross-compile the feature's dependencies. One classic example is perf. However, thanks to adeb, we can build perf natively on device without having to cripple it.

Requirements for running

Target: An armhf, arm64, i386 or amd64 Android N or later device which has "adb root" supported. Typically this is a build in a userdebug configuration. Device should have at least 2 GB free space in the data partition. If you would like to use an architecture other than the default of arm64, see the Other Architectures section.

Host: A machine running recent Ubuntu or Debian, with 4GB of memory and 4GB free space. Host needs the debootstrap, fakeroot and qemu-user-static packages. To install these, run sudo apt-get install debootstrap fakeroot qemu-user-static. Other distributions may work but they are not tested.

Quick Start Instructions

  • Clone adeb repository:
git clone https://github.com/joelagnel/adeb.git
cd adeb

# Add some short cuts:
sudo ln -s $(pwd)/adeb /usr/bin/adeb
  • Installing adeb onto your device: First make sure device is connected to system Then run, for the base image:
adeb prepare

The previous command only downloads and installs the base image. Instead if you want to download and install the full image, do:

adeb prepare --full
  • Now run adeb shell to enter your new environment!:
adeb shell
  • Once done, hit CTRL + D and you will exit out of the shell. To remove adeb from the device, run:
adeb remove

If you have multiple devices connected, please add -s <serialnumber>. Serial numbers of all devices connected can be obtained by adb devices.

  • To update the adeb you cloned on your host, run:
adeb pull

To update an existing adeb clone on your host, run:

adeb git-pull

More advanced usage instructions

Install kernel headers in addition to preparing adeb device:

adeb prepare --kernelsrc /path/to/kernel-source

Update kernel headers onto an already prepared device:

If you need to put kernel sources for an existing install, run:

adeb prepare --kernelsrc /path/to/kernel-source --skip-install

Note: The kernel sources should have been built (atleast build should have started).

Build and prepare device with a custom rootfs locally:

The adeb fs will be prepared locally by downloading packages as needed:

adeb prepare --build

This is unlike the default behavior, where the adeb rootfs is itself pulled from the web.

If you wish to do a full build (that is locally prepare a rootfs with all packages, including bcc, then do):

adeb prepare --full --build

Add kernel headers to device in addition to building locally:

adeb prepare --build --kernelsrc /path/to/kernel-source/

Build/install a base image with BCC:

adeb prepare --build --bcc --kernelsrc /path/to/kernel-source/

Note: BCC is built from source. Also --kernelsrc is recommended for tools to function unless device has them already.

Extract the FS from the device, after its prepared:

adeb prepare --buildtar /path/

After device is prepared, it will extract the root fs from it and store it as a tar archive at /path/adeb-fs.tgz. This can be used later.

Use a previously prepared adeb rootfs tar from local:

adeb prepare --archive /path/adeb-fs.tgz

Build a standalone raw EXT4 image out of the FS:

adeb prepare --build-image /path/to/image.img

This can then be passed to Qemu as -hda. Note: This option doesn't need a device connected.

How to use adeb for other Architectures (other than ARM64)

By default adeb assumes the target Android device is based on ARM64 processor architecture. For other architectures, use the --arch option. For example for x86_64 architecture, run:

adeb prepare --build --arch amd64 --bcc --kernelsrc /path/to/kernel-source/

Normally you want to use --foreign too, especially if your distro's glibc version does not match the --distro option. This mode eliminates the need for root (chroot) or qemu-debootstrap, but it does cause more setup to be done on the device side the first time you enter adeb. Note: The --download option ignores the --arch flag. This is because we only provide pre-built filesystems for ARM64 at the moment.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 61.2%
  • Python 38.8%