[Q] How do I properly use a prebuilt kernel with AOSP? - Android Q&A, Help & Troubleshooting

I'm trying to build AOSP for Moto X 2013 (ghost). I've successfully built the kernel separately already (and flashed it to my device to make sure it works) but I can't seem to find a way to tell AOSP to use it. I get the following error when running make -j16 otapackage:
No private recovery resources for TARGET_DEVICE ghost
make: *** No rule to make target `out/target/product/ghost/kernel', needed by `out/target/product/ghost/boot.img'. Stop.
I've already tried to add this line to device.mk:
LOCAL_KERNEL := device/motorola/ghost-kernel/zImage
But it did nothing.
Any ideas?

I think, you should use TARGET_PREBUILT_KERNEL variable
https://stackoverflow.com/questions/9008761/replace-the-prebuilt-kernel-in-the-android-platform-source
http://wiki.cyanogenmod.org/w/Doc:_integrated_kernel_building

Fixed this build step by adding these lines to the device makefile:
Code:
TARGET_PREBUILT_KERNEL := device/motorola/ghost-kernel/zImage
PRODUCT_COPY_FILES += \
$(TARGET_PREBUILT_KERNEL):kernel
Effectively, this copies the kernel file to the output directory to be processed by subsequent steps.

Related

[Q] Building a specific apk from CM7 sources

