[For Devs or Linux users] Conv option for dd [Resolved, but you can answer) - Galaxy 3 Q&A, Help & Troubleshooting

Hi.
I try to modify the stock lockscreen on an Odexed JPQ, and after re-odex the android.policy.odex, i need to re sign it.
Two choice : hex modify the file (i'm not good with hexadecimal )
Or use the dd command :
Code:
# dd if=original.android.policy.odex of=patched.odex bs=1 count=20 skip=52 seek=52 [B]conv=notrunc[/B]
But i have an error when i use the conv option : "conv option disabled"
Someone knows how to enable it ? It will simplify my life
Thanks
EDIT : I done it. But if someone can aswer, that will be good

How did u solve this ?

Related

Changing init.rc of LG GW620 / EVE

Hi guys,
I'm trying to make some changes in the init.rc of my LG GW620,
I have add this service:
Code:
service tole_services_sysinit /system/bin/logwrapper /system/bin/sh /system/bin/tole.sysinit
disabled
oneshot
And this at the end of "on boot" section:
Code:
start tole_services_sysinit
And this is the code of /system/bin/tole.sysinit:
Code:
#!/system/bin/sh
setprop ro.modversion "LG EVE/GW620 mod by jros aka tolemaC"
export ROM=tolerom
And have correct permisions:
Code:
# ls -l /system/bin/tole.sysinit
ls -l /system/bin/tole.sysinit
-rwxr-xr-x root root 359 2010-03-11 23:26 tole.sysinit
When phone reboot the property ro.modversion is not set and ROM isn´t in the export list and don't have value.
Yes, I have modify the boot.img and flash it.
To see if init.rc is being processed correctly I have added this lines at export sections (at the beginning of "on init":
Code:
export TERMINFO /system/etc/terminfo
export TERM linux
When reboot TERM and TERMINFO are defined with correct values, but ROM and ro.modversion property aren't defined.
I think that tole_services_sysinit service don´t start, but I don´t know why.
Any ideas?
I have lost too many time with that.
I have see this post:
http://forum.xda-developers.com/showthread.php?t=575144
But I don´t see what is wrong.
Thanks in advance.
EDIT
I have tryed to add the service with not "disable" modifier:
Code:
service tole_services_sysinit /system/bin/tole.sysinit
user root
group root
oneshot
But the result is the same.
One note: Is Android 1.5
Nobody knows?!?
Where can I find help about that?
Someone knows?
What are the permissions on the /system/bin/tole.sysinit file?
Thank you Zacpod.
The permissions:
-rwxr-xr-x root root 359 2010-03-11 23:26 tole.sysinit
And it runs as expected when you type /system/bin/tole.sysinit?
I followed the same tutorial you mentioned above, so I'm not sure why yours isn't working.
Hi Zacpod, I could run /system/bin/tole.sysinit without problems.
I don´t know what was happend, but I have good news.
I have started from scratch, I have flashed with V10G_00 version from LG and I have done a nandroid. Then I have extract boot.img and I have modified init.rc adding a simple service and now works fine.
In this test I have called my service as "toleinit1" and works fine but I have changed the name to "tole_services_sysinit" and then it doesn´t work , I don´t know if is due to length of service name or is due to "_" chars.
Well, now it´s work fine.
Thanks for passing, your response has made me review the issue.

use dd to root p970!

Op afraid that lg might know this and patch it. I call that's a bull. I don't think lg engineer didn't know how to use dd. As long as we have unecrypted bin file we can patch it. Btw, how can one conceal a patching method using simple dd when you have unpatch file and patched file to compare? Even I managed to figure it out. Op true intention known only to himself.
So, to patch your bin file: (this is done on ubuntu, i don't know if windows got dd)
1. Download cwm at http://download.clockworkmod.com/rec...8.1.3-p970.img to the folder where you keep your bin file.
2. Open terminal and cd to the same folder as above
3. What we need to find is the location where we're suppose to copy cwm into the bin file. dd is bit-stream reader and it will show us the location in term of bytes. We need to search for ANDROID! string. So type:
dd if=LGP970AT-00-V20b-SEA-XXX-JAN-02-2012+0_AP.bin| strings -n 8 -t d| grep ANDROID!
result:
1436661 ANDROID!
1703936 ANDROID!
6422528 ANDROID!
bla..bla..bla...
4. Look of the last entry which contain the ANDROID! string and take note of its byte location (6422528 in this case)
5. Now it's time to copy cwm into the bin file. Type:
dd if=<cwm.img> bs=1 seek=<byte location> conv=notrunc of=<rom.bin>
So in this case:
dd if=recovery-clockwork-touch-5.8.1.3-p970.img bs=1 seek=6422528 conv=notrunc of=LGP970AT-00-V20b-SEA-XXX-JAN-02-2012+0_AP.bin
6. That's it. Your rom is ready to be flash using smartflash tool. You can run the same command in step 3 to verify that cwm is succesfully copied into the bin file. If at the same byte location the ANDROID! string change to [email protected] then you're good to go.
Don't waste your bandwidth to download the op's file if you can do this yourself and beside there's nothing to test, not that op modified the rom in any way. You would be better off testing huexxx zues rom imho.
http://forum.xda-developers.com/showthread.php?t=1480392&page=11
So here's the first question: where from can we find an unecrypted bin rom for our O3D?
3rd step,after the command I don't get such lines
"1436661 ANDROID!
1703936 ANDROID!
6422528 ANDROID! "
I get a count of entries instead.

[Q] mmcblk0p23 - P/N 99HMN088-00

I've stupidly messed up my mmcblk0p23 partition and I'm desesperatly trying to restore it, but all the dump I tried to flash were not able to make it work properly.
So I've been looking into the raw dump using HexEdit and I noticed that they were for differente revision (P/N) of the board.
That's why I'm looking for someone with a HTC Desire S P/N 99HMN088-00 (this number is written on the phone behind the battery) willing to provide me with dump of their mmcblk0p23 partition.
If you're a volunteer, and if you need assistance in making a copy of that partition, here is a quick guide:
Prerequisite
- Phone rooted
- Android USB driver and tools installed
Procedure
Code:
On the command line type:
> adb shell
$ su <-- Needed if you're not already su
# dd if=/dev/block/mmcblk0p23 of=/sdcard/mmcblk0p23.img
# exit
$ exit <-- Needed if you had to type 'su' ;)
> adb pull /sdcard/mmcblk0p23.img
-Then you should have a copy of the partition on your PC.
-Edit it with HxD Hex Editor
-search for your IMEI (ctrl+F) replace it with XXXX...
-search for your serial number and replace it also with XXXX...
-Save the file
-You're ready to send me your file and save my phone
It's like an organ donation !!!! You'll save a DS :laugh:
All your help is welcome

[Guide] How to enable init.d script support on stock ROM

*****************************************************************************************************************************************************
Credit for discovering this method goes to Sr. Staff gurus @_that (bet you could have guessed) and @becomingx for parsing GNU code to figure out file naming limitations (no dots!) to make this work.
******************************************************************************************************************************************************
This short Guide accompanies the need to run my B2R startup script (or any script) as root at boot. If you are rooted and have busybox installed on a stock ROM or any ROM that does not have init.d support thru init.rc, here's how you can add it. This is an alternative method to either using Script Manager (SManager) or hijacking the install-recovery.sh file directly to run a startup script. Enabling this support allows you to be able to run all executable scripts located in init.d as root at boot.
IMPORTANT: Your init script name can NEITHER have any dots in the filename NOR use an extension. Name it something like autostart or start-up or init_script. Also when you write a script, NEVER forget to start it with the hash-bang-path to shell (#!/system/bin/sh) and NEVER forget to press ENTER after the last character of the last line of code. You can't just use any simple text editor to create the file - you must pay close attention to "line ends". I use ES Note Editor on device and Notepad++ configured for UNIX/OSX line ends on PC. Always save the file AS PLAIN TEXT. Read "Additional Information" below on line ends.
[NOTE: /system/etc = /etc (symlink)]
1. Mount your /system rw
Code:
mount -o remount,rw /system
2. Make directory /system/etc/init.d
Code:
mkdir /system/etc/init.d
3. Create a shell script (using a text editor with UNIX line ends [LF only] ) named "/system/etc/install-recovery.sh" with the following contents:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
4. Put your init script in init.d and remember to make both /system/etc/install-recovery.sh and your script in /system/etc/init.d executable.
Code:
cd /system/etc
chmod 755 install-recovery.sh
cd /system/etc/init.d
chmod 755 name_of_your_init_script
5. Immediately reboot or if not, mount your /system ro
Code:
mount -o remount,ro /system
If you have busybox installed in /system/xbin this enables support for running init.d scripts from ROMs that do not offer native support thru init.rc.
Additional Information:
Every file has what are know as line ends or more technically end of line (EOL) conversions. These are HIDDEN characters that you normally don't see (if the line end are in the native OS format) at the end of lines in a text editor when editing files. This is the character that tells the OS where one line stops and the next starts in any file. In order to see the line ends you must enable "show all characters".
Your text editor must support UNIX line ends (LF only, not CR + LF = CRLF). Do NOT use Windows Notepad as it only creates Windows line ends (CRLF).
Always use UNIX line ends - a Windows editor like Notepad will create CRLF line ends, while your shell script MUST use LF line ends or it will fail to execute. Otherwise your first line will look like this to Linux:
Code:
#!/system/bin/sh^M
The ^M above is the common convention to display the control character Ctrl+M, which is CR (carriage return) before the LF (line feed) or (CRLF). The consequence is that the system can't find your shell under the name "sh^M" (or any subsequent command "some_command^M") and your script will fail.
This is VERY important to understand and also how to configure any cross-platform text editor. Using notepad++ in Windows without changing the default settings still results in CRLF at the end of lines because it knows its running in Windows and thinks you want Windows line ends. In order to change this behavior, Under the Edit menu find EOL conversion, and select Unix/OSX format. Also toggle the paragraph symbol on the top bar (backwards P with double verticles; show all characters) and now its clear as day what line ends you have, where they are, and if you have one after the end of the last line or not. Now its WYSIWYG. Once these setting are toggled, saving the file in Windows results in Unix/OSX line ends (LF) and when you open notepad++ the next time the settings are retained. See screenshot before attachment at the end of this post.
Example for changing default EOL conversion to Unix LF for an older version of notepad++:
http://techtips-it.blogspot.com/2011/04/can-i-convert-file-format-in-notepad.html
If done correctly, the output you will see if VIEWED (not edited) using Windows notepad will show a small hollow rectangle representing each LF. You will see one for each line end, and two together at the end of the last line itself - the first is the EOL LF for that line, and the subsequent is the LF you entered after the last line. If notepad just shows what you would normally see in the XDA code block with no extra special characters as described, you have Windows line ends and your script will fail to execute.
If you have multiple scripts to run at boot, the real purpose of init.d, you should name your init scripts prepended with two digits between 00 and 99. (Fairly) Evenly divide the range into 3 groups like 2# (20-29), 5# (50-59), and 8# (80-89). Scripts in the 20 series will be run first, followed by 50 series scripts, ending with 80 series scripts. They will be executed from lowest number to highest number, in that order. This allows you to define the load order for a group of init scripts. We didn't use 00-19 or 90-99 in case we need to put a future script before the first or after the last one without having to rename the rest of the scripts to do so.
Example init script names: 20firststart, 50mid_start, 80end-boot
******************************************************************************************************************************************************
Download the attachment and remove the txt extension and copy it into /system/etc and make sure it is executable. Make directory /system/etc/init.d, put your executable boot scripts in there, and reboot to run your executable init.d scripts as root.
This method replaces the depreciated method of directly hijacking install-recovery.sh with a single boot script run as root. Why have only one when you can have many?
Linkback to dev thread
http://forum.xda-developers.com/showthread.php?t=2191777
Reserved
Sent from my LG-LS970 using xda app-developers app
elfaure said:
@_that, please review and bless.
Click to expand...
Click to collapse
elfaure said:
IMPORTANT: Your init script name can NEITHER have any dots in the filename NOR use an extension. Name it something like autostart or start-up or init_script.
Click to expand...
Click to collapse
I still recommend using the common Unix convention of 2 digits + lowercase name for init.d scripts, e.g. 50something, 60dothislater, 90somethingtodolast. The numbers allow for clearly defining the order in which multiple startup scripts are executed.
elfaure said:
Also when you write a script, NEVER forget to start it with the hash-bang-path to shell (#!/system/bin/sh) and NEVER forget to press ENTER after the last character of the last line of code. You can use any simple text editor to create the file. I use ES Note Editor on device and Notepad++ on PC. Always save the file AS PLAIN TEXT.
Click to expand...
Click to collapse
And always use UNIX line ends - a Windows editor like Notepad will create CRLF line ends, while your shell script MUST use LF line ends. Otherwise your first line will look like this to Linux:
Code:
#!/system/bin/sh^M
The ^M above is the common convention to display the control character Ctrl+M, which is CR (carriage return) before the LF (line feed). The consequence is that the system can't find your shell under the name "sh^M" and your script will fail.
elfaure said:
4. Remember to make it executable and to create the /system/etc/init.d directory.
Click to expand...
Click to collapse
You already created init.d in step 1.
Looks like it could work like this. If you want to be sure, remove your existing scripts and rmdir your init.d directory, then follow your own guide and see if everything is OK. Then you can bless it yourself. In software development, peer review is always good, but testing is even more important.
_that said:
I still recommend using the common Unix convention of 2 digits + lowercase name for init.d scripts, e.g. 50something, 60dothislater, 90somethingtodolast. The numbers allow for clearly defining the order in which multiple startup scripts are executed.
And always use UNIX line ends - a Windows editor like Notepad will create CRLF line ends, while your shell script MUST use LF line ends. Otherwise your first line will look like this to Linux:
Code:
#!/system/bin/sh^M
The ^M above is the common convention to display the control character Ctrl+M, which is CR (carriage return) before the LF (line feed). The consequence is that the system can't find your shell under the name "sh^M" and your script will fail.
You already created init.d in step 1.
Looks like it could work like this. If you want to be sure, remove your existing scripts and rmdir your init.d directory, then follow your own guide and see if everything is OK. Then you can bless it yourself. In software development, peer review is always good, but testing is even more important.
Click to expand...
Click to collapse
Thanks for the review! I will make some edits, test drive the guide, and bless it myself. I was already going to add the two digit numerical discussion. I'm not trying to get you to do any extra or my work here, God knows you are a very busy multi-tasking hundreds of tasks , I just thought I was on newb patrol after posting a non-working script and then mandated to your must review list.
Is this method works on other phone too?
I really do want the init.d support on stock rom
Sorry for my bad English...
Sent from my HTC Desire 200 using XDA Premium 4 Mobile app
dicks93277 said:
Is this method works on other phone too?
I really do want the init.d support on stock rom
Click to expand...
Click to collapse
The method is reasonably generic that it is worth trying on your device.
so sad that i can't make this work on my phone
but still thanks for your reply @_that
Awesome it works on my Panasonic T41 running MIUI 5 beta
Could you tell how to do the same thing from init.rc ???
and also one script is not working
Code:
#!/system/bin/sh
su
mount -o rw,remount /
mkdir -p /rex
mount -o bind /data/data/com.spartacusrex.spartacuside/files/system /rex
mount -o rw,remount /system
mkdir -p /system/vendor/bin
mount -o /rex/bin /system/vendor/bin
Is there any thing wrong with it ?? I used unix terminators and also set the permissions to 755
uttarayan21 said:
Awesome it works on my Panasonic T41 running MIUI 5 beta
Could you tell how to do the same thing from init.rc ???
and also one script is not working
Code:
#!/system/bin/sh
su
mount -o rw,remount /
mkdir -p /rex
mount -o bind /data/data/com.spartacusrex.spartacuside/files/system /rex
mount -o rw,remount /system
mkdir -p /system/vendor/bin
mount -o /rex/bin /system/vendor/bin
Is there any thing wrong with it ?? I used unix terminators and also set the permissions to 755
Click to expand...
Click to collapse
The 'su' command with no arguments starts an interactive shell, everything after 'su' waits for the user to exit that shell, which you can't do. Init.rc and subsequent scripts are run as root anyway, including init.d scripts, so just delete the 'su' line and it should work.
Sent from my LGL41C using Tapatalk
Kor1134 said:
The 'su' command with no arguments starts an interactive shell, everything after 'su' waits for the user to exit that shell, which you can't do. Init.rc and subsequent scripts are run as root anyway, including init.d scripts, so just delete the 'su' line and it should work.
Sent from my LGL41C using Tapatalk
Click to expand...
Click to collapse
Thanks !!! It worked !!!!
uttarayan21 said:
Thanks !!! It worked !!!!
Click to expand...
Click to collapse
You're welcome [emoji6]
Sent from my LGL41C using Tapatalk
Why don't use service from init.rc ??
elfaure said:
*************************************,
3. Create a shell script (using a text editor with UNIX line ends [LF only] ) named "/system/etc/install-recovery.sh" with the following contents:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
Click to expand...
Click to collapse
But it is better to add a service to init.rc and launch sysinit from there for init.d support !!!
Maybe you should update your guide with that !!!
:laugh: :good:
uttarayan21 said:
But it is better to add a service to init.rc and launch sysinit from there for init.d support !!!
Maybe you should update your guide with that !!!
:laugh: :good:
Click to expand...
Click to collapse
Changing init.rc requires repacking the boot image.
_that said:
Changing init.rc requires repacking the boot image.
Click to expand...
Click to collapse
Yeah it does but if you install SuperSU then the install-recovery.sh file will be modified and init.d will be lost !!!

[APP/FIX] Date/Time 1970 bug workaround v2.2

Hope this helps someone. I got fairly sick of the date/time bug giving me error alerts upon reboot. This fix takes the RTC date/time and applies an offset specific to your own phone to set the correct date/time at startup. I have attached an APK to make life easy. It should also give the ability to have recovery use the files it creates to set the clock correctly on startup.
The app requires root. If running AOSP, your ROM must have initscript support.
The app has 3 functions:
Install offset only (for use with a compatible recovery, not used by the ROM)
Install offset and initscript (to correct ROM clock offset, also for use with a compatible recovery)
Uninstall (Remove /data/local/userinit.sh /data/media/rtc_offset and /sdcard/rtc_offset)
Feel free to include the app in your own ROMs, just give me credit
As of version 2.0, the script will create /data/media/rtc_offset which can be used by recovery to correct the date/time on boot. Note this will require the recovery to specifically support this correction.
Version 2.1 uses /system/bin/toolbox for compatibility across roms (rather than relying on whatever /system/bin/date points to)
Version 2.2 places the rtc_offset file both in /sdcard/rtc_offset and also in /data/media/rtc_offset if available. The initscript will use either file that is available. This is for possible compatibility with older phones that may not have /data/media, at the request of Phil3759
Special thanks to Atze001, sniperle and Phil3759.
Hope this helps, enjoy.
dougiebee said:
Hope this helps someone. I got fairly sick of the date/time bug giving me error alerts upon reboot. My solution was to get the modification date of the /data/system directory and set that as the current date at boot time. Not great, but better than 1970. This or something similar may be posted elsewhere but I haven't seen it.
I'm running CM11 - not sure whether this works on other AOSP ROMS.
1) Create a file named 01datehack with the following content:
Code:
#!/system/bin/sh
olddate=`ls -ld /data/system | awk '{print $4, $5}' | sed -e 's/-//g' -e 's/ /./g' -e 's/://g' -e 's/$/00/g'`
date -s $olddate
Then run the following commands:
Code:
adb root
adb shell "mkdir -p /data/local/userinit.d"
adb push 01datehack /data/local/userinit.d
adb shell "chmod 755 /data/local/userinit.d/01datehack"
As it lives in /data it will survive flashing an update as long as you don't wipe. It's only a couple of fairly noddy linux commands, there's quite possibly a command line switch that would negate the need for all the SED'ing - also possibly a better directory/file to look at.
Hope this helps, enjoy.
Click to expand...
Click to collapse
I'm on the latest cm11 nightly. Tried your code but didn't make any difference. Phone still started up in February and then changed to today's date after network/WiFi started.
murdoch1 said:
I'm on the latest cm11 nightly. Tried your code but didn't make any difference. Phone still started up in February and then changed to today's date after network/WiFi started.
Click to expand...
Click to collapse
What do you get from "adb shell ls -ld /data/system"? Have you enabled ADB root access in developer options?
1970
dougiebee said:
What do you get from "adb shell ls -ld /data/system"? Have you enabled ADB root access in developer options?
Click to expand...
Click to collapse
Yes enabled ADB root access in Developer options. Running the command you provided results me with the following:-
drwxrwxr-x system system 2013-12-23 08:47 system
Cheers
deleted
Try this. I have made a flashable zip for TWRP
http://forum.xda-developers.com/showpost.php?p=48760802&postcount=13
Its a userinit.sh script in data/local
Atze001 said:
Try this. I have made a flashable zip for TWRP
https://dl.dropboxusercontent.com/u/20033515/TimeDateFix.zip[/U
Its a userinit.sh script in data/local
Click to expand...
Click to collapse
Will this work for me as I'm running philz cwm?
You can try it. If it dont work you get an Installation error and nothing more happens.
If you get an Error please tell me i will fix it for CWM.
Atze001 said:
You can try it. If it dont work you get an Installation error and nothing more happens.
If you get an Error please tell me i will fix it for CWM.
Click to expand...
Click to collapse
Just installed. Worked perfectly phone booted up with the correct date immediately.
Many thanks. Have a good Xmas.
Thanks go to dougiebee for this work.
Works perfectly on CM11 and TWRP.
Thanks a lot dougiebee and Atze001. :laugh:
Works on CM11/D802/TWRP!
Gesendet von meinem LG-D802 mit Tapatalk
Here are the new Links for the flashable fix.
This one ist with userinit.sh in data/local
https://dl.dropboxusercontent.com/u/20033515/TimeDateFix/TimeDateFix_Local.zip
and this ist the original with 01datehack in data/local/userinit.d
https://dl.dropboxusercontent.com/u/20033515/TimeDateFix/TimeDateFix_org.zip
Atze001 said:
Here are the new Links for the flashable fix.
This one ist with userinit.sh in data/local
https://dl.dropboxusercontent.com/u/20033515/TimeDateFix/TimeDateFix_Local.zip
and this ist the original with 01datehack in data/local/userinit.d
https://dl.dropboxusercontent.com/u/20033515/TimeDateFix/TimeDateFix_org.zip
Click to expand...
Click to collapse
thanks, but you didn't set permission to 755 in your script, that's why it doesn't work. i'm sure you can fix it
I personally use the first zip and it works. Many people confirmed that it works.
But if you want i can set the permissons to 755
Permissions fixed
I now have a much better fix. It uses the RTC rather than relying on file timestamps. It's easy to implement, but creation of a flashable zip will not be straight forward.
I ran the following using ADB once the system was up and the date/time was correct:
Code:
expr $(date +%s) - $(cat /sys/class/rtc/rtc0/since_epoch)
Which gave me 1384422218 - which is "Thu Nov 14 09:43:38 GMT 2013" - the exact date/time I first powered on my phone after I got it.
So I edited my userinit file to read:
Code:
#!/system/bin/sh
realdate=$(expr 1384422218 + `cat /sys/class/rtc/rtc0/since_epoch` | awk '{print strftime("%Y%m%d.%H%M%S",$1)}')
date -s $realdate
This takes my hard-coded (device-specific) power-on time and adds the current RTC time since then to give me the correct date/time, much better than using the timestamp of a file or directory.
I'll update the OP if others confirm this works for them. Note: you need to replace 1384422218 with the number specific to your phone. Creating a flashable zip would be a bit of a challenge, as it would need to be device specific.
Wouldn't it be possible to add a script to the flashable zip that determines the correct value and modifies the flashable file with the value before or after flashing?
PS: I don't know anything about this stuff...
dougiebee said:
I now have a much better fix. It uses the RTC rather than relying on file timestamps. It's easy to implement, but creation of a flashable zip will not be straight forward.
I ran the following using ADB once the system was up and the date/time was correct:
Code:
expr $(date +%s) - $(cat /sys/class/rtc/rtc0/since_epoch)
Which gave me 1384422218 - which is "Thu Nov 14 09:43:38 GMT 2013" - the exact date/time I first powered on my phone after I got it.
So I edited my userinit file to read:
Code:
#!/system/bin/sh
realdate=$(expr 1384422218 + `cat /sys/class/rtc/rtc0/since_epoch` | awk '{print strftime("%Y%m%d.%H%M%S",$1)}')
date -s $realdate
This takes my hard-coded (device-specific) power-on time and adds the current RTC time since then to give me the correct date/time, much better than using the timestamp of a file or directory.
I'll update the OP if others confirm this works for them. Note: you need to replace 1384422218 with the number specific to your phone. Creating a flashable zip would be a bit of a challenge, as it would need to be device specific.
Click to expand...
Click to collapse
Just applied your new version. Works a treat. As you say its better than basing the date on a file timestamp. I basically used the flash zip and amended the unserinit.sh script with the code generated on my device.
All done.
Cheers again.
With 01datehack in userinit.d it dont work for me. With userinit.sh in local it works.
I will take a look to make a Batch or a zip out of this.
dougiebee said:
I now have a much better fix. It uses the RTC rather than relying on file timestamps. It's easy to implement, but creation of a flashable zip will not be straight forward.
I ran the following using ADB once the system was up and the date/time was correct:
Code:
expr $(date +%s) - $(cat /sys/class/rtc/rtc0/since_epoch)
Which gave me 1384422218 - which is "Thu Nov 14 09:43:38 GMT 2013" - the exact date/time I first powered on my phone after I got it.
So I edited my userinit file to read:
Code:
#!/system/bin/sh
realdate=$(expr 1384422218 + `cat /sys/class/rtc/rtc0/since_epoch` | awk '{print strftime("%Y%m%d.%H%M%S",$1)}')
date -s $realdate
This takes my hard-coded (device-specific) power-on time and adds the current RTC time since then to give me the correct date/time, much better than using the timestamp of a file or directory.
I'll update the OP if others confirm this works for them. Note: you need to replace 1384422218 with the number specific to your phone. Creating a flashable zip would be a bit of a challenge, as it would need to be device specific.
Click to expand...
Click to collapse
Does this survive flashing or do I need to do this every time I flash?
Sent from my LG-VS980 using Tapatalk

Categories

Resources