Building your own ROM

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
I tried with no luck, phone still boots up as soon as you plug it in, but I'm not sure I have everything necessary:
commit:95e3f4ca

I did a bit of sleuthing...

The stock initrd contains only one reference to chargerlogo, and that is in the init binary:

boot.img-ramdisk$ find . -type f | xargs grep chargerlogo
Binary file ./init matches
boot.img-ramdisk$

Looks like the sources to this are system/core/init/init.c (in IHO). Of course there are no references to chargerlogo there because this is surely an LG specific change. I looked in the LG VM670 code drop and they don't appear to have published their changes to system/core at all. The only init.c is in oprofile, which is obviously not the droid we're looking for.

So it seems that to get this working, we either need to ask LG for their changes to system/core (politely), or find the mechanism that it uses and modify it ourselves. I'll poke around a bit more and see if I can figure out the mechanism.
 
  • Like
Reactions: JerryScript

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
I tried with no luck, phone still boots up as soon as you plug it in, but I'm not sure I have everything necessary:
commit:95e3f4ca

My IHO tree is about 6 weeks old but I don't see anything that would trigger a boot-pause action in system/core/init/init.c. Has this been changed recently? If not, that's probably what is missing.
 

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
So it seems that to get this working, we either need to ask LG for their changes to system/core (politely), or find the mechanism that it uses and modify it ourselves. I'll poke around a bit more and see if I can figure out the mechanism.

Almost there.

I found how to detect whether boot was initiated by power button or USB and I've modified init.c to call chargerlogo. Unfortunately, something isn't quite right, because when init exec's chargerlogo, the phone reboots. I suspect either I'm running chargerlogo too early or too late, or the CM/IHO init is doing (or not doing) something that chargerlogo doesn't like.

In order to get this far, I did the following:

1. Found the kernel code that exports the data. See arch/arm/mach-msm/lge/lge_proc_comm.c just above function lge_get_power_on_status().

2. Added code in init.c to check /sys/devices/platform/msm-battery/power_on_status and exec chargerlogo when booted via USB plugin.

3. Moved chargerlogo from / to /sbin in the initrd.

There are several possible directions to proceed. I'm a noob so I'll just toss out some options off the top of my head to solicit feedback from the ROM maintainers...

We can create a boot-pause trigger or hardcode the call to chargerlogo. Does anyone know if the boot-pause trigger is stock GB or a CM addition?

Second, we can either try to get the stock chargerlogo running or make our own replacement (preferably with some way to show the charged percentage, either numerically or graphically).
 

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
I added the boot-pause to init.thunderc.rc, you'll have to check my github:
https://github.com/JerryScript/android_device_lge_thunderc/commit/95e3f4cab6b54b6365327ca07b880067efe0faa6

I'm not sure if the boot-pause is CM or from one of the LG phones this change was recently submitted to gerrit code review for. I'm attempting to figure it out from the submissions, but there's no history, so it's a guessing game atm.


Noticed a couple of other submissions to gerrit, not sure if/when they will get added to CM7.2 so I cherry-picked them. One adds an option to have volume hard keys control media by default instead of ringer volume. I always hated having to start a song before setting it's volume, or going through settings menus for something that should be available on-the-fly. The other enables adb over networks. I hate wires so this is a must have for me! ;)

Volume option:
Gerrit Code Review

ADB over network option:
Gerrit Code Review
Gerrit Code Review
https://github.com/JerryScript/android_device_lge_thunderc/commit/9c93e20ccf1750f6b313fc5bc44796b5a5c6cd45

Tested both and they work fine. You have to go into wireless settings to get your ip address, then go into development and enable adb over networks, then connect from a command prompt with:

adb connect IP_ADDRESS:5555

So for example: adb connect 192.168.1.117:5555
 

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
I added the boot-pause to init.thunderc.rc, you'll have to check my github:
https://github.com/JerryScript/android_device_lge_thunderc/commit/95e3f4cab6b54b6365327ca07b880067efe0faa6

I'm not sure if the boot-pause is CM or from one of the LG phones this change was recently submitted to gerrit code review for. I'm attempting to figure it out from the submissions, but there's no history, so it's a guessing game atm.


Noticed a couple of other submissions to gerrit, not sure if/when they will get added to CM7.2 so I cherry-picked them. One adds an option to have volume hard keys control media by default instead of ringer volume. I always hated having to start a song before setting it's volume, or going through settings menus for something that should be available on-the-fly. The other enables adb over networks. I hate wires so this is a must have for me! ;)

Volume option:
Gerrit Code Review

ADB over network option:
Gerrit Code Review
Gerrit Code Review
https://github.com/JerryScript/android_device_lge_thunderc/commit/9c93e20ccf1750f6b313fc5bc44796b5a5c6cd45

Tested both and they work fine. You have to go into wireless settings to get your ip address, then go into development and enable adb over networks, then connect from a command prompt with:

adb connect IP_ADDRESS:5555

So for example: adb connect 192.168.1.117:5555

Don't know what the change is to BoardConfig.mk but it's not necessary for boot-pause.

