[Q][Froyo][ndk]Subversion Building and Installation of Shared Libs - General Questions and Answers

Disclaimer: This post is unstructured and may be missing crucial info because of that. Please point out the glaring errors and omissions.
Background:
Phone: Huawei Ideos U8150 (Aircel India branding)
OS: Stock 2.2 original firmware (Build number: U8150V100R001C234B832SP02)
Root: Z4Root temporary root (superuser and su installed by z4root)
Relavant Apps: SL4A+Perl for android, Vim for android, Connectbot, dropbear ssh client
I use vim and perl as my primary work tools and have them working beautifully on my Ideos. However, I am unable to access my source code as it is in a subversion repository with only svn+ssh access. So first, I got ssh on my phone (dropbear client 0.49) and then, searched for a subversion build for Froyo.
Finding nothing by way of a command line client for subversion, I decided to build it on my own with the NDK. This is where I've run into trouble. It has a lot of issues building it and once I do, it fails to run on the phone. Has someone tried to do this and successfully managed it? If so, I'd really appreciate the binaries and info on how to install
If not, I'd like to pool our knowledge for getting a successful build/run.
My process:
1) minimal Ubuntu lucid lynx
2) install ant1.8, make, and sun jdk 1.6 using apt-get (no X)
3) get the SDK in $HOME and use the Commandline interface to get everything (no package selection possible, just oneshot all selection)
4) get the NDK into $HOME
5) get svn source tar
6) get svn dependencies tar (svn site itself)
7) untar them together
8) Follow this and this to get the configure script running.
My configure is (using froyo: android-8 platform)
Code:
PATH="$PATH:$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/"
./configure --prefix=/usr/local/android-arm/sysroot/usr \
--build=i686-pc-linux-gnu --host=arm-linux-androideabi \
CFLAGS="-mandroid -nostdlib" \
CPPFLAGS="-I$NDK/platforms/android-8/arch-arm/usr/include" \
LDFLAGS="-Wl,-rpath-link=$NDK/platforms/android-8/arch-arm/usr/lib/ \
-L$NDK/platforms/android-8/arch-arm/usr/lib/" \
LIBS="-lc -lcrypt" --without-ssl --without-neon --without-serf --disable-dso
9) Get configure to run successfully.
9.1)Fix failures because cross-compile checks not possible: yes to /dev/null, yes to setpgrp void, no to PROCESS SHARED locks, no to TCP_NODELAY with TCP_CORK
9.2) Fix all config.sub to accept androideabi as a valid os (add relevant section into OS switch-case),
10) run make
11) Fix make issues (make APR_HAVE_IOVEC = 1 in apr.h, remove conditional so that fdatasync is defined as fsync in sqlite3.c)
12) fix link issues with libcrypt by creating the libcrypt from here and adding it to $NDK/platforms/android-8/arch-arm/usr/lib/
13) Run make install to create deployment tree.
14) tar gzip it and push on phone. (including libcrypt)
Open issues/steps with unknown solutions:
15) How to install shared libs (libcrypt)?
16) how to build static?
17) How to make this post better?

Could the mods please shift this thread to the android dev forum?

Related

Successful CM 10.1 build on Kali Linux x64 (Guide work-in-progress)

