Howto get WiFi running on Ubuntu - Folio 100 General

Hey,
first of all, thanks to ph84 for helping me getting the wireless drivers running and all the others who take part on developing Linux on Folio 100.
After this HowTo you'll be able to use wireless on your Folio!
Just follow this post, but add "build-essential" to the --seed part of the rootstock command to get gcc basic libraries for building applications on the folio!
Download the latest version of the compat wireless drivers and the firmware
Put the sd-card/usb-stick in your computer where you extracted your rootstock image to
Extract the wireless drivers source to whatever directory you want
Copy the folio kernel source to /lib/modules/2.6.32.9/build
Extract the ath6kl folder from the firmware tar-file to /lib/firmware
Rename the bdata.SD31.bin to bdata.CUSTOM.bin (needs root access)
Then safely plug out your sd-card/usb-stick, put it into your folio and start it
Open up a shell and browse to the folder where you extracted the driver source to ($ cd /home/ubuntu/compat-wireless-2.6.39-rc1-3/)
select the drivers ($ ./scripts/driver-select ath6kl)
build the driver ($ make)
install the driver ($ sudo make install)
restart and your wireless adapter should be present in network manager
The only problem which is still open is that you aren't able to connect to your WPA-Access-Point directly.
You have to add your Wireless-LAN manually in the network manager..
Have fun with that
Hope we will get the sound and so on running soon!

Thx to erazor & ph84... they had make a great job.

hey EraZoR could you post the files from the build please? i dont have my folio handy and i only have the driver there...
it should be some files called compat-wireless*.so or so...
also, the firmware would be really usefull.
then i can put that in the howto and users dont have to compile for themselves (which takes about 700mb for sources and a lot for build-essential)...

Hi there
first of all thanks for your great work,
I'm trying to get wifi working on my ubuntu installation but i got stuck at step 10 when builiding the drivers. Do I have to copy any additional files or change settings?
make runs into these errors:
Code:
make -C /lib/modules/2.6.32.9/build M=/home/Philipp/compat-wireless-2.6.39-rc1-3 modules
make[1]: Entering directory `/lib/modules/2.6.32.9/build'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /lib/modules/2.6.32.9/build/Module.symvers
is missing; modules will have no dependencies and modversions.
make[1]: Leaving directory `/lib/modules/2.6.32.9/build'
it would be great if you could provide your buit files, I don't have to compile them myself though

Saint9192 said:
Hi there
first of all thanks for your great work,
I'm trying to get wifi working on my ubuntu installation ...
Click to expand...
Click to collapse
How have you installed ubuntu? I don't found *.rar file to complete ph84 howto.

gipposat said:
How have you installed ubuntu? I don't found *.rar file to complete ph84 howto.
Click to expand...
Click to collapse
I didn't found it either, so just left this step out .
I have used the attached .zip file to flash the tablet.
I found this one in a post from ph84 in DerArtem's Linux HowTo in this forum
when I tried to create a root file system using rootstock, I got an error while installing xulrunner, so I left out the
Code:
--seed xubuntu-desktop
parameter and just added the build-essential package via chroot.
result:
I don't have a GUI but I'm able to log into an runnig ubuntu

gipposat said:
How have you installed ubuntu? I don't found *.rar file to complete ph84 howto.
Click to expand...
Click to collapse
I did a ubuntu-minimal with the seed command and got a running Ubuntu system but only with shell access.
Sent from my HTC Desire using XDA Premium App

°EraZoR° said:
Hey,
...
Copy the folio kernel source to /lib/modules/2.6.32.9/build
...
Click to expand...
Click to collapse
Hi,
I haven't in my *.img file a folder /lib/modules/2.6.32.9/build, I just have /lib/modules; I have to create it or am I missing something?
Of what is shown on the link folio kernel source, I have to copy all or just the kernel folder?
Thanks

gipposat said:
Hi,
I haven't in my *.img file a folder /lib/modules/2.6.32.9/build, I just have /lib/modules; ...
Click to expand...
Click to collapse
Same thing for me.

You shuld just create the folder. As for what to download, there shuld be a link somewhere near the top of the page that says "download" and that will give you all you need. (The file list you see below is what is in the download, it is the source for the kernel and all the modules it needs)
Sent from my HTC Desire using XDA Premium App

Problem with make driver
I used rootstock with only "--seed build-essential", I got a .img file and created a sdcard. Then I have added wifi driver just like this HowTo; I have created a new "/2.6.32.9/build" folder and I copied all "folio kernel source". So I have a running Ubuntu system (only with shell access) but at step 10 when builiding the drivers I have this error:
"config.mk:204: WARNING: CONFIG_CFG80211_WEXT will be deactivated or not working because kernel was compiled with CONFIG_WIRELESS_EXT=n. Tools using wext interface like iwconfig will not work. To activate it build your kernel e.g. with CONFIG_LIBIPW=m."
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
...
What did I do wrong?
Thanks

