joelagnel / adeb

A debian-based shell environment designed for Android and adb
Apache License 2.0
318 stars 98 forks source link

adeb prepare advertises --distro flag but doesn't accept it #43

Open mhansen opened 2 years ago

mhansen commented 2 years ago

Hi there, a little error I got when I tried to upgrade from debian buster (now superseded by bullseye).

$ git clone https://github.com/joelagnel/adeb.git
$ cd adeb
$ ./adeb prepare
> ./adeb
15:09:33 - INFO    : USAGE:
15:09:33 - INFO    : adeb
15:09:33 - INFO    :    shell           Enter the androdeb shell environment and get to work!
15:09:33 - INFO    :    remove          Remove androdeb from the device
15:09:33 - INFO    :    git-pull        Git pull androdeb to update it on your host
15:09:33 - INFO    :    pull            Copy files from the androdeb filesystem in the device
15:09:33 - INFO    :    push            Copy files to the androdeb filesystem in the device
15:09:33 - INFO    :
15:09:33 - INFO    :    prepare         Prepare the device (when running for the first time)
15:09:33 - INFO    :                    By default, this will download and install a base image.
15:09:33 - INFO    :    ** Folowing are the prepare options **
15:09:33 - INFO    :      --full        Pass this to prepare to download and install the full image which
15:09:33 - INFO    :                    contains compilers, editors, tracers etc.
15:09:33 - INFO    :
15:09:33 - INFO    :      --build       Instead of download, build and install the image onto the device
15:09:33 - INFO    :
15:09:33 - INFO    :      --archive     Use archive for root fs (overrides all other prepare options)
15:09:33 - INFO    :
15:09:33 - INFO    :      --buildtar    While preparing, also build a tar.gz.zip file of the filesystem,
15:09:33 - INFO    :                            this is how images that are downloaded by prepare are built
15:09:33 - INFO    :
15:09:33 - INFO    :      --build-image Build an ext4 .img with the base image and BCC (useful for Qemu)
15:09:33 - INFO    :
15:09:33 - INFO    :    ** Folowing are misc build options **
15:09:33 - INFO    :      --tempdir     Use a specific temporary directory for build operation
15:09:33 - INFO    :      --arch                Specify an ARCH to build for (default arm64)
15:09:33 - INFO    :      --distro      Debian distro to base on (default is buster)
[snip]
$  ./adeb prepare --distro bullseye
15:09:06 - ERROR   : Unknown option (--distro)

This was in order to get the latest version of bpftrace which should contain a fix for https://github.com/iovisor/bpftrace/issues/515.

mhansen commented 2 years ago

Looks like the DISTRO is hardcoded in androdeb.

I think this patch should fix it?

> git diff
diff --git a/androdeb b/androdeb
index a2ee65b..60c5566 100755
--- a/androdeb
+++ b/androdeb
@@ -63,6 +63,7 @@ case $key in
     --sshpass) SSHPASS="sshpass -p$2"; shift || true; shift || true; ;;
     --build-image) BI=1; BUILD_IMAGEF=$2; SKIP_DEVICE=1; DOWNLOAD=0; shift || true; shift || true; ;;
     --debug) set -x; shift || true; ;;
+    --distro) DISTRO="$2"; shift || true; shift || true; ;;
     *) c_error "Unknown option ($1)"; usage; ;;
 esac
 done
joelagnel commented 2 years ago

I no longer maintain it but I'm happy to accept PRs. Could you send me a PR for this?

mhansen commented 2 years ago

Absolutely — will send them next week when I’m back at work. Heads up I may have a few more PRs around moving from installing python2 to python3, so that new debian works.

Appreciate it!

On Fri, 24 Sep 2021 at 21:04, Joel @.***> wrote:

I no longer maintain it but I'm happy to accept PRs. Could you send me a PR for this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joelagnel/adeb/issues/43#issuecomment-926539233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZYOJKPI7NZ52TW2DVPLLUDRLMDANCNFSM5EVFTS5A .

mhansen commented 2 years ago

Before I send a bunch of PRs, I might ask: do you know of an easier way than this project to run bpftrace on Android? (I'm wondering/hoping if the lack of maintenance may be connected to a better way emerging that obsoletes this? e.g. can we copy a statically linked bpftrace to Android now?)

mhansen commented 2 years ago

Just linking up some issues: https://github.com/iovisor/bpftrace/issues/342#issuecomment-517353729 discusses some constraints around statically linking bpftrace -- the problem seems to be that bpftrace compiles programs with LLVM and LLVM is huge.

tiann commented 2 years ago

I no longer maintain it but I'm happy to accept PRs. Could you send me a PR for this?

https://github.com/joelagnel/adeb/pull/48 Can you review this PR?

tiann commented 2 years ago

Before I send a bunch of PRs, I might ask: do you know of an easier way than this project to run bpftrace on Android? (I'm wondering/hoping if the lack of maintenance may be connected to a better way emerging that obsoletes this? e.g. can we copy a statically linked bpftrace to Android now?)

This project can run bpftrace directly on Android: https://github.com/facebookexperimental/ExtendedAndroidTools