Question for experienced devs - Android Q&A, Help & Troubleshooting

OK, let me first preface by saying that I have like zero development experience but I'm pretty smart and I'm trying to learn. You have to start somewhere, right?
So I decided to take a crack at it when I came across this thread:
http://forum.xda-developers.com/showthread.php?p=24278953
It's a Linux tutorial but having only a Mac, I decided to see if I could make it work. It didn't but the point is that, in the process, I learned a LOT.
So following a suggestion, I scrapped the whole Mac idea and started all over on an Ubuntu 11.4 VM. Which works great but it's a little less forgiving than the Mac.
Anyway, I have my build environment completely set up with all the necessary packages installed...no problem. I have the device specific proprietary files in place and pre-builts installed as well.
Now its time to build. I do so using this command:
Code:
source build/envsetup.sh
brunch otter -j$(gprep -c processor /proc/cpuinfo)
...runs for a couple minutes before stopping at this error:
Code:
In file included from frameworks/base/media/libmedia/IMediaPlayerService. cpp:25: frameworks/base/include/media/IOMX.h:29:17: error: jni.h: No such file or directory make: *** [out/target/product/otter/obj/SHARED_LIBRARIES/libmedia_ intermediates/IMediaPlayerService.o] Error 1
So basically, the file "IOMX.h" makes a declaration to include "jni.h" which isn't anywhere in my /android tree.
Upon further research I learn that "jni.h" has something to do with Java. I have the required java-sun-jdk 6.1.x installed so I figured it must be a problem with my $PATH. I found the "jni.h" in question in the Java folder and did an export $PATH to that folder. Then I entered echo $PATH to make sure:
Code:
echo $PATH /home/linux/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun-1.6.0.26
Sure enough, the folder where "jni.h" is located is included in my path, but I'm still getting the same errors.
What am I doing wrong?
Sent from my Kindle Fire using xda premium

Related

How to compile native android code

