yashsingh1/xdaforums huggingface dataset:
[Samsung Epic 4G Touch] obelisk79:
Thanks for this effort. Unfortunately I don't have anything to contribute to your work. I consider myself a budding developer and have been diligently teaching myself to program with the use of some great texts over the last 2 weeks. While I have much to learn this guide and hopefully any additions you make will help me dive nose first into Android development like I've been hoping to for the last couple of years.

I hope you continue to add more into this guide and it becomes a great resource for others like me.

Great Job!
[Samsung Epic 4G Touch] shanenielsen1234:
I hope it helps!
[Samsung Epic 4G Touch] SweetwaterBurns:
I'm away from my computer for a while so can't check myself, but I know when compiling kernels for x86 there's an option to disable module version checking. Might be a way to work around the issue.
[Samsung Epic 4G Touch] interloper:
I've tried both options in the kernel config menu. I'm going to try to compile the kernel a few times with the driver NOT a module...
[Samsung Epic 4G Touch] agat63:
Any one was able to figure out the mystery of broken WiFi?

I'm at the end of my rope here and no matter what I do wifi is not working.

Recovery is part of the kernel everything else looks fine except WiFi.

And my kernels are much smaller than working ones. May by there is the problem that not everything is getting into it.

Calkulin's kernel is about 8MB

Rogue kernel is 8MB

and my kernel is 5.4Mb.

Quite a difference.

Any ideas or suggestions.
[Samsung Epic 4G Touch] interloper:
The newest rogue kernel is about the same size as yours. Mine are about 7mb. But still no wifi. I haven't worked on it much in the last week...I've checked code against github, read everything I can find. Kinda sad about it.
[Samsung Epic 4G Touch] agat63:
I did run ddms while trying to activate wifi.

It just can't load drivers and saying that a /.cid. blah blah blah file is missing.

This is log from ddms:

02-02 22:26:38.256: E/WifiHW(3350): Cannot open "/data/.cid.info": No such file or directory

02-02 22:26:38.263: E/WifiHW(3350): return of insmod (args:firmware_path=/system/etc/wifi/bcm4330_sta.bin nvram_path=/system/etc/wifi/nvram_net.txt) : ret = -1, Exec format error

02-02 22:26:38.266: E/WifiService(3350): Failed to load Wi-Fi driver.
[Samsung Epic 4G Touch] interloper:
What's strange about that is :the missing file is not present while a working kernel is installed either. Try enabling wifi then immediately after adb shell and type dmesg. Report will show a failure to insmod the module. Trying to manually insmod the module with terminal emulator produces the same error message. I think the error is a minor issue we just can't find.
[Samsung Epic 4G Touch] agat63:
I agree with you. It should be something minor. Otherwise kernel wouldn't work.

Everything else looks fine. Root, recovery, calls, sms, etc, etc., etc...

Just hope some one who had success building working kernel can help us to locate the problem.
[Samsung Epic 4G Touch] dtm_stretch:
Make sure to check the vibration also, it is usually broken when the wifi breaks.
[Samsung Epic 4G Touch] agat63:
Good catch.

No vibration either.
[Samsung Epic 4G Touch] odub303:
Mod, please sticky this thread, thanks!
[Samsung Epic 4G Touch] MikeC84:
can kernel dev please come in here and let us know what we need to do to compile this with working WiFi and haptik feedback.

It annoying we cant figure this out...

I also just tried adding smartass and smartassV2 but dont show up in setCPU
[Samsung Epic 4G Touch] agat63:
I tried different version of arm-2009q3 toolchain. No WiFi

Tried arm-2011q3 toolchain. No WiFi

Tried uClibc toolchain. No WiFi

Tried crosstool-ng-1.13.2. No WiFi.

Used: make xconfig and went over all config settings in GUI for all toolchains. Change WiFi from modular to driver. No WiFi.

All zImages came about same size and worked very similar.

So I guess it's not the toolchain it's something else.

