hw_config.sh updating using echo command - XPERIA X8 Android Development

firstly i'd like to apologize if this has been brought up before (i can't seem to find it), or if i'm posting in the wrong subforum. i originally made a thread in General but it seems that the entire subforum has far less visitors than here...
now idk if anyone's figured this out yet, but i just tried it and it works.
instead of pulling out hw_config.sh, editing it, then pushing it back again or just plain editing it from the phone itself, we can use the "ECHO" command...
from the shell:
# remount
# echo "whatever you want to put here" >> /system/etc/hw_config.sh
Click to expand...
Click to collapse
it will append whatever it is you typed within the " " to the END of hw_config.sh
still haven't figured out how to do insert new line in it tho apart from multiple echo commands.
i think this can be particularly useful for devs like doixanh who's said that he needs to create a custom zip for different ROMs? maybe something like that can be put into the xrecovery update script? idk how to go about editing that file so i didn't wanna try it.
maybe something for his for example mddi module can have a command like
echo "insmod /system/lib/modules/x8mddi.ko # fix mddi lags" >> /system/etc/hw_config.sh
Click to expand...
Click to collapse
or something like that

Simple universal solution: don't edit hw_config. Use chargemon, that way only one update zip is needed.

can't say i know what it is or how to use it i'm still quite new to all this hehe. will look it up tho. i do know a little basic linux and command line things so i was just trying it out to see if it works since DX said he won't be making custom zips for all the different ROMs out there but many ppl seems to be asking for one. just thought maybe it would help :shrugs:

add to the second (empty one) line in chargemon this:
insmod /system/lib/modules/ModuleName.ko
You can add more insmod lines, one bellow another.
Then everyone should update recovery with FlashTool 0.2.9.1 to avoid any issues, and push new chargemon to /system/bin
Of course, you can modify the positioning in chargemon, for example, place insmod lines after keypress check - for booting into recovery, to make it still possible to boot into recovery if modules cause bootloops.

Related

[Q] Start up script for X10?

Anyone know how to get a script to run at every boot? I've tried putting it in /etc/, /etc/init.d, and modifying the xRecovery init.rc with no luck. Any guidance would be greatly appreciated. Thanks.
have you tried to edit the modded chargemon file? it's a part of Xrec and is a simple script which do the mounting, so appending you things at its end could do the job... I think
Adolf1994 said:
have you tried to edit the modded chargemon file? it's a part of Xrec and is a simple script which do the mounting, so appending you things at its end could do the job... I think
Click to expand...
Click to collapse
Thanks, but no dice. Script still didn't run.
kxhawkins said:
Thanks, but no dice. Script still didn't run.
Click to expand...
Click to collapse
whts the script exactly? u want to execute some other script thru chargemon?
oh btw permission are verified right? (chmod 755 <scriptname>)
Some sysctl settings, like busybox sysctl -w parameter=value
Code:
/system/etc/install-recovery.sh
This file never existed, but it's being called from init.rc during the system boot.
Rename your script accordingly and enjoy.
Cheers,
z
AWESOME, thanks so much. I'll try that in just a second...
Nope doesn't work. Would of been nice if you could of report your results after you tried it. (Changed permissions to 777 as well.)
Tried editing init.rc and a post boot script file also at / both ignored and files reverted back to originals on boot (with 1st Jan 1970 as time-stamp).
There is a init file full of random symbols and a few lines of what looks like it should belong in init.rc (mount /system ect), could this be a signed file that reloads the other files on boot or something similar? (Attached to post, had to be zipped cos this forum has a stupid limit on .txt files.)
Seems SE has gone out of its way to stop commands being executed at boot time! I'm running stock ROM. Anyone got any other ideas?
Figured it (Get in!)
I edited /system/etc/hw_config.sh
Look at that init with HTML viewer and scroll down a lot
Sent from my X10i using XDA Premium App

[Q] Please help me... (problems with md5sum mismatch)

