[G1 Android Development] shafty023:
This thread is meant for ROM developers and the not the general public. Please don't comment asking questions unless you are a ROM developer planning on implementing this in your ROM.

I've taken the existing init.d framework and taken it to the next level.

Changes made:

Added a global scripts log directory so we can consolidate where we put our log files and help clean the system clean. It's located in /data/scriptlogs

Added logging to each init file which has its own individual logfile

Each init will set the following properties once it has completed. init.name_of_initfile.status & init.name_of_initfile.completed so we have record of its exit status and whether it finished running.

Wrote a shell script named bootstatus that will output a summary of the init scripts exist statuses.

If the phone is not booting or having issues you can verify init completed successfully by using bootstatus. If an init script failed it will tell you the location to the logfile containing a more descriptive log that should help explain why it failed. No more guessing game :)

Wrote a script to dump the stats from compcache. Previously this was done with rzscontrol, that no longer works on compcache 0.5 and up. The script is named ccstat

Lines to add to init.rc

start sysinit
on property:init.complete=1
class_start default

service sysinit /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot

Output from bootstatus

# bootstatus
-----------------------------------------
| SCRIPT | STATUS | DETAILS
-----------------------------------------
sysctl PASS
firstboot PASS
a2sd PASS
userinit PASS
compcache PASS
linuxswap PASS
cpu PASS
virtualmem PASS

Properties that got set after init.d finished

[init.sysctl.complete]: [1]
[init.firstboot.complete]: [1]
[init.a2sd.complete]: [1]
[init.userinit.complete]: [1]
[init.compcache.complete]: [1]
[init.linuxswap.complete]: [1]
[init.complete]: [1]

[init.sysctl.status]: [PASS]
[init.firstboot.status]: [PASS]
[init.a2sd.status]: [PASS]
[init.linuxswap.status]: [PASS]

Output from ccstat

DiskSize:	32768 kB
NumReads:	245
NumWrites:	2063
FailedReads:	0
FailedWrites:	0
InvalidIO:	0
NotifyFree:	0
ZeroPages:	787
GoodCompress:	70 %
NoCompress:	4 %
PagesStored:	1276
PagesUsed:	457
OrigDataSize:	5104 kB
ComprDataSize:	1783 kB
MemUsedTotal:	1828 kB

Snapshot of the logs directory, /data/scriptlogs

# ls -l
-rw-rw-rw- root root 71 2010-02-02 20:43 09virtualmem.log
-rw-r--r-- root root 105 2010-02-02 13:48 06compcache.log
-rw-r--r-- root root 64 2010-02-02 20:42 08cpu.log
-rw-r--r-- root root 70 2010-02-02 20:30 07linuxswap.log
-rw-r--r-- root root 67 2010-02-02 13:48 05userinit.log
-rw-r--r-- root root 462 2010-02-02 13:48 04a2sd.log
-rw-r--r-- root root 66 2010-02-02 13:48 03firstboot.log
-rw-r--r-- root root 92 2010-02-02 13:48 01sysctl.log
-rw-r--r-- root root 102 2010-02-02 13:48 init.log

Snippet from a2sd logfile

04a2sd Starting: 13:48 02/02/2010
Running fsck on ext partition:	Done
Mounting /system/sd	Done
Clean old symlinks, create data directories:
------------------------
------------------------
Done
Copying /data/dalvik-cache contents to /system/sd/dalvik-cache
Removing /data/dalvik-cache directory
Binding /system/sd/dalvik-cache to /data/dalvik-cache:	Done
Removing any .odex files in /system/sd/app:	Done
Finished at 13:48 02/02/2010

Ok I finished up my changes and they are attached to this post now.

EDIT

Going to release in King's Eclair ROM and give it a test first. If mods want to delete this thread for now that's fine. I'll recreate later