Any ideas? Suggestions? Directions?
[Samsung Epic 4G Touch] SweetwaterBurns:
My computer is in storage for now, so can't check on my own builds, but is the proper firmware being loaded by the module or driver? Not sure if it needs to be in the initramfs or not. I'm kind of just throwing stuff at the wall in the hopes that someone else can do the hard work before I sit down and work on my own...
[Samsung Epic 4G Touch] agat63:
I was using source from Samsung site.

GB kernel source and GB updated source.

I have tried initramfs from many sources and extracted ones from different zImage files.
[Samsung Epic 4G Touch] dtm_stretch:
Have tried you swapping out the files from the new touch recovery with the files posted in the op to see if compiling the new recovery might not break wifi and vibration?
[Samsung Epic 4G Touch] agat63:
New touch recovery?

What recovery and from where?

I used CW recovery in my tries.
[Samsung Epic 4G Touch] MikeC84:
IMO I don't think it has to do with the initramfs. We build the modules before we put them into the initramfs so as long as you put them in lib/modules it should work but unfortunately it not.

Don't think a recovery will help as it is just a file in the initramfs. I already have steady hawkin recovery on my kernel just wifi and haptik don't work.

Has to be something else. I reached out to steady hawkin. He said he would help us but he has 5projects he is currently working on so it may be a while.

Also been talking to Hero_Over but he been pretty busy as well and said he would help me when he at his computer.
[Samsung Epic 4G Touch] agat63:
Well.

That's mean we have to be patient and wait wile working on other stuff.

Right now I'm trying to make a transparent contacts/dialer as I had on my moment.

Keeping myself busy and waiting for help.
[Samsung Epic 4G Touch] MikeC84:
I know I already changed the battery images and app drawer to 4x4 with 5 icon dock on calkulin rom lol
[Samsung Epic 4G Touch] dtm_stretch:
I am working on a green ICS theme to keep busy.
[Samsung Epic 4G Touch] SweetwaterBurns:
Another thought, but has anyone tried not putting the modules in the initramfs and pushing them to /system/lib/modules instead? Only building the kernel once for everything. Not sure if there are different requirements (or technical conventions) for this phone, but I know many kernels for other phones are distributed with them separate from the boot image.
[Samsung Epic 4G Touch] MikeC84:
Just started a compile should be done in less than a min or two but where would I push it to if it gets packaged into the zimage during compile? Don't even know where I would push he files to...

Lol it done already..
[Samsung Epic 4G Touch] agat63:
I guess I got an idea what is going on.

I did check the /kernel/usr folder. Another kernel dev did suggest that. Wile building a kernel data is stored there.

There is an archive file named initramfs_data.cpio.lzma

It shows what has been packed into kernel.

There is no /lib/modules folder in there.

Also there are 2 files modules.buildin and modules.order.

Both are empty in my case.

You guys can check it as well. Let see if we have same results.

If yes we gotta figure out why modules have not been packed into zImage.
[Samsung Epic 4G Touch] MikeC84:
arch/arm/plat-samsung/include/plat/regs-serial.h:274: warning: 'struct uart_port' declared inside parameter list
arch/arm/plat-samsung/include/plat/regs-serial.h:274: warning: its scope is only this definition or declaration, which is probably not what you want
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
CC drivers/net/wireless/bcm4330/dhd.mod.o
CC drivers/samsung/j4fs/j4fs.mod.o
CC drivers/samsung/vibetonz/vibrator.mod.o
CC drivers/scsi/scsi_wait_scan.mod.o
CC drivers/staging/westbridge/astoria/switch/cyasswitch.mod.o
LD [M] drivers/bluetooth/bthid/bthid.ko
LD [M] drivers/net/wireless/bcm4330/dhd.ko
LD [M] drivers/samsung/j4fs/j4fs.ko
LD [M] drivers/samsung/vibetonz/vibrator.ko
LD [M] drivers/scsi/scsi_wait_scan.ko
LD [M] drivers/staging/westbridge/astoria/switch/cyasswitch.ko
AS arch/arm/boot/compressed/piggy.gzip.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

