On Monday, May 30, 2011 2:03:32 AM UTC-4, Gopi wrote:
>
> Hi Chris, 
>         Is the path '/data' correct to log to the sdcard??? 
>

No.  Well, it depends on what you mean by the sdcard.

If you mean the free-for-all user storage area which has been the 
traditional role of sdcards on android devices, then no.  That's usually 
something like /mnt/sdcard but is implementation dependent and should be 
found from an api call.  Of course, in a startup script that's not yet 
available, and you do know implementation details.   But as Dianne pointed 
out, this partition is not mounted immediately on boot, but only later when 
vold gets around to it (if properly configured).

Some other android installations though, particularly android on eval boards 
or devices not originally intended for android, use an sdcard as the 
physical medium for all files systems, including those such as /system and 
/data.  These should be mounted fairly early in the init script, at least 
before it starts to  run the android services which depend on them.

So, if you mean logging to the /data partition, either on soldered in flash 
or and sdcard, if your log data is of lasting interest that might not be a 
bad approach.  Otherwise you can log to a temporary scratch filesystem and 
then copy the log to the "sdcard" partition when it becomes available.  
During early development logging to data might make sense.  But if you have 
one, logging to a serial port and recording on an external computer will 
give you the most chance of having a useful message readily available after 
a crash. 

and also fopen is ok to write to the file??? 
>

>From code running as root, sure.  Code running as an application userid may 
not have permission until it has been granted by the android package manager 
for the associated application.

Note that if your code uses C library functions, you will have a dependence 
on the C library, which is stored on the system partition.  If your code is 
going to run before that is (reliably) mounted, it should be statically 
linked.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to