[DEV][Q] Root AOSP ? - Android Q&A, Help & Troubleshooting

Hi everyone,
I'm currently trying to compile Android 2.2.1 for my HTC Desire. My question is simple : how do i add Superuser and su to my build ? I managed to add Superuser but su isn't included... my android/system/extras/su/Makefile looks like that :
Code:
ifeq ($(BUILD_ORIGINAL_SU),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= su.c su.c activity.cpp
LOCAL_C_INCLUDES += external/sqlite/dist
LOCAL_SHARED_LIBRARIES := liblog libsqlite libandroid_runtime
LOCAL_MODULE:= su
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_STATIC_LIBRARIES := libc
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
include $(BUILD_EXECUTABLE)
endif
I took the code from Cyanogenmod.. but it doesn't work ...
Thanks in advance for your help,
Renan.

su.c didn't produce any output? Was there an error in the build?
You could probably fake it by just copying sh to su and giving it SIUD (root:root 4755) permissions

Thanks for your reply.
I tried to compile with different Makefiles (stock, modified, cyanogenmod one) and different files (su.c or su.c, su.h and activity.cpp) but there's no output :/ I don't see su in /system/bin or in /system/xbin... And when I load my ROM on my phone, Superuser doesn't work because there isn't su. I tried to flash superuser.zip but there's an issue with the symbolic link I think.
I found a guide who explaned how to root aosp for motorola sholes but this method (the one I used) doesn't work for me..

It it's just a matter of the su executable, one from any android build would probably work. The command line tools are all ELF ARM-NONE-EABI.

It doesn't work at all...
If I remove su (chainsdd's android_system_extras) and add the binary, then create symlinks, it doesn't work.
su causes an issue when I'm building source:
Code:
android/system/system/extras/su/su.c:149: undefined reference to `_mktemp'
But it's strange... when I build without it and then re-add the source, all is ok. But on the phone, I get a seg fault when I try to run su...
What's wrong ? :/

I'm also interested in this...

Look at the sources of my ROM : http://github.com/python08/android_system_extras.git
Look at su/Android.mk
You will understand the problem
Sent from my HTC Desire using XDA App

I dont know if it is too late to answer you~
Be aware of the following:
LOCAL_MODULE_TAGS := debug
It means this module is included ONLY when you are building an "eng" or "userdebug" version.
If you build your android with "user" this module will not be included.
Try change LOCAL_MODULE_TAGS to "optional".

Questions should be posted in Q&A forums, not Development forums.
http://forum.xda-developers.com/announcement.php?a=81
See rule #15
Thread moved.

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] Changing/Compiling Cyanogenmod 9 Lockscreen

So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Chiggins said:
So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Click to expand...
Click to collapse
If you look here:
https://github.com/CyanogenMod/android_frameworks_base/tree/gingerbread/policy
You will see Android.mk
Code:
LOCAL_PATH:= $(call my-dir)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := android.policy
include $(BUILD_JAVA_LIBRARY)
# additionally, build unit tests in a separate .apk
include $(call all-makefiles-under,$(LOCAL_PATH))
The local module you will need to call this is "android.policy"
It will build what it needs to. When it finishes compiling you will see a list of "Install:" Push those to your phone.
Code:
make -j$ android.policy
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Chiggins said:
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Click to expand...
Click to collapse
Yup just about. There might be issues at some point... but I have never had issues testing bits like this.
Alright sweet deal, thanks mate!

[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.

Port MultiRom v32 To your G3 Device

Note:
I noticed alot more people have been using MultiRom, So I decided to make a really simple basic How to guide for people who pretty much already know what they are doing.
Step #1, you need the omni source tree, I use Omni-lp5.1.1, But to use that, you will need to make some changes to your device tree, like g3-common and qcomm_common,
Only thing you will be doing to those to device tree sections, in g3-common you will remove the "liblight" directory. and in the qcomm_common Dir, you will remove The "power" Directory.
reason for that, because its already defined in hardware.. The above is only if you decide to use Omni LP trees.
If you use the Normal Omni KitKat 4.4.4, Then you dont have to remove anything.. should work right out of the box.
If using Omni 4.4.4, you can use your device from: https://github.com/TeamWin,
if your using Omni LP you can use your own device tree that works with LP..
Ok now for the code part:
open your BoardConfig.mk
and enter this at the bottom:
Code:
# Edited for TWRP Recovery
DEVICE_RESOLUTION := 1440x2560
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TW_NO_USB_STORAGE := true
TW_INCLUDE_JB_CRYPTO := true
TW_INCLUDE_CRYPTO := true
BOARD_SUPPRESS_SECURE_ERASE := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_BRIGHTNESS_PATH := "/sys/devices/mdp.0/qcom\x2cmdss_fb_primary.175/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 255
TW_SCREEN_BLANK_ON_BOOT := true
# TW_NO_SCREEN_TIMEOUT := false
# MultiROM
MR_INPUT_TYPE := type_b
MR_INIT_DEVICES := device/lge/d851/multirom/mr_init_devices.c
MR_RD_ADDR := 0x2200000
MR_DPI := xhdpi
MR_DPI_MUL := 1.5
MR_FSTAB := device/lge/d851/twrp.fstab
MR_KEXEC_MEM_MIN := 0x0ff00000
MR_KEXEC_DTB := true
MR_USE_MROM_FSTAB := true
MR_DPI_FONT := 420
MR_DEFAULT_BRIGHTNESS := 80
#MR_CONTINUOUS_FB_UPDATE := true
#MultiRom Hooks, So that we can run stock roms as secondary
MR_DEVICE_HOOKS := device/lge/d851/mr_hooks.c
MR_DEVICE_HOOKS_VER := 4
Of course change your device name and locations.
You will need to make changes to omni_(your device).mk (AKA cm_(your device).mk
and add this to it:
Code:
# Copy needed files to make everything work for recovery
PRODUCT_COPY_FILES += \
# device/lge/d851/kernel:kernel \
device/lge/d851/img_info:img_info \
device/lge/d851/postrecoveryboot.sh:recovery/root/sbin/postrecoveryboot.sh \
device/lge/d851/sign:recovery/root/res/sign
PRODUCT_COPY_FILES += device/lge/d851/fstab.g3:recovery/root/fstab.g3
PRODUCT_COPY_FILES += device/lge/d851/twrp.fstab:recovery/root/etc/twrp.fstab
PRODUCT_NAME := omni_d851
PRODUCT_DEVICE := d851
PRODUCT_BRAND := LG
PRODUCT_MODEL := G3
PRODUCT_MANUFACTURER := LG
Im not going to tell you how to get your own fstab. you should already know that.
You will need this for your hooks file: mr_hooks.c
I am sure you can see the location that it will go into, you can change it to meet your device spec.
Now read this for the rest of the way: https://github.com/Tasssadar/multirom/wiki/Porting-MultiROM
I already created a patch that works very well with the latest MultiRom: D851-CM_hardboot_kexec_kernel.patch
Yes the patch says D851, but its for the G3 kernel which all models use. And yes, it will work with CM based and stock based. If anything you will have to change the config file settings
to match the ones for your device config. This one is set for the d851_defconfig.. So just point it to your config when it asks.
Command to run patch from terminal: patch --verbose -p1 < patch/D851-CM_hardboot_kexec_kernel.patch
Yes when you copy it over, place it in its own dir called patch from your kernel tree.
or if you rather take an already patched kernel: 777Kernel-patched Branch "Testing"
Above kernel was patched by me with pemish from @777jon, I did remove his patch created by @Skin1980 since it didnt work well with todays MultiRom
and I added in mine.. I also made some changes to allow Sabermod 5.1 and 6.0 to compile it.
Ok this is it for me, I told you it was a quick guide for people that already know what they are doing. I am no good at teaching. I wrote this really quick so that others
can have the ability to get MultiRom running on their device (Developers)..
I will only answer questions from Developers that plan on porting to thier device and make it public.
any1 working on this?
I honestly forgot that I posted this. I do hope that some are working on this for their device.
I just dont have the time to port over to every single G3 family device......

[PixelExperience] Add own app as system app in custom build

hi, i want to build my custom rom from the source of PixelExperience with my app included as system app.
I already built the rom and flashed it with success on my asus x00dt.
what i tried to include my app as system app on the rom:
- added folder ./packages/apps/MyApp
- copied my.awesome.app.apk to folder
- created Android.mk in same folder with following content
Makefile:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := MyApp
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := my.awesome.app.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
when i build and flash the rom the app is "not installed". but i can see the folder and app under /system/app
also when i run "pm list packages" i dont see it in the list.
Could you guys help me adding the app to my custom rom?
EDIT:
I also created an entry in build\make\target\product\handheld_product.mk
PRODUCT_PACKAGES += \
MyApp
i could not find core.mk or common.mk which was mentioned in other posts (here: https://stackoverflow.com/questions/10579827/how-do-i-add-apks-in-an-aosp-build)
EDIT 2:
Seems like a signing issue. If i dont sign my app and use LOCAL_CERTIFICATE := platform it works.

Categories

Resources