[Q] Compiling pointers needed, pleeez. - Android Q&A, Help & Troubleshooting

I want to compile several pentesting tools such as nmap, aircrack-ng, openVAS, tcpdump, etc, etc on my phone using the gnu gcc compiler i got from g.play.
I also need to compile python, ruby, lua, and perl on my phone.
I want to do this so that it is all linked with the ROM. The chroot env of linux is too small, maybe if I had a tablet.
Eventually I want to release a pentesting ROM based off of Cyanogenmod but I need these tooles to be natively linked with the ROM and not need to chroot. I have found a work around for size limit of systemfs so it is not a worry as long as there is at least 4 gigs internal storage for other stuff.
Any help getting me going in the right direction would be awesome, thanks.

Related

Development Linux Distro

I was curious if any of the dev gurus had a nice Linux setup that they could make a Android Development distro from?
I keep running into repo issues when trying to set up my system. This led me to go.....'why isn't there a precompiled dev distro??'
If there is....please point me towards it, as I have been searching, but if it exist it's in a deep dark part of the internet I'm yet to discover.
Thanks
(ps. I wanted to make a clockwork recovery for an unsupported device.)
I keep running into repo issues when trying to set up my system.
Click to expand...
Click to collapse
I think the best Idea is to set up an Ubuntu based system at the moment.
With fedora based distros (fuduntu) I allways get some issues as well.
Some month ago I ran into a site that provided some Ubuntu based virtual box images with the Android SDK installed, but as it changes alot lately I don't think it's up to date, and I can't find it anymore anyway.
Maybe the guides aren't accurate anymore??
The distro I tried was the newest Ubuntu, but with everything I attempted to install I would get permission issues and sometimes the links to repo's weren't live any longer..
Perhaps what I should ask is 'Where can I find an accurate, reliable guide to setting up my linux distro for dev use?'
eh, I'm not completely dumb to Linux, but I require a bit of assistance :/
Ya, Ubuntu is kinda mandatory considering the way the kernel in AoS forked from it. Ubuntu is a common one, should be able to do what you need off the USB bootable even.
Really depends on your hardware setup. I've been playing around with a portable Puppy lately - something I can use at work and on my ancient semi-sandbox laptop. If you like I can put a vanilla package together for you.
There is a distro from 2010 made by a beginning builder specifically for linux/android developers. I haven't used it but it may be worth a go: http://www.simply-android.com/discu...oid-developers-have-their-own-linux-distro/p1

[DEV TUT] Building Kernels and Android Sources

