yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] melethron:
Why not try ownhere's sqlite3 fsync skip instead of loop file. Direct mount and skipping fsync directly in sqlite should have the same effect as loop. Apart from that there aren't issue with reboot on direct loop mount and there is no "double flush" as on loop file.

Edit: Im really interrested in what you think. I dont have time to test it myself. Im still messing with porting HD rom myself.
[Desire Android Development] sibere:
Well no fsync in sqlite3 sounds good, but what about other files? There is no cache there if ext2/4 is mounted with sync option. This may cause a lag too.

ATM I'm trying again a direct ext4 mount with some special option on format and mount and see what happens.

I'll let you know :)
[Desire Android Development] melethron:
Only difference between app2sd (cyanogen) and data2sd is that on data2sd /data/data is on sd-ext too. And that is where the sqlite db is. So guess what causes the lags ;).

Edit: i remind you of that article. So its definitly db commits. And the other possible issue of lags like network access in the mainthread can't be fixed by "loop" ;) -
[Desire Android Development] sibere:
what is the difference then between a delayed flush with loop (even if it's a single or double cache flush) and a delayed flush with no fsync in sqlite3 ?
[Desire Android Development] melethron:
No Fat ... no loop .... xD xD xD
[Desire Android Development] sibere:
;)

I was not specially thinking about fat thi ;)

Could be any fs mounted via loop or even direct mount without sync option.

A delayed flush is a delayed flush. So atm I don't really see the difference unless you're mounting with sync your ext partition.
[Desire Android Development] melethron:
Answer is in the thread where this belongs (this is a bit off topic here).
[Desire Android Development] sibere:
Yep that's right... Thought about this after posting ;)
[Desire Android Development] melethron:
Hey. I think it's better to just call "stop" than "stop zygote". According to this documentation "stop" will cause ALL android runtimes to stop:

http://www.netmite.com/android/mydroid/dalvik/docs/embedded-vm-control.html

EDIT: but im not sure if it makes a difference
[Desire Android Development] foobar66:
Well, to get back on-topic ...

I also needed a shutdown script but I'm not sure if it is feasible through etc/init.d (have not found yet how do it correctly).

During bootup (via init.d) I mount a looped ext2 from on /data/ext2data/

This contains:

data

system

dalvik-cache

app

app-private

Anyway ... I somehow needed a way to cleanly unmount.

So what I did (yes, *ugly* but it works I think):

Copy the /system/bin/shutdown to /system/bin/shutdown.orig (make sure original permissions are there).

Create a script in /system/bin/shutdown that first does the unmount and then calls the original shutdown.orig

Script looks like:

#!/system/bin/sh

/system/bin/log ===Shutdown===

/system/bin/umount /data/ext2data

/system/bin/shutdown.orig

Set the same permissions, owner, group on the copied shutdown file as on shutdown.orig

Upon booting, I first do the following with init.d

#!/system/bin/sh

/system/bin/log ====================philip====================

busybox mknod /dev/loop0 b 7 0

busybox losetup /dev/loop0 /data/linux.ex2

/data/local/e2fsck -p /dev/loop0 > /data/local/e2fsck.result

mkdir /data/ext2data

mount -t ext2 -o noatime,nodiratime,errors=continue /dev/loop0 /data/ext2data

As you can see, the result of the e2fsck is writen (somehow I needed a way to verify it).

If I do a clean phone shutdown and then a reboot, I see the following in the /data/local/e2fsck.result

/dev/loop0: clean, 1016/40960 files, 22475/40960 blocks

So this shows that my looped ext2 was cleanly unmounted during shutdown (I think, I hope).

Not a very nice solution but seems to work at least.
[Desire Android Development] sibere:
Your e2fsck report could be "clean" even without being nicely unmounted.

To check correctly, you can do a tune2fs -l on your loop0 and look for the actual status of the ext2

before