i was trying to build framework-res.apk
i went into android_frameworks_base/core/res from terminal
theres an Android.mk file there:
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_PACKAGE_NAME := framework-res
LOCAL_CERTIFICATE := platform
# Tell aapt to create "extending (non-application)" resource IDs,
# since these resources will be used by many apps.
LOCAL_AAPT_FLAGS := -x
LOCAL_MODULE_TAGS := optional
# Install this alongside the libraries.
LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)
# Create package-export.apk, which other packages can use to get
# PRODUCT-agnostic resource data like IDs and type definitions.
LOCAL_EXPORT_PACKAGE_RESOURCES := true
include $(BUILD_PACKAGE)
# define a global intermediate target that other module may depend on.
.PHONY: framework-res-package-target
framework-res-package-target: $(LOCAL_BUILT_MODULE)
and then i did
make framework-res
make: *** No rule to make target `framework-res'. Stop.
can u help me with the process? im just a beginner.

[Q] Problem with CWM recovery when building AOKP from source

So I decided to lean how to build AOKP from source. I referenced other developers Github's and multiple tutorials. I finally manged to create a good device and vendor tree and successfully build AOKP from source. All is good, or so I thought. When I attempted to perform my first CWM backup, I was prompted (at the end) with the error message "MD5 error". Looking into the recovery log shows that the script nandroid-md5.sh was not found.
So, I check my build output, "out/target/product/i777/recovery/root/sbin" and discover that the script is missing. Next I start to dig into the bootable/recovery project. I evaluate the Android.mk file and I find the following:
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := nandroid-md5.sh
include $(BUILD_PREBUILT)
So the make file should include the script in the build, but I can't figure out what is missing. I've done the following without success.
Rebuilt with an earlier version (6.0.1.5) of CWM recovery.
Evaluated other devices to see if I'm missing something in my device/vendor trees.
Checked AOKP & CM forums for anyone reporting similar issues.
Built a supported device i9100 and the same problem occurs.
Now, I've found a workaround, but it seems more like a hack. If I include the following line in one of my make files, then the file will get copied.
Code:
PRODUCT_COPY_FILES += \
bootable/recovery/nandroid-md5.sh:recovery/root/sbin/nandroid-md5.sh
I'm hoping that someone can help me understand why my build is having this problem.

Build Error CM12.1, missing reference to a JAR

Hi,
I currently try building this one myself:
http://forum.xda-developers.com/android/development/rom-cyanogenmod-12-0-samsung-express-gt-t2949359
it's CM 12.1 for the Samsung Galaxy Express GT-I8730
After hours of building it breaks with a missing library.
Code:
frameworks/testing/runner/src/main/java/android/support/test/internal/runner/ClassPathScanner.java:19: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
build/core/java.mk:346: recipe for target '~/src/cm-12.1-main/out/target/common/obj/JAVA_LIBRARIES/android-support-test-src_intermediates/classes-full-debug.jar' failed
make: *** [~/src/cm-12.1-main/out/target/common/obj/JAVA_LIBRARIES/android-support-test-src_intermediates/classes-full-debug.jar] Error 41
package android.support.annotation is missing. It's available here
Code:
./frameworks/support/annotations/src/android/support/annotation
./prebuilts/sdk/current/support/annotations/android-support-annotations.jar
But it's not included in build.
This is the code in question, in build/core/java.mk:346
Code:
# Compile the java files to a .jar file.
# This intentionally depends on java_sources, not all_java_sources.
# Deps for generated source files must be handled separately,
# via deps on the target that generates the sources.
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
$(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
$(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-java-to-classes.jar)
How do I find out the content of the variables? How do I modify it?
Since I am building from a branch, it probably is a temporary problem. I issued a repo sync, but it dit not help (yet).
any idea?
thanks
JPT

How to use 3rd party jar in system app

I want to use a 3rd party jar in the system app - Settings.
I have tried two methods, but both failed.
The Android version is 4.2.2 JB.
The first method is that I put the jar file into /packages/apps/Settings/ and modify the Android.mk.
Code:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_JAVA_LIBRARIES := bouncycastle telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305 nxpnfclib
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Settings
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := nxpnfclib.jar
include $(BUILD_MULTI_PREBUILT)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
Some proguard warnings show up:
Code:
Warning: class [com/nxp/nfclib/ntag/╦К.class] unexpectedly contains class [com.nxp.nfclib.ntag.ˊ]
Warning: there were 30 classes in incorrectly named files. You should make sure all file names correspond
to their class names. The directory hierarchies must correspond to the package hierarchies. If you don't mind
the mentioned classes not being written out, you could try your luck using the '-ignorewarnings' option.
Error: Please correct the above warnings first. make: *** [out/target/common/obj/APPS/Settings_intermed
iates/proguard.classes.jar] Error 1
Then I add some proguard flags to prevent this warnings. I can compile Android now. However, when I boot the system, some errors show up:
Code:
W/dalvikvm( 732): Unable to resolve superclass of Lcom/nxp/nfclib/ntag/NTag213215216; (1855)
W/dalvikvm( 732): Link of class 'Lcom/nxp/nfclib/ntag/NTag213215216;' failed
W/dalvikvm( 732): Unable to resolve superclass of Lcom/nxp/nfclib/ntag/NTag213F216F; (1844)
W/dalvikvm( 732): Link of class 'Lcom/nxp/nfclib/ntag/NTag213F216F;' failed
E/dalvikvm( 732): Could not find class 'com.nxp.nfclib.ntag.NTag213F216F', referenced from method com.nxp.nfclib.NxpNfcLib.ˊ
Another mothod: I put the jar file to /prebuilts/misc/common/nxp and write an Android.mk:
Code:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PREBUILT_JAVA_LIBRARIES := \
nxpnfclib$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_MODULE_TAGS := optional
include $(BUILD_HOST_PREBUILT)
Then modify /packages/apps/Settings/Android.mk:
Code:
LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305 nxpnfclib
However, when I compile the whole AOSP, the same proguard warnings show up:
Code:
Warning: class [com/nxp/nfclib/ntag/╦К.class] unexpectedly contains class [com.nxp.nfclib.ntag.ˊ]
Warning: there were 30 classes in incorrectly named files. You should make sure all file names correspond
to their class names. The directory hierarchies must correspond to the package hierarchies. If you don't mind
the mentioned classes not being written out, you could try your luck using the '-ignorewarnings' option.
Error: Please correct the above warnings first. make: *** [out/target/common/obj/APPS/Settings_interm
ediates/proguard.classes.jar] Error 1
Is there some other way to add the jar?
The jar runs well if I use Android Studio to build an app.
Can I put the jar in the system instead of merge it into the system?

Ninja unable to find target after updating to NINJA based build Lineage 14.1

I have been messing around and creating a custom ROM for a few different devices, and I like using LineageOS as my base, but just recently I ran into a problem where I can't get some of my make tasks to work correctly.
I have my own `vendor/alex/` repository and it has some makefiles in it. The general structure of my makefiles is
Code:
|- alex_pre.mk
|- alex_post.mk
|- alex_${device}.mk
Inside of alex_pre.mk I have some common PRODUCT_COPY_FILES that I use.
Inside of alex_post.mk I have a task that I would like to run after the LineageOS 'bacon' task is done
Code:
test-task: bacon
@echo "Hello, World!"
Inside of my device makefiles I have something like : ( using harpia as my example )
Code:
$(call inherit-product, vendor/alex/alex_pre.mk)
$(call inherit-product, device/motorola/harpia/lineage.mk)
PRODUCT_MODEL = Alex on Harpia
PRODUCT_NAME = alex_harpia
$(call inherit-product, vendor/alex/alex_post.mk)
Code:
build/core/ninja.mk:147: warning: overriding commands for target `test-task'
vendor/alex/alex_post.mk:152: warning: ignoring old commands for target `test-task'
make: *** No rule to make target `bacon', needed by `test-task'. Stop.
make: *** Waiting for unfinished jobs....
Running kati to generate build-alex_harpia.ninja...
vendor/alex/alex_post.mk was modified, regenerating...

Categories

Resources