Hello,
I am having a major problem... earlier today i made a backup of my ics'd out v8 rom in order to try the new CM7 Kang. I got the kang running but needed to install gapps. For some reason rom manager was not letting me install it from there because it wasn't an updated version of rom manager and i couldn't get an updated version. So i figured I would go back to my ics'd rom, download gapps on the sdcard, and then go back to cm7 to install... NOPE.
Every time I try to restore my backup I get md5 mismatch error. I went through a bunch of different threads for different phones and tried all the adb stuff it said and nothing worked. For some reason when I ran the command (given here http://forum.xda-developers.com/showthread.php?t=714114) "cd /sdcard..." the pound # changed to a > and everything I typed would just be repeated back at me. The phone never even asked for superuser permission. I am pretty sure that I have the adb stuff right since when I type in "adb devices" in command I see the device, but I just have no clue how to fix this. Maybe the instructions given on this page only applies to that particular phone?
I would really like to be able to recover this backup and if anyone has instructions on how to fix this error on this phone it would be very much appreciated.
Thanks!
ADB was working if you got a # prompt
Custom kernels are almost all "insecure" kernels - ADB sessions automatically have root permissions.
This was the case for you - a # prompt means you have root privileges.
A $ prompt means you don't
A > prompt means that something you typed on the previous line made the shell decide you wanted to type more before executing the command. Control-C will break out of this. So if you got a > prompt after the "cd /sdcard/clockworkmod/backup/blahblah" command - you mistyped something on that line. Possibly you put a ; in there by accident, or you have opening quotes without closing quotes
There is a comment later in that thread "the folder name for your backup couldn't have spaces in it" - Weird characters in the directory name would be a possible cause of your cd command failing.
CWM should never have created a folder name that behaves like this, unless you did a nandroid backup using ROM Manager. If you did - another reason NOT to use ROM Manager.
Did you change the file name of the backup? make sure there is no spaces in file name. hope this help.
I would just download gapps to computer then move the file to phone. Then reboot into cwm and flash galls.
Sent from my SAMSUNG-SGH-I777 using XDA App
Artimus009 said:
I would just download gapps to computer then move the file to phone. Then reboot into cwm and flash galls.
Sent from my SAMSUNG-SGH-I777 using XDA App
Click to expand...
Click to collapse
Code:
adb push
is your friend - great way to put a file on the phone when it's in recovery
Entropy512 said:
ADB was working if you got a # prompt
Custom kernels are almost all "insecure" kernels - ADB sessions automatically have root permissions.
This was the case for you - a # prompt means you have root privileges.
A $ prompt means you don't
A > prompt means that something you typed on the previous line made the shell decide you wanted to type more before executing the command. Control-C will break out of this. So if you got a > prompt after the "cd /sdcard/clockworkmod/backup/blahblah" command - you mistyped something on that line. Possibly you put a ; in there by accident, or you have opening quotes without closing quotes
There is a comment later in that thread "the folder name for your backup couldn't have spaces in it" - Weird characters in the directory name would be a possible cause of your cd command failing.
CWM should never have created a folder name that behaves like this, unless you did a nandroid backup using ROM Manager. If you did - another reason NOT to use ROM Manager.
Click to expand...
Click to collapse
Thanks for the reply! Yeah that would make sense but I copied the file path directly from windows explorer and I checked for spaces too... Yeah I only do backups straight from CWM.
getbuzzin said:
Did you change the file name of the backup? make sure there is no spaces in file name. hope this help.
Click to expand...
Click to collapse
I did change the name from the original name, I added like "ics'doutv8siyah2.6.1blahblahblah" to the beginning so that I could distinguish which backup was which. Could this make a difference? I mean I have done this before without issue.
Shadow12347 said:
Thanks for the reply! Yeah that would make sense but I copied the file path directly from windows explorer and I checked for spaces too... Yeah I only do backups straight from CWM.
I did change the name from the original name, I added like "ics'doutv8siyah2.6.1blahblahblah" to the beginning so that I could distinguish which backup was which. Could this make a difference?
Click to expand...
Click to collapse
Change it back and see if it works
Only letters, numbers and periods. the ' is probably to blame.
Sent from my SAMSUNG-SGH-I777
Well I deleted the beginning and it looked like it was going to work because it was checking md5 sums for a while and then it said md5 mismatch. But it wasn't instant like the other times.
I think I read on one of the pages that you could take the nandroid.md5 from another backup and replace it with the one in the nonworking backup, is this true and would it work?
Ok nevermind, I forgot to do the ADB thing again xD it worked... THANK YOU SO MUCH!
karth500 said:
Only letters, numbers and periods. the ' is probably to blame.
Sent from my SAMSUNG-SGH-I777
Click to expand...
Click to collapse
Most likely.
I usually rename my backups manually to something like romname_date in ADB
e.g.
villainrom_1224
I NEVER put spaces or other characters in the rom name
Right now I think I have:
modstock_1128
villainrom_1224
uckk6_1224
one other ROM...
Ok guys I'm sorry, it happened again... except this time I think it may be a problem with ADB. When I am in adb shell, it shows up as "~ #" instead of just "#", however, typing "su" changed it to just "#". However, in both instances ("~ #" and "#") it gets an error:
~ # cd /sdcard/clockworkmod/backup/2012-01-22.18.04.05
cd /sdcard/clockworkmod/backup/2012-01-22.18.04.05
/sbin/sh: cd: can't cd to /sdcard/clockworkmod/backup/2012-01-22.18.04.05
and
# cd /sdcard/clockworkmod/backup/2012-01-22.18.04.05
cd /sdcard/clockworkmod/backup/2012-01-22.18.04.05
cd: can't cd to /sdcard/clockworkmod/backup/2012-01-22.18.04.05
This is the original name, there are no spaces, I checked the driver for the phone, etc.
Anyone got any ideas?
Oops double post -_-
Try tab-completion (type part of a directory name and hit tab - sometimes it works and sometimes it doesn't, usually should work when ADBing into CWM), and use "cd" and "ls" to navigate through directories instead of just pasting the whole path.
ls = same thing as dir in DOS
Alright so I did that and found out the sdcard isn't mounting...
C:\android-sdk-windows\platform-tools>adb shell
~ # su
su
# ls
ls
acct fota.rc recovery.rc
app-cache init res
cache init.goldfish.rc sbin
config init.rc sdcard
customkernel init.smdkc210.rc sys
d init.smdkv310.rc system
data init_kernel_only.rc tmp
dbdata lib ueventd.rc
default.prop lpm.rc ueventd.smdkc210.rc
dev misc ueventd.smdkv310.rc
efs mnt vendor
etc proc
# cd /mnt
cd /mnt
# ls
ls
asec obb sdcard secure usb
# cd /sdcard
cd /sdcard
# ls
ls
#
I also went into root explorer and it said "SD card is not currently mounted"
...uhhh I feel like a noob to ask this but, how do you mount it? xD
The thing is, though, that it dismounts when I plug it into the computer to transfer files/adb, but it is mounted afterwards...

[Q] /sbin/echo and updater-script not playing nice...

Firstly, if this is the wrong forum, my apologies.
My problem is that I'm trying to use /sbin/echo to modify a file during a zip flash, but according to the recovery logs, all it's doing is printing the whole thing to the log. For example, if I do:
Code:
run_program("/sbin/echo", "'test' >> /sdcard/test.txt");
I don't get a new /sdcard/test.txt file with the word "test" in it, I get the output "'test' >> /sdcard/test.txt" in the log. Sorry if this is a common question, but I've been Googling without success for a couple hours now.
Thanks in advance!

[resolved] need Init.d script to execute a file on system/bin

Resolution on post #10, in post #11 a second resolution and on post #12 the confirmation.
I need a init.d script to run or execute a service that is on system/bin
Is this possible?
Which commands to use?
I researched a lot, and I do not find anything about it.
The file name is jellyservice.
Jellyservice is a normal service that need to be running before run a app, without that, the app does not run.
I know that:
1. The jellyservice is presented on stock rom and the stock rom use init.rc to call the jellyservice at boot, and i can change the init.rc by change the boot.img (unpack, change, repack), but i wanna to be able to run it on any device wit any kernel, and don't wanna to change it kernel for it rom.
2. I can use SManager to run the file on boot. but i don't wanna to need a app just init.d, init.d is already implemented and working on almost every custom rom, so I put the init.d file on a zip that flash the apk, libs etc, and no more app or config is need.
Thanks.
baybutcher27 said:
I need a init.d script to run a service that is on system/bin
Is this possible?
Which commands to use?
I researched a lot, and I do not find anything about it.
The file name is jellyservice.
Jellyservice is a normal service that need to be running before run a app, without that, the app does not run.
I know that:
1. The jellyservice is presented on stock rom and the stock rom use init.rc to call the jellyservice at boot, and i can change the init.rc by change the boot.img (unpack, change, repack), but i wanna to be able to run it on any device wit any kernel, and don't wanna to change it kernel for it rom.
2. I can use SManager to run the file on boot. but i don't wanna to need a app just init.d, init.d i already have implemented on rom, so I put the init.d file on a zip that flash the apk, libs etc, and no more app or config is need.
Thanks.
Click to expand...
Click to collapse
Is this what you are looking for, or I am missing something?
http://forum.xda-developers.com/showthread.php?t=1933849
And this, which is more up to date:
http://www.xda-developers.com/init-d-support-for-any-rooted-phone/
Ciuffy said:
Is this what you are looking for, or I am missing something?
http://forum.xda-developers.com/showthread.php?t=1933849
And this, which is more up to date:
http://www.xda-developers.com/init-d-support-for-any-rooted-phone/
Click to expand...
Click to collapse
No you did not read what I wrote.
As I said, i wanna a script of init.d that runs or execute a file, i already have init.d working...
baybutcher27 said:
No you did not read what I wrote.
As I said, i wanna a script of init.d that runs or execute a file, i already have init.d working...
Click to expand...
Click to collapse
Sorry, I was assuming you could find help there. By the way, you should be able to do this just by using a script like:
#!/system/bin/sh
-Give permission
/path/jelliservice
Then place it in init.d or write a specific script for init.d to run the above one.
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot
Sorry if there's a bigger obstacle I'm not aware of.
Ciuffy said:
Sorry, I was assuming you could find help there. By the way, you should be able to do this just by using a script like:
#!/system/bin/sh
-Give permission
/path/jelliservice
Then place it in init.d or write a specific script for init.d to run the above one.
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot
Sorry if there's a bigger obstacle I'm not aware of.
Click to expand...
Click to collapse
No is all good.
but??? that willl run the service, or just give a permission.
I don't really know much about init.d script and the web does not help in that thing i wanna.
i'm implemented it now to see what that script does. :good:
baybutcher27 said:
No is all good.
but??? that willl run the service, or just give a permission.
I don't really know much about init.d script and the web does not help in that thing i wanna.
i'm implemented it now to see what that script does. :good:
Click to expand...
Click to collapse
Oh, so you are just asking for help with the actual script, fine. See if you can figure it out yourself from that post, I'm trying to build an easy example right now. I seem to not have this jelliservice you are talking about, maybe you can give me a few more insights about this.
Ciuffy said:
Oh, so you are just asking for help with the actual script, fine. See if you can figure it out yourself from that post, I'm trying to build an easy example right now. I seem to not have this jelliservice you are talking about, maybe you can give me a few more insights about this.
Click to expand...
Click to collapse
ok.
i tested that you post doesn't do what i need.
i have this on init.d to now if it works.
#!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
so i change the "done" of the last line to wherever and it time i reboot it change to wherever i wrote.
so init.d is working fine.
The jellyservice is a service that only exist on motorola stock rom on devices that have dedicated hardware of DTV.
it is started by i .rc file:
init.mmi.dtv.rc
and the content of that .rc is:
Code:
on boot
# DTV feature
service dtv-jelly /system/bin/jellyservice
class main
user system
group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw
iknow that is possible to implemented that .rc on any device by add it to the kernel or boot.img but it will be need to do on any rom and that is allot of work and will be impossible.
so i have created a tread to give support for that DTV to any custom rom, and i wanna to make a more completed .zip to the app.
see the thread here
baybutcher27 said:
ok.
i tested that you post doesn't do what i need.
i have this on init.d to now if it works.
#!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
so i change the "done" of the last line to wherever and it time i reboot it change to wherever i wrote.
so init.d is working fine.
The jellyservice is a service that only exist on motorola stock rom on devices that have dedicated hardware of DTV.
it is started by i .rc file:
init.mmi.dtv.rc
and the content of that .rc is:
Code:
on boot
# DTV feature
service dtv-jelly /system/bin/jellyservice
class main
user system
group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw
iknow that is possible to implemented that .rc on any device by add it to the kernel or boot.img but it will be need to do on any rom and that is allot of work and will be impossible.
so i have created a tread to give support for that DTV to any custom rom, and i wanna to make a more completed .zip to the app.
see the thread here
Click to expand...
Click to collapse
You are right, it's not easy to test this out because of default .rc hardcoded into kernel... in order to do this you would have to edit .rc to run that service that runs userinit.sh... Have you already done this? And, are you able to start the service manually?
Ciuffy said:
You are right, it's not easy to test this out because of default .rc hardcoded into kernel... in order to do this you would have to edit .rc to run that service that runs userinit.sh... Have you already done this? And, are you able to start the service manually?
Click to expand...
Click to collapse
i didn't try implemented that .rc on boot.img, that is too much work, and need to be done on it kernel or rom update, but yes can be done.
The file is just like any other executable, just like a .sh or any file you can execute using a app that can execute files like, root browser or SManager.
all the process to run the file is on the thread i just post.
The thing is i already know how to run it via app, but i don't wanna to stop there i wanna to run it via init.d because is a very simple way, but very difficult to find the commands.
Exists any command on init.d that can run a file commands like, run, execute, open or start ?
any of those work? and how to use they?
have any website that have all the command available on init.d?
Hey, you can run a binary from sh by just invoking its path, for example:
Code:
#!/bin/sh
/system/bin/jellyservice
The proccess will spawn with UID 0 (root)
You can change that if you have a good root binary by doing this:
Code:
#!/bin/sh
su system -c '/system/bin/jellyservice'
If you're using supersu I think you have to enable root at boot (Look at the application settings)
baybutcher27 said:
i didn't try implemented that .rc on boot.img, that is too much work, and need to be done on it kernel or rom update, but yes can be done.
The file is just like any other executable, just like a .sh or any file you can execute using a app that can execute files like, root browser or SManager.
all the process to run the file is on the thread i just post.
The thing is i already know how to run it via app, but i don't wanna to stop there i wanna to run it via init.d because is a very simple way, but very difficult to find the commands.
Exists any command on init.d that can run a file commands like, run, execute, open or start ?
any of those work? and how to use they?
have any website that have all the command available on init.d?
Click to expand...
Click to collapse
so i resolve this :silly: :laugh: :victory:
after writing I read, and is so lame.
if the file is just like any other executable way not put it in the init.d folder?
and i put, rename to 99jellyservice
and the init.d run it and the apk that need that file to be running before you open it work.
@Ciuffy
Thanks you help me to find a way...
nagalun said:
Hey, you can run a binary from sh by just invoking its path, for example:
Code:
#!/bin/sh
/system/bin/jellyservice
The proccess will spawn with UID 0 (root)
You can change that if you have a good root binary by doing this:
Code:
#!/bin/sh
su system -c '/system/bin/jellyservice'
If you're using supersu I think you have to enable root at boot (Look at the application settings)
Click to expand...
Click to collapse
the 1° option work perfectly!, but i use like this
Code:
#!/system/bin/sh
/system/bin/jellyservice
i think doesn't make a difference.
Thanks man I will use your way, is better that my. :good:
baybutcher27 said:
the 1° option work perfectly!, but i use like this
Code:
#!/system/bin/sh
/system/bin/jellyservice
i think doesn't make a difference.
Thanks man I will use your way, is better that my. :good:
Click to expand...
Click to collapse
Yeah basically the only difference is that Android has no /bin/sh but /system/bin/sh. I though about just putting that there honestly but I couldn't get any of this working on my cyanogenmod so I was trying to figure out why >.>, but I'm probably missing something.
Anyway, glad I could help!

OpenRecoveryScript question

I hope someone can answer this question for me. I've written some logic for OpenRecoveryScript that I am going to use in conjunction with Tasker to get my phone to automatically take an image in TWRP once per month.
Below is the code I plan on using in Tasker to put some commands in the OpenRecoveryScript file. (The %MyDate and %TIME items are Tasker variables.)
My question is: do I need to somehow delete the OpenRecoveryScript file when it is done running? Or is it automatically deleted when exiting TWRP? I ask because I don't want the script to run every time I go into TWRP; only when it is set to run by Tasker.
Code:
set crfolder="/cache/recovery"
set orsfile="${crfolder}/openrecoveryscript"
chmod 0777 ${crfolder}
rm -f ${orsfile}
touch ${orsfile}
echo "backup SDBO auto-%MyDate--%TIME" >> ${orsfile}
I believe twrp clears out the /cache/recovery directory after exiting twrp. You can always make a script like echo "test" >> /sdcard/test.txt then boot into twrp twice, but one time running the script. then see if there are two lines in that text file or just one. that should answer your question definitively.
Ophidian_DarkCore said:
I believe twrp clears out the /cache/recovery directory after exiting twrp. You can always make a script like echo "test" >> /sdcard/test.txt then boot into twrp twice, but one time running the script. then see if there are two lines in that text file or just one. that should answer your question definitively.
Click to expand...
Click to collapse
Good idea. Thanks for the suggestion.

Categories

Resources