You'll probably want to make the path to chargerlogo absolute (add a leading /). Not sure if that's necessary.

You'll also need to add a boot-pause trigger in init.c, like so:

action_for_each_trigger("boot-pause", action_add_queue_tail);

I put this immediately above the main for(;;) loop -- seemed a good spot.

With all of that done, chargerlogo does indeed run. And it seems to contain the logic to detect the boot method, and exit when not booted from USB. So all that digging in the kernel was for naught. :/ But now chargerlogo runs asynchronously with the boot process. That is, it doesn't stop the system from booting up. It continues to run while the boot animation and lock screen are shown, interfering with them both.

So if we can figure out how to make the boot process run chargerlogo sychronously, that should be the final step. Yay! :)

I'd love to have networked adb. Can we get that pushed back to IHO?
 

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
You'll also need to add a boot-pause trigger in init.c, like so:

action_for_each_trigger("boot-pause", action_add_queue_tail);

I put this immediately above the main for(;;) loop -- seemed a good spot.

Figured it out. boot-pause needs to be before boot, because the boot action starts sysvinit.

These diffs should make chargerlogo work. Enjoy!

diff --git a/init/init.c b/init/init.c
index 2ef2b38..bb886e3 100755
--- a/init/init.c
+++ b/init/init.c
@@ -747,6 +747,7 @@ int main(int argc, char **argv)

/* execute all the boot actions to get us started */
action_for_each_trigger("early-boot", action_add_queue_tail);
+ action_for_each_trigger("boot-pause", action_add_queue_tail);
action_for_each_trigger("boot", action_add_queue_tail);

/* run all property triggers based on current state of the properties */


diff --git a/files/init.thunderc.rc b/files/init.thunderc.rc
index aed19ac..74d9b2b 100644
--- a/files/init.thunderc.rc
+++ b/files/init.thunderc.rc
@@ -260,3 +260,6 @@ on property:service.iq.active=0
# LGE_CHANGE [younchan.kim,2010-06-13]
#service tsdown /system/bin/tsdown
# oneshot
+
+on boot-pause
+ exec /sbin/chargerlogo


diff --git a/device_thunderc.mk b/device_thunderc.mk
index 0ffa394..075100d 100644
--- a/device_thunderc.mk
+++ b/device_thunderc.mk
@@ -46,7 +46,7 @@ PRODUCT_COPY_FILES += \
device/lge/thunderc/files/init.thunderc.rc:root/init.thunderc.rc \
device/lge/thunderc/files/ueventd.thunderc.rc:root/ueventd.thunder.rc \
device/lge/thunderc/files/initlogo.rle:root/initlogo.rle \
- device/lge/thunderc/files/chargerlogo:root/chargerlogo \
+ device/lge/thunderc/files/chargerlogo:root/sbin/chargerlogo \
device/lge/thunderc/files/chargerimages/battery_ani_01.rle:root/chargerimages/battery_ani_01.rl
device/lge/thunderc/files/chargerimages/battery_ani_02.rle:root/chargerimages/battery_ani_02.rl
device/lge/thunderc/files/chargerimages/battery_ani_03.rle:root/chargerimages/battery_ani_03.rl
 

thekraven

Well-known member
Nov 10, 2010
1,407
1,148
0
Visit site
Success partly, I got the battery charging only, but no OS booting. There's another step for it to boot into the OS. I think he uses
exec /sbin/ftm-power

I'll keep plugging away.

If you want to make custom bootlogos

Add to device_thunderc.mk

Code:
vendor/lge/thunderc/proprietary/sbin/bootlogo:root/sbin/bootlogo \
Grab the bootlogo from here https://github.com/adfad666/cm7_ven...1f6f16b60acd0f02fac/proprietary/sbin/bootlogo

And his bootimage folder here

https://github.com/adfad666/cm7_ven...b6f1f6f16b60acd0f02fac/proprietary/bootimages

Add to init.thunderc.rc .. looks like you could do boot sound too there.

Code:
# LGE_MERGE_S
# 20100708 hyeongwoo.seo@lge.com MS690: Change.. media -> root
#service bootsound /system/bin/playmp3
#    user root
#    group root
#    oneshot
# LGE_MERGE_E


# LGE_MERGE_S
# Boot logo in init script, munyoung.hwang@lge.com
service bootlogo sbin/bootlogo
    user root
    group root
    oneshot
# LGE_MERGE_E
 
Last edited:

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
Oh, and a couple of final comments on chargerlogo, in case any ROM maintainers want to play with it but don't want to build from sources:

The boot-pause action is not required. I added it to follow the CM changes that were discussed earlier. The early-boot action would work just as well. early-boot appears to be unused in CM/IHO, so using it to launch chargerlogo would be functionally equivalent and would not require changing any code at all.

The reason I moved chargerlogo to /sbin in the initrd was to ensure it got executable permissions. Note that in the current CM/IHO builds, chargerlogo is not executable inside the initrd. So when repacking the initrd, ensure it's executable. (I highly doubt that chargerlogo itself cares what directory it lives in.)
 
  • Like
Reactions: JerryScript

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
  • Like
