[DEPRECATED] || [GUIDE] || [XSP] || Create Your Own Boot-LED Sequence ||

Search This thread

Raienryu

Senior Member
Dec 18, 2014
361
1,795
26
Hyderabad
PEOPLE ON ROMS DATED ON OR AFTER JANUARY 2016 PLEASE DO NOT USE THIS. LOOK AT THIS POST FOR MORE INFO

Hey guys.
So, most of us have been using the SP since many months / couple of years by now and majority of us like the beautiful LED bar at the bottom and could probably even be the reason you've bought one.
So this guide here is another guide focused on that aspect of our phone. The LED Illumination bar.
As the title suggest, this guide will definitely help you learn how the Boot LED animation occurs and I will be giving you some tips and hints on how to create your own LED Boot sequence.


Requirements:
1) An Xperia SP rooted, bootloader unlocked, must be running a recent 5.1.1 LP ROM
2) An init.sh replacer template made by @Tomoms using @nosedive 's anykernel template (Which will be found in the attachments to this post)
3) Patience and a working brain and some more patience with a dash of common sense ;)
4) A good editor like notepad ++ (if on windows) or gedit is more than enough for Linux distributions. (Make sure to enable line numbers in your editor. Mostly the option will be in preferences )

Firstly, I shall explain the file we are going to modify. The init.sh file.
(Note that this is my interpretation of the code and is 99% correct, however if at all there are mistakes in what I explain, please do mention so that I can correct it and update this post.)

So where is this init.sh?