Hi everyone,
There has been a few questions on how to compile native android code (for exploits and such). Easy enough.
Go to http://source.android.com/download. You will need to be running Linux. Ubuntu is easiest. Follow the directions to get the source code for android downloaded and compiled.
Run this command
export PATH=/path/to/android/source/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin
Run arm-aebi-gcc or arm-aebi-g++ (depending on the language, c or c++) followed by
-o (OUTPUT) (INPUT)
So, for example, test.c would be:
arm-aebi-gcc -o test test.c
And test.cpp would be
arm-aebi-g++ -o test test.cpp
Just a note, this will make STATICALLY linked files. Meaning any headers will be included INSIDE the executable. Simply put, this means the files will be HUGE for large projects. There is a program, named agcc, which fixes this and can be found here:
http://plausible.org/andy/agcc
Put it in /bin by:
Code:
cd /bin
sudo wget http://plausible.org/andy/agcc
chmod 755 agcc
chmod +x agcc
Run agcc -o (OUTFILE) (INPUT) to compile. Be warned though, if a header is in the file that isn't in bionic (android's smaller libc) it won't compile.
Hope this helps!
+1
Awesome
............(stuipid mistake >>was<< here)..............
Thanks man...
now i can break out my bootable 50 meg linux disc and play around.
love that thing used to use it to crack windows passwords
should see the guys face when you crack his 20 char password in 5 mins without ever needing to use it.
well not really cracking but changing it. used to work at the pentagon. this one guys who used to be support for one dept. thought it would be funny to change all the admin passwords in his office. so when one of the pc's was beyond his repair. i showed up and he was like give me 10 min and i'll log you in. well 5 mins later i was fixing the machine while he was screwing off. boy was he pissed.
how big's gcc? cause i'll need to compile it for my linux.
rigamrts said:
how big's gcc? cause i'll need to compile it for my linux.
Click to expand...
Click to collapse
Massive. You're definitely better off using the prebuilt toolchain found in the Android (N|S)DK.
I would like to add something to this.
libc is essentially derived from the kernel. So, if you take agcc, and make changes to use the libc directory (I don't remember it atm) and NOT bionic, the app won't compile. Simple enough, libc is based of the kernel, so bionic is based of the android kernel. Things missing in bionic that are in libc WON"T work simply because certain kernel calls in glibc DON'T exist on the Android platform.
My exploit relied on the fact that I would be able to compile exploits using glibc, instead of using bionic. So it failed. Thats what I've figured out so far anyways.
zifnab06 said:
My exploit relied on the fact that I would be able to compile exploits using glibc, instead of using bionic. So it failed. Thats what I've figured out so far anyways.
Click to expand...
Click to collapse
Would you be willing to share the code for that exploit, even if it doesn't work? (sorry if you already have, I didn't see it anywhere)
I may be able to help.
Look up anything in our old thread, especially when we were talking about "sys/personality.h". The one I was working with exploited a hole that was patched (min_map_addr).
This blog post
honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html
(Sorry, my account isn't allowed to post links yet.)
gives a minimalist approach to using dynamically linked executables. (In particular, see steps #2 and #3 for the sources for hello.c and start.c) I gave it a try, and it seemed to work without agcc, e.g. with a makefile like the following (and with the arm-eabi- executables in the PATH of the user invoking the make) :
Code:
AR = arm-eabi-ar
AS = arm-eabi-as
CC = arm-eabi-gcc
CXX = arm-eabi-c++
LD = arm-eabi-ld
NDK_KIT = /opt/android/android-ndk-1.5_r1
PLATF_KIT = build/platforms/android-1.5
ARM_INC = $(NDK_KIT)/$(PLATF_KIT)/arch-arm/usr/include
ARM_LIB = $(NDK_KIT)/$(PLATF_KIT)/arch-arm/usr/lib
PLATF_INC = $(NDK_KIT)/$(PLATF_KIT)/common/include
OBJS = hello.o start.o
EXES = hello
hello: hello.o start.o
$(LD) \
--entry=_start \
--dynamic-linker /system/bin/linker -nostdlib \
-rpath /system/lib -rpath $(ARM_LIB) \
-L $(ARM_LIB) -lc -o hello hello.o start.o
hello.o: hello.c
$(CC) -I $(ARM_INC) -I $(PLATF_INC) -c hello.c
start.o: start.c
$(CC) -I $(ARM_INC) -I $(PLATF_INC) -c start.c
clean:
rm -f $(OBJS) $(EXES)
HTH
bftb0
Just curious, but I'm trying to get some native code that I've compiled to run on the Incredible. I've followed the instructions to download the the arm gcc, compiled my C code, and adb push'ed the executable over to /sdcard but I get a "permission denied" error when I try running it from my phone and adb shell. Does the phone have to be rooted in order to run native C compiled executables?
Thanks!
zebdor44 said:
Just curious, but I'm trying to get some native code that I've compiled to run on the Incredible. I've followed the instructions to download the the arm gcc, compiled my C code, and adb push'ed the executable over to /sdcard but I get a "permission denied" error when I try running it from my phone and adb shell. Does the phone have to be rooted in order to run native C compiled executables?
Thanks!
Click to expand...
Click to collapse
On an unrooted phone, push your code to /system/local or another place that you can write to and chmod it to be executable. By default the sdcard is mounted no execute. You will either need to add the directory you put it in to the path or execute it implicitly by specifying it is in the local directory.
for example ./myprogram
I hope that helps. I re-read it and it doesn't make much sense unless you have a firm grasp of the things that happen between the lines.
best of luck.
Thanks. Good stuff.
rigamrts said:
now i can break out my bootable 50 meg linux disc and play around.
love that thing used to use it to crack windows passwords
should see the guys face when you crack his 20 char password in 5 mins without ever needing to use it.
well not really cracking but changing it. used to work at the pentagon. this one guys who used to be support for one dept. thought it would be funny to change all the admin passwords in his office. so when one of the pc's was beyond his repair. i showed up and he was like give me 10 min and i'll log you in. well 5 mins later i was fixing the machine while he was screwing off. boy was he pissed.
how big's gcc? cause i'll need to compile it for my linux.
Click to expand...
Click to collapse
This is one of the most unbelievable stories ive read in a while. The fact that the pentagon had an administration department without policies or security in place to prevent such a widely known method, is comical.
btw, such a linux cd is no secret. Its called pnordahl.
Useful information
I'm surprised to see that many of you don't use the Forum's search function and simply start new topics over and over again. What funny is that the info you put here is old and useless.
I've posted an article on how to compile native C code for Android months ago, with several examples and tools:
http://forum.xda-developers.com/showthread.php?t=514803
or direct link herE:
http://www.pocketmagic.net/?p=682
However this technique is now too old.
The best approach is to simply use the NDK and build a custom Makefile for Cygwin's make under windows or easier under linux, see:
http://betelco.blogspot.com/2010/01/buildingdebugging-android-native-c.html
radhoo said:
I'm surprised to see that many of you don't use the Forum's search function and simply start new topics over and over again. What funny is that the info you put here is old and useless.
I've posted an article on how to compile native C code for Android months ago, with several examples and tools:
http://forum.xda-developers.com/showthread.php?t=514803
or direct link herE:
http://www.pocketmagic.net/?p=682
However this technique is now too old.
The best approach is to simply use the NDK and build a custom Makefile for Cygwin's make under windows or easier under linux, see:
http://betelco.blogspot.com/2010/01/buildingdebugging-android-native-c.html
Click to expand...
Click to collapse
Thank you for your very informative links. I'll take a look tonight, since I find this very interesting and would love to compile a few things for Android.
"What funny is that the info you put here is old and useless." - This was posted almost 10 months ago. That's a long time in smart phone years. By the same token, if it were January 2010 and I was looking for this info, I would assume that a post from May 2009 would be dated too.
"I'm surprised to see that many of you don't use the Forum's search function and simply start new topics over and over again." - Maybe zifnab did search and find your post and deemed your technique too old for Jan. 2010, so he created a new post with newer information. Or maybe he wanted to show a different way to do the same thing. Or maybe he figured that many users only have/take the time to look in their phone-specific forum. No one knows other than zifnab.
Personally, I welcome multiple posts by different people on the same topic. Everyone is different and often have different takes on the same thing. I find it easier to understand many techniques/topics if I get multiple perspectives.
Again, thank you for your contribution.
I need to compile the library with some modifications. how to do it as simple as possible? what will it take?
vlad072 said:
I need to compile the <library> with some modifications. how to do it as simple as possible? what will it take?
Click to expand...
Click to collapse
Did you get any thing in this regard ? Even i want to compile a part for library for the Android 5.1.1 device but not able to find any resource. Help will be appreciated.

[Q] having alot of trouble getting sdk up and going on linux

I have spent the last to days trying to solve my error setting up sdk on linux mint12. I keep getting this error.
[Qoute]
scott-Presario-CQ62-Notebook-PC scott # apt-get -f installReading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libc-bin libc6
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-bin
The following packages will be upgraded:
libc6
1 upgraded, 1 newly installed, 0 to remove and 376 not upgraded.
3 not fully installed or removed.
Need to get 0 B/5,143 kB of archives.
After this operation, 3,432 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: error: 1 expected program not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
[Qoute]
I have tried every fix I have found online and all return this exact error. I tried changing the permisons on etc/sudoers to make sure they were right. I also added a these paths.
export PATH={PATH}:/usr/local/sbin:/usr/sbin:/sbin
export PATH={PATH}:/usr/local/bin:/usr/bin:/bin
I have even placed a permission file inside sudoers.d to try to add the path but I just ended up ruining my root access and have to do a complicated fix through my bootloader.but just cant seem to get it to work I am newer to linux and know basic commands but have no idea why I keep getting the same error or how to fix it any help would be deeply appreciated.
Are you running 64 bit? You need to dl the 32 bit lib's
Now it may be cheating, but try Tommytommatoe's android utility it sets up SDK for you and adds everything to your path... It's my go to for stubborn SDK
Sent from my PC36100 using xda premium
Yea it 64bit and I added the 32 bit libs for java but it gives the error when I try that to. I guess I will try that tanks man
Sent from my ADR6425LVW using XDA
Are you using an installer script or something like that?
RoberGalarga said:
Are you using an installer script or something like that?
Click to expand...
Click to collapse
No just piece by piece did java then unpacked SDK in my root dir and update it installed the API and all that then when I try to use adb it says their is no command and all the fixes make the error I described at first.
Sent from my ADR6425LVW using XDA
Ok... you don't need any fixes... you can simply move to platform-tools directory (using command cd /path/to/platform-tools) to can run ./adb command (note: ./adb, not adb).
RoberGalarga said:
Ok... you don't need any fixes... you can simply move to platform-tools directory (using command cd /path/to/platform-tools) to can run ./adb command (note: ./adb, not adb).
Click to expand...
Click to collapse
Really now I feel dumb lol. Guess I'm to used to windows been developing on it for a while. Thanks a lot.
Sent from my ADR6425LVW using XDA
Well thanks for all your help guys I guess I had a bad download of linux so I did a new clean install and setup SDK and apktool and dsixdas kitchen. Now everything works fine. No sudo errors or nothing the good news is with all the trying to fix what was wrong I got used to root being / instead of c:/ so that's a bonus
Sent from my ADR6425LVW using XDA

[Guide] In-Depth Compiling using Ubuntu 12.10

DISCLAIMER: I am in no way responsible for you breaking your phone or your computer. You the reader/user/dev/compiler understand that you enter into this agreement freely with no expectations that everything will work 100% of the time.
This is in no way a means of stealing people away from Shrikes guide. If you do not have ubuntu installed as a complete os/ or do not intend to maked modifications to system files etc. Then please use the guide for compiling roms using a virtual box here (CM9 The complete noobs guide to building CM9 in a virtual machine)
Still with me. COOL. So you now have either a dual boot or a fully thrashed Linux machine. I will be using my Vaio VPCF114 box with Ubuntu 12.10 to make this guide. This is also compatible with 12.04 if you have not yet upgraded. I am not sure if the same goes for Redhat/Fedora or Backtrack 5. My work here is a compilation of years of doing research and compiling my own roms.
This guide is to help people that have little knowledge of linux get a base idea of where to start to make their own roms and kernels. Part 1 will be building your box and compiling a rom. Part 2 will be how to make and grab your Kernel.
First lets get Dropbox from here DROPBOX This is good for backing up your libs and sharing files with other Devs.
What you need:
1) A Windows computer, preferably with a CPU that supports 64-bit. Your pc/laptop does no need to have 64-bit windows on it, your CPU just needs to support the hardware. I think at this day and age, almost all devs have a 64-bit box. You will need this so you can make a dual boot box.
2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
3) At least 60GB of free hard drive space during the install, but i'm sure you already know that and have gigs upon gigs of free space. If you do not know how much space you have, go to settings>details and it will tell you. Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.
4) Lastly a good book, tab, second pc, whatever because this is not a quick process. And compiling roms literally takes hours.
5) Most importantly UBUNTU 12.10. If on the off hand you do not have it, you can pick it up at Ubuntu Central
OK YOU READY. LET'S GET CRACKING. First you need to set up Java on your box. Then grab a couple of programs you will need for editing files Go to your UBUNTU SOFTWARE CENTER. In the search bar in the top right type in Java. We will be installing Java 6 Runtimes.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, go here JAVA
If the link does not work, you want accept the license agreement and download jdk-6u35-linux-x64.bin
Once it done:
chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
cd /usr/lib
sudo ./jdk-6u35-linux-x64.bin
Now lets finish the install and make it default: (Remember to enter in the lines one at a time)
sudo mv jdk1.6.0_35/ jvm/
sudo rm jdk-6u35-linux-x64.bin
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1
IF YOU HAVE MULTIPLE JAVA JDK'S INSTALLED FOR OTHER PROJECTS YOU WILL WANT TO MAKE 1.6 THE DEFAULT.
On each command you will have to select the version of java you want to use. This command is helpful if you also do other coding.
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Java 6: for Gingerbread and newer
Java 5: for Froyo and older
Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.
Now what we need:
We need to open up a terminal window and download packages.
Remember you will need to input your password after each line.
sudo add-apt-repository ppa:git-core/ppa
and
sudo apt-get update
(this will download all of the Quantal updates for universe and multiverse.
Next we want to install some Libs and Binaries. (You can copy and paste this into your terminal)
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool gcc-multilib g++-multilib pngcrush
(don't worry. some of the libs my fail. This happens as google changes their sources)
Now we need to tell the computer how to "REPO", this is where you will tell it to handle the Andorid sources via the Git command.
cd ~
mkdir -p bin
export PATH=${PATH}:~/bin
Once done you can use "echo $PATH" to see all of your path directories.
sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
(this will get you the repo script)
Now lets give it executable permissions by using chmod
chmod a+x ~/bin/repo
Now that we can repo
Lets setup the Android SDK. (Get a beer/coffee/soda, this will take a second)
Go to http://developer.android.com/sdk/index.html And install the ADT bundle for Linux.
Install the SDK and Eclipse IDE
Unpack the ZIP file (named adt-bundle-linux.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
Open the adt-bundle-linux/eclipse/ directory and launch eclipse.
That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go. To start developing, read Building Your First App on the developer site.
Caution: Do not move any of the files or directories from the adt-bundle-linux directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.
Now to just add the tools to our $Path.
gedit .bashrc
Scroll to very bottom, under last fi input
export PATH=${PATH}:~/adt-bundle-linux/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux/sdk/platform-tools
That was pretty painless.
Now lets start some cool stuff.
TestSigning
Click on your desktop menu bar and go into your home folder. Press Ctrl and h together on your keyboard to show hidden folders. Anything marked with a . in front of it is hidden, we are looking for a folder name .gnome2, go into it and look for nautilus-scripts. Once inside this folder, right click on a empty space and select create document and then empty file and name it sign. Open up that empty document and copy and paste this script from dumbfaq on xda
Code:
#!/bin/bash
# Update the Loc var to where YOU stored the testsign.jar file !
SUCCESS=
Loc=~/android/source/
for arg
do
TMP=$(ls $arg | sed 's/\(.*\)\..*/\1/')
EXT=${arg##*.}
java -classpath "$Loc"testsign.jar testsign "$arg" "$arg"-signed 2> /tmp/signTmp
SUCCESS=$?
if [ $SUCCESS -eq 1 ]
then
zenity --info --title "Sign APK" --text "signing FAILED! \n`cat /tmp/signTmp`"
exit 1
fi
mv $TMP.$EXT-signed $TMP-signed.$EXT
done
zenity --info --title "Sign APK" --text "signing completed!"
Save and exit out and right click on our new script and select properties. select the permissions tab and look for a check box that says allow executing as a program. click on it and now we have a pretty little script that we can just right click on a update.zip file and sign with our test keys for flashing. You will also need the testsign.jar from the bottom of this guide.
Now lets do a couple things so that we can get our Phones Vendor ID.
Type in your terminal
lsusb
While your phone isconnected to see our vendor id and you will something like this. Note that for the Rezound our vendor id is
Bus 002 Device 003: ID 0bb4:0ccd HTC (High Tech Computer Corp.)
In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.
Now that we have that, we can make our rules for for connecting to adb
sudo gedit /etc/udev/rules.d/51-android.rules
Paste
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
Save and exit
Reboot your computer so that all of the changes we have made can Take effect.
OK. All setup and ready to start making a Rom with your name on it.
IF you are already running AOSP on your phone, you can back up you system now Do this by:
cd ~/
mkdir stock
cd stock
adb pull /system/ ~/stock/
This will dump your entire system directory into the stock folder. This is good so you always have a working system. Now zip the folder and tuck it away for safe keeping.
Now the MEAT AND POTATOES. Grabbing the Source. "CYANOGENMOD"
cd ~/
mkdir -p android/source
touch ~/.netrc
cd ~/android/source
sudo apt-get install git
sudo sysctl -w net.ipv4.tcp_window_scaling=0 (remvoes the overstack flow problem that causes some repo jobs to hang)
repo init -u git://github.com/Chad0989/android.git -b ics
(Note: If you want to compile a jellybean rom, just replace the ics with jellybean!)
Once you do this, it's going to ask you for your email. This is how you will log back into the repo in the future. So answer the questions correctly.
Now we will sync the Repo and set it to run.
repo sync -j4
-j# (# means twice the amount of cores in your computer) means jobs. I have an i7 processor and a pretty decent internet connection, so i'm running max jobs at once for faster sync) Be patient. It's still going to take a while to clone the directory.
Once done with the Sync we want to setup our device.
This is where we get the pre-built part of our rom.
First we will
./vendor/cm/get-prebuilts
Probably all that will be left directly after the repo will be the Terminal service for android.
Now we are about ready to compile our Rom:
cd ~/android/source
repo sync (it should only take a moment this time)
. build/envsetup.sh
make clobber
Now you can compile your rom using the brunch command (This will take about 1 to 1 1/2 hours depending on your box)
brunch vigor
Now you can go to the output box and pick up your freshly made Rom.
Reserved for Kernel
Changed Repo from CyanogenMod to Chad0989 for easier Vigor integration.
21NOV12: Change Repo from Chad0989 to Dragonstalker github.
Change Repo from DragonStalker to Chad0989 github
Modified Testsign script to reflect changed ADT Tools location.
First, looks interesting i might look into this when i boot into Ubuntu next time.
jon7701 said:
First, looks interesting i might look into this when i boot into Ubuntu next time.
Click to expand...
Click to collapse
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
dragonstalker said:
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
Click to expand...
Click to collapse
Nice, if i can figure out a little more about how to dev and stuff maybe ill make my own rom one day.
Wow. So going to do this right now. Thanks for your effort on this.
Sent from my ADR6425LVW using xda premium
I can't wait for the final act! I am going to try this so I can get my hands on some jelly beans.
Vedor ID
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
Very nice guide. Extremely thorough which makes a great tutorial.
vonhinkle said:
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
Click to expand...
Click to collapse
It shows it as 0bb4. But as for the drivers Ubuntu uses. The Vendor id for High Tech Computers is 18d1. I was using a stock rom to pull the vendor Id from and for some reason, HTC has never changed it on there.
GrayTheWolf said:
Very nice guide. Extremely thorough which makes a great tutorial.
Click to expand...
Click to collapse
I teach networking to and development to the Army. I took the same ideology into this guide. Not just tell you how to do it, but explain why it works. I will, as thing change try to keep this updated, and keep up with Shrike as he learns new things. Thank Shrike for making me realize that we didn't have a guide for people that do run Ubuntu, and need to know how to set up.
Ok the updated Guide is online. Please tell me if anything is not correct. I'm only Human. Working with Snuzzo for and Updated Kernel Optimization section and hopefully Chad with the Repo..
More to Follow .............................
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
drkow19 said:
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
Click to expand...
Click to collapse
Thanks for the headsup. Android.source.com said to change it to that. SO I will change it back.
As for the progs that did not install. Android Source pulls progs, i've just been to lazy to go over the tag and remove the ones that have been obsoleted. I will take care of that this weekend.
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.
drkow19 said:
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.
Click to expand...
Click to collapse
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
issues
dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
hey guys ive been compiling on 12.04 still new to this but ive set up a new enviorment useing this guide with 12.10 im getting this error though
Import includes file: /home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/import_includes
make: *** No rule to make target `/home/ken/CM10/out/target/product/i577/obj/lib/libaudioalsa.so', needed by `/home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/LINKED/audio.primary.msm8660.so'. Stop.
make: *** Waiting for unfinished jobs....
target StaticLib: libc_nomalloc (/home/ken/CM10/out/target/product/i577/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a)
any help would be appreatiated thanks
dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
drkow19 said:
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
Click to expand...
Click to collapse
Never heard of that happening before. Let me know what you find out.

[Q] Compiling directly on Hardware

I've been working on porting Octave (command line only) to the m8 for a few days now. I have all of its' dependencies compiled now, except for SuiteSparse. It requires output from some components during compile (it first compiles one program, then runs it to generate some data, then uses the data to compile others.) Since I can't run these on a computer, I've created a toolchain to compile on the device itself. Surprisingly, I can get the compiler to run on the device. Unfortunately, I have to use ld to run anything. The command looks something like this:
~$ ld-linux.so /path/to/gcc/tuple-gcc
It outputs just fine. But I can't simply run
~$ tuple-gcc
I have added the path to PATH, but still can't figure it out.
To compile anything I need to specify CC, as well as the other tools, but I can't figure out how to do this if they have to be executed using ld.
Any ideas?
Also, for anyone trying to do this, many configure scripts require "ls -t".
The coreutils that are installed in the base system are extremely stripped down, and ls doesn't support many of its normal switches.
I have compiled coreutils and will be testing them shortly. Hopefully they don't also have to be executed using ld!
***UPDATE***
I now have a fully-working compiler, to compile on the hardware itself.
Will try to make the 10 post minimum soon, to post a tut.

[Ruby] Installing gems on android.

Hello friends!
I am using Termux in order to run ruby.
I installed ruby successfully with "apt" command, and it functions fine.
Current ruby version:
Code:
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [arm-linux-androideabi]
The problem is, I can't really install gems. I tried to install bettercap for the experiment, but it failed. This is what I get:
Code:
$ gem install bettercap
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: network_interface-0.0.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing bettercap:
ERROR: Failed to build gem native extension.
current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1/ext/network_interface_ext
/data/data/com.termux/files/usr/bin/ruby -r ./siteconf20161129-14856-1cclchu.rb extconf.rb
mkmf.rb can't find header files for ruby at /data/data/com.termux/files/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/gem_make.out
I found some instructions if I ran "gem help install" but I couldn't really understand what to do in order to fix that.
Can anyone help me to solve this? BTW I have a rooted device so I can use "su" and "sudo" and all that stuff...
Thanks for people who answer~
FurySh0ck said:
Code:
mkmf.rb can't find header files for ruby at /data/data/com.termux/files/usr/lib/ruby/include/ruby.h
Click to expand...
Click to collapse
You can install ruby.h with:
Code:
apt install ruby-dev
.
fornwall said:
You can install ruby.h with: .
Click to expand...
Click to collapse
I installed ruby-dev but it still won't work. It tells me it saved a log file which contains the explanation to the failure. I'll post the whole code, but please pay attention to the last part of it:
Code:
apt install bettercap
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package bettercap
$ gem install bettercap
Building native extensions. This could take a while...
ERROR: Error installing bettercap:
ERROR: Failed to build gem native extension.
current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1/ext/network_interface_ext
/data/data/com.termux/files/usr/bin/ruby -r ./siteconf20161206-31345-1xerjr9.rb extconf.rb
[*] Running checks for netifaces code...
[*] Warning : this platform as not been tested
checking for getifaddrs()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/data/data/com.termux/files/usr/bin/$(RUBY_BASE_NAME)
/data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
from extconf.rb:43:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/gem_make.out
Any solutions in mind?
BTW Thanks for your time, I appreciate anyone who tries to help.

Categories

Resources