being checked by e2fsck. Hopefully it'll be fine :)
[Desire Android Development] sibere:
No you did not miss anything. On non-sense roms, there is no unmount at all! That's mainly why google and others manufacturers uses a journaled partiton. I would strongly recommend then to use a journal on your partition. You can leave default mount options or change them if you want more safety. Obviously this will be at the cost of performance and SD wear

Fortunately, the few fixes you have don't look to bad and you should not suffer from data loss.

once again, if you can't get a clean unmount like sense roms, use a journal.
[Desire Android Development] foobar66:
Hi Sibere, I am running stock HTC sense ROM, only modified kernel.

Still, I am not getting a clean unmount ... every time when I boot my init.d script shows "tune2fs -l ..." and usually it is not clean.

When I boot the phone and I shutdown => then it reports "clean".

When I boot the phone, do something (e.g. start app, change some setting) => then it reports "not clean".

What I also did:

- copy /system/bin/shutdown to /system/bin/shutdown.orig

- wrote a script /usr/bin/shutdown which does: sync, sync, then tries to unmount external partition and then call the /usr/bin/shutdown.orig

The unmount NEVER happens! I am guessing because there are still processes accessing the partition on SD. I think this is the reason why I do not get the clean flag upon the reboot.

9 out of 10 times I see repairs during boot in the e2fsck step.

What I am getting at boot (my own init.d script):

I//system/xbin/busybox( 54): +++ Doing e2fsck on /dev/block/mmcblk0p2

I//system/xbin/busybox( 54): e2fsck 1.41.3 (12-Oct-2008)

I//system/xbin/busybox( 54): userdata: recovering journal

I//system/xbin/busybox( 54): Pass 1: Checking inodes, blocks, and sizes

I//system/xbin/busybox( 54): Pass 2: Checking directory structure

I//system/xbin/busybox( 54): Pass 3: Checking directory connectivity

I//system/xbin/busybox( 54): Pass 4: Checking reference counts

I//system/xbin/busybox( 54): Pass 5: Checking group summary information

I//system/xbin/busybox( 54): userdata: ***** FILE SYSTEM WAS MODIFIED *****

I//system/xbin/busybox( 54): 2130 inodes used (3.25)

I//system/xbin/busybox( 54): 171 non-contiguous inodes (8.0)

I//system/xbin/busybox( 54): # of inodes with ind/dind/tind blocks: 166/1/0

I//system/xbin/busybox( 54): 38401 blocks used (14.65)

I//system/xbin/busybox( 54): 0 bad blocks

I//system/xbin/busybox( 54): 1 large file

I//system/xbin/busybox( 54): 1083 regular files

I//system/xbin/busybox( 54): 1036 directories

I//system/xbin/busybox( 54): 0 character device files

I//system/xbin/busybox( 54): 0 block device files

I//system/xbin/busybox( 54): 0 fifos

I//system/xbin/busybox( 54): 0 links

I//system/xbin/busybox( 54): 2 symbolic links (2 fast symbolic links)

I//system/xbin/busybox( 54): 0 sockets

I//system/xbin/busybox( 54): --------

I//system/xbin/busybox( 54): 2121 files

I//system/xbin/busybox( 54): +++ Filesystem errors detected and corrected

I//system/xbin/busybox( 54): +++ Adding journal (if not present) to microSD file system

I//system/xbin/busybox( 54): tune2fs 1.41.3 (12-Oct-2008)

I//system/xbin/busybox( 54): +++ Mounting microSD file system to /system/flashdata

I//system/xbin/busybox( 54): +++ apps2sd script completed

I do not understand how you manage to get a clean file system upon reboots.

But as you say, I am 99% safe ... external partition is a ext4 journalled.
[Desire Android Development] sibere:
Well if you're on stock sense rom, there is something really messy in your ROM. All stock HTC froyo sense roms are unmounting /data nicely before shutting down the phone.

tune2fs -l always reports unclean when the partition is mounted, but after a shutdown, it should report clean when unmounted.
[Desire Android Development] foobar66:
Yes, very strange. Anyway ... I think I found a fix.