This file is inside sbin folder of root directory of our phone. (/sbin/init.sh)
This init.sh is a part of the ramdisk which is in turn a part of our kernel
So to modify this init.sh , we directly need to edit the ramdisk (thus manually pushing edited init.sh into /sbin/ won't work)
Good. Now you know where this file is. So we proceed to the next step.

What is this file anyway?

It is a script file ( *.sh files are script files . Google for more info) that automatically runs at every startup.
Now what you need to do is download the init.sh zip , extract it ( Taken from AdrianDC's repo , attached below as init_sh_original.zip) and open it up with an editor.

Here are some things you need to keep in mind as you start reading it.

The Left LED of our phone is LED3
The Middle LED is LED1 and
The Right LED is LED2

Also
Code:
LED1_R_BRIGHTNESS_FILE
LED2_G_CURRENT_FILE
LED3_B_BRIGHTNESS_FILE
Here the letter in between both the underscores R/G/B stands for Red/Green/Blue colors
BRIGHTNESS_FILE is where we set the maximum brightness value ( value ranges from 0 - 255 so max we generally set is 255)
and CURRENT_FILE is the file where in we set the brightness of the LED at that time.
Now that you know this, let's get to the first important (relative to this guide) lines of the script.
At lines 6-24 ,
Code:
# leds paths
LED1_R_BRIGHTNESS_FILE="/sys/class/leds/LED1_R/brightness"
LED2_R_BRIGHTNESS_FILE="/sys/class/leds/LED2_R/brightness"
LED3_R_BRIGHTNESS_FILE="/sys/class/leds/LED3_R/brightness"
LED1_R_CURRENT_FILE="/sys/class/leds/LED1_R/led_current"
LED2_R_CURRENT_FILE="/sys/class/leds/LED2_R/led_current"
LED3_R_CURRENT_FILE="/sys/class/leds/LED3_R/led_current"
LED1_G_BRIGHTNESS_FILE="/sys/class/leds/LED1_G/brightness"
LED2_G_BRIGHTNESS_FILE="/sys/class/leds/LED2_G/brightness"
LED3_G_BRIGHTNESS_FILE="/sys/class/leds/LED3_G/brightness"
LED1_G_CURRENT_FILE="/sys/class/leds/LED1_G/led_current"
LED2_G_CURRENT_FILE="/sys/class/leds/LED2_G/led_current"
LED3_G_CURRENT_FILE="/sys/class/leds/LED3_G/led_current"
LED1_B_BRIGHTNESS_FILE="/sys/class/leds/LED1_B/brightness"
LED2_B_BRIGHTNESS_FILE="/sys/class/leds/LED2_B/brightness"
LED3_B_BRIGHTNESS_FILE="/sys/class/leds/LED3_B/brightness"
LED1_B_CURRENT_FILE="/sys/class/leds/LED1_B/led_current"
LED2_B_CURRENT_FILE="/sys/class/leds/LED2_B/led_current"
LED3_B_CURRENT_FILE="/sys/class/leds/LED3_B/led_current"
So basically, what these lines of codes say is nothing but the file locations for BRIGHTNESS and CURRENT of each LED with it's respective primary color.
Next on
Lines 55 - 126

Here, if the system detects a normal boot and not recovery, then these lines are executed in the script.
So we don't boot into recovery. But just do a normal reboot.
What happens here is
Firstly, see these lines
Code:
	# LEDs activated
	echo '255' > $LED1_G_BRIGHTNESS_FILE
	echo '255' > $LED2_G_BRIGHTNESS_FILE
	echo '255' > $LED3_G_BRIGHTNESS_FILE
	echo '255' > $LED1_R_BRIGHTNESS_FILE
	echo '255' > $LED2_R_BRIGHTNESS_FILE
	echo '255' > $LED3_R_BRIGHTNESS_FILE

These basically set the maximum value of the LED's brightness we are going to use to 255
The command echo is one that gives / print if you may say and here > redirects the echo command onto the path given
Example: echo 'a' > abc.txt would make the file abc.txt have a added in it.
So here echo '255' > $LED1_G_BRIGHTNESS_FILE gives a value of 255 into the brightness file of LED1_G and so on.
So once all the LED's we are going to use are activated, it goes to the next path.
The one we're interested in.
The Animation/Sequence of LED's
See lines 65-125
Code:
	# LEDs starting animation
	echo '16' > $LED1_G_CURRENT_FILE
	echo '16' > $LED2_G_CURRENT_FILE
	echo '16' > $LED3_G_CURRENT_FILE
	busybox sleep 0.05
	echo '32' > $LED1_G_CURRENT_FILE
	echo '32' > $LED2_G_CURRENT_FILE
	echo '32' > $LED3_G_CURRENT_FILE
	busybox sleep 0.05
	echo '64' > $LED1_G_CURRENT_FILE
	echo '64' > $LED2_G_CURRENT_FILE
	echo '64' > $LED3_G_CURRENT_FILE
	busybox sleep 0.05
	echo '92' > $LED1_G_CURRENT_FILE
	echo '92' > $LED2_G_CURRENT_FILE
	echo '92' > $LED3_G_CURRENT_FILE
	busybox sleep 1
	echo '64' > $LED1_G_CURRENT_FILE
	echo '64' > $LED2_G_CURRENT_FILE
	echo '64' > $LED3_G_CURRENT_FILE
	busybox sleep 0.05
	echo '32' > $LED1_G_CURRENT_FILE
	echo '32' > $LED2_G_CURRENT_FILE
	echo '32' > $LED3_G_CURRENT_FILE
	busybox sleep 0.05
	echo '0' > $LED1_G_BRIGHTNESS_FILE
	echo '0' > $LED2_G_BRIGHTNESS_FILE
	echo '0' > $LED3_G_BRIGHTNESS_FILE
	echo '0' > $LED1_G_CURRENT_FILE
	echo '0' > $LED2_G_CURRENT_FILE
	echo '0' > $LED3_G_CURRENT_FILE
	echo '16' > $LED1_R_CURRENT_FILE
	echo '16' > $LED2_R_CURRENT_FILE
	echo '16' > $LED3_R_CURRENT_FILE
	busybox sleep 0.05
	echo '32' > $LED1_R_CURRENT_FILE
	echo '32' > $LED2_R_CURRENT_FILE
	echo '32' > $LED3_R_CURRENT_FILE
	busybox sleep 0.05
	echo '64' > $LED1_R_CURRENT_FILE
	echo '64' > $LED2_R_CURRENT_FILE
	echo '64' > $LED3_R_CURRENT_FILE
	busybox sleep 0.05
	echo '92' > $LED1_R_CURRENT_FILE
	echo '92' > $LED2_R_CURRENT_FILE
	echo '92' > $LED3_R_CURRENT_FILE
	busybox sleep 1
	echo '64' > $LED1_R_CURRENT_FILE
	echo '64' > $LED2_R_CURRENT_FILE
	echo '64' > $LED3_R_CURRENT_FILE
	busybox sleep 0.05
	echo '32' > $LED1_R_CURRENT_FILE
	echo '32' > $LED2_R_CURRENT_FILE
	echo '32' > $LED3_R_CURRENT_FILE
	busybox sleep 0.05
	echo '0' > $LED1_R_BRIGHTNESS_FILE
	echo '0' > $LED2_R_BRIGHTNESS_FILE
	echo '0' > $LED3_R_BRIGHTNESS_FILE
	echo '0' > $LED1_R_CURRENT_FILE
	echo '0' > $LED2_R_CURRENT_FILE
	echo '0' > $LED3_R_CURRENT_FILE
Here we specify which LED gets which brightness and we give the delay in between a few brightness settings
Same as before
echo '64' > $LED3_G_CURRENT_FILE does nothing but give a value 64 to the current file of LED3_G
So what this does is give a definite value with which that respective LED glows
The next command here is

Code:
busybox sleep 0.05

Here busybox, is the same as the busybox we all know. And sleep is a command we give to busybox and the value we give after it is the time in seconds
So the above command is nothing but telling it to sleep for 0.05 seconds. This is same as giving a delay of 0.05 seconds.
Now that the required stuff is cleared out, let's see what's going on in there.
Firstly, all the LED's are given a definite brightness in Green , and the brightness is increased upto a value and then slowly, symmetrically decreased back until zero. Then even the brightness file of Green LED's are given zero because they aren't needed anymore.
So this gives a breathing effect into all of the LED's in a green color.
Same goes for the next part except, Green is replaced with Red, even at the end of this the LED's are given 0 to both Brightness and current files.
Okay that's done for this part of the code.
Next from lines 128 to 135 we see a breakage in our code, why is that?
Code:
# android ramdisk
load_image=/sbin/ramdisk.cpio

# boot decision
if [ -s /dev/keycheck ] || [ ! -z "$RECOVERY_BOOT" ]; then
	busybox echo 'RECOVERY BOOT' >>boot.txt
	# LEDs for recovery
	busybox echo '100' > /sys/class/timed_output/vibrator/enable
These lines of code are to check whether we've chosen to boot into system or chosen to boot into recovery.
So incase the keycheck is toggled and the correct button combination is pressed, then it'll execute lines 131-171
Else
It'll go and execute 174 to end. These last two sequences(recovery / boot into android system), you will be able to interpret since I've told the basics above.

Now that you know the required stuff on how init.sh works and how the LED's are programmed into a sequence, the only thing left out is for you to unleash your creativity and change the LED positions, delay, brightness values, give combination of colors to a single LED at the same time to create a new color (other than RGB) and what not.
Hopefully you will be able to make your own custom Boot Sequence now.
It might not be easy and will take multiple tries for it to be quite perfect, but in case you do something wrong, all you need to do is just flash the old kernel and things will be back to normal :)

You attached a initsh_replacer.zip in the attachments, what am I supposed to do with it?

Simple.
To save the trouble of having to rebuild a kernel on a PC I've asked tomoms to slightly edit his tangerine kernel zip ( Made from nosedive's anykernel template) to suit for just and only replacing init.sh.
So what you've to do once you've made a custom init.sh is to extract that zip, go to the folder tools and delete the init.sh in there and replace that with the one you've made and compress both the META-INF and tools folder back into a zip file and flash it and enjoy your own custom boot sequence :)