gipposat;13007124
said:
...
when builiding the drivers I have this error:
"config.mk:204: WARNING: CONFIG_CFG80211_WEXT will be deactivated or not working because kernel was compiled with CONFIG_WIRELESS_EXT=n. Tools using wext interface like iwconfig will not work. To activate it build your kernel e.g. with CONFIG_LIBIPW=m."
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
...
Click to expand...
Click to collapse
I get exactly the same errors

when running on your folio, do a
$cp /proc/config.gz /some/dir
$tar xvf /some/dir/proc.gz
$cp /some/dir/.config /your/folio/sources/
and retry the build. otherwise it "looks" like you dont have that stuff built into the kernel because were using our own kernel configuration (because its a folio )
good luck

Hello, I get this error when I try to build the driver :
CC /home/azer/w/compat/compat.mod.o
/home/azer/w/compat/compat.mod.c:8: error: variable ‘__this_module’ has initializer but incomplete type
/home/azer/w/compat/compat.mod.c:9: error: unknown field ‘name’ specified in initializer
/home/azer/w/compat/compat.mod.c:9: warning: excess elements in struct initializer
/home/azer/w/compat/compat.mod.c:9: warning: (near initialization for ‘__this_module’)
/home/azer/w/compat/compat.mod.c:10: error: unknown field ‘init’ specified in initializer
/home/azer/w/compat/compat.mod.c:10: warning: excess elements in struct initializer
/home/azer/w/compat/compat.mod.c:10: warning: (near initialization for ‘__this_module’)
/home/azer/w/compat/compat.mod.c:14: error: unknown field ‘arch’ specified in initializer
/home/azer/w/compat/compat.mod.c:14: error: ‘MODULE_ARCH_INIT’ undeclared here (not in a function)
/home/azer/w/compat/compat.mod.c:14: warning: excess elements in struct initializer
/home/azer/w/compat/compat.mod.c:14: warning: (near initialization for ‘__this_module’)
make[2]: *** [/home/azer/w/compat/compat.mod.o] Error 1
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/lib/modules/2.6.32.9/build'
make: *** [modules] Error 2
Click to expand...
Click to collapse
Can somebody help to solve the problem please?

ph84 said:
when running on your folio, do a
$cp /proc/config.gz /some/dir
$tar xvf /some/dir/proc.gz
$cp /some/dir/.config /your/folio/sources/
Click to expand...
Click to collapse
This didn't work for me I still get the "kernel configuration invalid error"
Could somebody help me

gipposat said:
I used rootstock with only "--seed build-essential", I got a .img file and created a sdcard. Then I have added wifi driver just like this HowTo; I have created a new "/2.6.32.9/build" folder and I copied all "folio kernel source". So I have a running Ubuntu system (only with shell access) but at step 10 when builiding the drivers I have this error:
"config.mk:204: WARNING: CONFIG_CFG80211_WEXT will be deactivated or not working because kernel was compiled with CONFIG_WIRELESS_EXT=n. Tools using wext interface like iwconfig will not work. To activate it build your kernel e.g. with CONFIG_LIBIPW=m."
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
FATAL: Could not load /lib/modules/2.6.32.9/modules.dep: No such file or directory.
...
What did I do wrong?
Thanks
Click to expand...
Click to collapse
Type "sudo depmod -a" in a console, press enter and voilà.

zoken4 said:
Type "sudo depmod -a"
Click to expand...
Click to collapse
thanks zoken4 that worked like a charm ,
do you have any suggests about the invalid kernel configuration error i mentioned before

Saint9192 said:
thanks zoken4 that worked like a charm ,
do you have any suggests about the invalid kernel configuration error i mentioned before
Click to expand...
Click to collapse
You're welcome.
For the configuration error, you have to run "sudo make oldconfig && make prepare" in "/lib/modules/2.6.32.9/build/".
In a terminal : "cd /lib/modules/2.6.32.9/build/", and then "sudo make oldconfig && make prepare".
You'll maybe also have to run "sudo make scripts" after that.

ok I'll give it a try and report back

Ok I have the same error that all of you...
What are we doing wrong ??????
Solutions ?? ?!
thanks !

Related

Compile binary for testing linux kernel exploit for arm architecture