Dear Community,
Please read the following before starting on reading on.After lots of requests I decided its time to provide every oncoming developer with a short guide on how to start developing for our beloved Mimmi (most stuff applies also for Robyn or other Android devices).
I'd also like to get a few words passed on what actually in most cases developing is, so let's start with the basics:
There is different ways of developing there is people like Cyanogen Mod which provide you with a bunch of changes to the original Android source code which enables new features, adds hardware support or make things easier for specific device developers. However these people at Cyanogen are often not fully recognized so please make sure to thank these people as well. Besides that there are ports of similiar devices which will not be explained in this tutorial but also these developers usually put a lot of effort into their roms however since the source is already compiled changes are usually of a cosmetic nature. In this tutorial however you will find the basics on how to compile kernel or android from source in order to build your own changes into your own rom, which btw would have never been possible without the developers porting xrecovery or cwm to our devices so please give these people a big thumbs up as well after reading on.
What do I need/Environment set up
Most people have issues on setting up a the heart of your Developer Carreer, the Environment. What I strongly advise is to have at least a bit knowledge of the main usuage of Linux Distributions and also programming languages. Without these you will most likely fail at one stage or another to make a successful build.
So lets evaluate what you need :
Linux Distro (i.e. any Ubuntu should do well)
a VM or native Linux
quite a bit of Linux skills and programing skills
Time and a high tolerance of frustration
Sufficent RAM (at least 4 GB, more is advised otherwise use native Linux)
If you know how to install a native Linux Distribution you can probably skip this part, I will explain how to use a VM to fill the basic needs and keep your development area seperated from you most likely otherwise needed productive platform.
The following Steps are just keywords, if you want to develop you will need to inform yourself how to achieve all this yourself, there's lots of tutorials out there.
Step 1: Download a VM and a Linux Distro
Step 2: Install VM Software (i.e. VirtualBox or VMWare Server)
Step 3: Install the Linux Distro in VM (you'll need at least 6 GB Swap and 50 GB or More HD space to have enough room for experiments/seperate syncs/etc...)
Step 4: Figure out if you installed 32 Bit or 64 Bit (you'll need this later)
Step 5: Boot your new VM based Linux Distro
Step 6: Set up a Share Mount between your host and your VM
Step 7: download the Android Source/Cyanogen Source of your desire (i.e. : repo http://**** -b gingerbread) into a folder for you desire (the folder should represent your ROM's/Kernel name)
Building a Kernel
Building a Kernel is one of the easier parts considering the full source code is available for download. Sony Erricson Open Source Dev Website is providing fully funtional Kernel sources usually in the tar.gz format. Download the source code and extract it, or if you use a git based repository clone or checkout the project into a folder of your desire.
The next step, is not mandatory but advised to sync the entire Android repo/CyanogenRepo as the repo also provides the Cross Compiler toolchain which is needed to compile for your device.
Once everything is finished downloading you should check the following path in the Android repo : platform/linux-x86(orx64)/prebuilt/toolchain/arm-eabi-4.4.3/bin/ this is the cross compiler we will use to build the kernel itself, its vital to have the compiler present, the version number maybe different though.
Lets start with the building process itself:
Code:
cd kernelfolder
cp arch/arm/configs/semc_mimmi_defconfig .config (the command maybe change to copy another default config file, it creates a file in the root of the kernel folder called ".config"
ARCH=arm make menuconfig (this will bring up the kernel configuration menu for arm devices)
In the Menu Config you can change/add features to the Kernel once you are done safe the kernel config. Now your Kernel is ready to be compiled:
Code:
ARCH=arm CROSS_COMPILE=/pathtoandroid_source/platform/linux-x86(x64)/prebuilt/toolchain/arm-eabi-4.4.3/bin/arm-eabi- make -j4
This will start a compile with 4 Jobs using the Architecture ARM and the Cross Compiler arm-eabi from the Android Source Repo. Once finished you'll find your Image in your kernel folder under arch/arm/boot/Image. Now you'll need to build your own ramdisk this is covered here at xda as well azuzu has also build a tool available to download.
Follow the instructions to create the kernel.sin which now can be flashed with Flashtool. Changes to Kernel source will now be available to your compiled Kernel. How to change the Kernel source is beyond this tutorial but programmers in C will have fun there.
Building Android from Source
Now lets get started with the more advanced part and the most frustrating part in the beginning. The easiest way to build for the mimmi would be to sync the Cyanogen Gingerbread source code. Which can be checked out using the repo binary (see tutorials on googles website also which packages for which architecture (x86 or x64) are addionally needed also the correct java version is important)
Now lets cut to the chase.
Code:
repo sync -u http://github.com/CyanogenMod/... -b gingerbread (or froyo or another branch you would like to check out)
once your repo is synced (you could also add "-j8" to enhance the speed of the repo command, it will take quite a while) you are almost ready to start. If you synced an AOSP source you will have the get your device and hardware libraries ready first. This means you will have to port i.e. the device project and hardware project (mimmi and msm7227-common folders from CM and also hardware folder from CM) to the AOSP source. It makes sense to port these to your AOSP source since they are the most complete so far. For Camera libraries you can sync from doixanhs repo the libcamera-5mp.
Now lets get a short overview over the Android source, it contains of various folders:
frameworks
device
vendor
hardware
platform
external
These are the most interesting, frameworks folder holds a bunch of android libraries and files which provide the functionality however often you will need to change a few things here and there since the mimmi is unique in its hardware. Everything you change will need to be approved with the following command:
Code:
make update-api
This will add all the functions, variables or anything else to the current-api.xml and ensure its available at build time.
The device folder holds device specific files, build-configs and so on. Lets look at some of the important files:
Code:
device/semc/mimmi/overlay/frameworks/base/res/res/values/config.xml/power.xml
The two xmls hold configurations of the build process which are device specific either LightSensorWarmupTime and so on the full list is in the root folder of frameworks/base/res/res/values/config.xml <-- any part you feel you need to change copy the lines from there and change in you device specific config.xml.
Now to another file:
Code:
device/semc/msm7227-common/BoardConfig.mk
This files olds the device sepecific configurations for the ARM, WLAN, etc.
Look at all the files in mimmi and msm7227-common and figure out what they do, google of course will guide you on that.
Also take a look in the:
Code:
vendor/cyanogen/products/
folder and find the mimmi config and get familiar with this as well. Nobody will be able to help unless you face specific issues. Developing is learning by doing and a lot of self teaching and the will to understand all of this yourself. We can't teach but you can learn. Specific questions however are usually proudly answered by most devs if they have already figured it out.
Lets start building now, first you'll need to get your lunch command to know which devices have makefiles (I always do it to be sure)
Code:
source build/envsetup.sh
This will now add all the known devices to your lunchcombo (the devices are usually definied in the vendorsetup.sh pointing to the makefiles)
Code:
lunch
Will get you the list of available devices and will wait for user input to select the device you want to build, choose the mimmi.
Code:
make -j4
This will start the building process with 4 jobs.
Now its time to get a coffee. Usually you will have a bunch of different issues on this part but the CM source is pretty good and you might be lucky there.
Now lets look at typicial errors:
Code:
symbol not found : means a variable in used in the code has not been defined, before its use this one is a tricky one
try to locate the source file and find the line the compiler is complaining about. Now check in the framework usually in
res/res/values or layout look for the type of the erros (String or array) and look in the corresponding xml if the variable
is present. Now look in vendor/cyanogen/overlay if your variable is also declared there and so on.
Code:
function not found/function of incompatible types : also a tricky one, you might sync a repo and made local changes to
a file and suddenly your functions another file calls are not present or have changed, find the differences between them and
think about how it has changed, maybe add the function again or maybe another function does the job now. you will need
to locate the changes compare them and you should be fine again
Code:
No Rule to make target: this one is usually due to a missing/incomplete Makefile you might need to add manually or
if you don't need it anyway the easiest would be to delete the not building folder
Once your source has finished compiling you will find you system image in:
Code:
out/products/mimmi/system/
As of now unfortunately its still missing a few files here and there. Compare ROMs and Compare what might needs to be added. However I advise not switch libraries around its best to use your own libraries. However sometimes you will face issues when doing this so start with the files created there and just add the recovery and ramdisk to your rom. Now observe via adb if everything is running. This will take time and add one missing lib after another one and reboot, after each (like grallocs or librils or fm libs and so). This is basically a debugging part of the job.
You will now add one by one more functionality, but keep in mind to use logcat to see what goes wrong, maybe some stuff can be changed in the source rather then randomly adding stuff.
also this one just in case.
Hey there c: As always, you come surprising everyone with your stuff haha Good job on this one, I think it is always good to have some tutorials from the people who build specifically for our Mimmi's
Before reading this, I wanted to get started on developing and I went to Android's official developers site, I did some steps, now I have the complete source of Android here (I use Ubuntu 10.04, the LTS version... Dunno if telling you that it is LTS ver. really matters, but just in case) andthe whole environment ready to build. Now, reading at this, I realize I don't have 4Gb of RAM on this "old" (2007..) notebook. Anyways, the thing is: I followed the steps listed here, but when I wrote this command-
Code:
$ make -j4
-the terminal started to execute files, or something... I'll add a screenshot at the end about this. It has been 3 days since that, and the terminal is still doing the same. I know developing requires a lot of patience, but... 3 days? Is this normal?? I have looked through the Internet for problems with this command, but no one seems to have talked about it.
Thanks for your time, work and effort for the community, we really appreciate it c: Bye!
Link to the Screenshot:
http://i259.photobucket.com/albums/hh313/link_4ever/Screenshot.png
The 'make -j4' uses 4 threads to compile everything, if your notebook does not have at least an hyperthreading-technology enabled CPU, well, that's to expect when building an entire OS, plus you don't have sufficient RAM, I do have 2GB and a DualCore CPU and it takes at least 1 hour to compile an average desktop kernel with that same command. I have not tried to compile android, but I think that it will take at least 4 hours to compile everything. Just my thought.
RozenTensai said:
The 'make -j4' uses 4 threads to compile everything, if your notebook does not have at least an hyperthreading-technology enabled CPU, well, that's to expect when building an entire OS, plus you don't have sufficient RAM, I do have 2GB and a DualCore CPU and it takes at least 1 hour to compile an average desktop kernel with that same command. I have not tried to compile android, but I think that it will take at least 4 hours to compile everything. Just my thought.
Click to expand...
Click to collapse
Thank you for your answer! Just ten minutes ago, the 'make' command finished ! And about my notebook, it is just like yours: 2Gb RAM and Dual-Core CPU, I'm not sure but I think it runs at 2,8 GHz. And also, like I said earlier, I know developing takes time. I know how slow processes can be, in fact, there were commands previously that took 1 hour or more to finish their tasks. 1 hour, 4 hours, it's ok but... 3 days? Isn't it a bit too much xd?? Now I'm afraid to turn off the computer because I don't want to compile that thing again hahaha
the "-j" option depends on the number of (virtual) cores you have.
get the number:
Code:
grep processor /proc/cpuinfo | wc -l
if you have native linux and like to work on the machine I recommend do lower the number at least -1 otherwise get a coffee and keep hands off the build process
b
make -j4, lol. Many people do not have. 4 cores on the processor
paul-xxx said:
make -j4, lol. Many people do not have. 4 cores on the processor
Click to expand...
Click to collapse
This parameter refers to threads instead of hardware cores
Sp4rrow said:
This parameter refers to threads instead of hardware cores
Click to expand...
Click to collapse
ok. probably a mistake. but still. I always use 2. it brought to me the best results
I use j6
And also j refers to jobs everybody may change to what they want. For kernel i build with j12.
If you know better like it seems you always do write it down.
Sent from my U20i using xda premium
I can't find any 2.1.1.A.0.6 Sources. Link to the sources you use slade?
http://developer.sonyericsson.com/cws/devworld/search-downloads/opensource?cc=gb&lc=en
should be:
x10_x10mini_X10minipro_x8_eclair_2.1.A.0.435.tar.gz
Stock Kernel with only CWM5 installed...
Slade i want some help from you. how can i embed CWM5 in the stock kernel without any other changes to it??
i want a stock kernel with nothing changed in it only CWM5 installed in it. how this can be done???
i forgot to say the most important thing!: Thank you very much for your work and effort Slade
I just came to the configuration menu of the kernel. i see there are options predefined for the mimmi, but how can i optimize it more, there are soooo many options, and to tell the truth i don't have a clue what they do

[Help] Setting up building environment in a RedHat based Linux

As the Title says, all the guides and posts here are about debian distros, mainly ubuntu, Being a fan of Fedora, I'd like to start building on What i have. If someone can point me to a guide or give me a headstart I'll be most grateful. Just help me get started , I'll google my way!
Thanks In Advance!
http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development#Compiling_Android_from_Source it's all described in fedora wiki, adjust for own build choice, at all its not complicated when you only know which dependencies to install, I've set it correctly on gentoo for once, fedora, arch and debian and ubuntu, was long time ago when froyo and gingerbread were current android versions, I believe not much changed since then
hard way to do it you can use yum provides or rpmfind such things to locate what you need compared to ubuntu listed packages

TP-LINK WN722N (ath9k driver) install on Ubuntu touch 15.04 (Nexus 10- Manta)

I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
roninisc said:
I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
Click to expand...
Click to collapse
anyone anyone, Beuller...
Hey, saw this was unanswered and figured I could help. First off, you will not be able to compile or install headers in the Ubuntu Touch system, as /lib/modules/<kernel version> is a bind-mount into the read-only LXC system image, one way to work around this issue on device is to mount the LXC container's system image read-write somewhere, move out the lib/modules directory to someplace else, umount, reboot and then link your moved lib/modules back into /lib/modules. You will need to do this compilation outside of your Nexus 10 in a cross-compilation environment or in an armhf chroot (imho, a chroot running the ARM build of Ubuntu works very well for this).
Once you have that, you can install the kernel package for your device (which I believe are labeled linux-headers-manta and linux-image-manta respectively) and build the driver you seek. However the kernel already comes with backports 4.4.2 in it's tree, so you may be able to apt-get source linux-image-manta and build the driver and/or the kernel itself if you wish. (I believe building the kernel builds the firmware needed for the drivers as well, but I have no way of knowing as I haven't actually rebuilt any drivers with firmware yet in my foray into linux-image-flo's source.)
One piece of advice: Make sure to join together the config.*.ubuntu files under the debian.flo and debian.master folders to get the working .config for your device. The defconfig from arch/arm/configs doesn't have all the needed options for uTouch and won't boot it.
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
roninisc said:
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
Click to expand...
Click to collapse
Sadly at this time, it definitely seems to be. The normal linux way of building drivers doesn't work on here because the modules directory (/lib/modules/3.4.0-5-flo) is read-only, also due to this kernel headers cannot be installed, this can be worked around, but it is definitely not something that the casual user can do easily. I hope this will change so I could start compiling modules and NOT need to rebuild the entire kernel for it.
Glad I could be of help and I love answering questions, I am currently using Ubuntu Touch as my main OS on my Nexus 7 as I'm trying to make it into my own portable workstation. So I'm constantly digging into the system and learning what I can, and I love to share.

Running Flash Tool on Linux.

The installation instructions for the Linux-based are minimal, and give very little guidance on precisely what is required. There is no specification of which distros or versions it is supposed to be compatible with, but it definitely does not run on Ubuntu 14.04 (which is still current and supported until this time next year).
The application is clearly not statically linked, and running it on Ubuntu 14.04 fails to execute after failing to load libpng16.so.16, which was not introduced until much later in the Ubuntu release cycle.
Q1: Is the flash tool known to run on any particular release of Ubuntu?
Q2: Which distro and release was it developed on/released for originally?
Q3: Would it not make more sense for it to be statically linked (as Nokia did for the maemo-flasher which still works with the N900 'phone to this day, despite the end of official support about 7 years ago)?
Q4: Who do I need to take these other queries up with at Planet? There seems woefully little proper contact information.
cain.mosni said:
The installation instructions for the Linux-based are minimal, and give very little guidance on precisely what is required. There is no specification of which distros or versions it is supposed to be compatible with, but it definitely does not run on Ubuntu 14.04 (which is still current and supported until this time next year).
The application is clearly not statically linked, and running it on Ubuntu 14.04 fails to execute after failing to load libpng16.so.16, which was not introduced until much later in the Ubuntu release cycle.
Q1: Is the flash tool known to run on any particular release of Ubuntu?
Q2: Which distro and release was it developed on/released for originally?
Q3: Would it not make more sense for it to be statically linked (as Nokia did for the maemo-flasher which still works with the N900 'phone to this day, despite the end of official support about 7 years ago)?
Q4: Who do I need to take these other queries up with at Planet? There seems woefully little proper contact information.
Click to expand...
Click to collapse
Ubuntu 14.04 sounds unreasonably old to me to be complaining about this, but you make a fair point that the issue could be avoided altogether. I'm also used to rolling release and having the latest kernel on most devices, though. I still just have Android on my Gemini due to difficulties finding info and files on this whole process. I run GNU/Linux myself, so hopefully I'll manage to figure out the flasher without needing to borrow a Windows machine.
From what I've gathered, there's a public file for setting up Android/Debian dual-boot, but I don't see anything about having Debian as the only OS, and it seems files for builds of the other distros with support (Sailfish, Ubuntu, postmarketOS) are private. Support for them is lacking right now, but I still found it frustrating to think I had a lot of choices and then see that I was a bit misled. It'd be nice if I could find an IRC channel dedicated to the Gemini so I could discuss this with knowledgeable people in a more fast-paced manner.
soundtoxin said:
Ubuntu 14.04 sounds unreasonably old to me to be complaining about this, but you make a fair point that the issue could be avoided altogether.
Click to expand...
Click to collapse
The whole point about the Ubuntu LTS releases is that they ARE LTS (long-term support - stable but supported for up to 5 years), so it's perfectly reasonable to still be running it.
I've since tried on Ubuntu 16.04, and same problem.
I'm also used to rolling release and having the latest kernel on most devices, though. I still just have Android on my Gemini due to difficulties finding info and files on this whole process. I run GNU/Linux myself, so hopefully I'll manage to figure out the flasher without needing to borrow a Windows machine.
From what I've gathered, there's a public file for setting up Android/Debian dual-boot, but I don't see anything about having Debian as the only OS, and it seems files for builds of the other distros with support (Sailfish, Ubuntu, postmarketOS) are private. Support for them is lacking right now, but I still found it frustrating to think I had a lot of choices and then see that I was a bit misled.
Click to expand...
Click to collapse
That is irritating. As is the woeful lack of meaningful support.
Progress
Progressing...
Having cloned the Github source, it is now compiled and fully operational on both 16.04 LTS (xenial) and 14.04 LTS (trusty) .
git clone the source from Github - dguidipc/SP-Flash-Tool-src (board will not allow me, as a new user, to post the full link)
Install dependencies
qt4-dev-tools
libqtwebkit4
libqtwebkit-dev
alter the make configuration for the location of qmake
Code:
cd ${gitrepo}/SP-Flash-Tool-src/Build/
#backup the original build config just in case
f=build-linux.mk; cp -vp ${f} `date --reference=${f} "+${f}-%Y%m%d%H%M%S"`
In
Code:
build-linux.mk
change the path config for
Code:
qmake
to read:
Code:
QMAKE := /usr/bin/qmake
compile
Code:
cd ${gitrepo}/SP-Flash-Tool-src/
make
Binary will be in
Code:
../_Output
along with the object modules and a supporting shell script.
cain.mosni said:
Progressing...
[*]alter the make configuration for the location of qmake
Click to expand...
Click to collapse
No longer required. The linux I tweaked the linux build file to detect when it's on Ubuntu, and that tweak is now incorporated in the official source.

Categories

Resources