Copied shutdown to shutdown.orig, then replaced shutdown by following script:

/system/bin/logwrapper echo "Running my own shutdown script"

sync

sync

sync

/system/bin/logwrapper echo "Trying unmount of /dev/block/mmcblk0p2"

/system/bin/logwrapper busybox umount -l /dev/block/mmcblk0p2

/system/bin/logwrapper echo "Now phone is really shutting down"

/system/bin/shutdown.orig

The busybox umount provided -l option (lazy). I had not noticed it at first because the standard umount command in /system/bin does not allow lazy umount.

It looks like being OK now ... during the boot I now see the following in my init.d script.

I//system/xbin/busybox( 54): +++ Doing e2fsck on /dev/block/mmcblk0p2

I//system/xbin/busybox( 54): e2fsck 1.41.3 (12-Oct-2008)

I//system/xbin/busybox( 54): Pass 1: Checking inodes, blocks, and sizes

I//system/xbin/busybox( 54): Pass 2: Checking directory structure

I//system/xbin/busybox( 54): Pass 3: Checking directory connectivity

I//system/xbin/busybox( 54): Pass 4: Checking reference counts

I//system/xbin/busybox( 54): Pass 5: Checking group summary information

I//system/xbin/busybox( 54): 2150 inodes used (3.28)

I//system/xbin/busybox( 54): 175 non-contiguous inodes (8.1)

I//system/xbin/busybox( 54): # of inodes with ind/dind/tind blocks: 168/1/0

I//system/xbin/busybox( 54): 38562 blocks used (14.71)

I//system/xbin/busybox( 54): 0 bad blocks

I//system/xbin/busybox( 54): 1 large file

I//system/xbin/busybox( 54): 1102 regular files

I//system/xbin/busybox( 54): 1037 directories

I//system/xbin/busybox( 54): 0 character device files

I//system/xbin/busybox( 54): 0 block device files

I//system/xbin/busybox( 54): 0 fifos

I//system/xbin/busybox( 54): 0 links

I//system/xbin/busybox( 54): 2 symbolic links (2 fast symbolic links)

I//system/xbin/busybox( 54): 0 sockets

I//system/xbin/busybox( 54): --------

I//system/xbin/busybox( 54): 2141 files

I//system/xbin/busybox( 54): +++ Filesystem check found no errors

I rebooted like 20 times or so and it always came back with no errors.

So this seems to work for me now. Thanks for your help sibere!
[Desire Android Development] foobar66:
Back to original topic: "[DEV] Someone ever tried an "init.d/rc0.d" script on Android ?"

Here are the instructions on how I did it. It's not perfect and would be better if done through a service I guess (but I don't know how to do that).

Instructions to make a wrapper around /system/bin/shutdown

---

1) Create a "shutdown" script with the following contents:

#!/system/bin/sh

/system/bin/logwrapper echo "+++ Running shutdown scripts"

/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/shutdown.d/

/system/bin/logwrapper echo "+++ Running shutdown scripts finished"

/system/bin/shutdown.orig

Save this as "shutdown" on your PC.

2) Move the original shutdown (no need to do this in recovery, can just be done when phone is running)

PC> adb shell

# mount -o remount,rw /dev/block/mtdblock3 /system

# cd /system/bin

# busybox mv shutdown shutdown.orig

# <CTRL-D>

3) Put new shutdown to wrap round the original

PC> adb push shutdown /system/bin/

PC> adb shell

# cd /system/bin

# busybox chown 0.2000 shutdown

# busybox chmod 755 shutdown

4) Create directory /etc/shutdown.d

# cd /system/etc

# mkdir shutdown.d

# busybox chown 0.0 shutdown.d

# busybox chmod 755 shutdown.d

5) Now create your own shutdown scripts "01xxx", "02xxx" and put them in /etc/shutdown.d/ (example)

PC> adb shell

# mount -o remount,rw /dev/block/mtdblock3 /system

# <CTRL-D>