Hi,
i'm an android app developer. I have an HTC Desire and I would test kernel issue for root my device.
For check kernel or software issue, I compile on my linuxbox (on Intel) and binary file run in the same arch that compile it.
In an arm device like my android phone, how can I compile c source file?
We will say: "With an arm croos toolchain!"...
I have read http://www.hermann-uwe.de/blog/buil...-with-binutils-gcc-newlib-and-gdb-from-source that explain how to build the toolchain, but binary compiler that this steps create not compile a simple "Hello World" program:
Code:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
because not have stdio.h header... O_O
So I have downloaded the GNU ARM toolchain binary for linux, but the compiler don't work because I can't run it on my linuxbox...
Why?
mmm... So I have copied the "include" directory from GNU Arm ToolChain to toolchain compiled from source (how explaine the link above).
now stdio.h is present but...
Code:
/tmp/ccfmzOMU.s: Assembler messages:
/tmp/ccfmzOMU.s:11: Error: junk at end of line, first unrecognized character is `@'
/tmp/ccfmzOMU.s:12: Error: junk at end of line, first unrecognized character is `@'
/tmp/ccfmzOMU.s:13: Error: too many memory references for `mov'
/tmp/ccfmzOMU.s:14: Error: no such instruction: `stmfd sp!,{fp,ip,lr,pc}'
/tmp/ccfmzOMU.s:15: Error: too many memory references for `sub'
/tmp/ccfmzOMU.s:16: Error: no such instruction: `ldr r0,.L3'
/tmp/ccfmzOMU.s:17: Error: no such instruction: `bl printf'
/tmp/ccfmzOMU.s:18: Error: expecting operand after ','; got nothing
/tmp/ccfmzOMU.s:19: Error: too many memory references for `mov'
/tmp/ccfmzOMU.s:20: Error: no such instruction: `ldmfd sp,{fp,sp,pc}'
How can i build binary elf file for my Desire architecture?
Thanks in andvance!
I am unable to link to any resources here due to them being behind a corporate firewall, but this link I found might help:
http://www.ibm.com/developerworks/linux/library/l-arm-toolchain/index.html
Here is a link to the tools:
http://www.codesourcery.com/sgpp/lite/arm/portal/[email protected]=lite
Let me know if this is not what you are looking for.
Yes, this is what I need.
Thanks!
Now I've tried to compile my hello world in C for ARM, but the binary not run on my desire... I think that I have compiled with a mistake mcpu parameter.
The result is that if I copy helloworld binary in /data/local path in my Desire, set execution permission and execute the program:
Code:
$ ./helloworld
./helloworld
./helloworld: not found
the output of 'ls -l' command show that helloworld file exist and have 'x' permission...
So I think that is an incompatibily issue of the binary file...
Which one "-mcpu" value is correct for the Qualcomm Snapdragon QSD8250 inside HTC Desire?
I've tried any arm7* but it's the same... "not found".
Any ideas?
@azatoth
I get the same on my hero. Tried to run it on a other arm device (Linksys NSLU2) the same "not found" appears
mopodo said:
@azatoth
I get the same on my hero. Tried to run it on a other arm device (Linksys NSLU2) the same "not found" appears
Click to expand...
Click to collapse
Do you have found a solution for that?
I have no real way to test this, but the Snapdragon is a Cortex-A8 I believe... Try the following:
Code:
-mcpu=cortex-a8 -mfpu=neon
I hope this works, let me know if the behavior changes...
Vermithrax said:
I have no real way to test this, but the Snapdragon is a Cortex-A8 I believe... Try the following:
Code:
-mcpu=cortex-a8 -mfpu=neon
I hope this works, let me know if the behavior changes...
Click to expand...
Click to collapse
don't work yet... the response is always the same: not found...
you are linking to the wrong libc, you have to link to bionic... Are you using the full android build compiler?

[Q] libpcap static linking errors

Hello,
I have downloaded the libpcap in external folder from android source code using the Git and
repo. I used the toolcains of ndk (android-ndk-r5b) to compile the library following these
steps:
./configure --prefix=path-to-android-src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
make clean
make
make install
and then a file libpcap.a is produced.
I have make a simple sniffer using libpcap (sniffer.c). When I try to compile it, these errors occur:
agcc sniffer.c libpcap.a
sniffer.c:9:18: error: pcap.h: No such file or directory
sniffer.c:19: warning: 'struct pcap_pkthdr' declared inside parameter list
sniffer.c:19: warning: its scope is only this definition or declaration, which is probably not what you want
sniffer.c: In function 'processPacket':
sniffer.c:23: warning: incompatible implicit declaration of built-in function 'printf'
sniffer.c:24: error: dereferencing pointer to incomplete type
sniffer.c:26: error: dereferencing pointer to incomplete type
sniffer.c:33: error: dereferencing pointer to incomplete type
sniffer.c: In function 'main':
sniffer.c:45: error: 'pcap_t' undeclared (first use in this function)
sniffer.c:45: error: (Each undeclared identifier is reported only once
sniffer.c:45: error: for each function it appears in.)
sniffer.c:45: error: 'descr' undeclared (first use in this function)
sniffer.c:46: error: 'PCAP_ERRBUF_SIZE' undeclared (first use in this function)
sniffer.c:62: warning: incompatible implicit declaration of built-in function 'printf'
sniffer.c:66: warning: incompatible implicit declaration of built-in function 'fprintf'
sniffer.c:66: error: 'stderr' undeclared (first use in this function)
sniffer.c:72: warning: incompatible implicit declaration of built-in function 'fprintf'
when I try to produce the object code in advance:
agcc -c sniffer.o sniffer.c
the same errors occured.
Can someone explain me how to solve this problem?
here is the alias of agcc I use in bashrc file:
./configure --prefix=/home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
Also, I have attached a file with the outputs of the commands above: configure, make and make install.
Thank you in advance!
I used the options -I and -L to specify the include and library files, and these errors are gone now..
Here is my new error log:
agcc --static -I /home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/include -L /home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/lib -o sniffer sniffer.c libpcap.a
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
libpcap.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
any ideas?
I'm not 100% sure, but if you want to build native library for android you shouldn't use ./configure script. You should create Android.mk file and build library using it. Android.mk file is a native build environment for Android.
Refer to android-ndk\docs\ANDROID-MK.html for more information.
Yeah!
Thank you Zuljin!!!
I put the libpcap direcotry into the android-ndk-r5b/samples, I modified a bit the Android.mdk
and the structure of the direcotry, so as to look like the other ones inside the samples dir and
I used the ndk-build command inside the android-ndk-r5b direcory:
ndk-build -C samples/android-ndk-r5b
All worked fine! I was able to produce a libpicap.so file, and put it in the phone using the
commands:
in android:
# su
# mount -o,rw remount /dev/block/mtdblock4 /system/lib
in my Desktop:
$ adb push libpcap.so /system/lib/
I made a simple sniffer, I compiled and linked with the libpcap.so and works perfectly in
my HTC Hero!
Hi,
I have also trying to build this libpcap on Android.
I have downloaded the source from platform_external_libpcap and put all these files under jni directory for a android-ndk project (default) and tried building using ndk-build script.
But nothing happens but the control returns plainly without compiling the .so or .a file.
Can you tell me how you organized the folders in ndk project.?
regards,
Vijayan
Hello Vijayan,
You have to make a directory i.e. libpcap and then inside this directory,
you've got to create another one named as jni and put there all the source
files, as you have done. Then, inside this directory (jni) create a file named as
Android.mk so that it contains the follow lines:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=\
/bpf_dump.c\
/bpf/net/bpf_filter.c\
/bpf_image.c\
/etherent.c\
/fad-gifc.c\
/gencode.c\
/grammar.c\
/inet.c\
/nametoaddr.c\
/optimize.c\
/pcap.c\
/pcap-linux.c\
/savefile.c\
/scanner.c\
/version.c
LOCAL_CFLAGS:=-O2 -g
LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE
LOCAL_MODULE:= pcap
LOCAL_MODULE_FILENAME:= libpcap
LOCAL_LDLIBS := \
-ldl
include $(BUILD_SHARED_LIBRARY)
Then, you only have to type this command:
ndk-build -C <path-to-jni-direcotry>
That's all! Now, inside the libpcap directory, and in the path:
libpcap/libs/armeabi/ should have been created the file you want:
libpcap.so
Let me know if you have any problems,
Thanasis
Hi,
Thanks. Now I'm able to compile the libpcap.so.
using this .so I have compiled the jpcap-0.7 (C source fiiles) to generate libjpcap.so.
Then I have created my Sniffer Application on Android. I have added the jpcap.jar, jpcap.so and libpcap.so in the lib folder of my Application.
But when I call this line
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
am getting the following runtime error:
FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: getDeviceList
at jpcap.JpcapCaptor.getDeviceList(Native Method)
at com.example.snifferapp.SnifferApp.onCreate(SnifferApp.java:26)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Click to expand...
Click to collapse
Can you tellme What is going wrong here ?
Thanks.
Vijay
Yes, I had the same problem with you when I tried to make a sniffing application
using another one known java wrapper of libpcap: the jNetPcap, and particularly
I couldn't get the devices through this call: Pcap.findAllDevs(alldevs, errbuf);
That's because, even if you have root privileges on the console of the phone, as
you have a rooted phone, you cannot raun an application as root. That's not possible.
You can do that, only if your application is signed with the key of the platform, that is
of the Android OS that runs inside your phone.. So, the only way is to built by yourself
the Android OS and put it into the mobile. And then you have to sign your application
with the key that you have used to sign the OS.
For more information you can look here:
http://stackoverflow.com/questions/5966603/jnetpcap-on-android-problem-with-findalldevs-method
Hi,
Thanks for your reply.
But its very confusing.
Can you tellme, Whether Its possible to run a client application into Android which can monitor the network traffic in the device by anymeans?
If then what are all the possible ways. (like jpcap, etc....)
My idea is to develop a simple client application. I cannot think of building the whole Android OS and loading it into each device.
Hope to get a reply.
Thanks,
Vijay
I haven't done it before, because I only experience with native
programs that do network monitoring..
I think there are two simple solutions here. The first one is what exactly
Shark does: A tcpdump is running in the background that produces
traffic traces (pcap files) and you can develop an application that in periodic
time intervals reads these files and produce some outputs to the user.
The other one solution I can imagine is to develop again a native sniffer in
C with libpcap and then for each packet you receive or better for a batch of
packets you receive, you can send it through sockets to you application for
further processing..
Hope that helps..
FYI: There is a new application in Android called faceniff that does the work of
firesheep. That is you can hijack web sessions from facebook users. How is it
possible this application to monitor the web traffic of the phone? I think that
uses a native sniffer for this.. I am not sure, but it is not open source..
Hi, I did the steps as you described above:
Create a dir 'libpcap' with subdir 'jni'
Download the 'platform_external_libpcap' from 'github.com/android/platform_external_libpcap' (based on original libpcap version 0.9.8) and put the files at 'libpcap/jni'
Change the 'Android.mk' (see post number 6 of this thread)
run 'path/to/ndk-build -C path/to/libpcap/ndk' (android-ndk-r6)
When I do the last step of this list no 'libpcap/libs/armeabi/libpcap.so' will be produced but I get this output (I can reproduce this behavior on ubuntu 10.04 x86_64 and on debian i586):
> <user>@<host>:~/android/libpcap$ path/to/android-ndk-r6/ndk-build -C /home/<user>/android/libpcap/jni
> make: Entering directory `/home/<user>/android/libpcap/jni'
> SharedLibrary : libpcap.so
> /home/<user>/android/libpcap/obj/local/armeabi/objs/pcap//grammar.o: In function `pcap_parse':
> /home/<user>/android/libpcap/jni/y.tab.c:1711: undefined reference to `pcap_lex'
> collect2: ld returned 1 exit status
> make: *** [/home/<user>/android/libpcap/obj/local/armeabi/libpcap.so] Error 1
> make: Leaving directory `/home/<user>/android/libpcap/jni'
Does someone know what this error means and how to solve this problem?
daim0nas said:
Yeah!
Thank you Zuljin!!!
I put the libpcap direcotry into the android-ndk-r5b/samples, I modified a bit the Android.mdk
and the structure of the direcotry, so as to look like the other ones inside the samples dir and
I used the ndk-build command inside the android-ndk-r5b direcory:
ndk-build -C samples/android-ndk-r5b
All worked fine! I was able to produce a libpicap.so file, and put it in the phone using the
commands:
in android:
# su
# mount -o,rw remount /dev/block/mtdblock4 /system/lib
in my Desktop:
$ adb push libpcap.so /system/lib/
I made a simple sniffer, I compiled and linked with the libpcapp.so and works perfectly in
my HTC Hero!
Click to expand...
Click to collapse
Can you post your libpcap for us please.

