[HD2 Android NAND Development] arif-ali:
This is for ROM makers, and if they want to support cLK

Files that need to be present on the phone

in /system/etc/ppp

* pap-secrets - empty

* chap-secrets - empty

* ip-down

#!/bin/sh

/bin/rm /etc/ppp/ppp0.pid

* ip-up

#!/bin/sh

#/bin/touch /etc/ppp/ppp0.pid
#/bin/chmod 777 /etc/ppp/ppp0.pid

case $1 in
ppp1)
iptables --flush;
iptables --table nat --flush;
iptables --delete-chain;
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE;
iptables --append FORWARD --in-interface ppp1 -j ACCEPT;
echo 0 > /proc/sys/net/ipv4/ip_forward;
echo 1 > /proc/sys/net/ipv4/ip_forward;
;;
ppp0)
echo "ip-up fired" > /tmp/ppp.log
# /system/bin/setprop "net.interfaces.defaultroute" "gprs"
;;
esac

# Use interface name if linkname is not available
NAME=${LINKNAME:-"$1"}

/bin/touch /etc/ppp/ppp0.pid
/bin/chmod 777 /etc/ppp/ppp0.pid
/bin/echo $(pidof pppd) > /etc/ppp/ppp0.pid

/system/bin/setprop "net.$NAME.dns1" "$DNS1"
/system/bin/setprop "net.$NAME.dns2" "$DNS2"
/system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL"
/system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE"
/system/bin/setprop "net.dns1" "$DNS1"
/system/bin/setprop "net.dns2" "$DNS2"
modem_log()
{
/bin/echo -e "${@}" >> /tmp/ppp.log
}
modem_log "Connection attempt SUCCESSFUL!"
modem_log "Phone IP: `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f2 | /bin/cut -d' ' -f1`"
modem_log "Subnet : `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f4 | /bin/cut -d' ' -f1`"
modem_log "P-t-P : `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f3 | /bin/cut -d' ' -f1`"
modem_log "Done!"

* ip-up-vpn - binary file

* options - as below

* options.smd - as below

* options.smd1- as below

noauth
defaultroute
usepeerdns
ipcp-accept-remote
ipcp-accept-local
holdoff 3
noaccomp
noccp
nobsdcomp
nodeflate
nopcomp
novjccomp

all the files that there is no output or doesn't have code above are empty files

we need to make sure that the permissions on these files are set correctly, I usually do this by including a file XXppp in /system/etc/init.d

#!/system/bin/sh

chown 1001.1001 /dev/smd1;
touch /etc/ppp/active;
touch /etc/ppp/pap-secrets;
touch /etc/ppp/chap-secrets;
touch /etc/ppp/options.smd;
touch /etc/ppp/options.smd1;
touch /etc/ppp/ppp-gprs.pid;
chown 0.1001 /system/etc/ppp/*
chmod 775 /system/etc/ppp/*
chown 0.0 /system/bin/pppd;
chmod 4755 /system/bin/pppd;
#/system/bin/pppd /dev/smd1 defaultroute;

# Create link for resolv.conf (generated by pppd)
ln -s /etc/ppp/resolv.conf /etc/resolv.conf

make sure either you have the following lines in /system/etc/init.d/01modules, and /system/ppp file, or you completely remove msm_rmnet.ko from the file. As we don't want the phone to load the msm_rmnet modules.

if [ -f /system/ppp ]
then
echo "Not loading RMNET module as /system/ppp exists"
else
echo "Loading RMNET module as /system/ppp doesn't exist"
insmod /system/lib/modules/msm_rmnet.ko
fi

In the initrd, you need to make sure that the line that reads ...

service ril-daemon /system/bin/rild -l /system/lib/libhtc_ril_wrapper.so -- -d /dev/smd0 nand_init rmnet_mode

and replace with

service ril-daemon /system/bin/rild -l /system/lib/libhtc_ril_wrapper.so -- -d /dev/smd0 nand_init

if anyone has any questions/comments on this small howto, then feel free to let me know how I can improve this