为 Android 交叉编译 v4l2-ctl

Cross Compiling v4l2-ctl for Android

我有一个 USB 摄像头在 android 上工作(通过 Android On-The-Go),我想改变摄像头的曝光。我已经能够通过在 linux 机器上使用 v4l2-ctl 来实现它,我希望在我的 Android 设备上做同样的事情。

安装文件提到以下内容:

Android Cross Compiling and Installing:
----------------

v4l-utils will only build using the complete AOSP source tree, because of the
stlport dependency.

List of v4l-utils that supply an Android.mk makefile:
* utils/v4l2-compliance
* utils/v4l2-ctl
* utils/v4l2-dbg

To cross compile an utility you must first configure the shell with Android's
envsetup.sh to add the mm alias, before running lunch to select your target
device.

cd /path/to/aosp
source build/envsetup.sh
lunch
cd /path/to/v4l-utils
cd <utility>
mm

所以我下载了 android 源,运行 前两个命令和 lunch 成功。然后我把cd'd变成v4l-utils/v4l2-ctl和运行mm。我收到以下错误:

make: *** No rule to make target `out/target/product/generic/obj/lib/crtbegin_dynamic.o', needed by `out/target/product/generic/obj/EXECUTABLES/v4l2-ctl_intermediates/LINKED/v4l2-ctl'.  Stop.

我该如何解决这个问题?

注意:正常编译工作:我可以使用 ./bootstrap.sh./configure、然后 make[= 制作所有 v4l2 20=]

我知道怎么做了!我发现这些说明很有效,除了这两点:

下载并构建整个 Android 源代码

  • 在做任何事情之前,您需要下载并制作完整的 Android 源代码。这意味着 setting up your environment, downloading it, and then building it.
  • 确保您正在下载正确版本的 Android 源(即 运行ning 在您的 phone 上的版本)。
  • 为了加快下载速度,运行 repo-sync-c,仅适用于当前分支
  • 我建议购买大型的按小时计费的服务器,然后 运行将其安装在那里。网络连接会更好,机器可能比你自己的好。我在 DigitalOcean 上有一台 8 核,16GB 的机器。
  • 当运行宁lunch时,我只是选择了第一个选项:aosp_arm-eng

设置 TOP 变量

  • 执行 mm 步骤时,您会收到一条错误消息 Couldn't locate the top of the tree. Try setting TOP. So 运行 export TOP=/location/of/android/source