[Samsung Galaxy S (4G Model)] jeffsf:
First off, this is an ICS kernel that is intended for use with ICS ROMs. If you aren't using a ROM that is substantially similar to TeamAcid's CM9, then you may want to reconsider before you flash this.

This kernel is the same as the current TeamAcid CM9 kernel. Now that [MENTION=3833556]FBis251[/MENTION] poked me about it, there is a version that also includes the "Hefe Kernel of Darkness" patch to turn off the touch-key backlight after it is touched.

If it's not all that different from the TeamAcid kernel, why would I want to flash this?

It's got TWRP

You can reliably mount /sd-ext or...

...move /data to your microSD, never worry about running out of app & data space, and speed your boot time

It allows you to get to the file system early in the boot process, to be able to change things that ordinarily you couldn't without creating a custom initramfs. This lets you, for example, create /sd-ext and mount something there, or get even wilder and do something completely untested like replacing /data entirely

TWRP can backup and restore /sd-ext

You hate the touch-key backlight

You want to be able to load the FUSE kernel module

How does it work?

When the SGS4G boots, it has a filesystem in the compressed boot/recovery image. It mounts that as the root file system, starts things running, and then all but that root filesystem sort of disappears as Android starts taking over. What happens and what is in that root file system is pretty much locked down unless you're going to create your own boot images. You can't edit a file on your running system and change that behavior. So....

The boot scripts in this build look for /system/etc/init-on-fs.sh right after /system gets mounted, but before much else happens. If it is executable, it will run the script. This means that you can make most of the changes to the environment or process you might reasonably want!

The "interesting" section of init.herring.rc is shown in the hidden text

on fs
exec /system/bin/logwrapper /system/xbin/echo "init.herring.rc: on fs enter"
# We chown/chmod /efs because mount is run as root + defaults
mkdir /efs 0775 radio radio
chown radio radio /efs
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mkdir /radio 0775 radio radio
mount yaffs2 mtd@radio /radio
chmod 0775 /radio
chmod 0775 /radio/modem.bin
chown radio radio /radio
chown radio radio /radio/modem.bin
mount yaffs2 mtd@efs /efs
mount yaffs2 mtd@system /system
mount yaffs2 mtd@userdata /data
mount yaffs2 mtd@cache /cache

exec /system/bin/logwrapper /system/etc/init-on-fs.sh

chmod 770 /efs/bluetooth
chmod 770 /efs/imei

mkdir /gps 771 gps system
chown gps system /gps

[...]

My init-on-fs.sh

Lists the mounts already in place (from the "stock" init commands)

Creates /sd-ext

Mounts the second partition of the microSD on /sd-ext

Lists the mounts, which should now include /sd-ext

and looks like this:

#!/system/bin/sh

/system/xbin/busybox mount
/system/xbin/busybox mkdir /sd-ext
/system/xbin/busybox mount -t ext4 /dev/block/mmcblk0p2 /sd-ext
/system/xbin/busybox mount

Since it's running under logwrapper the output goes to the logs and can be seen with logcat or the like.

Since this script runs before any "working" directories get set up and before any processes start running, if you're adventurous, you could even change the mounting of /data and just use microSD storage. I haven't gotten that adventurous yet, as TitaniumBackup seems to be very reliable in moving app data to the microSD partition.

Do I need to repartition my microSD and use /sd-ext?

Nope, you can just enjoy TWRP if you want.

How do I install it?

Download the current version from the next post. Push to your device and flash with your recovery.

init-on-fs.sh does not have an installer and is not distributed. Create it in /system/etc and make sure it's executable.

I have a question...

Check the FAQ right after the Downloads.

If you still have questions, especially if they are about how to use the Hefe Hook or how to configure your phone for 2 GB of /data, please use the Q&A thread.

.