Here the last part of my compile and it looks like the kernel modules where added even though I removed them from initramfs...

Or maybe not lol what does LD mean? Ill compile with them in the initrmfs and see if that changes...
[Samsung Epic 4G Touch] dtm_stretch:
Thanks, I will give this a try in a few hours I am just taking care of some things this morning.
[Samsung Epic 4G Touch] interloper:
That is super helpful. Thanks a lot! I too will have some time later to put some of these ideas to good use. I will post results as I get them.

---------- Post added at 11:41 AM ---------- Previous post was at 11:32 AM ----------

I'm keeping busy but trying to compile the OS source updating to android 2.3.7. But its giving errors like crazy. Again, if I can make it work I will post about it.
[Samsung Epic 4G Touch] dtm_stretch:
Goodnews: your script worked and it is compiling the kernel now. I will report back shortly.

Well the kernel compiled fine, flashed fine and was about 7.1mb but it just sent me into splashscreen loops.
[Samsung Epic 4G Touch] azyouthinkeyeiz:
Error

NVM...

I'm a dip****. Figured it out.
[Samsung Epic 4G Touch] agat63:
Did try the script.

Placed kernel source folder to my desktop.

Placed initramfs folder into kernel folder.

My toolchain is on desktop as well.

Placed build.sh into kernel folder.

Opened terminal and cd to kernel source directory.

typed sh build.sh.

Kernel did build but zImage size is about 1.2 MB smaller than in my other attempts.

Checked initramfs/lib/modules and initramfs_temp/lib/modules folders.

Both are empty.

Checked initramfs_data.cpio.lzma filed in /kernel/usr folder.

/lib/modules/ folder inside it is empty as well.

Any suggestions.
[Samsung Epic 4G Touch] SweetwaterBurns:
From your kernel source directory, try running 'find -name *.ko' it should print out any modules you had set to compile, if there is nothing there check to make sure the modules compiled OK.

If anyone knows scripting, you might do some error checking...

I'm setting up Ubuntu right now so I can do some debugging myself, but tonight is also date night with the wife, so I might not have it up until later.

Dtm, try removing the .cpio from the last line and just using the directory, as that apparently worked before.

I guess, all else considered, at least I broke it in a different and new way. :rolleyes:
[Samsung Epic 4G Touch] thatdudepoops:
http://xdaforums.com/showthread.php?t=1263838

Wow have u seen this?

Sent from the future
[Samsung Epic 4G Touch] agat63:
I guess I found solution to one error message.

in /Kernel/Makefile

line 192 refers to /opt/toolchain/arm-2009q3/bin/arm-none-linux-gnueabi-

I did change that line to show path to my toolchain. No more error messages about not finding gcc at that location.

Give it a try.
[Samsung Epic 4G Touch] MikeC84:
Too bad that not for our phone...
[Samsung Epic 4G Touch] agat63:
Well.

Did compile the kernel and than extracted initramfs from zImage just to check if all modules are in place. Sure enough all newly compiled modules are in right place /lib/modules.

I think the module is compiled with errors. I guess some settings are wrong.
[Samsung Epic 4G Touch] interloper:
A lot of the code is the same. Enough to port the features we get past the current issue.
[Samsung Epic 4G Touch] agat63:
There are many tweaks to try and to implement but as long as we can't make wifi work we can't do nothing.
[Samsung Epic 4G Touch] thatdudepoops:
I haven't been able to be home long enough to play in my vm but in sure there could be some useful info in there...

Sent from the future
[Samsung Epic 4G Touch] dtm_stretch:
Did you flash the kernel?
[Samsung Epic 4G Touch] agat63:
Yep.

No wifi
[Samsung Epic 4G Touch] ih8aol:
A very will written guide. Well have to try this when I feel brave enough.

Thanks!