After much frustration with getting things to work on Ubuntu, I switched back to Kali Linux and attempted the same procedure described here ... http://wiki.cyanogenmod.org/w/Build_for_d2spr ... as well as for Ubuntu here ...http://source.android.com/source/initializing.html .... When a step for Ubuntu 10 didn't work I tried the Ubuntu 11 or 12 approach and something always went through regarding setting up the build environment.
***Update-3: Sat Nov 9, 9:59 AM 2013 (Building CM_10.2 : Android_4.3 in progress as of 10:33 AM)***​
Well I screwed up my Linux installation last night trying to put my /usr dir on a seperate partition and some file permission issues broke out with sudo, though everyone suggest 04755, thats what it was at. Kinda trippy, anyways so I found myself having to go through these steps again which gave me a chance to update this:good:...
***These are the packages I installed***​​
Code:
sudo apt-get install git git-core gnupg flex bison gperf \
build-essential zip curl lib32ncurses5-dev libc6-dev libgl1-mesa-dev \
lib32readline-gplv2-dev g++-multilib gcc-multilib mingw32 tofrodos \
python-markdown lib32z1-dev libxml2-utils xsltproc \
libesd0-dev libsdl1.2-dev libwxgtk2.8-dev lzop \
pngcrush schedtool squashfs-tools
The next thing you need to do after getting the build packages to install^^^ is install sun-java6-jdk which you can do following the "kind-of" instructions below regarding debian packages, unixodbc es la pinche problema, (If you see anything I am missing please please inform me).
or
You can install the *.bin file/s from Oracle here http://www.oracle.com/technetwork/j...ds/java-archive-downloads-javase6-419409.html and follow their instructions for getting it installed.
***Notes on sun-java6-jdk debian packages***​I just finished installig sun-java6-jdk and it's dependencies, I downloaded the packages from here ... http://packages.debian.org/squeeze/sun-java6-bin ... all packages were installed using 'sudo dpkg -i [./the/package/was/a.deb]' . For 'unixodbc' I used the dpkg but got an error and ended up using 'sudo apt-get install unixodbc', but that gave a warning about breaking and needing to remove other packages, I did not do that. Then 'sudo apt-get -f install' because it asked me to unless there was another solution. Becarefull and you should be fine. Due to not installing the packages in a specific order I had a run around of a time doing this but it was not too bad, plan ahead and it will be easier. [Note- Makes sure you get all the packages, ie the *-common, *-bin, *-jre, *-jdk etc, etc ]
***Update-3:Continued***​Once you have your new jdk installed don't forget to update alternatives, the alternative manager is basically a really useful tool for keeping track of links in your $PATH to different program versions, for instance if you have two versions of Java, then one will be linked to /usr/bin/java and that link points to the executable with a particular version usually maintained by the "alternatives" program. When you update this 'alternative' java version what you are doing is changing the link /usr/bin/java to point to the executable installed by the sun-java6-jdk package instead of the open-java6-jdk executable. I also like to repoint Eclipse to use sun-java6-jdk as well just to keep it all the same. You can update Eclipse's JDK location from within Eclipse, but I won't go into that here. If you installed java6 with the debian packages as I did, then your sun-java6-jdk installation should be located in "/usr/lib/jvm/java-6-sun-1.6.0.26". If its not there, try issuing this command...
Code:
dpkg -L sun-java6-jdk
...the output may be long, but it will tell you where everything got installed to, you can replace the package name with any other package whenever you need to know where all of it's files get installed, very useful.
Updating alternatives should look something like this depending on which version of the JDK you installed
Code:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-sun-1.6.0.26/bin/java"
, so Google "how to update alternatives for java" or something like that, I might be forgeting something, I have just been trying **** out till it works. You can varify that indeed you are using the correct java executable by issuing the following command...
Code:
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR] java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR]
p.s. If thats not the correct output, please let me know.
While your checking version numbers, go ahead and check Git, Python, and Make.
from http://source.android.com/source/initializing.html
Python 2.6 -- 2.7, which you can download from python.org.
GNU Make 3.81 -- 3.82, which you can download from gnu.org,
JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com.
Git 1.7 or newer. You can find it at git-scm.com.
Click to expand...
Click to collapse
Checking the versions should look something like this...
Code:
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$ [/COLOR]python --version
Python 2.7.3
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR] make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR] git --version
git version 1.7.10.4
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR]
***Notes on Android SDK***​ The Android SDK should already be installed on Kali Linux or at least is when I install using a mirror to get extra packages. All you have to do is this, (I never build as root so you should create another user before doing building.):
Code:
echo "" >> ~/.bashrc
echo "#OURCHANGES" >> ~/.bashrc
echo "export ANDROID_SDK=\"/usr/share/android-sdk\"" >> ~/.bashrc
echo "export PATH=\"\${PATH}:\${ANDROID_SDK}:\${ANDROID_SDK}/tools:\${ANDROID_SDK}/platform-tools\"" >> ~/.bashrc
and then "cat ~/.bashrc" to make sure the changes went as planed.
Code:
cat ~/.bashrc
then "source ~/.bashrc"
Code:
source ~/.bashrc
then "android" and the gui should pop up and you can install all the lates updates or older ones if you want.
Code:
android
Then execute "which adb" it should result in this output "/usr/share/android-sdk/platform-tools/adb"
Code:
which adb
***Notes on USB and ADB***​
Also, don't forget the USB rules for your device. I just used the sytax from source.android.com/source/initializing.html but make sure to add your username that you build with to the OWNER=<"some-user-name-here-is-important"> and I usually change 600 to 666. Also, you don't need all the enteries, just the ones for the device you have you can find the idVendor and idProduct by using the command "lsusb" with your device plugged in, it will look like this.
Code:
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~$[/COLOR] lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 007: ID [COLOR="Red"]04e8:6860[/COLOR] Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 0489:e04e Foxconn / Hon Hai
Bus 002 Device 003: ID 1bcf:2c17 Sunplus Innovation Technology Inc.
What is in red above ^^^ are the {idVendor}:{idProduct}. I am not sure what to do with fastboot, I am still also learning.
The following is exactly as I have it in my "/etc/udev/rules.d/51-android.rules" file...
Code:
[COLOR="Red"][email protected][/COLOR][COLOR="Navy"]:~/cyandekali/system$[/COLOR] sudo cat /etc/udev/rules.d/51-android.rules
[sudo] password for edge-case:
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="[COLOR="Red"]04e8[/COLOR]", ATTR{idProduct}=="[COLOR="Red"]6860[/COLOR]", MODE="0666", OWNER="<edge-case>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0666", OWNER="<edge-case>"
Once you have your build enviroment set up you can build CyanogenMod for your device by initializing repo to your chosen repository and then sync'ing it up, most ROMs have their own little tweaks and optimizations so the guide can branch off into many directions at this point. (as far as I know it should work with most if not any other ROM, it worked with ReVolt). If you have any questions what so ever just ask, we all starte somewhere, and vise versa, if I need to be corrected anywhere please take the minute to post a reply, everyone will benifit from it.
And after a long day:
Code:
Package Complete: /home/edge-case/cyandekali/system/out/target/product/d2spr/cm-10.2-20131109-UNOFFICIAL-d2spr.zip
***The rest is history***​Eventually I am going to modify this all so that Android and Kali will become one, I really really want to test my nfs server with my phone as a client
Edit/Update 1: I installed the .zip I built on Kali and it got stuck during boot or init, right before the spinning circle usually comes up. I will try again with sun-java6-jdk and libgeofence.so and report back.
Edit/Update 2: I initialized 'brunch d2spr' without the 'libgeofence.so', I have no idea how vital it is, I am assuming it is only needed for gps. If this fails to boot, then I will add the blob manually and test again.
A question I do have though. Should I be worried about "warning"'s? They come up every now and again it seems like they are C variables or something that get set to UCHAR or unsigned char and warnnings like that, are there any caveats I need to look out for?
The following is what I am refering to, how worried should I be about stuff like this, this build is missing libgeofence.so as stated.
Code:
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp: In member function 'void WebCore::SQLiteDatabase::setSynchronous(WebCore::SQLiteDatabase::SynchronousPragma)':
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: passing 'WebCore::SQLiteDatabase::SynchronousPragma' chooses 'int' over 'long unsigned int' [-Wsign-promo]
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: in call to 'static WTF::String WTF::String::number(int)' [-Wsign-promo]
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: passing 'WebCore::SQLiteDatabase::SynchronousPragma' chooses 'int' over 'long int' [-Wsign-promo]
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: in call to 'static WTF::String WTF::String::number(int)' [-Wsign-promo]
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: passing 'WebCore::SQLiteDatabase::SynchronousPragma' chooses 'int' over 'unsigned int' [-Wsign-promo]
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp:229:75: warning: in call to 'static WTF::String WTF::String::number(int)' [-Wsign-promo]
In hindsight, the above ^^^ just meant it was working, just in case your wondering the same thing, if you see that kind of output after starting your build, you probably can go make some dinner or take a nap espescially if it's the first build, then you might want to go out to the movies or something, unless your like me and like trying to read stdout as it flys up the screen :good::good::cyclops:
I used Open-Java6-JDK and at the initialization of the 'brunch d2spr' command it complained about the Java Version but continued to build, I haven't installed the zip as I also on a rush built without 'libgeofence.so' or some such 'glob'.
Also, I am having trouble finding an official source to download 'libgeofence.so' , does anyone have a link they can point me to?
I did get this one but I have no idea about it's trust worthyness....http://downloads.codefi.re/houstonn/lgog_pro/unzipped/lib/libgeofence.so
Actually CM 10.2 but I need 10.1 [Reason 4 Failure?]
Ok so I built the second zip using sun-java6-jdk with no libgeofence.so, it installed but did not boot properly as did the first try with open-java6-jdk.
I did a 'make clean' and this was the output :
Code:
[COLOR="Red"]PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=[B][COLOR="Blue"]4.3.1[/COLOR][/B]
CM_VERSION=[B][COLOR="Blue"]10.2[/COLOR][/B]-20131013-UNOFFICIAL-d2spr
TARGET_PRODUCT=cm_d2spr
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.7-trunk-amd64-x86_64-with-debian-1.0
HOST_BUILD_TYPE=release
BUILD_ID=JLS36I
OUT_DIR=/home/edge-case/CyAnDeKaLi/system/out
[/COLOR]
It may vary well be that it is trying to build for Android 4.3.x , what do you think?
I am thinking it was from the 'repo sync -j4 -c', what can I execute to clean my repo and re-sync it with 4.2.1 or 4.2.2 ?
Which I guess would be CM 10.1.x instead of CM 10.2.x (which may not be compatible with my phone's firmware)
Edit/Update: As I was looking through the nightlies at the CM website I noticed a "fix boot hang" version of CM 10.2 this may be a known issue with 10.2, also I guess the command is during the repo init:
Code:
[COLOR="Indigo"]repo init -u git://github.com/CyanogenMod/android.git -b [COLOR="Red"][B]cm-10.2[/B][/COLOR][/COLOR]
I guess I will just delete everything and start fresh replacing 10.2 with 10.1 and see how things go. Maybe the build was more "successful" than I thought after it didn't boot (ie the build went fine but the code just isn't there yet), or missing that libgeofence.so is fatal.
I had an idea that kinda relates to the topic, what if people where able to donate their C-CACHE's to the "cloud" so that other developers could speed up theirs, like a kind of high availability cluster. Though some kind of algorithm would need to be developed to identify whats what and what different and more than I can think of right now.
It really did work!
It is confirmed, the build is working on Kali Linux, I suppose I could write a step by step guide if any body asks.
Now the next step...Sewing CyanogenMod Android Debian Kali Linux into CyAnDeKaLi.
Sent from Samsung Galaxy SIII SPH-L10 running CyanogenMod 10.1 built on Kali Linux.
Cleaned it up a bit, more of a guide, this would probably work on most Debian distros.
If the Orange is too much, let me know but for now it is all the new stuff in case you were following along, most of the other stuff is just me talking to myself in public.
peace,
Edge-Case
I successfully built CM 10.2 on Kali Linux by following CyanogenMod's instructions on their wiki.
I thought I was the only one who was building ROM on Kali linux, But I was wrong
KALI LINUX FTW!!
mzahmed95 said:
I successfully built CM 10.2 on Kali Linux by following CyanogenMod's instructions on their wiki.
I thought I was the only one who was building ROM on Kali linux, But I was wrong
KALI LINUX FTW!!
Click to expand...
Click to collapse
Run Kali with Cyanogenmod (no chroot)?
Edge-Case said:
Run Kali with Cyanogenmod (no chroot)?
Click to expand...
Click to collapse
Sorry, But I didn't get your question....
Sent from my GT-N7100 using Tapatalk
mzahmed95 said:
Sorry, But I didn't get your question....
Sent from my GT-N7100 using Tapatalk
Click to expand...
Click to collapse
Ah, just a lil' project I decided to torture myself with. It's CyanogenMod with added Linux executables I picked from Kali's and Debian's armhf repos. It requires glibc to be placed in /lib of the Android file system hierarchy, which is normally not there. Also, a few tweaks to file and directory permissions need to be done, with out those tweaks to Android before the build, /lib and everything in it won't be executable and the owner:group gets changed to something like root:shell 644 or something. It has to do with the sticky bit that I am still trying to fully comprehend as Android implements it as a security feature. I heard removing a configuration flag to the kernel when building will get rid of the whole paranoid feature and allow more access to thing like file/socket creation.
Basically, Android with apt, nmap, wireshark-cli, aircranck-ng, tcpdump(which comes from the Android ports), and what ever else anyone wants really, even the whole (what works on arm that is) Kali pentesting suite if desired.
Though one caveat is that both glibc and bionic have to be loaded up into memory (RAM) from what I understand, and the amount of that resource varies, as well as /system storage (which is about 2g on sph-l710), but bind mounting from .img file or extSdCard also works (so long as owner:group and sticky bit has been adjusted correctly before build). Though I am having trouble mounting during init, so I just run a script when I turn my phone on, about to auto script it as a service or just use sl4a's feature. I got one builld that is a bit of a skeloton working, but all my attempts to tweak init.rc to mount what I want have resulted in failure to boot.
I am almosted tempted to take a BSD rootfs and try to hack together something that will boot BSD with Android as the "window server" taking the place of kde4 or gnome2. It would be an endever, maybe I should stick with debian based linux because it alsready runs on Android so long as glibc is available.
Edit: Interestingly enough I found this in FreeBSD's "/usr/ports/devel/android-tools-adb"
Code:
[email protected]:/usr/ports/devel/android-tools-adb$ cat pkg-descr
Android Debug Bridge (adb) is a versatile command line tool that
lets you communicate with an emulator instance or connected
Android-powered device.
WWW: http://developer.android.com/tools/help/adb.html
[email protected]:/usr/ports/devel/android-tools-adb$
I just got done building openjdk6, I saw bison, gcc, I have git, python27.... hmm....I heard about a Linux compatability layer... It might be more possible than I thought to build on FreeBSD. I searched "Build Android on FreeBSD" and saw some projects such as BroidSD, BSDroid (which looks like its bit rotting), GnatDroid. I think BSDroid even wanted to get Android running on the FreeBSD kernel!
I think watchdog needs to be picked out of NetBSD's arm rootfs though.
edit 2: Taada
Code:
[email protected]:/usr/ports/devel/android-tools-adb #make install
.....
.....
.....
===> Installing for android-tools-adb-4.3
===> Generating temporary packing list
===> Checking if devel/android-tools-adb already installed
install -s -o root -g wheel -m 555 adb /usr/local/bin/
===> Registering installation for android-tools-adb-4.3
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/bin/adb
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://developer.android.com/tools/help/adb.html
[email protected]:/usr/ports/devel/android-tools-adb #
Not quite a build environment on FreeBSD yet, but hey, adb is a good start. As long as the dependencies are there it should work. I might need to set some enviroment variables if I do try to build on FreeBSD.
Code:
[email protected]:/etc/devd # adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
c90855ae device
[email protected]:/etc/devd #
Just make sure to accept the rsa key on the phone/tablet... I almost thought I had more configuration to do but no, it works.
Update: Fri Nov 22, 2013
Well of all the build-tools I have these installed on FreeBSD:
bison, curl, flex, git, gperf, gnugp, open-jdk-6, open-jre-6, pngcrush, squashfs-tools, xsltproc, and zip.​
These I don't have or don't know if I do have and they are named differently:
build-essential, lzop, schedtools, zlib1g-dev, libesd0-dev, libncurses5-dev, libsdl1.2-dev, libwxgtk2.8-dev, libxmil2-utils, g++-multilib, gcc-multilib, lib32ncurses5-dev, lib32readline-gplv2-dev, and lib32z1-dev.​
If anyone has any knowledge they'd like to share regarding the packages I can't find and their possible counterparts for FreeBSD, please do share.
Note: It may be easier to build within a debian chroot/jail. -> ( http://blog.vx.sk/archives/22-Updated-Tutorial-Debian-GNUkFreeBSD-in-a-FreeBSD-jail.html )
BSDeb Chroot notes:
- I couldn't access the internet to apt-get at first in the jail, so I exited and then chrooted back into it and networking worked.
- squeeze's dpkg is old, upgrade to wheezy to get multi-arch support. -> ( http://www.howtoforge.com/how-to-upgrade-debian-squeeze-to-wheezy )
- I ran into this error while upgrading:
Code:
[....] Mounting kernel filesystems...mount: fdescfs : No such file or directory
invoke-rc.d: initscript freebsd-utils, action "start" failed.
dpkg: error processing freebsd-utils (--configure):
subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
Errors were encountered while processing:
freebsd-utils
E: Sub-process /usr/bin/dpkg returned an error code (1)
This fixed that:
Code:
mount -t fdescfs fdescfs /jail/debian/dev/fd/
Update on FreeBSD Debian chroot:
I couldn't install some packages, with squeeze because dpkg doesn't support multiarch at version 1.5. After upgrading to Wheezy, libc6-dev or libc6-dev:i386 could not be installed, was using libc0.1 for KFreeBSD Debian. Also lib32ncurses5-dev and lib32readline-gplv2-dev could not be installed with Wheezy. Perhaps with Jesse or Sid.
Oh well, enough of that, time to study.

[GUIDE] Keepass2 with Keepasshttp on TF700 Lubuntu

Hey guys,
I struggled for a long time to get keepass2 to work on the TF700 Lubuntu and finally got it working, so I want to share with you so you don't have to go all the same way.
What is keepass?
With keepass2 you can store all your passwords in a strongly encrypted database. You can store this database on dropbox, google drive or an own ftp server (my choice) to keep it up-to-date on all devices all the time. Keepass integrates this solution very well. It integrates also perfectly with chromium. Once you unlock the database with one secure master password the username and password for the website you need are automatically typed in (just like if you saved them with chromiums built-in "save password" feature) But there is even a well maintained Android app and iOS app, so you are very independent.
How to get it to work?
Background:
Keepass relies on mono. Until version 3.4 mono used only soft float calculation (armel) but our Infinity is armhf (hard float). Since 3.4 it *should* work without modifications to the source. The newest version (3.8.1, I compiled it from git) started fine but had no Internet access at all. So I found a version of mono ported to support hard-float where everything works as expected, although it is an older version.
To install this version:
Open a terminal (In Lubuntu 12.04 v1.3 this can be done by pressing the "Touchpad enable/disable" button)
Code:
sudo apt-get install git-core
git clone git://github.com/directhex/mono-1.git
cd mono-1
git checkout remotes/origin/armhf-port
./autogen.sh --disable-mcs-build --prefix=/usr
make -CFLAGS=-DARM_FPU_VFP_HARD
sudo make install
Download this: https://mega.co.nz/#!Tcw3ABLb!ETpn4SDEy1i2Pj8pFN2VyVpyAfGvmNv8q0BdIZCvDZ8
Code:
cd /usr/lib
sudo tar -xvf ~/mono.tar.lzma
To test your installation this should be the output:
Code:
mono -V
Mono JIT compiler version 2.11.4 ((no/50bb5e4 Thu Aug 28 13:46:52 CEST 2014)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp(hardfp-abi)
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
To install keepass:
Download the latest "Portable" zip from http://keepass.info and extract it to a folder of your desire (my choice was ~/.keepass2)
Keepass requires the locale settings to be C, otherwise the settings would not be saved after exit, so to start keepass create a file startkeepass.sh with following content:
Code:
#!/bin/bash
LC_ALL=C
mono ~/.keepass2/KeePass.exe
Make it executable (chmod 755 startkeepass.sh) and from now on you can start keepass by executing that script.
To install keepasshttp
Keepasshttp is used to connect Keepass with the chromium plugin chromeipass. The plgx file does not work, but following method works:
Code:
git clone git://github.com/pfn/keepasshttp.git
cd keepasshttp/mono
cp * ~/.keepass2/
To install ChromeIPass
In Chromium: Menu -> Tools -> Extensions -> Get more extensions
Search for ChromeIPass and install it.
Congratulations! You can now use Keepass2 to manage your passwords on your TF700!

[GUIDE]Cross Compiling C/C++ for ARM on Linux

I wrote this guide to make it easy for everyone to be able to cross compile c/c++ for android, the easy way that I know. I admit, I am a total n00b to c/c++. I started learning to cross compile when I got my new nexus 9 for christmas. I, for some reason, couldnt get busybox installed on it. So, I had to manually compile and load it on there. After reading a hundred tutorials and none of them working, I got frustrated. Finally, I compiled a working version. And it was SO EASY. Anyway, Im specifically giving instructions for Ubuntu 14.04/14.10. First thing you need to do is download a package called binutils-arm-linux-gnueabi.
- sudo apt-get install binutils-arm-linux-gnueabi
- sudo apt-get install binutils-aarch64-linux-gnu (for aarch64, or arm 64bit, or armv8)
- sudo apt-get install binutils-arm-linux-gnueabihf (for armhf)
To compile busybox for your platform, you must download the source package you want to compile from http://busybox.net/downloads/. Then extract it
- tar xvf busybox.tar.gz
Then, cd into your root busybox folder.
- export ARCH=arm
- export CROSS_COMPILE=arm-linux-gnueabi- (dont forget the trailing dash(-))
This will setup your variables for compilation. Then
- make menuconfig (if you dont get a config menu, you need to "sudo apt-get install libncurses5-dev")
Now, go into the busybox settings -> Build options. Select the option "build busybox as static executable". You can select/deselect options by hitting the space bar. [ESC] key will take you back. Make sure to save your new configuration. Its almost time to compile! One last thing. If you want to add your name to it, go into the Makefile in the root busybox folder. At the top of the file, where it says EXTRAVERSION = .git, you can add something like -bynarie or whatever you want. That way when you run busybox on the terminal emulator on android, it will print out something like "BusyBox v1.24.0-bynarie". OK! Time to compile. Really simple:
- make install
This will compile every applet, and put everything in a folder called _Install. You will have busybox and busybox_unstripped in the root directory. Please, be aware that this busybox puts an applet named "su" in the bin folder in the _install folder. So, DO NOT COPY THE SU APPLET INTO YOUR ANDROID BIN FOLDER, OR YOU WILL LOSE ROOT!!! Now, to verify it compiled to the right architecture, do "file busybox" at the term and it should spit out something like "ELF 32bit ARM executable". If this is the case, congrats. We have successfully compiled busybox for android arm!! Copy the needed files over to your device and set permissions and you are done. The suggested way to move the busybox binary to your device is as follows:
- adb push busybox /data/local/tmp/busybox
- open adb shell and do "chmod 755 /data/local/tmp/busybox" or chmod it on your linux box before pushing.
- open file manager on device and move busybox to /system/xbin
- If properly done, should work.
For other nix programs like tar, the procedure is as follows:
- Open term, cd into root source folder
- ./configure CC="arm-linux-gnueabi-gcc" CPP="arm-linux-gnueabi-cpp" --host=arm-linux-gnueabi
- make
The CC variable is your C compiler command and the CPP variable is the C preprocessor, if you need to add a C++ compiler just add CXX="arm-linux-gnueabi-g++" but TAR is specifically C only. You can add all three variables I would assume to be safe. Most of the time, the readme or install documents will give you some guidance on cross compiling. But, this is how I successfully compiled TAR for arm and aarch64.
If you want to compile small/single source file c/c++, you will be using the same tools, but in a different way. Cd into your source file directory, and depending on which type of source it is (c or cpp), you will do the following:
- arm-linux-gnueabi-gcc helloWorld.c -static -o helloworld.out (for C)
- arm-linux-gnueabi-g++ helloWorld.cpp -static -o helloworld.out (C++)
Yep, its that easy. I cant guarantee 100% this will work on everything, but its a good starting point. And you dont even have to fool with the Android NDK. I find that the android ndk would mostly benefit "Apps" that need to integrate c/c++ code into them, not little console apps run from the terminal emulator. I hope someone finds this guide useful and if anyone has any problems trying to get somethin to work, you can respond and I will do my best to help.
thanks

Parrot Security OS auto chroot for android, Nethunter alternative - NOT TESTED YET -

NOT WORKING. I WANTED TO PORT TOO FAST. PLEASE CLOSE THIS THREAD. I'LL REOPEN IT WHEN EVERYTHING WILL WORK FINE
PAO or Parrot On Android is an Android penetration testing platform for any android devices.
Supported architectures: armhf, arm, amd64 and i386
Issues:
No known issues yet
I builded the rootfs using the following commands (We built for armhf architecture in this exemple):
qemu-debootstrap --arch armhf stable ./parrot-armhf http://ftp.parrotsec.org/parrot/
tar cJvf parrot-armhf.tar.xz ./parrot-armhf
To install, just extract the zip file (link at the end of this message) to any folder (for e.g. /sdcard/install_PAO). Then, in a terminal app, execute the install.sh as root and answer the questions. The script will automatically download and install the right chroot for you
To run Parrot, just type in a terminal 'chrootparrot' (as root)
To remove chroot, please make sure your chroot isn't running and type 'removeparrot' in a terminal (as root)
NOTE: This is only the base Parrot Securiry OS system. It doesn't come with a lot of tools. To install Parrot Security OS tools, just type 'apt update && apt install parrot-tools'
Link: https://drive.google.com/open?id=1NOJVItcM6NkbTQj3i72mda1m-5DA9cAT
PS: check out https://ssd.eff.org/en and spread this url to your bookmarks
Could you elaborate a lil bit.... Iam not able to run it via vnc

A noob tries his hand at ROM development for the MiA1 tissot

The problem with reading the articles on XDA is that eventually you want to try out some of the things described in these pages. I am no exception. After reading the superb article https://forum.xda-developers.com/mi-a1/how-to/guide-build-rom-source-tissot-t3754723 I decided to try my hand at developing the ROM for the Xiaomi MiA1. This is my daily driver and that in itself was a strong reason for motivation.
I tried replicating the steps given in the article on my Dell Inspiron and immediately ran into issues. The basic requirements mentioned are a linux or Mac computer. So to start with I formatted my laptop. Removed windows 10 and installed Ubuntu's latest 18.04 LTS.
I believed I had the next set of requirements for custom ROM development which were
• A basic understanding of Linux based OS specifically Ubuntu.
• Ability to type and use the command line. Write or copy paste commands in the Ubuntu konsole.
• A basic understanding of programming concepts, read and update XML files, understand error messages.
• Fast internet access.
• Steady electricity supply.
• Lots and lots of patience.
This still did not solve my problem. The build would crash repeatedly. Then I read the https://source.android.com/setup/. A whole new set of requirement came up. The article said that ideally the build system should exceed these conditions
• 64 bit environment
• 100 GB of free hard disk space
• 16 GB RAM / swap space.
At home my son was about to buy a new PC and this made his old PC available. I upgrade the RAM and added a new hard disk. Now my hardware configuration was as under :
• Intel i5 processor
• 16 GB RAM
• 1 TB hard disk.
With a new hard disk I had to create a boot-able USB drive. This I achieved with Rufus. My old laptop which again had its Windows 10 installation was used to install Rufus based on the instructions i got from https://rufus.akeo.ie/
The latest version of Ubuntu I downloaded from https://www.ubuntu.com/download/desktop
Setting Ubuntu from scratch for someone used to the world of windows is not exactly easy. I found the tutorial at https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop#0 extremely helpful.
I wrote down the steps I took in reaching the final goal of a Lineage ROM for my Mi A1.
Step 1: Setup Ubuntu - already completed
I chose the default settings as recommended in the setup.
Step 2: Installation of Java Development Kit
Once Ubuntu was up and running I opened a konsole window and typed the following commands
PHP:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Ubuntu did all the installing as I looked on.
Step 3: Installing required packages
PHP:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip
Step 4: Configure your smart phone access
I next installed the tools required to access the phone. This access would be required to later flash the phone or access its internals with ADB.
PHP:
sudo apt-get install android-tools-adb
sudo apt-get install fastboot
Step 5: To creating the work directories i typed the following commands. I was following the instructions from the above two articles alternately.
PHP:
mkdir -p ~/bin
mkdir -p ~//lineage
Step 6: Installing repo
I was informed that the Android source tree is located in a Git repository which is hosted by Google. The Git repository includes metadata for the Android source. Repo is a tool that makes it easier to work with Git .
PHP:
curl [url]https://storage.googleapis.com/git-repo-downloads/repo[/url] > ~/bin/repo
Once the repo was downloaded I had to make it executable
PHP:
chmod a+x ~/bin/repo
Step 7: The next step was to initialize the lineage source
This required to change to the directory created in step number 5 above. As someone coming from the world of windows I preferred to use the GUI and open the lineage folder created by using the mouse click. There right click brings up the option of ' Open in Terminal' . Those who prefer to type commands can use the below command
PHP:
cd ~//lineage
Once I had made sure that I was in the newly created lineage folder I moved ahead.
Step 8: Now i was required to configure my Git user
PHP:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
I replaced the text within the " " with my creadentials, which I had created on https://github.com/
Step 9: Now we moved on to initializing the repo
PHP:
repo init -u [url]https://github.com/LineageOS/android.git[/url] -b lineage-15.1
A successful initialization showed a message stating that Repo is initialized in your working directory. The lineage directory now contain a .repo folder. To check hidden folder I used control + H key.
Step 8: Download the source code
This is the step where you will realize the importance of having a fast internet connection. The source code size is about 30 – 35 GB. I have a 10 mbps line and at times the download speed shoots up to 20- 25 mbps!!!* Yet it takes me anything from 4 – 10 hours to download the entire code!
My suggestion is check the time when your local ISP download speeds are at its best. For me it is during the night. I set the download up at night and go to sleep!
The command to get the source code is :
PHP:
repo sync -c -f --force-sync --no-clone-bundle --no-tags --optimized-fetch –prune
Optional Step 8 a: Making a backup of your source code
I copied the entire folder and kept a copy on an external device. This is just in case there is any need for me to format my hard disk. While copying I do not copy the .Repo and .Cache folders on to my backup. To check hidden folders press control + H keys.
Step 9: Get the source code for your specific device.
This is where I was stuck numerous times. As I understood the code which was downloaded is generic in nature. For your particular device you would need to get files which are specific to your device.
The source for all these files is github. You are targeting three sets of folders – Device, Kernel and vendor.
The git clone commands given below are for the tissot or Xiaomi MiA1 phone. Similarly other phones have their locations on GitHub from where you can get files specific to them.
PHP:
git clone [url]https://github.com/TheScarastic/andr...msm8953-common[/url] -b lineage-15.1 device/xiaomi/msm8953
git clone [url]https://github.com/TheScarastic/andr..._xiaomi_tissot[/url] -b lineage-15.1 device/xiaomi/tissot
git clone [url]https://github.com/TheScarastic/prop..._vendor_xiaomi[/url] -b lineage-15.1 vendor/xiaomi
git clone [url]https://github.com/Tissot-Developmen..._xiaomi_tissot[/url] -b 8.1 kernel/xiaomi/msm8953
Step 10: Modify Caching to speed up the build process.
PHP:
export CCACHE_DIR=./.ccache
ccache -C
export USE_CCACHE=1
export CCACHE_COMPRESS=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Step 11: Configure JACK
JACK is the java compiler and can cause crashes – believe me! A simple fix is this command which you type next
PHP:
export _JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
Step 12: Cleaning up the build folder
PHP:
make clean
Step 13: Initializing the build
PHP:
source build/envsetup.sh
Step 14: Starting the build
PHP:
croot
brunch tissot
Watching the build on the screen is an interesting phase. It can get a bit tedious. In my case it took about 3 hours to complete the build. There were numerous errors that were thrown up. Files were declared as missing. After a couple of failures I realized I could search for them and then paste the file in the appropriate folders.
The one good thing about the build errors is googling for them usually gets you the right help. There would definitely be someone in some part of the world who would have run into a similar issue.
Finally after a 3 hour wait I got my zip file which when i flashed through TWRP on my MiA1. The sheer joy of having a ROM you created on your phone is indeed beyond words. It took me about a week of sitting for about ten to fifteen hours to get the various combination right, but believe me when I tell you the results are worth it.
My thanks to arunassain https://forum.xda-developers.com/member.php?u=6768248 from whose article I was able to understand the basics. He helped me with responses to my queries when I was stuck.
I further picked up from the excellent articles under the title Establishing a build Environment at https://source.android.com/setup/build/initializing
A great video that helped me was available on the topic How to build your own custom Android ROM at https://www.androidauthority.com/build-custom-android-rom-720453/
To check out the ROM's built for the MiA1 please click here
Now coming to the question if I have understood everything that is to learn about ROM development, well the answer is no. This was just the first build by a noob of a ROM which somehow worked. I have been using the ROM on my daily driver for the past one day and it is working perfectly. Having said that I still need to understand more of what happens behind the scenes in this wonder world of Custom ROM development.
Don't tell me you thought that you could build a rom on x86 processor/OS
Give him a break, he admitted that he is new to this building ROM world, I can understand that some people can think that if a proc is powerful enough they can use it to build no matter if it's a x64 or x86.
Thanks for you story mate! And don't hesitate to ask dev on telegrams or G+ to explain you some what you don't understand :good: I'm pretty sure that would love to finally have someone like you, who is truly interested in this whole world

Categories

Resources