PC> adb push 01xxx /etc/shutdown.d/

PC> adb shell

# cd /etc/shutdown.d

# chown 0.2000 01xxx

# chmod 750 01xxx

As an example, I now have 2 shutdown scripts:

a) 10syncfs (to ensure all file systems synced)

#!/system/bin/sh

/system/bin/logwrapper echo "+++ Syncing file systems"

sync

sync

sync

b) 20lazyunmount (to cleanly unmount my ext4 partition on /sdcard)

#!/system/bin/sh

/system/bin/logwrapper echo "+++ Lazy unmount of /dev/block/mmcblk0p2"

/system/bin/logwrapper busybox umount -l /dev/block/mmcblk0p2

---

When you now CLEANLY shut down the phone (not via reboot recovery or so), you can see the following output (I have cut

I/echo ( 817): +++ Running shutdown scripts

I/logwrapper( 817): echo terminated by exit(0)

I/echo ( 822): +++ Syncing file systems

I/logwrapper( 822): echo terminated by exit(0)

I/LSState ( 114): EventReceiver:android.intent.action.NOTIFICATION_ADD

I/echo ( 829): +++ Lazy unmount of /dev/block/mmcblk0p2

I/logwrapper( 829): echo terminated by exit(0)

I/logwrapper( 831): busybox terminated by exit(0)

I/logwrapper( 819): /system/xbin/busybox terminated by exit(0)

I/echo ( 833): +++ Running shutdown scripts finished

Actual output can differ from above as multiple processes are outputting stuff.

I will think how to turn this into an automatic setup and then make a flashable zip from it.
[Desire Android Development] sibere:
You're welcome and I'd say that's a very good job. It will help getting better data integrity on shutdown :)
[Desire Android Development] Droidzone:
Nice idea. I can build the flashable zip for you with this script if you like.
[Desire Android Development] foobar66:
That would be great. I know how to make flashable zips for updating a kernel (using Kouch method) but I have not used it for anything else.

One way to do it I think is to create an init.d script (e.g. "17setupshutdown") with following contents:

#!/system/bin/sh

if [ ! -d /system/etc/shutdown.d ];

then

mount -o remount,rw /dev/block/mtdblock3 /system

busybox mv /system/bin/shutdown /system/bin/shutdown.orig

cat > /system/bin/shutdown << EOF

#!/system/bin/sh

/system/bin/logwrapper echo "+++ Running shutdown scripts"

/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/shutdown.d/

/system/bin/logwrapper echo "+++ Running shutdown scripts finished"

/system/bin/shutdown.orig

EOF

busybox chown 0.2000 /system/bin/shutdown

busybox chmod 755 /system/bin/shutdown

mkdir /system/etc/shutdown.d

busybox chown 0.0 /system/etc/shutdown.d

busybox chmod 755 /system/etc/shutdown.d

mount -o remount,ro /dev/block/mtdblock3 /system

fi

But this has as disadvantage that this script is ran upon every boot and the setup only needs to be done once.

If the flashable zip can FIRST move the shutdown to shutdown.orig and only after that create a new shutdown (with content as above between the cat and EOF) ... that would be much better. But I do not know if this is possible with a flashable zip.

BTW: I can't reply for a couple of days probably ... have to travel to Turkey for work.
[Desire Android Development] foobar66:
For info, by having this shutdown method with proper clean unmount, I now also have my ext4 partition on the /sdcard mounted with following options:

barrier=0,data=writeback,noatime,nodiratime,nosuid,nodev,nouser_xattr,errors=continue

data=writeback means that metadata for files can be written lazily after the file is written. This will not cause file system corruption, but it may cause the most recent changes to be lost in the event of a crash (so you may jump back into the past a bit). But with the extra sync during shutdown and the lazy unmount this is OK in case of a CLEAN shutdown (i.e. via long pressing power button).

Of course for a power out or "reboot recovery" that will still potentially loose some data. Works for me as I will always shutdown my phone cleanly. And in case battery gets drained ... well, that's bad luck for me ;-)

In the meantime, since yesterday, I have probably done 40 reboots ... and each time I have a clean ext4 file system upon boot!
[Desire Android Development] xavierjohn22:
Cool, now theres light, wanna check and try it when i get home. Thanks.
[Desire Android Development] Droidzone:
I think the entire thing is best done as a one time procedure and once the script replaces the original shutdown script, the rest seems to be self contained. So best done at the time of running the zip from recovery console. No need to be part of init.d

Made the flashable zip..Just testing it out before uploading, with CM7

Edit: This is weird..CM7 doesnt have an original shutdown???
[Desire Android Development] Droidzone:
Isnt there supposed to be a script called shutdown in /system/bin/ originally?

I dont see that in both CM7 and Oxygen

The flasher does its job, but it is supposed to move a file called /system/bin/shutdown to /system/bin/shutdown.orig.

The file /system/bin/shutdown doesnt exist on my system after a normal install. Am I missing something here?
[Desire Android Development] foobar66:
Yes, that is the best way. Thanks for trying to make the zip, I would not know how to do it.

I am still running the stock Froyo Sense ROM. I like this one actually. So I have not tried any of the above on other ROMs.

Probably CM7 uses a different shutdown method.
[Desire Android Development] foobar66:
For the record, the original shutdown in /system/bin is not a script but:

shutdown.orig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[Desire Android Development] Droidzone:
Sorry, I meant binary, not script.

So you've actually made the code for Sense Roms? I had hoped that this could solve the aosp unclean umount problem.. But since aosp doesnt have even the shutdown binary, I guess this isnt useful for aosp.

Here's the zip..

http://www.box.net/shared/hkmnobfm63

If someone tests it out, just let me know..

It's foobar's code..in updater-script form
[Desire Android Development] foobar66:
Thanks for the zip ... I will try it.

I am not sure how to make it work on other ROMS.

But in /init.rc there is (on Sense):

service shutdown /system/bin/shutdown

user root

group root

disabled

oneshot

Can you have a look how this file looks like on your ROM?

It's just a hunch ... maybe with the proper /init.rc it could be made to work on your ROM as well.
[Desire Android Development] Droidzone:
Actually, my Rom is Stock Sense too. So it would be the same. Will have to look into how aosp handles shutdown. Maybe I'll try the Cyanogen thread and see
[Desire Android Development] Droidzone:
They dont have that binary. Perhaps aosp devs will be able to answer that.
[Desire Android Development] copenhagen:
Perhaps we can ;) @AOSP devs

