[Q] Compiling iptables - Android Software Development

Hello.
I'm looking to compile iptables from the android git repo (with the LED trigger target patch). Hacking the source and patch was easy, but I'm not sure how to compile it. There's an Android.mk file in the source I pulled, but since it isn't structured like a JNI project, the NDK doesn't seem to help. Any suggestions on how I would go about compiling it?
I don't have much experience with the Android SDK and NDK (mostly do kernel hacking), and good ol' Google didn't help much either.

To run iptables you have to compile them in into the kernel or build as a kernel module. To do that you need to download the kernel for you specific device.
As for the actual iptables program, you can compile it using the agcc script. Since this site doesn't let new users to post the link just google for "vlad android-cruft" to find it.
PM me for details

Related

NFS kernel module compilation problems

Hello everybody,
I am new at kernel building and so please bare with me. I have been using kernel modules for CIFS from this thread http://forum.xda-developers.com/showthread.php?t=2003836http://forum.xda-developers.com/showthread.php?t=2003836 by H3g3m0n and all is working fine.
But since I couldn't find modules for NFS I decided to compile them myself. I had no problem in building the kernel and modules for stock android kernel gaf9c307 4.2.2 but the modules just won't load. That is why I also created the CIFS modules. I taken a look at the md4.ko modules with modinfo command and they both seem exactly the same. I have attached the md4.ko module which is used in CIFS just to show the example, the md4_works.ko is the module by H3g3m0n and the md4.ko is mine.
Can anybody please help me. What am I doing wrong. I have appended the steps I have taken when building modules.
git clone https://android.googlesource.com/device/samsung/manta
cd manta/
git log --max-count=1 kernel
git clone https://android.googlesource.com/kernel/exynos.git
cd exynos/
git checkout af9c307
export PATH=$(pwd)/arm-eabi-4.6/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=/home/ziga/ndk/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
make manta_defconfig
make
make menucofing
make modules
Click to expand...
Click to collapse
Thank you for all your help
Come on guys, nobody knows this? Then please tell me how I can get in touch with H3g3m0n who compiled the working modules!
Thank you.

[GUIDE] How to build AOSP kernel from source S4 Mini (i9195 & i9190)