~Where there's a well there's a way~
[Samsung Epic 4G Touch] SweetwaterBurns:
Ok, I finally have a build environment set up, but the build fails on the wifi driver every time. Did you guys change any settings in order to get it to build?
[Samsung Epic 4G Touch] dtm_stretch:
I have only had 1 success and that was building with EK02 source and stock initramfs. I posted a screen shot on like page 3 of this thread.
[Samsung Epic 4G Touch] agat63:
Yesterday I decided to start from scratch and tried to record my steps so may be some one with more knowledge and understanding can help us figure out what we doing wrong.

Following has been done:

1. Deleted Kernel source, initramfs, toolchain.

2. Downloaded toolchain again, made sure it's correct verion too.

3. Downloaded GB updated source from Samsung site.

4. Downloaded iniramfs from Chris41's github (thanks a lot for that).

5. Set up my toolchain on Desktop of my linux machine

6. Created a folder SGS2 and extracted Kernel and initramfs into that folder.

7. Folder structure is /home/agat/SGS2/Kernel and /home/agat/SGS2/initramfs

8. Created my own tiny script to delete existing .ko files from /initramfs/lib/modules folder and kopy newly made once into it. (only 6 ko files listed in op).

9. Based on Chris41's initramfs did put together initramfs_list file and placed it into /initramfs folder (used same permissions as he did)

10. Did run 'make xconfig' in terminal.

11. In kernel general settings changed compression rate from LZMA to GZIP so I can extract initramfs from zImage to see if everything has been packed into it.

12. In config file set CONFIG_INITRAMFS_SOURCE=/path to my /initramfs_list

13. Did run make modules

14. Run script to delete old .ko files and replace them with new once in /lib/modules folder

15. Run make -j8

16. zImage came to 7.1Mb

17. Extracted initramfs from newly build zImage. All modules were there and had correct date and time stamp.

18. Flash zImage to my phone using Flashzimage script from xda site.

19. Phone rebooted by itself after flashing kernel.

20. NO WIFI.

21. Checked /lib/modules/ folder on the phone using root explorer. All .ko files were there with correct date/time stamp.

I think there are 2 things that can be wrong

Some permissions are not set correctly

Modules, especially dhd.ko and vibrator.ko are build with error

Hope some kernel dev can look at this list of steps taken and make sense out of it. I don't have any other ideas to try.

Any suggestion and/or guidance is greatly appreciated.

Thanks in advance.
[Samsung Epic 4G Touch] SweetwaterBurns:
Ok, I'll try the ek02 source. I'm also going to see if we can do anything with the siyah kernel source as it does have a defconfig for the E4GT, albeit without his tweaks, but maybe with some work, it can be done.
[Samsung Epic 4G Touch] interloper:
I'm still at it too, but no real progress to post or any new ideas. Good luck everyone.
[Samsung Epic 4G Touch] SweetwaterBurns:
Siyah kernel compiled... Just waiting for an important phone call and then I'm free to break stuff. The recovery is for the international GS2 so I imagine key mappings are probably off.

I'm going to attach my defconfig if anyone wants to try it out

Install mercurial and run 'hg clone https://bitbucket.org/gokhanmoral/siyahkernel'

either copy the defconfig to .config or to arch/arm/configs/ and run 'make siyah_e4gt_defconfig' and then './build.sh'

You also have to create the initramfs/lib/module/ directory in order for the modules to copy properly...

As a side note, please don't post binaries without getting gokhanmoral's permission first as this is mostly his work.

Edit: Probably should note that I'm using the latest Linaro eabi tool chain. If your tool chain isn't working with this, try that one.