Best way to compile tcpdump?

References:
http://nerdjusttyped.blogspot.com/2...nology.com/index.php/Cross_Compiling_on_Linux
http://androidap.blogspot.com/2010/11/tcpdump-for-android.html
http://wiki.neurostechnology.com/index.php/Cross_Compiling_on_Linux
Is the Openmoko toolchain the best one to use for this? If so, which file from the link would I need for 64 bit Debian Squeeze?
http://downloads.openmoko.org/developer/toolchains/
ndk-build needs an Android.mk file so that is not going to work easily.
agcc only does .c files and not complicated projects with a makefile so that is not going to work easily. If it does please correct me.
this command:
CC=arm-linux-gcc./configure --host=arm-linux --with-pcap=linux
or this command:
CC=arm-angstrom-linux-gnueabi-gcc ./configure --host=arm-linux --with-pcap=linux
gives:
"error: C compiler cannot create executables".
So if I remove CC entirely:
./configure --host=arm-linux --with-pcap=linux
make
These lines will build and make libpcap ok and configure tcpdump ok. But when making tcpdump it fails with "error: ppi.h: No such file or directory".
Thanks for any help.

[Q] Run Linux execute file on Android

Hello I Want to run This File in my phone (via terminal emulator).
but after type ./amxxpc i have error
line 1: syntax error: unexpected "("
how i can fix that?
File witch I Want to start is in scripting.zip
Bump!
cheqolada said:
Hello I Want to run This File in my phone (via terminal emulator).
but after type ./amxxpc i have error
line 1: syntax error: unexpected "("
how i can fix that?
File witch I Want to start is in scripting.zip
Click to expand...
Click to collapse
Not possible.
a) The file is compiled for the wrong architecture and can only be executed on a Intel 386 type machine.
b) The file is linked with the GNU libraries, and can not be executed in the Android (bionic) environment.
You need to solve those two issues by recompiling it for the ARM architecture using the Android bionic libraries.
Try to get source and to compile for your device.

