yashsingh1/xdaforums huggingface dataset:
[Samsung Epic 4G Touch] MikeC84:
What do I do to run the script? I have chmod it and tried running it, I tried bash build.sh, sh build.sh, ./build.sh None of these do anything???

Got it but get an error

make: *** No rule to make target `c1_rev05_na_spr_defconfig'. Stop.

.: 19: Can't open /home/michaelc/Desktop/.config

Here the script

#!/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=/home/michaelc/Desktop/arm-2009q3/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/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="/home/michaelc/Desktop/initramfs/" || exit 1
# make -j5 zImage
[Samsung Epic 4G Touch] dtm_stretch:
This is what I did, just cut and paste the posted script to gedit in linux. Make the script executable by right clicking>properties. Then change my directories. Hit save and close the script.

Open up terminal, cd /kernel source directory

Drag script into terminal and hit enter.

The error your getting is because the script is looking for the .config on your desktop when in all likelihood your .config is in the kernel source folder you unzipped. That is why I cd to the kernel source folder then drag and drop the script.
[Samsung Epic 4G Touch] dtm_stretch:
This is where my steps change:

-Do not sudo make clean. Without changing anything

-Copy the drivers from kernel/drivers/dhd.ko, vibration.ko, j4fs.ko, bcm4330.ko, scsi_wait_scan.ko, cyasswitch.ko to initramfs/lib/modules and also copy those same files to kernel_source/initramfs/lib/modules (same folders but one is inside your kernel source created by the script and the other is in your initramfs folder outside of your kernel source)

-Rerun the script

This is how my script looks:

#!/bin/sh
export KERNELDIR=`readlink -f .`
export INITRAMFS_SOURCE=`readlink -f $KERNELDIR/../initramfs`
export PARENT_DIR=`readlink -f ..`

export CONFIG_DEFAULT_HOSTNAME=console-ubuntu
export ARCH=arm
export CROSS_COMPILE=/home/derek/Desktop/toolchain/bin/arm-none-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=/home/derek/Desktop/initramfs || exit 1
# make -j5 zImage
[Samsung Epic 4G Touch] dtm_stretch:
Have you put it in a cwm.zip and tried flashing it? I get the same errors on the second build also. Make sure to put a working kernel on your sd card or be ready to go with odin in case the one you made doesn't work.
[Samsung Epic 4G Touch] agat63:
Copmiled kernel following dtm_stretch instructions.

zImage size 7,650,176 bytes.

Flashed in recovery. Was able to boot to system.

Vibration works.

WiFi trying to connect but something wrong with wpa_supplicant file.

No WiFi but we are one step closer. At least it doesn't show error when going to /menu/settings/wireless.

Hotspot works. I'm posting this replay wile connected to the internet via hotspot running my kernel.

I guess we are very close to build a stable and working kernel.
[Samsung Epic 4G Touch] dtm_stretch:
Interlope seems to be having the same issues on his builds. I am moving to stock EL29 to see if my kernel works fully on that. If it does I am going to try and build an EL29 with the ACS recovery and see how that goes.

***UH OH apparently Ive gotten ahead of myself because I just flashed EL29 stock deodexed with my kernel and wifi is not working. Trying to figure this out. Why would it work on Calkulin's 2.8.1 all day for me?

*Same error as agat63, supplicant is giving me errors in DDMS
[Samsung Epic 4G Touch] MikeC84:
You can just replace the recovery.rc file in initranfs to get a different recovery.

So what is the different with using the script than doing it manually?

Why would wifi work using the script but wont work doing it manually, it doing the same thing right?
[Samsung Epic 4G Touch] agat63:
Any one want to share success story or there is nothing to share yet.

I'm still unable to make wifi work.
[Samsung Epic 4G Touch] SweetwaterBurns:
What are the errors? I don't have eclipse set up at the moment and am away from the computer, besides. I'm working today and need my phone up, but could someone check to see if 'ifconfig eth0' spits out any errors when run in adb shell or terminal. If it says something about no such device, try wlan0 (or browse through /dev for any appropriate network devices.) It occurred to me this morning that the driver might be creating the wlan0 device and we would just have to edit some files in the initramfs to point to the appropriate place, if I remember right.
[Samsung Epic 4G Touch] dtm_stretch:
The error showing in ddms(I can't remember exactly) was something like wpa_supplicant failing/missing. Unfortunately, I also need my phone to be fully operational for at least the most part today but tonight I might be able to get you some better information.

For the 1st command is it:

adb shell

#ipconfig eth0 or wlan0

That simple? I apologize but I am still in the learning curve. Are you saying we need eth0 and you think the phone driver is creating the wlan0?
[Samsung Epic 4G Touch] SweetwaterBurns:
I think you might have to su first, but yeah those command should work. Type 'lsmod' first and make sure that dhd.ko is loaded, if it is not, load it with 'insmod /lib/modules/dhd.ko' I've had this issue on some Linux boxes when I upgraded or changed drivers. If this is the issue, all we would have to do to fix it is add a line symlinking the two into the initramfs(in theory)

Edit: the line to load the module should be 'insmod /lib/modules/dhd.ko firmware_path=/system/etc/wifi/bcm4330_sta.bin nvram_path=/system/etc/wifi/nvram_net.txt' to make sure the firmware is loaded.
[Samsung Epic 4G Touch] dtm_stretch:
I am not sure where to go from here but here are my results.

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
# su
su
# ipconfig eth0
ipconfig eth0
ipconfig: not found
# ipconfig wlan0
ipconfig wlan0
ipconfig: not found
# lsmod
lsmod
j4fs 71761 1 - Live 0xbf010000 (P)
bthid 4555 0 - Live 0xbf009000
vibrator 9515 2 - Live 0xbf000000
# insmod /lib/modules/dhd.k
insmod /lib/modules/dhd.k
insmod: can't open '/lib/modules/dhd.k'
# insmod /lib/modules/dhd.ko firmware_path=/system/etc/wifi/bcm4330_sta.bin nvram_path=/system/etc/wifi/nvram_net.txt
insmod /lib/modules/dhd.ko firmware_path=/system/etc/wifi/bcm4330_sta.bin nvram_path=/system/etc/wifi/nvram_net.txt
insmod: init_module '/lib/modules/dhd.ko' failed (File exists)
#
[Samsung Epic 4G Touch] SweetwaterBurns:
.ko not .k

Edit: looks like you did on the second try there. Make sure the file is there. If its not if apparently didn't get copied into your initramfs. You could manually copy it over and the rerun the build to make sure all is well.
[Samsung Epic 4G Touch] SweetwaterBurns:
OK, probably shouldn't try to debug things when I should be working, I end up half assing both. It seems like the module is failing to load for you like it was for some other people... unless you can build one that will load, we're back to square one.
[Samsung Epic 4G Touch] interloper:
Alright, I have built at least three fully functional kernels using a couple different approaches discussed in the thread. I believe I narrowed the issue down to a problem with the init.rc from the initramfs posted in the OP. I extracted another initramfs from a working EL26 kernel with the same CWR v5.0.2.7 as in the OP and built from EL26 and EL29 kernel source. After two successful attempts I began comparing the files and ran across the biggest difference in the init.rc files. The file from the OP is written for custom bootani support and has other changes also. The permissions were also a notable difference. I'm going to keep working on this tomorrow and try to fix the EL29 init.rc to make the kernel properly because it has the most customization already. As I post this one build is finishing from EL29 source, the initramfs from the OP and a slightly edited and hopefully functional init.rc. If I am correct I will post all I can to github tomorrow night and we can work together on some mods.
[Samsung Epic 4G Touch] dtm_stretch:
I just got a successful build using the EL26 initramfs that I pulled from Chris41g's EL26 Repack. Although, I remain skeptical because I have had false positives before. Anyone want to test this for me? It won't brick your phone it will just give you CWM 5.0.2.7 and maybe broken wifi but Im hoping that this fixed that.
[Samsung Epic 4G Touch] agat63:
I did work. Finally we got to the bottom of this issue.

That was a genius idea to look into init.rc. I went thru init.rc and compared it with init.rc extracted from fully working kernel (did run diff meld) and this is what I discovered.

wpa_supplicant In my init.rc:

service wpa_supplicant /system/bin/wpa_supplicant -Dwext -ieth0 -c/data/wifi/bcm_supp.conf

disabled

oneshot

init.rc of working kernel:

service wpa_supplicant /system/bin/wpa_supplicant -Dwext -ieth0 -c/data/wifi/bcm_supp.conf

class main

socket wpa_eth0 dgram 0660 wifi wifi

disabled

oneshot

I changed that in my init.rc and made few other changes. Compiled EL29 source. Everything is working.

Did run lsmod and here is result:

# lsmod

dhd 284802 0 - Live 0xbf028000

j4fs 71761 1 - Live 0xbf010000 (P)

bthid 4555 0 - Live 0xbf009000

vibrator 9515 2 - Live 0xbf000000

I'm attaching modified init.rc so you guys can try it as well.

So far I did build 3 times running make clean in between.

All 3 times got fully working kernel.

Hope it will work for you as it did for me.

Let modding and tweaking begin.

http://www.mediafire.com/download.php?fzhcosqh4shc7iu
[Samsung Epic 4G Touch] greatlakesghost:
Work fine for me. Both wifi and hypatic feedback work.
[Samsung Epic 4G Touch] dtm_stretch:
Awesome job! What a team effort.
[Samsung Epic 4G Touch] agat63:
Where is the will there is a way!!!!
[Samsung Epic 4G Touch] SweetwaterBurns:
Interloper mentioned setting up a git repo for us so I set about working on a standardized but flexible base for us to work from and also to allow people to get set up quickly to start digging in themselves and helping. I have a basic file system layout and build.sh that I believe is fairly future proof and should minimize build errors.

The proposed base would include the Sourcery G++ Lite 2009q3-68 toolchain (or better, if we find something that works. I've had good luck with Linaro's latest), a clean el29 kernel, a modified version of the initramfs from the OP that includes agat63's fixes and a base for creating a ClockworkMod flashable zip. Obviously, this could be updated after we have git set up.

I've included a lite version that only includes the basic filesystem layout, build.sh, modified init.rc for wifi fixes, xda-dev_defconfig identical, for now, to c1_rev05_na_spr_defconfig and a modified kernel Makefile that points to the 2009q3-68 toolchain within the filesystem layout instead of /opt.

The build.sh defaults to build with only the included components but can be customized for kernel, initramfs, defconfig and toolchain at the command line. i.e. "./build.sh el29 initramfsroot xda-dev 2009q3-68" would build everything with the default options.

I'm sure the build.sh could be made a bit more elegant, but it works on my machine and hopefully if we all work from a common base it will help us focus on code instead of build errors due to our varying layouts.

I've tried to make the layout fairly self-explanatory and successfully built a kernel on my machine. Feedback is always welcome.

In order to use, copy xda-base-lite.tar.gz to wherever you would like and from the shell type 'tar -xzvf xda-base-lite.tar.gz'

Copy the el29 kernel source into xda-base/kernels/el29 making sure not to overwrite the Makefile. Do the same for the initramfs(don't overwrite init.rc if you want the wifi fix) and toolchain.

I love the collaboration that this thread has inspired and hope we can keep the development as open as it has been. I feel this thread could provide a very nice place to start and catch up with android kernel development and would like to thank everyone involved.

Edit: On a side note, I haven't seen shanenielsen1234 in a while and if he's not up to maintaining the OP maybe one of us should start a new thread so that the most up to date info is available in the first post.
[Samsung Epic 4G Touch] agat63:
I like the idea with new thread.

We got to the point where we have a fully working enviroment and tools to build kernels.

Let us have new thread with all the tools in the OP and start collaborating on different mods and tweaks to make our kernels better.

SweetWaterBurns you did put together all tools in one zip why don't you start new thread and just put the link to it here so we all can follow you.

We really appreciate your input into solution of our issues here and IMO it would be good if you will be OP in new thread.

Hope others will support my suggestion.
[Samsung Epic 4G Touch] interloper:
Sweetwaterburns, I'm cool with all those ideas. I'm not spending as much time at my desk but I will be chiming in to continue learning with everyone.

---------- Post added at 04:52 PM ---------- Previous post was at 04:42 PM ----------

I'm down

10 char.
[Samsung Epic 4G Touch] dtm_stretch:
I agree. We should also start working towards getting set up on github so we can see each other's changes. I'm up on github but I really don't know exactly what I'm doing nor did I previously feel comfortable putting up a kernel with broken wifi.
[Samsung Epic 4G Touch] greatlakesghost:
You guys are all awesome! I haven't had the time to spend on this as I would like and nor will I for a few months as work is insanely busy right now. I am gonna try to get caught up as soon as I can but in the mean time I can do testing or provide file hosting if needed. Just let me know how I can help in the mean time and I will do my best for this incredible group. :)
[Samsung Epic 4G Touch] SweetwaterBurns:
Thanks for the vote of confidence. I'll put together a new post this evening and work on getting a git repo set up. I've not actually used get for anything but leaching other peoples work, so looks like I have some reading to do.
[Samsung Epic 4G Touch] MikeC84:
Used your file and compiled with the instructions in the op and still no wifi or haptik...
[Samsung Epic 4G Touch] agat63:
Did any one else tried my init.rc and had wifi broke?

I compiled 6 kernels so far with different settings in config (same init.rc) wifi worked with every kernel.
[Samsung Epic 4G Touch] thizz415:
i want work on making n IC rom we need more dev in epic 4g touch like in gt-l9100
[Samsung Epic 4G Touch] dtm_stretch:
I just did a meld/diff with the init.rc you posted and the one sweetwaterburns included in the base pack, and I merged both of those into the init.rc I used from Chris41g's EL26 Kernel. I am building now so I will let you know. Btw, there wasn't much/if any difference from yours and the one sweetwaterburns included in his pack.
[Samsung Epic 4G Touch] agat63:
Sweetwaterbuns said he did include my initr.rc in his pack. If there were any differences I would guess he did some editing. May be he added/removed something. I don't know. I haven't compare them yet.

I hope it will work out for you.

Fingers crossed.
[Samsung Epic 4G Touch] dtm_stretch:
I don't think he made changes, I just compared yours to mine, then the one he included to mine, and I didn't make any additional changes. I am pretty sure it will work too I just checked out Team Rogues and their init.rc looked like it had similar changes but I didn't run a diff.

When you build your kernels, are you building with initramfs outside of the kernel directory or inside?
[Samsung Epic 4G Touch] agat63:
1 st of all I forgot to mention that I'm using build script posted here just modified to my directories and folders.

My file structure is like this:

/home/agat/SGS2/Kernel

/home/agat/SGS2/initramfs.

The script is copying initramfs folder into kernel folder thou.
[Samsung Epic 4G Touch] dtm_stretch:
It works, Thanks.
[Samsung Epic 4G Touch] agat63:
I'm glad it worked for you but apparently the script is not universal or there are some other thing we have to pay attention to since some people still have broken wifi.

---------- Post added at 07:41 PM ---------- Previous post was at 07:39 PM ----------

How did you compile your kernel?

Following command lines in OP or you used the script posted here?

May be your modules weren't copied properly to /lib/modules folder
[Samsung Epic 4G Touch] SweetwaterBurns:
Those of you having issues with the script I included in the pack, I figured out that I accidentally kept an old version with a bunch of errors instead of the good one. Here's the good one, now back to uploading to github.
[Samsung Epic 4G Touch] MikeC84:
Here what I did:

cd to kernel

export CROSS_COMPILE=/home/michaelc/Desktop/arm-2009q3/bin/arm-none-eabi-

sudo make clean

make c1_rev05_na_spr_defconfig

make modules

cp drivers/samsung/j4fs/j4fs.ko /home/michaelc/Desktop/initramfs/lib/modules && cp drivers/scsi/scsi_wait_scan.ko /home/michaelc/Desktop/initramfs/lib/modules && cp drivers/bluetooth/bthid/bthid.ko /home/michaelc/Desktop/initramfs/lib/modules && cp drivers/net/wireless/bcm4330/dhd.ko /home/michaelc/Desktop/initramfs/lib/modules && cp drivers/samsung/vibetonz/vibrator.ko /home/michaelc/Desktop/initramfs/lib/modules && cp drivers/staging/westbridge/astoria/switch/cyasswitch.ko /home/michaelc/Desktop/initramfs/lib/modules

make -j5 CONFIG_INITRAMFS_SOURCE=/home/michaelc/Desktop/initramfs
[Samsung Epic 4G Touch] SweetwaterBurns:
I wasn't able to download your version of the file for some reason, so I just pasted your fixes into my local copy. Other then that the init.rc should be identical to the one in the OP
[Samsung Epic 4G Touch] agat63:
You copied only j4fs.ko?

What about dhd.ko and others?

To minimize possibility of any errors try to use the script posted in this thread.

Just edit it to point to folders in your set up.

Once script is completely clean for your PC is will be much easier for all future builds.

You won't have to type all those commands one by one and script will make sure all newly build *.ko files are copied to proper location.

If you need any help to adopt the script to your settings I'll gladly help you with that.
[Samsung Epic 4G Touch] SweetwaterBurns:
Instead of 'make modules' run 'make -j5'

This builds the entire kernel the first time and fixes errors with module version checking that prevent the modules from loading. I'll be posting an updated thread in a bit that has an updated build process that should be a bit more foolproof.
[Samsung Epic 4G Touch] MikeC84:
No you have to scroll to the right to see the rest of that line lol

Im not using a script I do it manually
[Samsung Epic 4G Touch] agat63:
There is either a typo or your toolchain is set wrong.

It reads:

export CROSS_COMPILE=/home/michaelc/Desktop/arm-2009q3/bin/arm-eabi-

it should be:

export CROSS_COMPILE=/home/michaelc/Desktop/arm-2009q3/bin/arm-none-eabi-

Check it please

Is your initramfs folder on your desktop or it's inside Kernel folder?

You referring 2 different locations in your script.

1. copy modules to /kerneldir/initramfs/lib/modules

2. CONFIG_INITRAMFS_SOURCE=/home/michaelc/Desktop/initramfs
[Samsung Epic 4G Touch] MikeC84:
Think your reading something different. It copies to desktop/initramfs/lib/modules

And it IS set to arm-none-eabi.

Read my post again..
[Samsung Epic 4G Touch] MikeC84:
Please delete
[Samsung Epic 4G Touch] agat63:
I was going over your full script you posted on page 25.

If you have fixed it you should be all good.
[Samsung Epic 4G Touch] MikeC84:
Thanks bro that worked! Compiled my first fully working kernel. Thanks guys
[Samsung Epic 4G Touch] SweetwaterBurns:
Github is up and new thread is started.

If everyone could try out the base from github and tell me if it's workable, that would be awesome.

Off to bed though, have a good night.
[Samsung Epic 4G Touch] agat63:
Thank you very much. Now gotta learn how to work with github.:)
[Samsung Epic 4G Touch] Entropy512:
Ah, you guys had the same system changes as I9100 and I777 builds that required initramfs changes for wifi to work. I777 UCKK6 needed the same initramfs change for wifi to work.
[Samsung Epic 4G Touch] Entropy512:
Siyah's own versioning is getting into a state where it starts to conflict with mainline Linux versions.

Siyah 2.4.x and Siyah 2.6.x are all Linux 2.6.35.14. They use the I9100 update3 sources which are MISSING nearly all Sprint-specific drivers. (I9100 update3 needs minimal changes to build for I777, it would need MAJOR changes to target the E4GT)
[Samsung Epic 4G Touch] datzstr8:
Hi,

This guide has helped me get started on learning how to build the kernel for my T989. I am currently stuck at several places. I have made a new post here: http://xdaforums.com/showthread.php?t=1508358

Any help would be appreciated. Thank you.
[Samsung Epic 4G Touch] justlovejoy:
can i use this method to modify the cm9 kernel that came pre-installed? Sorry the search is disabled. I was looking for a git to use so i can build a whole new cm9 for my personal use but have come up short. I'm a noob to the 8th power when it comes to compiling so I may need to the location or way to extract kernel thats already on my device. Thanks!
[Samsung Epic 4G Touch] interloper:
The tools required to work with CM made kernels are not exactly the same. The method and tools are mentioned on the CM wiki. I dont have the link handy but if you google it you will find it. Good luck.