Best way to compile tcpdump? - Android Q&A, Help & Troubleshooting

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.

Related

Howto get WiFi running on Ubuntu

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 !

Best way to compile Busybox?

After searching around , it seems there are several ways to compile Busybox.
Codesourcery toolchain direct compile method
http://mobisocial.stanford.edu/news/2011/02/compile-busybox-on-android-os/
http://omappedia.org/wiki/Android_Installing_Busybox_Command_Line_Tools
Running make gives:
gcc: error trying to exec 'cc1': execvp: No such file or directory
What exact folder belongs in the path?
What exact statement belongs for the cross compiler prefix in make menuconfig?
Source integration method
https://github.com/Gnurou/busybox-android
This method wants you to include the files with the android source and rebuild.
Is there a way to instead compile this directly?
Scripted NDK compile method
http://matrixrewriter.com/wiki/tiki-index.php?page=Building+BusyBox+binaries+for+Android
This method goes well until near the end of the script when the script returns:
/usr/include/string.h.274: error: expected ')' before '!=' token
I am completely lost after searching for this error.
Which of these three methods, if any, is best? Is there another easier way?

(Q) First time Compiling

Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
I don't known, maybe gcc
try checking your mount options?
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
SgtPropain said:
Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
Click to expand...
Click to collapse
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
glarepate said:
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
Click to expand...
Click to collapse
just as i thought. that might have happened. its worth a try though.
SgtPropain said:
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
Click to expand...
Click to collapse
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
I actually tried that already.... I have been at this for about three days. XDA was my last resort as I like to figure things out on my own. However I'm stuck @ a brick wall. I have edited /etc/fstab and removed the bs mount options..remounted same error. Mind you I'm doing most of this from a Virtual Environment. Starting to think this is my issue, but it doesn't explain the same error on machine #2. Maybe I'm doing it right, possibly a bad git clone?
thachtunganh said:
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
Click to expand...
Click to collapse
Yeah that would be great if I hadn't done that already. In my post I stated I had replaced the .config from my device. I have literately tried everything but doing this from base. IE not from a VM. I appreciate the help but its a "no go".
Beginning of my .config for proof
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9-ck2
# Wed Apr 11 20:41:44 2012
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_KTIME_SCALAR=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
Setting up a third independent machine Ubuntu x86 testing..
where do you get that .config from?
pull /proc/config.gz
SgtPropain said:
pull /proc/config.gz
Click to expand...
Click to collapse
What device are you using, and what kernel are you using.
for the time being you can use prebuilt kernel...no need to build kernel from source....
williamcharles said:
for the time being you can use prebuilt kernel...no need to build kernel from source....
Click to expand...
Click to collapse
He isn't building ROM from source. He is learning how to build a kernel from source.
Sorry for the delay; had 2 deaths in the family.
I setup my third box and again I get the same results. I really don't know where I'm going wrong. This kinda makes me lean to, I have bad source code. I'm no pro C programmer; however when building I get Kconfig errors. I opened said file and the comments look all messed up. The compiler I think is reading the comments as code and kicking it back giving me this error.
by the way what are you compiling and please teach me compiling i want to learn it .
I'm compiling a modified kernel for the Optimus V. I can't teach you how to compile because I don't even know if I'm doing it right.

Guide on how I build my own CM10 test builts