[GUIDE][TOOL] How Build/Compile your own kernel for LG G2

There is still no "how to" specific to the LG G2, so I'll try to share the maximum of my experience (or almost) with ["kernel", "build", "LG G2"] here. I'll show two methods different using CM12 kernel, The method for LG ROMs is very similar, I show some tips for LG ROMs also. The first method is the "manual" and second is the "automatic" using my "tool" called DCC. So come on! For this you will need a computer running Linux (x64) and have knowledge about basic Linux commands. I'm using a laptop (i3-2328M and 4GB of RAM) running Ubuntu 14.10 :good:
Setting Up the Environment
First install the essential tools (common environment for those already working with C/C++):
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Check Java and Java Compiler version:
Code:
java -version && javac -version
If the default Java is 1.6.x, Use this command and select java-7-openjdk as default:
Code:
sudo update-alternatives --config java
Click to expand...
Click to collapse
Setting Up the kernel Environment
Code:
mkdir -p ~/android/mykernel && cd ~/android/mykernel && mkdir out
This will create a folder and two subfolder in your home, Within mykernel folder will get all the tools that we will set up. Now we set the toolchain, Particularly I use Linaro 4.9.3, the version optimized for Cortex-A15 by @Christopher83, so I will use it here.
Clone Linaro GCC 4.9.3:
Code:
git clone https://github.com/Christopher83/arm-cortex_a15-linux-gnueabihf-linaro_4.9
Now the required binaries (Common essential binaries to work with msm8974):
Code:
git clone https://github.com/ferreirawax/mkboot_exec ~/android/mykernel/executables
Clone the RAM disk compiled from CM12:
Code:
git clone -b aosp https://github.com/ferreirawax/ramdisk_g2 ~/android/mykernel/ramdisk
For stock Kitkat:
This RAM disk was extracted from my d805 (d805 is a d802 which was released in latin america), then so will work on the d802, d805 and d806 (d806 is a d802 as the d805) If the variant is another you will have to draw your own device using a tool such AIK or search repositories of other developers.
Click to expand...
Click to collapse
Code:
git clone -b lge https://github.com/ferreirawax/ramdisk_g2 ~/android/mykernel/ramdisk
Now finally the source code of the kernel, Here I will use a configured kernel to compile the code without CM12 source, you can use the source code that is in the official repositories of CM12, but you will face some errors and warnings during the build that can be solved using the commits that are in my source and supply of other developers.
Clone kernel source:
Code:
git clone -b cm-12.0 https://github.com/ferreirawax/kernel_lge_msm8974-patched ~/android/mykernel/msm8974
For stock KitKat:
Code:
git clone -b lge-kitkat https://github.com/ferreirawax/kernel_lge_msm8974-patched ~/android/mykernel/msm8974
Apparently not but we already have a complete environment, see the folders in mykernel to have a shadow on it. Now let's the good part of the story. :fingers-crossed:
Click to expand...
Click to collapse
Compiling
Enter in kernel folder:
Code:
cd msm8974
Export Architecture and Toolchain:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/mykernel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-
For stock KitKat you need export LZ4 path:
Code:
export PATH=$PATH:tools/lz4demo
Select the model of the device you want to compile your pointing due defconfig, If you are using source code directly from the repositories of the CM12, defconfig each supported model is called "cyanogenmod_MODEL_defconfig".
Select model to build (In my case I will compile for d802):
Code:
make d802_defconfig
Now let's clear the specific waste of d802:
Code:
make clean && make mrproper
Select model again to generate new .config:
Code:
make d802_defconfig
Now we start to build:
Code:
make -j4
-j4 is suitable for dual-core processors and -j5 for quad-core.
Depending on the configuration of your PC can take up to 20 minutes. In my laptop the build time is about 10 minutes. If you are using VirtualBox, can take much longer. Upon completion, will generate a zImage and some dtb (Device tree binary) files, The dtb files will be used to create a specific image (dt.img) file containing board informations. Now let's create a RAM disk and then dt.img to later put it all together and result in a final boot.img.
Enter in executables folder:
Code:
cd ~/android/mykernel/executables
Create GNUZip compressed RAM disk:
Code:
./mkbootfs ~/android/mykernel/ramdisk | gzip > ~/android/mykernel/out/ramdisk.gz
Create dt.img:
First copy the dtc file that is in executables folder to /usr/bin
Code:
gksu nautilus
This will open the file manager with root privileges, After click the left mouse button and select the dtc as executable.
You may need to restart, After that create the dt.img with the following command.
Code:
./dtbTool -s 2048 -o ~/android/mykernel/out/dt.img ~/android/mykernel/msm8974/arch/arm/boot/
Finally assemble boot.img file:
Code:
./mkbootimg --kernel ~/android/mykernel/msm8974/arch/arm/boot/zImage --ramdisk ~/android/mykernel/out/ramdisk.gz --cmdline "XXXX" --base 0x00000000 --pagesize 2048 --offset 0x05000000 --tags-addr 0x04800000 --dt ~/android/mykernel/out/dt.img -o ~/android/mykernel/out/boot.img
Replace the XXXX for the following:
console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd androidboot.selinux=permissive
Do not remove the quotes. Replace the panel model (red) for your model. if you are compiling for stock KitKat, remove everything that is green.
Click to expand...
Click to collapse
Now let's add a "signature" in your kernel for the damn locked LG G2 bootloader so you can not be invalidated. If you do not do this procedure, the bootloader of your LG G2 will verify that this kernel has a particular signature, as it does not have your device will be unable to boot. We have two tools for this, Loki is able to fool the bootloader and open_bump (This tool is controversy) is able to add a "valid" signature using illegal means. I'll show how to use both. To this is very simple..
open_bump method:
You need Python to run any Python code, open_bump requires Python 2.x
Code:
git clone https://github.com/CyboLabs/Open_Bump
cd Open_Bump && python open_bump.py ~/android/mykernel/out/boot.img
You will now have an output "boot_bumped.img".
loki_tool method:
First get a copy of the bootloader of your G2, For this you need the adb installed and your G2 properly connected to your PC.
Get bootloader:
Code:
sudo apt-get install android-tools-adb
adb devices && adb shell "su -c dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/sdcard/aboot.img"
adb pull /sdcard/aboot.img
Do not forget the USB debugging enabled
Patch kernel:
Code:
./loki_patch boot aboot.img ~/android/mykernel/out/boot.img ~/android/mykernel/out/loki_boot.img
Will generate an output "loki_boot.img" on mykernel/out folder.
You can install using "my easy installer" (Attached at the end of post):
Download the attachment and extracted, Place your boot.img in the delta folder and
copy all the modules that are in your kernel source for the modules folder:
Code:
find ~/android/mykernel/msm8974/. -name "*.ko" -type f -exec cp {} ~/android/mykernel/installer/system/lib/modules \;
Now zip folder and install on your device. This installer already have panel detection script by @dr87
{
"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"
}
Finally now you have your own kernel! Now I will show the second method of how to automatic compile your kernel using my tool.
To rebuild you have to use the following:
Code:
make clean && make mrproper
make MODEL_defconfig
make -j4
Click to expand...
Click to collapse
Some tips
To not export the toolchain path every time you restart the system, Create a Shell executable in /etc/profile.d as follows:
Code:
sudo nano /etc/profile.d/export_gcc.sh
Copy and paste:
export PATH=~/android/mykernel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin:$PATH
Click to expand...
Click to collapse
CTRL + X, Y, ENTER
Now you just use:
Code:
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
Useful guides:
If you are new, you can start learning about git, One of the main tools for working with modifications to your kernel. Below I leave some links with some guides that can help you.
How to use Github
How to cherry-pick a github commit
Click to expand...
Click to collapse
DCC is a tool I developed to simplify my day, DCC is just a simple Python code that can help you save your time! See the features:
Command-line arguments like M$'s DiskPart
Real-time Shell executer
Manage builds for AOSP and LG ROMs
Build for single or ALL variants in same time
Manage the parameters of your kernel
DCC works with embedded open_bump
Manage your favorite toolchain
Easy to configure and use
I'll show how to use DCC is easy
Setup kernel environment:
Code:
reset && cd $HOME
mkdir dev && cd dev
git clone https://github.com/ferreirawax/dcc
cd dcc && find . -name '.gitignore' -delete
git clone https://github.com/ferreirawax/ramdisk_g2_aosp ramdisk/aosp
git clone https://github.com/ferreirawax/kernel_lge_msm8974-patched msm8974/aosp
Build kernel:
Code:
python dcc.py
do boot d802
exit
You know what happens to these magical commands? An immediate flashable zip of your kernel ready to flash. But for that you need to "setup" to your taste, see the page on github.
@ferreirawax this is great i was waiting for something like this so much, tommorow i will try your guide and post the results
EDIT
I followed everything and got stuck here:
[email protected]:~/android/mykernel/msm8974$ make clean && make mrproper
make: /home/simex/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-gcc: Command not found
THANKS for help
EDIT 2
I tried method with DCC and im stuck here:
[email protected]:~/dev/dcc$ python dcc.py
Traceback (most recent call last):
File "dcc.py", line 19, in <module>
from colorama import *
ImportError: No module named colorama
[email protected]:~/dev/dcc$
Sorry if im annoying but i hope someone can help me
Boris31 said:
@ferreirawax this is great i was waiting for something like this so much, tommorow i will try your guide and post the results
EDIT
I followed everything and got stuck here:
[email protected]:~/android/mykernel/msm8974$ make clean && make mrproper
make: /home/simex/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-gcc: Command not found
THANKS for help
EDIT 2
I tried method with DCC and im stuck here:
[email protected]:~/dev/dcc$ python dcc.py
Traceback (most recent call last):
File "dcc.py", line 19, in <module>
from colorama import *
ImportError: No module named colorama
[email protected]:~/dev/dcc$
Sorry if im annoying but i hope someone can help me
Click to expand...
Click to collapse
This error happens when the toolchain path is wrong.
Colorama module need to use DCC (I forgot to mention that)
Code:
sudo pip install colorama
Really exited to see sutch a complete guide for how to make a kernel for our G2
Will try and see if I can manager to compile my first kernel with this guide today..
ferreirawax said:
This error happens when the toolchain path is wrong.
Colorama module need to use DCC (I forgot to mention that)
Code:
sudo pip install colorama
Click to expand...
Click to collapse
ok thanks i got i working
---------- Post added at 10:43 AM ---------- Previous post was at 10:21 AM --------- @ferreirawax you got a typing mistake here thats why method 1 didnt work i finaly figured it out:
Export Architecture and Toolchain:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-
It should be myKERNEL and that it works
Now i succesfully build my kernel but im having problems with bump, i cant get past this:
[email protected]:~$ python open_bump.py ~/android/mykernel/out/boot.img
python: can't open file 'open_bump.py': [Errno 2] No such file or directory
but im sure its there i tryed nearly everything but cant get bumped boot.img
Thank you!!!! I have wanted something like this to compile different kernels .
It would have been totally awesome if @dorimanx did a tutorial once where he shared how he makes his (stock) kernels..anyways will this work on a 11 year old PC with 1gb RAM and 1,7 GHz processor?
any help for bumping boot.img ?
Boris31 said:
any help for bumping boot.img ?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=56987541
(OP gave cmd lines too)
6ril1 said:
http://forum.xda-developers.com/showthread.php?p=56987541
(OP gave cmd lines too)
Click to expand...
Click to collapse
Yeah thanks i finally got it
Norside said:
It would have been totally awesome if @dorimanx did a tutorial once where he shared how he makes his (stock) kernels..anyways will this work on a 11 year old PC with 1gb RAM and 1,7 GHz processor?
Click to expand...
Click to collapse
This is willpower
Boris31 said:
Yeah thanks i finally got it
Click to expand...
Click to collapse
Now you have what start modifying your kernel!
ferreirawax said:
Now you have what start modifying your kernel!
Click to expand...
Click to collapse
Yeah finally i'v built a kernel now i need to learn to modify it. Any good guide for that maybe
Boris31 said:
Yeah finally i'v built a kernel now i need to learn to modify it. Any good guide for that maybe
Click to expand...
Click to collapse
For that you need to read a little about git, then see the changes made by other developers and place them in your own kernel.
ferreirawax said:
For that you need to read a little about git, then see the changes made by other developers and place them in your own kernel.
Click to expand...
Click to collapse
Thanks, I'm finally beginning to understand Linux terminal commands.
@ferreirawax
I am aware that the rules prohibit posting simple thanks but I feel duty do it here because it is really nice to find shared topics showing how to fish rather than giving fish.
Big thank you to you so, great initiative !
@ferreirawax
Thanks for taking the time to post this. I would love for more people to try their hand at Custom Kernels! Otherwise you end up with the same kernel, different name.
DTB combiner:
Input directory: '/home/bolt890/dev/dcc/msm8974/aosp/arch/arm/boot/'
Output file: '/home/bolt890/dev/dcc/outputs/dt.img'
Found file: msm8974-v2-2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-v2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
=> Found 0 unique DTB(s)
error: dt.img not found, failed to make target
Keep getting this error
bolt890 said:
DTB combiner:
Input directory: '/home/bolt890/dev/dcc/msm8974/aosp/arch/arm/boot/'
Output file: '/home/bolt890/dev/dcc/outputs/dt.img'
Found file: msm8974-v2-2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-v2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
=> Found 0 unique DTB(s)
error: dt.img not found, failed to make target
Keep getting this error
Click to expand...
Click to collapse
Seem to lack the DTC binary on your system. Download the attachment and follow:
Code:
sudo cp ~/dtc.zip /usr/bin/dtc
Or you can simply remove the extension and copy the file to /usr/bin any other way, may be necessary to a log-in/out for effect. Then compile again.

Categories

Resources