From 6d6f3e3de08dd0ac37966e4516f5431c16a8d8d4 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 5 Sep 2017 19:52:26 -0500 Subject: Get ppp to work from boot up --- recipes-connectivity/ppp/files/default | 8 ++++++++ recipes-connectivity/ppp/files/init.patch | 34 +++++++++++++++++++++++++++++++ recipes-connectivity/ppp/files/poff.patch | 12 +++++++++++ recipes-connectivity/ppp/ppp_%.bbappend | 15 ++++++++++++++ recipes-connectivity/ppp/ppp_2.4.7.bb | 2 +- 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 recipes-connectivity/ppp/files/default create mode 100644 recipes-connectivity/ppp/files/init.patch create mode 100644 recipes-connectivity/ppp/files/poff.patch create mode 100644 recipes-connectivity/ppp/ppp_%.bbappend diff --git a/recipes-connectivity/ppp/files/default b/recipes-connectivity/ppp/files/default new file mode 100644 index 0000000..6cc92df --- /dev/null +++ b/recipes-connectivity/ppp/files/default @@ -0,0 +1,8 @@ +# Check to see if the SIM is registered before using ppp. +# Need this if using a cellular connection. +CHECKREGISTRATION=1 +# Note that boot will not complete until +# ppp completes, and the PPPTIMEOUT is the +# maximum wait time for the SIM to register +# for cellular PPP. +PPPTIMEOUT=60 diff --git a/recipes-connectivity/ppp/files/init.patch b/recipes-connectivity/ppp/files/init.patch new file mode 100644 index 0000000..e74e981 --- /dev/null +++ b/recipes-connectivity/ppp/files/init.patch @@ -0,0 +1,34 @@ +diff -Naru old/init new/init +--- old/init 2017-09-05 19:07:19.810885424 -0500 ++++ new/init 2017-09-05 19:08:05.106884083 -0500 +@@ -8,11 +8,29 @@ + + test -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot || exit 0 + if [ -x /etc/ppp/ppp_on_boot ]; then RUNFILE=1; fi +- ++: ${PPPTIMEOUT:=60} ++logger timeout is $PPPTIMEOUT ++[ -f /etc/default/ppp ] && . /etc/default/ppp + case "$1" in + start) ++ t0=($(cat /proc/uptime)) ++ if (( CHECKREGISTRATION == 1 )) ; then while : ; do ++ REG=$(/usr/bin/radio-query --netreg) ++ [[ $REG == "REGISTERED" ]] && break ++ t1=($(cat /proc/uptime)) ++ diff=$(awk "BEGIN{print int($t1-$t0)}") ++ logger -s "Modem not ready. Waited $diff of $PPPTIMEOUT seconds" ++ if ((diff > PPPTIMEOUT)) ; then ++ logger -s "Timed out waiting for modem registration" ++ exit 1 ++ fi ++ sleep 1 ++ done ; fi ++ ++ logger "Starting up PPP link: pppd" + echo -n "Starting up PPP link: pppd" + if [ "$RUNFILE" = "1" ]; then ++ logger "ppp_on_boot" + /etc/ppp/ppp_on_boot + else + pppd call provider diff --git a/recipes-connectivity/ppp/files/poff.patch b/recipes-connectivity/ppp/files/poff.patch new file mode 100644 index 0000000..2385886 --- /dev/null +++ b/recipes-connectivity/ppp/files/poff.patch @@ -0,0 +1,12 @@ +diff -Naru old/poff new/poff +--- old/poff 2017-09-05 19:07:11.630885666 -0500 ++++ new/poff 2017-09-05 19:08:09.586883950 -0500 +@@ -1,7 +1,7 @@ + #!/bin/sh + + # Lets see how many pppds are running.... +-set -- `cat /var/run/ppp*.pid 2>/dev/null` ++set -- `cat /var/run/ppp[0-9]*.pid 2>/dev/null` + + case $# in + 0) # pppd only creates a pid file once ppp is up, so let's try killing pppd diff --git a/recipes-connectivity/ppp/ppp_%.bbappend b/recipes-connectivity/ppp/ppp_%.bbappend new file mode 100644 index 0000000..1c3a023 --- /dev/null +++ b/recipes-connectivity/ppp/ppp_%.bbappend @@ -0,0 +1,15 @@ +SRC_URI_append = "\ + file://init.patch;patchdir=.. \ + file://poff.patch;patchdir=.. \ + file://default" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +FILES_${PN} += "/etc/default/ppp" + +CONFFILES_${PN} += "${sysconfdir}/default/ppp" + +do_install_append() { + install -d -m 0755 ${D}/${sysconfdir}/default/ + install -m 644 ${WORKDIR}/default ${D}/${sysconfdir}/default/ppp +} diff --git a/recipes-connectivity/ppp/ppp_2.4.7.bb b/recipes-connectivity/ppp/ppp_2.4.7.bb index 881c40e..635efb4 100644 --- a/recipes-connectivity/ppp/ppp_2.4.7.bb +++ b/recipes-connectivity/ppp/ppp_2.4.7.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://pppd/ccp.c;beginline=1;endline=29;md5=e2c43fe6e81ff77 file://pppd/plugins/passprompt.c;beginline=1;endline=10;md5=3bcbcdbf0e369c9a3e0b8c8275b065d8 \ file://pppd/tdb.c;beginline=1;endline=27;md5=4ca3a9991b011038d085d6675ae7c4e6 \ file://chat/chat.c;beginline=1;endline=15;md5=0d374b8545ee5c62d7aff1acbd38add2" -PR = "r8" +PR = "r9" SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \ file://makefile.patch \ -- cgit v1.2.3