Welcome to Kernel build guide.
WITH THIS METHOD YOU WILL GET installable zip for your kernel.
My english is not best but i think you all will understand this guide . I write this guide because i dont own S4 Mini anymore and unfortunally i cant build kernels or roms anymore for s4 mini.
this is my kernel build method. you will have everything (tools) for build a kernel for s4 mini device. if you have questions, then ask it here. this kernel method is working only aosp based kernel (not tested for tw kernel but it may also work but you need ramdisk of tw kernel)
be sure you have packages installed for build something like this, or edit or clone a github source. look at cm kernel build guides.
1. Download build-s4-mini-kernel.zip [here]
extract it to root of your user directory (my is /home/proxuser/)
2. We need toolchain 4.7.4 by Christopher83 original thread [here]
download
arm-unknown-linux-gnueabi-linaro_4.7.4-2013.07-build_2013_07_12.tar.bz2
extract arm-unknown-linux-gnueabi-linaro_4.7.4-2013.07 folder to toolchains folder (home/yourusername/toolchains) and name it linaro_4.7.4
Download Build scripts from my source here
download:
- abooteur_3g.img
- abooteur_lte.img
- build_all.sh
- build_eur_3g.sh
- build_eur_lte.sh
- build_master.sh
- mkbootfs
- mkbootimg
and put them to your kernel folder "root folder of your kernel".
if you want clone a kernel source: example CyanogenMod's cm-10.2 kernel then
open Terminal, and be in user root folder /home/yourusername (just open terminal and your there)
Code:
git clone https://github.com/CyanogenMod/android_kernel_samsung_msm8930-common.git -b cm-10.2
if you want clone my Kartal kernel then
Code:
git clone https://github.com/proxuser/kartal.git -b master
it will named "if you cloned cyanogenmod kernel android_kernel_samsung_msm8930-common" if you clone my kernel then it will named "kartal"
you can rename kernel folder, its not problem.
if you want change of kernel name(example kartal), then go yourkernel/arch/arm/configs/kartal_defconfig and edit CONFIG_LOCALVERSION="-Kartal" change only "Kartal" for your kernel's name. if you want change defconfig example "kartal_defconfig" to "yourkernel_defconfig" then you need change it in build_master.sh too that it builds with your config file.
if you downloaded your kernel source and your build tools are there then lets start
Open terminal
type
Code:
cd yourkernelfolder
for build both phones i9195 & i9190
Code:
./build_all.sh
if it denies access for build_all.sh then type
Code:
chmod 777 build_all.sh
you can give all files access with this command.
for build i9195
Code:
./build_eur_lte.sh
for build i9190
Code:
./build_eur_3g.sh
finally it will start building. it will done within 4-5 min. depend your pc speed.
after it builds succesfully, your kernel will be in your /home/yourusername/Packages/ folder
IF YOU WANT add new changes from CM or other kernel to your kernel
then open Terminal
cd yourkernelfolder
git remote add CyanogenMod https://github.com/CyanogenMod/android_kernel_samsung_msm8930-common.git
git fetch CyanogenMod
this will fetch CyanogenMod kernel changes but it will not apply to your kernel. you will add changes step by step yourself. copy commits SHA from CyanogenMod kernel and
open Terminal
Code:
git cherry-pick 2108e6c3109ae126590a81876145a1f17d6771b5
if you get success on pick a commit then you will get a message like this
Code:
[email protected]:~/kernel$ git cherry-pick a41564437a0eb910d0347d274456f3f0116c3c77
[master 5dd0694] net-fixes: flow_dissector: prevent an infinite loop (CVE-2013-4348)
Author: Eric Dumazet <[email protected]>
1 file changed, 3 insertions(+), 1 deletion(-)
if you get an error like this
Code:
[email protected]:~/kernel$ git cherry-pick 63ee35463ea3ec5d4e8f2c60ad0f70abd8463733
error: could not apply 63ee354... ARM: 7809/1: perf: fix event validation for software group leaders
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
thats mean it is not applied to your files. just type "git status" to see what files are not modified.
then type: git reset --hard for go to your last commit.
this will make changes of error commit back.
Work always with git because with this way you can save a lot your changes and you can restore anything anytime.
Credits:
XDA Community
Christopher83 for toolchain
ktoonsez for build scripts
arco68 for s4 mini kernel development
cyanogenmod
I really appreciate these posts! :good:
wonderful. thank you very much :good:
Srry wrong topik..
I have built your kernel successfully, but after flashing the .zip the device is stuck on the "Samsung Galaxy S4mini" Bootscreen.
I tested it with the this two roms:
- cm-10.2-20131102-SNAPSHOT-M1-serranoltexx
- CARBON-JB-UNOFFICIAL-20131026-1327-serranoltexx
Do you have any idea why it's not working?
Edit: I used arcos source and it is working fine now
@junkyde
Can't get the stock kartal kernel to build.
What for OS are you running in your virtual box? ubuntu? 86x or 64x?
Did you install any other buildtools?
there isn't a stock kartal kernel. kartal kernel is aosp. I am using Linux Mint 15 in a 64bit version on Virtual Box.
Ps: I had also my troubles with ubuntu x86 and x64, thats why I switched.
junkyde said:
there isn't a stock kartal kernel. kartal kernel is aosp. I am using Linux Mint 15 in a 64bit version on Virtual Box.
Ps: I had also my troubles with ubuntu x86 and x64, thats why I switched.
Click to expand...
Click to collapse
Thanks for you reply!
With "stock" I meant: without changing anything....
I will try mint 15 64bit with xfce!
you can also take a look into this tutorial: http://forum.xda-developers.com/showthread.php?t=1748297
junkyde said:
you can also take a look into this tutorial: http://forum.xda-developers.com/showthread.php?t=1748297
Click to expand...
Click to collapse
Got it working under Ubuntu 12.04 64bit.
Had some troubles because mkboofs and mkbootimg could not be found.
After installing : "sudo apt-get install ia32-libs" everything was fine
Now I will try to compile the 10,1 kernel from source, lets see how that goes..
Keon91 said:
After installing : "sudo apt-get install ia32-libs" everything was fine.
Click to expand...
Click to collapse
Yes I know, that this is required, when you are working with a 64bit system. But I couldn't get this installed in Ubuntu. On Mint everything worked fine. But I am glad you made it
@junkyde
After some trial and error I've succesfully compiled the cm 10.1 kernel.
Can you give me any direction on how to compile the custom liblights?
Do I need to download the full cm 10.1 source?
I used proxusers tutorial on how to build carbon rom. Downloaded full rom, modified lights.c and compiled whole rom.
Can someone build a kernel for the i257m
It would be nice if there was some kernel mods for this. especially just a near stock one with insecure root permissions.
The source is out if anyone was wondering
opensource.samsung.com/reception/receptionSub.do?method=search&searchValue=i257
IF YOU WANT add new changes from CM or other kernel to your kernel ...
Click to expand...
Click to collapse
What do you mean by this? Add changes that cm has done after you last downloaded them or changes you want to do to customize the kernel?
git cherry-pick 2108e6c3109ae126590a81876145a1f17d6771b5
Click to expand...
Click to collapse
What does this means and where do you get that ID? I would think that after fetching the changes from the source it will have been added to all the files you have already downloaded. Thanks for the tutorial!
---------- Post added at 05:58 PM ---------- Previous post was at 05:55 PM ----------
junkyde said:
I used proxusers tutorial on how to build carbon rom. Downloaded full rom, modified lights.c and compiled whole rom.
Click to expand...
Click to collapse
junkyde here you don't mention lights.c, aren't they needed for 10.1? http://forum.xda-developers.com/showpost.php?p=49958578&postcount=215
yes you need custom liblights for BLN, but since I have compiled them already, you can use the one from inside the .zip of my kernel.
junkyde said:
yes you need custom liblights for BLN, but since I have compiled them already, you can use the one from inside the .zip of my kernel.
Click to expand...
Click to collapse
Doesn't it matter that you compiled it for 10.2? Also, where is the source for liblights?
proxuser said:
Welcome to Kernel build guide.
WITH THIS METHOD YOU WILL GET installable zip for your kernel.
Click to expand...
Click to collapse
On ubuntu I got this message after the process took a while:
KERNEL DID NOT BUILD! no zImage exist
Click to expand...
Click to collapse
At some point in the process it printed:
[email protected]:~/Development/SGS4Mini/build-s4-mini-kernel/android_kernel_samsung_msm8930-common$ ./build_all.sh
...
...
...
rm: cannot remove `/home/rpgdev/Development/SGS4Mini/build-s4-mini-kernel/Packages/AOSP/zImage': No such file or directory
rm: cannot remove `arch/arm/boot/zImage': No such file or directory
Make the kernel
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
***
*** Can't find default configuration "arch/arm/configs/kartal_defconfig"!
***
...
...
...
Click to expand...
Click to collapse
And if I go there I indeed can't find the zImage, where can I get it?
PS: Used the characters "..." to denote abridgment of the compilation verbose printout.
Forgot to add, I'm downloaded the cyanogenmod kernel from build 10.1 since that's the cyanogenmod version I use and for the one I need to make this mod, could this be the cause of the problem? Googling it seems that the kernel version you use may need a specific toolchain version.
rpgdev said:
Doesn't it matter that you compiled it for 10.2? Also, where is the source for liblights?
Click to expand...
Click to collapse
I think it doesn't matter, I used the same for different roms and it worked. Source is as I said the lights.c file inside of the rom.
rpgdev said:
Can't find default configuration "arch/arm/configs/kartal_defconfig"!
Click to expand...
Click to collapse
This is why zImage can't be build.
junkyde said:
I think it doesn't matter, I used the same for different roms and it worked. Source is as I said the lights.c file inside of the rom.
This is why zImage can't be build.
Click to expand...
Click to collapse
I'm not using kartal but the one downloaded from cm. Thought the instructions were generic and the script took into account wether you had downloaded the kernel from cm or kartal :/, I did go inside the directory with all the defconfig files, how do I know which one should I point it to on cm-10.1 kernel?
Regarding the lights.c then I just have to include that library on the same directory you put it in your kernel AND add the changes you pointed to here http://forum.xda-developers.com/showpost.php?p=49958578&postcount=215 and I would be set?
Thanks!