If there are any queries or some part about this guide you didn't understand, please do reply to this thread. Also if you've made any custom boot sequence, please do share it here for everyone else to enjoy :)

Cheers and have fun :)
 

Attachments

  • initsh_replacer.zip
    1.6 MB · Views: 82
  • init_sh_original.zip
    1.3 KB · Views: 51
Last edited:

flash-

Senior Member
Jan 5, 2014
1,468
1,009
24
sweida
great guide really ....it's real simple ....and we needed this since a long time ....i'm so excited to do my own boot led's :D
p.s: if u read this thread and u didn't see the attachments because it's not there :p ...i told @Raienryu and he will add them soon ...so have patience :)
great work :good:
 

Raienryu

Senior Member
Dec 18, 2014
361
1,795
26
Hyderabad
great guide really ....it's real simple ....and we needed this since a long time ....i'm so excited to do my own boot led's :D
p.s: if u read this thread and u didn't see the attachments because it's not there :p ...i told @Raienryu and he will add them soon ...so have patience :)
great work :good:

Thanks for notifying me. I had created a duplicate thread by mistake and attachments got uploaded to the duplicate instead of here.
Now added them :)

So after making it could you give me your work as a flashable zip?

The initsh_replacer.zip already has a modified boot LED but note that I made it at around 3 AM and isn't so great. But if you'd like to test it out, flash that.
In case you don't like it, extract the init_sh_original.zip , you'll find an init.sh in there.
replace this init.sh with the one in initsh_replacer.zip and flash it to get back original Animation.
 