are you looking for this?

see attachment

:)

okay I am deploying this idea with my future builds.

shutdown -> shutdown.orig

shutdown to call busybox runparts on the shutdown.d folder

01shutdown to sync rsync dismount and run real shutdown.

I've got to say these are some pretty crafty ideas you guys are comming up with.

Its just timing that I found you when I did. 2 days ago i finished a bkup2sdext script for my build that would backup dalvik cache apps and data to the sd-ext so users who update to new builds or have their fat32 partition blow out and need formatting; could have all their shiz re-installed on first boot. phew.. hopefully you followed me there.

(we run completely off sdcard for our device/this build so mostly just use fat32/ext234/linuxswap)

either way.. this will keep our ext partitions cleaner/properly un-mounting @ shutdown

etc.

so THANKYOU FOR the collective effort you guys have put in on this.

NOW to give back....

since we compile our own build, it is possible we can make some changes

that will automatically take care of the shutdown.d exec process without the need

to rename your shutdown to shutdown.orig <-- i think this seems a fair repayment to you all. so let me see what I can do about that.

THANKYOU
[Desire Android Development] theGanymedes:
Hey guys, first of all, thanks for all your effort. This way exactly what I was looking.

Tried your shutdown solution - all seems to be working now, even though tune2fs always says "not clean"; I didn't see any "fix?yes" lines..

