Android porting: ueventd parsing order

In a recent CyanogenMod 9 port I needed to set permissions on various device nodes at boot. I knew I needed to use ueventd, but I wasn’t sure which file Android’s ueventd daemon was looking in for device-specific rules.

As it turns out, Android’s init system decides which ueventd.*.rc file to parse based on the kernel’s androidboot.hardware command line parameter. Here’s the relevant snippet from system/core/init/ueventd.c:

/* Respect hardware passed in through the kernel cmd line. Here we will look
     * for androidboot.hardware param in kernel cmdline, and save its value in
     * hardware[]. */
    import_kernel_cmdline(0, import_kernel_nv);

    get_hardware_name(hardware, &revision);

    ueventd_parse_config_file("/ueventd.rc");

    snprintf(tmp, sizeof(tmp), "/ueventd.%s.rc", hardware);

After I read that, it was trivial to set my kernel’s cmdline to androidboot.hardware=u8185 and then start throwing rules into ueventd.u8185.rc.

Now you know. May the source be with you. 😉

One thought on “Android porting: ueventd parsing order

  1. Hi Alan,
    An unrelated question: I would appreciate if you know the answer and let me know.

    I want to add udev rules to the pandaboard I have.So that when I plug an USB device, I want the board to run a script.
    I added a rules file in /sytem/etc/rules.d/10-rules.rules

    But its not taking effect. Any ideas. I am using ICS release from http://www.linaro.org.

    Please let me know if you know some details/idea.

    BR,
    Venkat.

Comments are closed.