将文件夹中结构化的预构建文件集添加到android out文件夹中 [英] Adding prebuilt set of files structured in folders to android out folder

查看:64
本文介绍了将文件夹中结构化的预构建文件集添加到android out文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为ARM编译了glibc,它不同于Android glibc或仿生C,因为我编译的glibc环境将有助于提供更多api.现在,我可以在Android运行时在/system/文件夹中复制glibc环境,在执行chroot时,我可以在glibc环境中运行程序.

I have glibc compiled for arm which is different from Android glibc or the bionic C as the glibc environment I have complied will help in providing more api's. Now I can copy the glibc environment on /system/ folder while Android is running, and on doing chroot I can run my programs on glibc environment.

当前,我将分别编译glibc和Android,然后将其打包并在Android模拟器sdcard上复制,然后在/system文件夹中将其取消压缩,然后在/system/glibc上执行chroot

Currently I am compiling glibc and Android separately and then tarring the glibc and copying it on Android emulator sdcard and then untarring it on /system folder and then doing chroot on /system/glibc

我分别编译glibc,然后将其放在Android源代码中的某个位置.现在,在编译Android源代码时,我应该怎么做,以便将glibc的整个预构建文件夹结构复制到/system文件夹,并成为system.img的一部分.

I compile glibc separately and then place it somewhere in Android source code. Now while compiling Android source, what should I do so that the entire prebuilt folder structure of glibc gets copied to /system folder and become part of part of system.img.

当我将system.img复制到Android模拟器并启动它时,glibc已经存在于/system文件夹中,只需要在glibc环境中运行应用即可.

With this when I copy the system.img to Android emulator and launch it, glibc is already present in /system folder and just need to run the apps in glibc environment.

更新

我按照Yuri在他的回答中提到的做后(我创建了glibc文件夹并将所有内容复制到其中),当我编译代码时得到的输出如下.

after I did as per Yuri mentioned in his answer (I created glibc folder and copied everything into it), when I compile the code I get below output.

build/core/main.mk:490: * Some files have been added to ALL_PREBUILT.
build/core/main.mk:491: *
build/core/main.mk:492: * ALL_PREBUILT is a deprecated mechanism that
build/core/main.mk:493: * should not be used for new files.
build/core/main.mk:494: * As an alternative, use PRODUCT_COPY_FILES in
build/core/main.mk:495: * the appropriate product definition.
build/core/main.mk:496: * build/target/product/core.mk is the product
build/core/main.mk:497: * definition used in all products.
build/core/main.mk:498: *
build/core/main.mk:499: * unexpected glibc in ALL_PREBUILT
build/core/main.mk:500: *
build/core/main.mk:501: * ALL_PREBUILT contains unexpected files. Stop.

所以我在build/core/legacy_prebuilts.mk中添加了glibc

So I added glibc in build/core/legacy_prebuilts.mk

但后来我得到了

make: * No rule to make target mkdir', needed byout/target/product/generic/root/glibc'. Stop.

推荐答案

以下是嵌入式Android"一书中的一个示例,它将为您提供帮助.在aosp项目的根目录中创建一个名为 rootfs-glibc 的文件夹,在其中放置要复制的代码,并在其中创建具有以下内容的 Android.mk 文件:

Here is an example from the book "Embedded Android" that will help you. Create a folder in the root of your aosp project called rootfs-glibc, put there the code that you want to copy, and create there Android.mk file with the following content:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# This part is a hack, we're doing "addprefix" because if we don't,
# this dependency will be stripped out by the build system
GLIBC_ROOTFS := $(addprefix $(TARGET_ROOT_OUT)/, rootfs-glibc)
$(GLIBC_ROOTFS): mkdir -p $(TARGET_ROOT_OUT) cp -af $(TOPDIR)rootfs-glibc/* $(TARGET_ROOT_OUT) rm
# The last command just gets rid of this very .mk since it's copied as-is
ALL_PREBUILT += $(GLIBC_ROOTFS)

有一点说明,这对于姜饼是正确的.也许在更新版本的Android中,make系统已更改.

There is a note that this is true for Gingerbread. Maybe in newer versions of Android the make system has been changed.

这篇关于将文件夹中结构化的预构建文件集添加到android out文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