Now, since we know that shutdown isn't called for reboot; and since I've seen a "reboot" binary; do you think we can do the same to it as well?

Thanx all in notice. I'm trying to apply it myself right now, but wanted to discuss with you as well - even though this topic is old now :)

PS: Doesn't seem to be working... :(
[HD2 Windows Mobile 6.5 Themes and Apps] dody:
is there application i can use to set custome icon (i choose) in slider tab? not a theme or fixed icon, i am looking for something like csmi but for tab slider
[HD2 Windows Mobile 6.5 Themes and Apps] dody:
up.. nothing guys?
[HD2 Windows Mobile 6.5 Themes and Apps] jsmccabe78:
the answer is no, not really.

the only thing that comes close to what you want is hdwall:http://xdaforums.com/showthread.php?t=503511&highlight=hdwall

haven't used it myself for that purpose, but it says it can work. but really the best way is to edit the manila files yourself.
[Captivate General] nooomoto:
More here:

http://www.engadget.com/2010/12/09/samsung-undecided-about-gingerbread-on-galaxy-s-google-says-har/
[Captivate General] SlimJ87D:
Nope, the Galaxy S will be getting gingerbread:

http://twitter.com/Samsung_Mobiles/status/12437775529803776

A reporter already touched bases with Samsung, Samsung has claimed to be working on Gingerbread way before Motorola and HTC supposedly because they were experimenting with it on the tablets.
[Captivate General] alphadog00:
Both of these pieces of information have been discussed in the Gingerbread thread.

And saying "Nope" doesn't change the fact that the Engadget article is pointing out the same inconsistencies - Samsung UK says "unknown at this time" and as your tweet shows; Samsung India says "yes" - so I think we can agree that the answer is undecided.

No idea why a new thread was started.
[Captivate General] SlimJ87D:
"UK contact presumably speaking on behalf of the mothership:"

Who is this contact and presume is better way of saying assume.

I truly hope that India is right.
[Captivate General] Miami_Son:
Considering most employee's Twitter use about work is governed by non-disclosure agreements, for an Indian employee to Tweet something like that he is either corect and doing it with company permission, or soon to be fired, correct or not.
[Captivate General] SlimJ87D:
A big question is where do Samsung software engineers work?

Maybe they work in India or Korea, who knows. But I think the UK wouldn't have as much knowledge as either of them.

We'll just have to wait and see.
[Captivate General] nooomoto:
You really don't have an idea? It should be quite obvious...I did it to annoy you.
[Captivate General] alphadog00:
That and because you probably don't know to search first... standard rookie mistake. But I forgive you.
[Captivate General] nooomoto:
Whew! That was a close one, I wasn't sure if you were going to forgive me or not. Now I can rest easy tonight...I'll post a new thread to let you know.

I apologize for not having superior forum searching skills. I'm so glad that you found the time in your busy day to point out that the link to the article had already been posted in the 8 page long Gingerbread thread, while at the same time offering your analysis of the situation and reaching the conclusion that nothing has been decided. You are truly a shining beacon in the pantheon of multi-tasking.

Really dude, stop being so anal. Everyone on this forum is so pissy. I've been on physics forums that are more light-hearted.
[Captivate General] A.VOID:
Bravo to the UK rep for giving a nice neutral PC response. He should get a job in politics.

Seriously, what is the rep supposed to say?

"Yes, without question."

"NO, never going to happen. Buy new Samsung products."

:rolleyes:
[Captivate General] sixk:
Do you think samsung wants to make more money or keep current customers happy?

Because I think they are more after money.

So they in my conclusion they would not make gingerbread FW for SGS.

they would make a whole lot to give us froyo and make the "next gen" phone with Gingerbread and have that updated to whatever is going to be next....h...h...

offtopic... what dessert starts with a h?
[Captivate General] SlimJ87D:
Well making money and keeping your customers go hand in hand.
[Captivate General] malicenfz:
Honeycomb

Sent from my Axura 2.1 phone with Gingerbread keyboard.