Edit 2: Not booting, back to work I guess.
[Samsung Epic 4G Touch] SweetwaterBurns:
Ok, have siyah booting by using the initramfs from the OP. Still no wifi... or cell radio, sd card, and bluetooth... Everything else seems usable though.
[Samsung Epic 4G Touch] dtm_stretch:
Are you trying to port the whole kernel or just the tweaks?
[Samsung Epic 4G Touch] interloper:
Siyah says 2.6.12 kernel version ,EL29 is 2.6.35. That might make porting it to EK02 the way to go. But mods should port either way. I tried the script you posted but haven't been able to make a working kernel of any kind from it. Just the boot looping kind. I do like the idea of a script tho and will keep trying to make it work.
[Samsung Epic 4G Touch] SweetwaterBurns:
I was doing the whole kernel. It has config options for all of the drivers we need. I figured it would be harder than just building it, but thought I should try the easy way first. I'm going to sit down with it today and see if I can do anything with it.

---------- Post added at 10:42 AM ---------- Previous post was at 09:52 AM ----------

The source I'm using says 2.6.35.14 while el29 is 2.6.35.7. The 2.6.12 listed in the changes is his internal build version.

Did you try just using the initramfs directory instead of the .cpio as the initramfs source? I don't think the stock E4GT kernels like that very much.

On a side note, it appears that siyah does not include the westbridge drivers which, as far as I can tell, connect the processor to everything else which might explain why nothing worked. I've done an initial port of the drivers over from el29 and am building right now... Damn slow computer. I'll post if it fixes anything.
[Samsung Epic 4G Touch] agat63:
In my build I was using initramfs directory and not initramfs.cpio.

initramfs_list is pointing to files, modules, libs and recovery in initramfs folder.

Phone did boot without problems. Was able to boot to recovery. Everything worked except WiFi and haptic feedback. (dhd.ko and vibrator.ko).

These 2 modules are compiling with some errors inside.

I guess.
[Samsung Epic 4G Touch] interloper:
I was able to modify the build script a bit and make a couple kernels. Still have a wifi error, but a different error, and haptic feedback working. I will make some more efforts tonight.
[Samsung Epic 4G Touch] dtm_stretch:
I just tried the script again while removing the cpio and changing it to the initramfs directory, and that didn't even give me bootloops it was just stuck on the samsung splash screen
[Samsung Epic 4G Touch] interloper:
#!/bin/sh
export KERNELDIR=`readlink -f .`
export INITRAMFS_SOURCE=`readlink -f $KERNELDIR/../SPH-D710-initramfs`
export PARENT_DIR=`readlink -f ..`

export CONFIG_DEFAULT_HOSTNAME=console-ubuntu
export ARCH=arm
export CROSS_COMPILE=/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-

# Sets the working directory for creating the initramfs, useful because it keeps the original clean of any modules, etc. that might cause issues
INITRAMFS="$KERNELDIR/initramfs"

# Check to see if .config exists and if it doesn't runs a defconfig(set to your choice)
if [ ! -f $KERNELDIR/.config ];
then
make c1_rev05_na_spr_defconfig
fi

. $KERNELDIR/.config

# Remove any old initramfs stuff to make sure we build clean
rm -rf $KERNELDIR/initramfs
mkdir $INITRAMFS
cp -ax $INITRAMFS_SOURCE $INITRAMFS

echo compiling modules...
cd $KERNELDIR/
# Compile whole kernel, not just modules, to get the errors sooner
make -j5 || exit 1

# Copies the clean initramfs to our working directory and cleans it up a bit.
# cp -ax $INITRAMFS_SOURCE $INITRAMFS
# find $INITRAMFS_TMP -name .git -exec rm -rf {} \;
# rm -rf $INITRAMFS_TMP/.hg

# Find all modules that were just built and copy them into the working directory
echo copying driver modules...
find -name '*.ko' -exec cp -av {} $KERNELDIR/initramfs/SPH-D710-initramfs/lib/modules/ \;

# Create initramfs for final build
# cd $INITRAMFS_TMP
# find | fakeroot cpio -H newc -o > $INITRAMFS_TMP.cpio 2>/dev/null
# ls -lh $INITRAMFS_TMP.cpio
# cd -