OsGhaly

Senior Member
Jan 26, 2014
605
351
Cairo
@Raienryu Brilliant. Well organised, simple and so informative post, many thanks bro :highfive:
I Just have a question here please, we find that some apps like Gmail, Taptalk, etc.. can control these LEDs and also can change its colors. So, I wonder if we could have these LEDs to work with dialer just like the stock do (LEDs will turn on once a call being answered while the screen is on, and turn off if the screen off or call ended)? does this need mod to the dialer itself and is it hard to be implemented?.
 

flash-

Senior Member
Jan 5, 2014
1,468
1,009
24
sweida
@Raienryu Brilliant. Well organised, simple and so informative post, many thanks bro :highfive:
I Just have a question here please, we find that some apps like Gmail, Taptalk, etc.. can control these LEDs and also can change its colors. So, I wonder if we could have these LEDs to work with dialer just like the stock do (LEDs will turn on once a call being answered while the screen is on, and turn off if the screen off or call ended)? does this need mod to the dialer itself and is it hard to be implemented?.
i think it does need some work ...and we were hoping adriandc port that to lp or cm13 if he have time(if he have time he will work on it) :D
 

flash-

Senior Member
Jan 5, 2014
1,468
1,009
24
sweida
okay my first attempt is going now ....if it was beautiful i'll upload it :p
edit: okay i made my first one and it was so much funny...i'll keep trying to reach doomkernel level :p
 
Last edited:
  • Like
Reactions: Raienryu

Raienryu

Senior Member
Dec 18, 2014
361
1,795
26
Hyderabad
okay my first attempt is going now ....if it was beautiful i'll upload it :p
edit: okay i made my first one and it was so much funny...i'll keep trying to reach doomkernel level :p

In case you would want to see how DoomLoRD actually made it in his kernel, I've uploaded in attachments his original script for rainbow animation of his kernel.
The coding is a bit different from what we have now but the basic idea is the same.
Have a look at it :)
Most probably, he must've used a code/script to automatically generate symmetric gradual increase and decrease of the brightness of those colors. (Even I've done the same for the init.sh file in the replacer zip. Wrote 20 lines or so in C to get around 70 lines =D ) No way he would have sat down and written 6645 Lines :p
 

Attachments

  • rainbow.txt
    63.8 KB · Views: 71
Last edited:
  • Like
Reactions: flash-

LWWSaint

Senior Member
Mar 21, 2014
103
48
Pune
@Raienryu Brilliant. Well organised, simple and so informative post, many thanks bro :highfive:
I Just have a question here please, we find that some apps like Gmail, Taptalk, etc.. can control these LEDs and also can change its colors. So, I wonder if we could have these LEDs to work with dialer just like the stock do (LEDs will turn on once a call being answered while the screen is on, and turn off if the screen off or call ended)? does this need mod to the dialer itself and is it hard to be implemented?.

Which file governs in the incall --'pre-call' actually-- LED working in the stock rom?? Has anyone tried finding it and copying it back? :p
 
Last edited:

Raienryu

