This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Ethernet settings in android JB 4.1.2

Hi,

I have to use the ethernet based communication in my project where I am using blaze board & ported the android JB source code.

There are no issues with booting. As their is no UI support for ethernet to set Static IP. I have used the adb shell & configured the following settings

netcfg eth0 up
ifconfig eth0 172.16.1.121 netmask 255.255.255.0
route add default gw 172.16.1.1 dev eth0
setprop net.dns1 172.16.1.1

But on every boot I have give these setting. So, to get these commands executed how I have to add in the init.rc. I have also the blazeboard.rc file. I'm confused in which file I need to add above 4 lines & whats the procedure. since I am seeing services getting enabled from the init.rc file through which some .sh shell scripts are being invoked.

so please someone help me out from here in setting the static Ip.

If possible also give me some hints on adding the ethernet UI support to android.

Regards,

Sainath

  • Hi,

    Can someone help me out from here in configuring the ethernet during bootup process of android.

    Regards,

    Sainath

  • Hi Sainath,

    As said in the previous thread , try putting the lines you require in the specific start-up script- example for pandaboard : init.omap4pandaboard.rc

     

    Regards,

    Boyko

  • Hi Bokyo,

    I have done that, its not working for me. even though after adding those lines in the init.omap4blazeboard.rc.

    here in this  init.omap4blazeboard.rc file there are services being invoked.

    For example for WiFi module its like

         service wpa_supplicant /system/bin/wpa_supplicant \
            -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
            class main
            socket wpa_wlan0 dgram 660 wifi wifi
            disabled
            oneshot

    So I need similar kind of work around for ethernet.

    Apart form above wifi service enable  lines, sockets are also being enabled for specially for wifi.

    I want these kind of changes to make the ethernet up on boot itself.

    Simply by adding the lines to enble the eth0 interface, its working.

    please provide me if their is any patch to do this.

    Regards,

    Sainath

  • Hi Sainath,

    The only way to do is by adding the following line to the init.rc script:

    service ethernet /eth0.sh ( you can remove the dhcp service for the required interface)

    and create a bash script containing your settings:
    #!/system/bin/sh
    netcfg eth0 up 
    ...
    ...

    Regards,
    Boyko
  • Hi,

    I have taken fresh android jb 4.1.2 source code. Here I tried to add the script file in the

    < ANDROID_SOURCE>/system/etc. their is no etc directory.

    But this system/etc is available only after the  android is compiled.

    The board's init.rc file is at   < ANDROID_Parent_dir >/device/ti/blaze/initblazeboard.rc. In this file I have commented the dhcp service & added the following lines

    ## Ethernet Static IP

    Service ETH0 /system/etc/StaticIP.sh

    onseshot

    The following script file have to be their at the out/product/blaze/system/etc

    #!/system/etc/StaticIP.sh
    netcfg eth0 up
    ifconfig eth0 172.16.1.121 netmask 255.255.255.0
    route add default gw 172.16.1.1 dev eth0
    setprop net.dns1 172.16.1.1


    Here I have the problem. system/etc/ is available only after the compilation of android source code. Can you please clarify my confusion where to add the script file so that after compilation the script file will be their in <ANDROID_Source_code>/out/product/blaze/system/etc/ .

    Regards,

    Sainath

  • Hi Sainath,

    Check rootfs basics in order to put your file in the root base before compile.

    http://unix.stackexchange.com/questions/122787/how-to-add-folders-and-file-before-compiling-kernel

    Regards,

    Boyko