Reactions: JerryScript

jack454

Well-known member
Mar 3, 2011
53
11
0
Visit site
For the last week or so I have been getting this error (Fetching projects: 91% (186/204) fatal: The remote end hung up unexpectedly
error: Cannot fetch CyanogenMod/android_prebuilt) when syncing with the repo. Anyone know what the problem might be? Thanks for any help.
 

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
Yeah me too. A google search turned up a solution that works for me: replace git: with http: in the problem repo stanzas under the .repo directory.
 
  • Like
Reactions: jack454

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
Yeah, the prebuilt repository got derped as a result of some ICS pushes. Edit default.xml file in the android folder and make the following change:
Code:
## Add this under the existing cyanogen remote:
  <remote  name="github-https"
           fetch="https://github.com/"
           review="review.cyanogenmod.com" />

## Find this line and change the remote at the end to read like this:
  <project path="prebuilt" name="CyanogenMod/android_prebuilt" remote="github-https" />
Or you can fork prebuilt and sync from your own repository. ;)
 
  • Like
Reactions: jack454

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
I'm slowly getting the hang of git and the android layout. I'd like to solicit comments on some contributions:

1. Enable chargerlogo. I've posted the diffs above in this thread and someone may beat me to it.

2. Enable bootlogo. Haven't got this yet and others may beat me to it. But given that IHO targets multiple variants, the original VM splash is surely not appropriate. Should I attempt to gather all the original splashes and switch based on the build target, or just use a generic one? I am partial to the android scribble myself, and I have already got it converted to 12 320x480 RLE images. :)

3. Disable FM radio (assuming no IHO variants actually have one...?) This is pretty simple -- it just requires ifdef-ing out a couple chunks in AudioHardware.cpp and removing the two radio entries in BoardConfig.mk.

After that, my todo-list looks like this:

* Reduce timeout for receiving IMAP banner to work around a broken exchange server at work.
* Look into why certain apps crash when network permission is removed -- perhaps reimplement a different way.
* Introduce a WiFi portal auto-login for portals that require an "agree" button to be pressed.
* Look into fixing the sound volume bug.
* Enable flashlight mode with white screen instead of graying out the option.
* Make an option to disable the emergency call button in the lock screen (which should be the CM default for non-cell devices such as the Nook Color, but I like it on my phone also).
 
  • Like
Reactions: mustafu

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
1- we appreciate and are experimenting with your ideas on the chargerlogo, hope to have something to report this weekend when I have more time.

2- the standard android bootlogo scrawl isn't done via a sequence of images, it's a moving bitmask, and LeslieAnn create a harmonia version of it months ago. Perhaps I'm speaking of something else?

3- To disable FM radio in the build, just comment it out in the vendor/cyanogen/products/bcm_fm_radio.mk

Looking forward to your contributions! Let us know when you have your github setup well enough to share!
 
  • Like
Reactions: mustafu

tdm

Well-known member
Apr 11, 2011
1,409
3,596
0
Visit site
1- we appreciate and are experimenting with your ideas on the chargerlogo, hope to have something to report this weekend when I have more time.

2- the standard android bootlogo scrawl isn't done via a sequence of images, it's a moving bitmask, and LeslieAnn create a harmonia version of it months ago. Perhaps I'm speaking of something else?

3- To disable FM radio in the build, just comment it out in the vendor/cyanogen/products/bcm_fm_radio.mk

Looking forward to your contributions! Let us know when you have your github setup well enough to share!

2. I was speaking of the virgin mobile animation that runs immediately at boot on the stock ROM. This is done with 12 rle images named sprint_power_on_%d so it's obviously hacked from a similar animation for sprint. I assumed all thunderc variants did this and it would be desirable to have. But perhaps one or both of those assumptions is faulty?

3. Yes i did that and it works thanks. But disabling the radio settings in BoardConfig.mk is a lower level and cleaner IMO. I'm going under the assumption (again) that the reason blarfie used the radio settings is due to the compile issue. No big deal either way. I just wanted to share what I thought was a cleaner solution.
 
  • Like
Reactions: mustafu

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
3. Yes i did that and it works thanks. But disabling the radio settings in BoardConfig.mk is a lower level and cleaner IMO. I'm going under the assumption (again) that the reason blarfie used the radio settings is due to the compile issue. No big deal either way. I just wanted to share what I thought was a cleaner solution.

Blarf spent a couple of weeks trying to get the radio to work when he first put IHO together. He finally came to the conclusion that even though it's in the specs for the chip, it's most likely disabled by a pin or a lack of connected I/O (he even did a visual inspection after disassembly). I know several others attempted to get it to function, all in vain. I do not know if it's necessary for compilation.

Since you clearly know your way around, if you have time, looking into the headset mic situation would be appreciated by many. Blarf, thekraven, Bob, and I have all been looking into it as well. Here in Vegas, the new year brought a new law for cell phone usage while driving, so this is one issue I would love to resolve! ;)
 
  • Like
Reactions: mustafu

Forum statistics

Threads
943,150
Messages
6,917,533
Members
3,158,848
Latest member
kerokekerol