echo compiling kernel...
make -j5 zImage CONFIG_INITRAMFS_SOURCE="$KERNELDIR/initramfs/SPH-D710-initramfs/" || exit 1
# make -j5 zImage

I just simplified it a bit. I put my initramfs source outside the kernel directory to avoid the issue with the cpio not making right. With this I was able to get a booting kernel each time and haptic feedback. Wifi turns on, but something else is missing and it doesn't start or cannot find the supplicant files.
[Samsung Epic 4G Touch] dtm_stretch:
Working Kernel

Here we go, this is how I managed to get an EL29 Kernel with CWM(non-touch) to compile with working wifi and vibration

I used interloper's script which is a modified version of sweetwaterburns.

I ran the script, it compiled the kernel, I flashed it but it still had broke wifi and vibration.

Instead of doing a sudo make clean, I just copied over the drivers(dhd.ko, j4fs.ko, etc) to /home/derek/Desktop/initramfs/lib/modules and also copied the same drivers to /home/derek/Desktop/SPH-D710_SPR_Kernel/initramfs/lib/modules

After copying those drivers and rerunning the script it built a fully working kernel.

Here is a download link if anyone wants to verify or use an EL29 CWM kernel to flash before flashing CM9 http://dev-host.org/V3O
[Samsung Epic 4G Touch] greatlakesghost:
That's awesome! Great job. Will have to try it this weekend if time allows. Just want to say way to keep at it guys, great to see the collaboration amongst everyone.
[Samsung Epic 4G Touch] agat63:
unfortunately no dice for me.

Followed all steps but ending up in boot loop.

I noticed that script refers to a different toolchain.

export CROSS_COMPILE=/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-

Am I ritgt?

What toolchain is it?
[Samsung Epic 4G Touch] dtm_stretch:
Oh no, you need to change that to your toolchain, for example mine, which is the one from the OP, is /home/derek/Desktop/toolchain/bin/arm-none-eabi-

If you followed the directions in the OP yours should look like this /home/USER/Desktop/arm2009q3/bin/arm-none-eabi- (or similar)
[Samsung Epic 4G Touch] spdwiz18:
First: thank you very much for this. This is something that's been holding me back for a long time. Again..... big thanks.

and: as I know this is a e4gt touch forum.. Can this method be used for any Samsung kernel? Other than the obvious differences like the Intrams and kernel sources. The reason I ask is I jump back and forth alot between the e4gt and my nexus 4g. Thanks again for the tutorial and look forward to you response.
[Samsung Epic 4G Touch] SweetwaterBurns:
Yeah, this method should work with other phones as long as you have the right source and initramfs.
[Samsung Epic 4G Touch] agat63:
I did that.

I change cross compile reference to my arm2009q3 location. The reason I asked about toolchain is because my kernel wouldn't even boot.

I was stack on boot loop and the only way to get out of it was using ODIN to flash full OS.

Apparently something went wrong with script and/or my modifications to that script so that would work with my settings.
[Samsung Epic 4G Touch] dtm_stretch:
What are the changes you made to interlope's script? You should change the toolchain location and your initramfs locations (near the end of the script). I also had to make sure my initramfs were located outside the kernel source because that way wouldn't even boot. I am using the initramfs posted in the OP and the EL29 source.
[Samsung Epic 4G Touch] agat63:
Yep. Exactly what I did.

My paths are as following:

/home/agat63/tSGS2/Kernel - Kernel source paht.

/home/agat63/tSGS2/initamfs - Initramfs folder

/home/agat63/Desktop/arm-2009q3/bin/ - toolchain build folder.

Script has been modified to call out those locations.

zImage build size 7.4 MB

Phone didn't boot neither to system nor to recovery.

Had to boot to bootloader and flash OS using ODIN
[Samsung Epic 4G Touch] dtm_stretch:
I'll take another look at my script when I get home but I do know that my booting zimage was 7.5mb. The ones that wouldn't boot were 7.1-7.4mb.