This is a follow up on my "old" "Guide on how I build my own CM9 test builts" thread.
Guide how I build CM10 for my Mango.
For the first time you try to build CM10.
Create ~/bin and download repo to that directory. Afterwards set executable bit to make it possible to ”execute”.
Code:
mkdir -p ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now reboot the computer.
Create ~/android/system and initialize the repository.
Code:
mkdir -p ~/android/system
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
Unpack the attached local_manifest.xml.bz2 and place local_manifest.xml into ~/android/system/.repo
Synchronise towards the current git repositories.
Code:
repo sync
Setup the environmental settings and initialize the Mango build.
Code:
. build/envsetup.sh
breakfast mango
Initialize the Mango build.
Code:
cd ~/android/system/device/semc/mango/
./setup-makefiles.sh
Download the prebuilts
Code:
~/android/system/vendor/cm/get-prebuilts
Check for new changes
Code:
cd ~/android/system/
repo sync
Setup the environment again and build the ROM (takes long time)
Code:
. build/envsetup.sh
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-10-DATE-UNOFFICIAL-mango.zip
The next times you try to build it, you only need to do the following.
Delete build.prop, if not will build.prop not get generated.
Code:
rm -f ~/android/system/out/target/product/mango/system/build.prop
Syncronise the git repositories.
Code:
cd ~/android/system/
repo sync
Setup the environmental settings.
Code:
. build/envsetup.sh
Configure/build.
Code:
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-10-DATE-UNOFFICIAL-mango.zip
EDIT (August 14. 2012): If the boot.img is not booting, is it most likely due to the bootloader bug.
To make it "work", do the following (replace mango with your own device)
Code:
cd out/target/product/mango/
rm -f ./boot.img ./combinedroot.cpio ./combinedroot.fs ./ramdisk.img
cp ./root/logo.rle ./root/waste_of_space1
cp ./root/logo.rle ./root/waste_of_space2
cp ./combinedroot/logo.rle ./combinedroot/waste_of_space1
cp ./combinedroot/logo.rle ./combinedroot/waste_of_space2
cd ../../../..
brunch mango
just a technical: is it really necessary to reboot the computer after downloading the repo binary? and if so, why is that??
bokrug said:
just a technical: is it really necessary to reboot the computer after downloading the repo binary? and if so, why is that??
Click to expand...
Click to collapse
It is only necessary on some Linux distributions, where you will not be able to execute anything from that directory, before a reboot. You can try to see if you can do it without. If it is working, do you not need it.
hnl_dk said:
It is only necessary on some Linux distributions, where you will not be able to execute anything from that directory, before a reboot. You can try to see if you can do it without. If it is working, do you not need it.
Click to expand...
Click to collapse
There's no really need to reboot - edit .bashrc in your home directory and add
Code:
export PATH=~/bin/:$PATH
Save, then run:
Code:
source ~/.bashrc
It have to work on all distros
pikpok said:
There's no really need to reboot - edit .bashrc in your home directory and add
Code:
export PATH=~/bin/:$PATH
Save, then run:
Code:
source ~/.bashrc
It have to work on all distros
Click to expand...
Click to collapse
I just want to show the "universal" way.
Not everyone is using bash
hnl_dk said:
I just want to show the "universal" way.
Not everyone is using bash
Click to expand...
Click to collapse
If someone use another shell, e.g. zsh, then he'll know what files he have to edit IMO rebooting is wasting time.
pikpok said:
If someone use another shell, e.g. zsh, then he'll know what files he have to edit IMO rebooting is wasting time.
Click to expand...
Click to collapse
no it is not, as you do not need to edit any files. It will work automatically.
It is as much a waste of time to edit the resource-definition scripts.
hnl_dk said:
no it is not, as you do not need to edit any files. It will work automatically.
It is as much a waste of time to edit the resource-definition scripts.
Click to expand...
Click to collapse
Reboot - about 1 min
Edit one file and paste single command in terminal - for me it's 10secs
But it comes to offtop discussion, so it would be better to end it now
@edit - now when I think about it... bin in home folder won't be added to PATH automatically, at least in Arch Linux. Maybe Ubuntu is more "intelligent" :laugh:
pikpok said:
Reboot - about 1 min
Edit one file and paste single command in terminal - for me it's 10secs
But it comes to offtop discussion, so it would be better to end it now
@edit - now when I think about it... bin in home folder won't be added to PATH automatically, at least in Arch Linux. Maybe Ubuntu is more "intelligent" :laugh:
Click to expand...
Click to collapse
It does not take that long for me to make a reboot
No matter what, is it always good to have more methods to make something work.
It did the last time I tried Arch Linux... and no I am not using Ubuntu (too flashy for me )
Assuming that there is an entry in your ~/.profile that adds ~/bin to PATH, a reboot won't do anything that logout/login wouldn't. Furthermore, logout/login (in this case) won't do anything that sourcing ~/.profile wouldn't. So, simply issuing "source ~/.profile" is sufficient on most distributions. If you are using a distribution or a shell that doesn't do this by default, then you probably already know what you need to do.
I do, however, commend hnl_dk's efforts to make things simpler for newcomers to Android and Linux, even if it's not the the "fastest" or the "best" way. Whenever you start getting into one of those "what if?" arguments, things tend to spiral out of control. Sometimes it's better to just make a few assumptions and go with what is most likely to work.
A reboot might be a bit of an overkill, though. :laugh:
Can't run 64-bit prebuilts on my 32-bit Linux
I have a 32-bit Linux box so get the errors:
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: cannot execute binary file
Had a quick look around, but are there gcc etc. prebuilts for 32-bit Linux boxes?
TIA,
AK-A
ak-a said:
I have a 32-bit Linux box so get the errors:
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: cannot execute binary file
Had a quick look around, but are there gcc etc. prebuilts for 32-bit Linux boxes?
TIA,
AK-A
Click to expand...
Click to collapse
Did you try to build it as described?
It is working fine on my 32bit debian machine.
If not, please describe hos you try it build it.
hnl_dk said:
Did you try to build it as described?
It is working fine on my 32bit debian machine.
If not, please describe hos you try it build it.
Click to expand...
Click to collapse
Yeah, followed the instructions as per the first post. Will re-try and see if I missed/messed something and report back.
Hey !!! Do you think I should post my AOSP errors in this thread...so that its easier for us to keep track..?? :highfive:
As this is a Tutorial Thread for "how to build cm10 on your own" I don't think it makes sense posting errormessages of errm. "android open source project"? As I am writing this I recognize that I do not really understand what you mean.
CosmoDroid said:
Hey !!! Do you think I should post my AOSP errors in this thread...so that its easier for us to keep track..?? :highfive:
Click to expand...
Click to collapse
Like Snoopo is saying, should that be in this thread. Compiling AOSP is not as "user friendly" as CM, as our devices are officially supported by CM and not AOSP.
If you want, can you make a new thread about compiling "AOSP - Jelly bean".
i always stop at "repo sync"
i always stop at "repo sync"
and it always tell me
"Fetching projects: 21% (66/313) fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=??????"
can you help me
thanks
shufuking said:
i always stop at "repo sync"
and it always tell me
"Fetching projects: 21% (66/313) fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=??????"
can you help me
thanks
Click to expand...
Click to collapse
Same also happens for me, then I try again and again and again and then it is working.
Lots of people are accessing github, and there is only a limited "whole" for the data to get through.
hnl_dk said:
Same also happens for me, then I try again and again and again and then it is working.
Lots of people are accessing github, and there is only a limited "whole" for the data to get through.
Click to expand...
Click to collapse
thanks for your suggestion
finally i make it.
another question.
when i perform " brunch smultron"
i got lots of "cannot execute binary file"
and final "make: *** [out/target/product/smultron/obj/lib/crtbegin_static.o] Error 126"
do you know what it means?
shufuking said:
thanks for your suggestion
finally i make it.
another question.
when i perform " brunch smultron"
i got lots of "cannot execute binary file"
and final "make: *** [out/target/product/smultron/obj/lib/crtbegin_static.o] Error 126"
do you know what it means?
Click to expand...
Click to collapse
without more details, my best guess is that you may be building it on a FAT32 or NTFS partition?
then there is a good chance that linux is not able to read the executable bits.

[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