[Q] Kernel Panic s3cfb on SMDK4412

I am porting OmniROM to UrBetter s702 devices (Hyundai T7s/T7) using the Mixtile Garage board (mixtile.com) as a reference design. The CPU is Exynos4412.
The Mixtile Garage board comes with Linux kernel 3.0.15 and I am trying to update to 3.0.64 using the smdk4412 kernel source tree from Omni.
After creating the necessary mach-mixtile4x12.c file on arch/arm/mach-exynos (using mach-smdk4x12.c as a reference and adapting it, it compiles but on boot is panicking on s3cfb_clk_on: http://paste.omnirom.org/view/0d0fd2ec
The modified kernel tree is here: https://github.com/Frontier314/kernel_smdk4x12
The kernel source is compiled with GCC arm-eabi-4.7; gcc-arm-eabi-4.4.3 has the same problem so it should be something in the source tree.
Any ideas on how to fix this?
Many thanks in advance.

[Devs] Looking for a kernel base to work with? Start here.

Hello!
I'm hoping to get custom kernel & rom development up and running quickly for the G5 community, and have created a git repository which provides a kernel source base to start with.
What I've done is taken the v10a release sources and modified them to work with build directories and multiple variants. (should they be unlocked or receive the CodeFire treatment at any time)
Here's where to start: https://github.com/jcadduono/nethunter_kernel_g5/tree/stock-6.0
If you'd like a somewhat updated kernel, the stock-6.0.y branch will be patched from Linux 3.18.y branch at kernel.org, see:
https://github.com/jcadduono/nethunter_kernel_g5/tree/stock-6.0.y
Different from the absolute stock defconfigs, I've made the following changes:
Module signature verification disabled
Unnecessary debugging flags separated into debug_defconfig (use EXTRA_DEFCONFIG=debug_defconfig to enable them)
Flags that were previous set to module (=m) have been set to =y (built-in) in case incompatibilities are unable to load stock modules
Each known variant & target is listed in build.sh comments. The default variant when building with ./build.sh is h850 with debugging disabled.
When using the Makefile, VARIANT_DEFCONFIG=variant_xxx_defconfig adds the additional settings per variant to the target defconfig. (by default stock_defconfig)
build.sh is set up to automatically build a dtb.img after creating the kernel Image.gz based on whichever variant you've built for.
You can use ./menuconfig.sh to modify the stock defconfig, or you can copy the stock_defconfig to another name such as my_defconfig and use TARGET=my ./menuconfig or TARGET=my ./build.sh
It's easier to just set the default target in build.sh/menuconfig.sh - each have their configuration options near the top of the files.
Be sure to edit the config variables in build.sh and menuconfig.sh before using. The VERSION file gets appended to the kernel version shown in `uname` when using build.sh.
The toolchain must be pointed to the correct location before it can build. Be sure to have libncurses5-dev and colordiff packages installed for menuconfig.sh.
For a toolchain, I recommend using the GCC Linaro aarch64 5.3 2016.02 release. You can use basically any aarch64 toolchain though.
Download here: https://releases.linaro.org/compone...o-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz
You can start by forking my repository on GitHub and giving it your own name if you like. Extra interesting commits are available in the other branches that you should be able to cherry-pick without issues should you be interested in them.
Looking to test your kernel Image.gz + dtb.img?
Look no further than my LazyFlasher repository!
See here: https://github.com/jcadduono/lazyflasher/tree/kernel-flasher
Simply do:
Code:
git clone -b kernel-flasher https://github.com/jcadduono/lazyflasher.git kernel-flasher
cd kernel-flasher
cp /path/to/Image.gz /path/to/dtb.img ./
make
(simply place your kernel Image.gz (optional) and dtb.img (optional) in the root of the repository and type make!)
And you'll have your own dynamic kernel flashing zip for custom recoveries!
The kernel-flasher repository is capable of great things. You can create scripts in patch.d to do anything you like.
Add files to the ramdisk-patch folder and create a script that copies them into the $ramdisk folder and they will be rebuilt into the ramdisk!
By default, no-verity-opt-encrypt is there as an example.
Using setprop in patch.d scripts allows you to set props in default.prop with ease.
Add functions to patch.d-env to make them globally usable across patch.d scripts.
See other branches for more examples, like how to add f2fs lines to the fstab, or patch for system mode SuperSU.
LazyFlasher is the installer used in the Kali NetHunter project. You can also find more examples in the kali-nethunter GitHub!
Good luck, and happy kernel developing!
Thanks so much for posting this.
Code:
./obligatoryn00bstatement
Sorry for not being too knowledgeable here (yet?) and if this sort of comment doesn't belong.
I am a Computer Science major who really wants to learn some skills to hopefully give back to the community.
Is this an area that I could be of use or should I perhaps spend more time going through material on the XDA-U site?
toefurkey said:
Thanks so much for posting this.
Code:
./obligatoryn00bstatement
Sorry for not being too knowledgeable here (yet?) and if this sort of comment doesn't belong.
I am a Computer Science major who really wants to learn some skills to hopefully give back to the community.
Is this an area that I could be of use or should I perhaps spend more time going through material on the XDA-U site?
Click to expand...
Click to collapse
I'm a little tired and somewhat intoxicated here at 3:45 AM so this is going to be a bit of rambling and so on...
While it's certainly a good idea to study up on what interests you before digging into it, sometimes it really can be easier just to dive in to your hobby.
I'm a high school drop out, never made it through college. Everything I've learned is by taking the great work done by the open source community and reading their code and applying it to other projects. That's the great thing about open source and nonrestrictive licenses. Everything is there for you to figure out, make changes, borrow code, run into problems, and the best part - search for solutions that others have already provided in their struggle to do exactly what you're doing.
Have an idea for a great feature? You can probably find it already implemented in another kernel somewhere.
Find the work someone else has done and modify it to fit your needs, but don't forget to give them credit for their work that you've used!
If you're going to start writing your own code, be certain to keep it tidy and variables/functions with meaningful names and comments so that not only others can understand and learn from it, but that you can return to the same code later on and understand it. Confusing code is how bugs tend to show up and become almost impossible to squash.
What I'm trying to get across here is don't be afraid to not be original. Don't be afraid to use others work to accomplish what you want, so long as they receive some attribution. The quickest way to learn how things work is by understanding what's already there and available to you.
You'll notice that there's projects all over XDA with special features ported from one device to another. Isn't it great having the all the best features people have added to other devices on one really nice device that you have?
PS I've never been on the XDA-U site before, so I can't give an opinion there.
I forgot what I was on about so I'll end this here lol.
?jcadduono you're on fire man thank you for everything you've been doing so far with such little resources.
Sent from my LG-H820 using XDA-Developers mobile app
jcadduono, thanks for the info and wonderful words of wisdom!
I totally agree on what you're saying and my goal is to try diving into this as a hobby. The hardest part for me isn't so much the coding part, but just figuring out a starting point to get grounded and build upon and I feel like what you've provided here is perhaps the starting point I need. Now it's just up to me to push myself in my free time.
Hi, i am new to kernel developing, but i did some roms myself before, so no total linux noob.
I cloned your 6.0.y and want to start from there, but im a little bit lost. Do i need to follow the steps @ github, or is your branch kinda pre setup ?
Toolchain path is also set to the one you gave a link too.
Pinu'u said:
Hi, i am new to kernel developing, but i did some roms myself before, so no total linux noob.
I cloned your 6.0.y and want to start from there, but im a little bit lost. Do i need to follow the steps @ github, or is your branch kinda pre setup ?
Toolchain path is also set to the one you gave a link too.
Click to expand...
Click to collapse
Hopefully once the toolchain path is set you should only need to run ./build.sh to actually build the kernel and dtb.
You may be missing some items for menuconfig.sh, which should just be solved by apt-get install colordiff libncurses5-dev
If building inside a ROM tree, it should be fairly simple for developers to adjust their ROM configs to add more to the kernel make command line, such as VARIANT_DEFCONFIG.
No matter what i do, kernel builds, but no dtb.img will be created. Any ideas where to look / what to test ?
I have stock-6.0.y, and did the h850 one.
Hi, is the stock-6.0.y branch removed?
I didnt find it. and need the right defconfig
greetz
mericon

Kernel Compilation procedure

I am new to android kernel build stuff. So please forgive me if this is not the right platform to raise this query.May i know the steps involved in building the kernel? I am trying to build the stock kernel updated by oneplus in github. Any help or supporting links about kernel compilation will be of utmost help to me. Thanks!
https://forum.xda-developers.com/an...erence-how-to-compile-android-kernel-t3627297
Kernel devs most likely uses scripts to compile their kernel which you can probably find in their github and adapt for yourself

Categories

Resources