Senior Member
Dec 18, 2014
361
1,795
26
Hyderabad
Small notice guys
Now that CM has removed busybox in the latest builds of CM13, this flashable zip will not work. We don't even have an init.sh anymore. The sources have been changed.
Look at this commit for more info.
So please do not use this on any CM13/based ROMs dated on and after Jan 2016.
Most probably there will be no simple easy way to change boot LEDs like this anykernel template.
But if there is a way I find, I will update the OP.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    PEOPLE ON ROMS DATED ON OR AFTER JANUARY 2016 PLEASE DO NOT USE THIS. LOOK AT THIS POST FOR MORE INFO

    Hey guys.
    So, most of us have been using the SP since many months / couple of years by now and majority of us like the beautiful LED bar at the bottom and could probably even be the reason you've bought one.
    So this guide here is another guide focused on that aspect of our phone. The LED Illumination bar.
    As the title suggest, this guide will definitely help you learn how the Boot LED animation occurs and I will be giving you some tips and hints on how to create your own LED Boot sequence.


    Requirements:
    1) An Xperia SP rooted, bootloader unlocked, must be running a recent 5.1.1 LP ROM
    2) An init.sh replacer template made by @Tomoms using @nosedive 's anykernel template (Which will be found in the attachments to this post)
    3) Patience and a working brain and some more patience with a dash of common sense ;)
    4) A good editor like notepad ++ (if on windows) or gedit is more than enough for Linux distributions. (Make sure to enable line numbers in your editor. Mostly the option will be in preferences )

    Firstly, I shall explain the file we are going to modify. The init.sh file.
    (Note that this is my interpretation of the code and is 99% correct, however if at all there are mistakes in what I explain, please do mention so that I can correct it and update this post.)

    So where is this init.sh?

    This file is inside sbin folder of root directory of our phone. (/sbin/init.sh)
    This init.sh is a part of the ramdisk which is in turn a part of our kernel
    So to modify this init.sh , we directly need to edit the ramdisk (thus manually pushing edited init.sh into /sbin/ won't work)
    Good. Now you know where this file is. So we proceed to the next step.

    What is this file anyway?

    It is a script file ( *.sh files are script files . Google for more info) that automatically runs at every startup.
    Now what you need to do is download the init.sh zip , extract it ( Taken from AdrianDC's repo , attached below as init_sh_original.zip) and open it up with an editor.

    Here are some things you need to keep in mind as you start reading it.

    The Left LED of our phone is LED3
    The Middle LED is LED1 and
    The Right LED is LED2

    Also
    Code:
    LED1_R_BRIGHTNESS_FILE
    LED2_G_CURRENT_FILE
    LED3_B_BRIGHTNESS_FILE
    Here the letter in between both the underscores R/G/B stands for Red/Green/Blue colors
    BRIGHTNESS_FILE is where we set the maximum brightness value ( value ranges from 0 - 255 so max we generally set is 255)
    and CURRENT_FILE is the file where in we set the brightness of the LED at that time.
    Now that you know this, let's get to the first important (relative to this guide) lines of the script.
    At lines 6-24 ,
    Code:
    # leds paths
    LED1_R_BRIGHTNESS_FILE="/sys/class/leds/LED1_R/brightness"
    LED2_R_BRIGHTNESS_FILE="/sys/class/leds/LED2_R/brightness"
    LED3_R_BRIGHTNESS_FILE="/sys/class/leds/LED3_R/brightness"
    LED1_R_CURRENT_FILE="/sys/class/leds/LED1_R/led_current"
    LED2_R_CURRENT_FILE="/sys/class/leds/LED2_R/led_current"
    LED3_R_CURRENT_FILE="/sys/class/leds/LED3_R/led_current"
    LED1_G_BRIGHTNESS_FILE="/sys/class/leds/LED1_G/brightness"
    LED2_G_BRIGHTNESS_FILE="/sys/class/leds/LED2_G/brightness"
    LED3_G_BRIGHTNESS_FILE="/sys/class/leds/LED3_G/brightness"
    LED1_G_CURRENT_FILE="/sys/class/leds/LED1_G/led_current"
    LED2_G_CURRENT_FILE="/sys/class/leds/LED2_G/led_current"
    LED3_G_CURRENT_FILE="/sys/class/leds/LED3_G/led_current"
    LED1_B_BRIGHTNESS_FILE="/sys/class/leds/LED1_B/brightness"
    LED2_B_BRIGHTNESS_FILE="/sys/class/leds/LED2_B/brightness"
    LED3_B_BRIGHTNESS_FILE="/sys/class/leds/LED3_B/brightness"
    LED1_B_CURRENT_FILE="/sys/class/leds/LED1_B/led_current"
    LED2_B_CURRENT_FILE="/sys/class/leds/LED2_B/led_current"
    LED3_B_CURRENT_FILE="/sys/class/leds/LED3_B/led_current"
    So basically, what these lines of codes say is nothing but the file locations for BRIGHTNESS and CURRENT of each LED with it's respective primary color.
    Next on
    Lines 55 - 126

    Here, if the system detects a normal boot and not recovery, then these lines are executed in the script.
    So we don't boot into recovery. But just do a normal reboot.
    What happens here is
    Firstly, see these lines
    Code:
    	# LEDs activated
    	echo '255' > $LED1_G_BRIGHTNESS_FILE
    	echo '255' > $LED2_G_BRIGHTNESS_FILE
    	echo '255' > $LED3_G_BRIGHTNESS_FILE
    	echo '255' > $LED1_R_BRIGHTNESS_FILE
    	echo '255' > $LED2_R_BRIGHTNESS_FILE
    	echo '255' > $LED3_R_BRIGHTNESS_FILE

    These basically set the maximum value of the LED's brightness we are going to use to 255
    The command echo is one that gives / print if you may say and here > redirects the echo command onto the path given
    Example: echo 'a' > abc.txt would make the file abc.txt have a added in it.
    So here echo '255' > $LED1_G_BRIGHTNESS_FILE gives a value of 255 into the brightness file of LED1_G and so on.
    So once all the LED's we are going to use are activated, it goes to the next path.
    The one we're interested in.
    The Animation/Sequence of LED's
    See lines 65-125
    Code:
    	# LEDs starting animation
    	echo '16' > $LED1_G_CURRENT_FILE
    	echo '16' > $LED2_G_CURRENT_FILE
    	echo '16' > $LED3_G_CURRENT_FILE
    	busybox sleep 0.05
    	echo '32' > $LED1_G_CURRENT_FILE
    	echo '32' > $LED2_G_CURRENT_FILE
    	echo '32' > $LED3_G_CURRENT_FILE
    	busybox sleep 0.05
    	echo '64' > $LED1_G_CURRENT_FILE
    	echo '64' > $LED2_G_CURRENT_FILE
    	echo '64' > $LED3_G_CURRENT_FILE
    	busybox sleep 0.05
    	echo '92' > $LED1_G_CURRENT_FILE
    	echo '92' > $LED2_G_CURRENT_FILE
    	echo '92' > $LED3_G_CURRENT_FILE
    	busybox sleep 1
    	echo '64' > $LED1_G_CURRENT_FILE
    	echo '64' > $LED2_G_CURRENT_FILE
    	echo '64' > $LED3_G_CURRENT_FILE
    	busybox sleep 0.05
    	echo '32' > $LED1_G_CURRENT_FILE
    	echo '32' > $LED2_G_CURRENT_FILE
    	echo '32' > $LED3_G_CURRENT_FILE
    	busybox sleep 0.05
    	echo '0' > $LED1_G_BRIGHTNESS_FILE
    	echo '0' > $LED2_G_BRIGHTNESS_FILE
    	echo '0' > $LED3_G_BRIGHTNESS_FILE
    	echo '0' > $LED1_G_CURRENT_FILE
    	echo '0' > $LED2_G_CURRENT_FILE
    	echo '0' > $LED3_G_CURRENT_FILE
    	echo '16' > $LED1_R_CURRENT_FILE
    	echo '16' > $LED2_R_CURRENT_FILE
    	echo '16' > $LED3_R_CURRENT_FILE
    	busybox sleep 0.05
    	echo '32' > $LED1_R_CURRENT_FILE
    	echo '32' > $LED2_R_CURRENT_FILE
    	echo '32' > $LED3_R_CURRENT_FILE
    	busybox sleep 0.05
    	echo '64' > $LED1_R_CURRENT_FILE
    	echo '64' > $LED2_R_CURRENT_FILE
    	echo '64' > $LED3_R_CURRENT_FILE
    	busybox sleep 0.05
    	echo '92' > $LED1_R_CURRENT_FILE
    	echo '92' > $LED2_R_CURRENT_FILE
    	echo '92' > $LED3_R_CURRENT_FILE
    	busybox sleep 1
    	echo '64' > $LED1_R_CURRENT_FILE
    	echo '64' > $LED2_R_CURRENT_FILE
    	echo '64' > $LED3_R_CURRENT_FILE
    	busybox sleep 0.05
    	echo '32' > $LED1_R_CURRENT_FILE
    	echo '32' > $LED2_R_CURRENT_FILE
    	echo '32' > $LED3_R_CURRENT_FILE
    	busybox sleep 0.05
    	echo '0' > $LED1_R_BRIGHTNESS_FILE
    	echo '0' > $LED2_R_BRIGHTNESS_FILE
    	echo '0' > $LED3_R_BRIGHTNESS_FILE
    	echo '0' > $LED1_R_CURRENT_FILE
    	echo '0' > $LED2_R_CURRENT_FILE
    	echo '0' > $LED3_R_CURRENT_FILE
    Here we specify which LED gets which brightness and we give the delay in between a few brightness settings
    Same as before
    echo '64' > $LED3_G_CURRENT_FILE does nothing but give a value 64 to the current file of LED3_G
    So what this does is give a definite value with which that respective LED glows
    The next command here is

    Code:
    busybox sleep 0.05

    Here busybox, is the same as the busybox we all know. And sleep is a command we give to busybox and the value we give after it is the time in seconds
    So the above command is nothing but telling it to sleep for 0.05 seconds. This is same as giving a delay of 0.05 seconds.
    Now that the required stuff is cleared out, let's see what's going on in there.
    Firstly, all the LED's are given a definite brightness in Green , and the brightness is increased upto a value and then slowly, symmetrically decreased back until zero. Then even the brightness file of Green LED's are given zero because they aren't needed anymore.
    So this gives a breathing effect into all of the LED's in a green color.
    Same goes for the next part except, Green is replaced with Red, even at the end of this the LED's are given 0 to both Brightness and current files.
    Okay that's done for this part of the code.
    Next from lines 128 to 135 we see a breakage in our code, why is that?
    Code:
    # android ramdisk
    load_image=/sbin/ramdisk.cpio
    
    # boot decision
    if [ -s /dev/keycheck ] || [ ! -z "$RECOVERY_BOOT" ]; then
    	busybox echo 'RECOVERY BOOT' >>boot.txt
    	# LEDs for recovery
    	busybox echo '100' > /sys/class/timed_output/vibrator/enable
    These lines of code are to check whether we've chosen to boot into system or chosen to boot into recovery.
    So incase the keycheck is toggled and the correct button combination is pressed, then it'll execute lines 131-171
    Else
    It'll go and execute 174 to end. These last two sequences(recovery / boot into android system), you will be able to interpret since I've told the basics above.

    Now that you know the required stuff on how init.sh works and how the LED's are programmed into a sequence, the only thing left out is for you to unleash your creativity and change the LED positions, delay, brightness values, give combination of colors to a single LED at the same time to create a new color (other than RGB) and what not.
    Hopefully you will be able to make your own custom Boot Sequence now.
    It might not be easy and will take multiple tries for it to be quite perfect, but in case you do something wrong, all you need to do is just flash the old kernel and things will be back to normal :)

    You attached a initsh_replacer.zip in the attachments, what am I supposed to do with it?

    Simple.
    To save the trouble of having to rebuild a kernel on a PC I've asked tomoms to slightly edit his tangerine kernel zip ( Made from nosedive's anykernel template) to suit for just and only replacing init.sh.
    So what you've to do once you've made a custom init.sh is to extract that zip, go to the folder tools and delete the init.sh in there and replace that with the one you've made and compress both the META-INF and tools folder back into a zip file and flash it and enjoy your own custom boot sequence :)

    If there are any queries or some part about this guide you didn't understand, please do reply to this thread. Also if you've made any custom boot sequence, please do share it here for everyone else to enjoy :)

    Cheers and have fun :)
    3
    Small notice guys
    Now that CM has removed busybox in the latest builds of CM13, this flashable zip will not work. We don't even have an init.sh anymore. The sources have been changed.
    Look at this commit for more info.
    So please do not use this on any CM13/based ROMs dated on and after Jan 2016.
    Most probably there will be no simple easy way to change boot LEDs like this anykernel template.
    But if there is a way I find, I will update the OP.
    2
    great guide really ....it's real simple ....and we needed this since a long time ....i'm so excited to do my own boot led's :D
    p.s: if u read this thread and u didn't see the attachments because it's not there :p ...i told @Raienryu and he will add them soon ...so have patience :)
    great work :good:
    1
    okay my first attempt is going now ....if it was beautiful i'll upload it :p
    edit: okay i made my first one and it was so much funny...i'll keep trying to reach doomkernel level :p
    1
    okay my first attempt is going now ....if it was beautiful i'll upload it :p
    edit: okay i made my first one and it was so much funny...i'll keep trying to reach doomkernel level :p

    In case you would want to see how DoomLoRD actually made it in his kernel, I've uploaded in attachments his original script for rainbow animation of his kernel.
    The coding is a bit different from what we have now but the basic idea is the same.
    Have a look at it :)
    Most probably, he must've used a code/script to automatically generate symmetric gradual increase and decrease of the brightness of those colors. (Even I've done the same for the init.sh file in the replacer zip. Wrote 20 lines or so in C to get around 70 lines =D ) No way he would have sat down and written 6645 Lines :p