Android init.rc

1,927 views
Skip to first unread message

ARM_SOC

unread,
May 22, 2011, 4:34:31 AM5/22/11
to android-porting, samina...@gmail.com
In Android i am facing a problem.

In android boot time Kernel boot parameter has file system location
information root=/dev/sda1 or root=/dev/mmcblkp1. Based on that
android init.rc mount the /system /data /cache folders. Now we are
using two different init.rc for specific device (sda1 or mmcblk1p1) ,
i want make into a single script which need to validate the device
information from kernel boot parameter in the init.rc file and mount
accordingly.

What i Analysis & understand:

system/core/init/init.c :
Which reads all kernel boot parameter
and set_property("ro.kernel.root",value). This function reads the cat /
proc/cmdline and spilit it.


system/core/rootdir/init.rc
which reads like on
property:ro.kernel.root. But this is not working when i tested.

Am i approaching this problem in a correct way? not?


If not, kindly help me out this problem.


Deva R

unread,
May 22, 2011, 3:38:09 PM5/22/11
to samina...@gmail.com, android-porting
Hi,

not sure, how changes in init.c (option #1) would help in this case, or having generic script.,


regrading option#2 (updating init.rc), below syntax should have worked.., can u check your syntax? (we can check for any warnings while exporting init.rc or while init is running below commands)

on property:ro.kernel.root="/dev/sda1"
<mount sda>
on property:ro.kernel.root="/dev/mmcblkp1"
<mount from mmc>






--
Regards,
Deva

Deva R

unread,
May 23, 2011, 1:46:44 AM5/23/11
to saminath sanjai, android-porting
[+list - many eyes are better to get quick help]

you can increase loglevel in init.rc to get all traces of init.,

You can use ERROR("..",fmt) macro or log_write() calls to get traces out. check in init.c, utils.c for exisiting traces reference..



On Mon, May 23, 2011 at 8:07 AM, saminath sanjai <samina...@gmail.com> wrote:
Hi Deva,
                   Thanks for reply,

How enbale debug/print in the  system/core/init/init.c file.  This will help me more on analysis.


with regards,
saminath.



--
Regards,
Deva

Tim Bird

unread,
May 23, 2011, 12:09:39 PM5/23/11
to android...@googlegroups.com
On 05/22/2011 10:46 PM, Deva R wrote:
> [+list - many eyes are better to get quick help]
>
> you can increase loglevel in init.rc to get all traces of init.,
>
> You can use ERROR("..",fmt) macro or log_write() calls to get traces
> out. check in init.c, utils.c for exisiting traces reference..

Just another point, for those unfamiliar with the init logging...

The log messages from init go into the kernel log buffer, NOT
the regular Android logging system. (These both go through the
Linux kernel, but are currently separate.)

So to access 'init' messages after booting, use the Linux command 'dmesg',
not 'logcat'.
-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment
=============================

tforce

unread,
May 23, 2011, 12:42:05 PM5/23/11
to android-porting
I think you want to look into your BoardConfig.mk file. Usually this
file is located in /vendor/<product_name>/<board_name>/ folder.

You can add some parameters as following:

Ifeq($(x),1)
BOARD_BOOTMEDIA:=harddisk # This refers booting from
hard drive
Else
Ifeq($(x),2)
BOARD_BOOTMEDIA:=sdcard1 #This referst booting from SD Card
Endif

After you modify Boardconfig.mk file as mentioned above, rebuild your
android boot files using parameter "x" as following:

$ make x=1 xyz_platform -j 16 // this will show you
"bootmedia=harddisk" in new boot/cmdline file and will boot from
harddrive

$ make x=2 xyz_platform -j 16 // this will show you
"bootmedia=sdcard1" in new boot/cmdline file and will boot from SD
Card

I have tried this and it is working without issue. Let me know if you
see any problem.

I hope the above will help.

Regards

-Tapan

saminath sanjai

unread,
May 23, 2011, 1:30:16 PM5/23/11
to tapan...@gmail.com, Deva R, android-porting
Hi
Thanks for response
loglevl  and ERROR() helps a lot to debug the init process.
In the import_kernel_nv(char *name, int in_qemu) function

else if (!strcmp(name,"root")) {
          
 if (!strcmp(value,"/dev/sda1")) {
USB
}
else
{
MMC
}

}

I am able to capture the boot device information(sda/mmc) from above condtion apply. But how to pass device info into init.rc script?. In this place property_set() is not working. The property_init() is called after this function.



with regards,
saminath



Reply all
Reply to author
Forward
0 new messages