android 移植 rp-pppoe
16lz
2021-12-04
1.android已经自带pppd程序,所以就不用移植pppd了
2.下载rp-pppoe代码
wget -c http://www.roaringpenguin.com/files/download/rp-pppoe-3.10.tar.gz
3.把rp-pppoe-3.10.tar.gz解压到android的 external目录下
4.cd external/rp-pppoe-3.10/src
1) ./configure --host=arm-linux
2) vi config.h
一、注释掉 #define HAVE_SYS_UIO_H 1 要不然会提示重定义的警告
二、如果提示 if.c:34:26: error: net/ethernet.h: No such file or directory
注释掉 #define HAVE_NET_ETHERNET_H 1
三、我的config.h 内容如下
-------------------- config.h ---------------------------------------------
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* LIC: GPL */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define to `int' if doesn't define. */
/* #undef pid_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
/* #undef SETVBUF_REVERSED */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both and . */
#define TIME_WITH_SYS_TIME 1
/* Define if your declares struct tm. */
/* #undef TM_IN_SYS_TIME */
#define HAVE_STRUCT_SOCKADDR_LL 1
/* The number of bytes in a unsigned int. */
#define SIZEOF_UNSIGNED_INT 4
/* The number of bytes in a unsigned long. */
#define SIZEOF_UNSIGNED_LONG 4
/* The number of bytes in a unsigned short. */
#define SIZEOF_UNSIGNED_SHORT 2
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strtol function. */
#define HAVE_STRTOL 1
/* Define if you have the header file. */
#define HAVE_ASM_TYPES_H 1
/* Define if you have the header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the header file. */
#define HAVE_GETOPT_H 1
/* Define if you have the header file. */
#define HAVE_LINUX_IF_ETHER_H 1
/* Define if you have kernel-mode PPPoE in Linux file. */
/* #undef HAVE_LINUX_KERNEL_PPPOE */
/* Define if you have the header file. */
#define HAVE_LINUX_IF_PACKET_H 1
/* Define if you have the header file. */
#define HAVE_LINUX_IF_PPPOX_H 1
/* Define if you have the header file. */
/* #undef HAVE_NET_BPF_H */
/* Define if you have the header file. */
#define HAVE_NET_IF_ARP_H 1
/* Define if you have the header file. */
//#define HAVE_NET_ETHERNET_H 1
/* Define if you have the header file. */
#define HAVE_NET_IF_H 1
/* Define if you have the header file. */
#define HAVE_LINUX_IF_H 1
/* Define if you have the header file. */
/* #undef HAVE_NET_IF_DL_H */
/* Define if you have the header file. */
/* #undef HAVE_NET_IF_ETHER_H */
/* Define if you have the header file. */
/* #undef HAVE_NET_IF_TYPES_H */
/* Define if you have the header file. */
#define HAVE_NETINET_IF_ETHER_H 1
/* Define if you have the header file. */
#define HAVE_NETPACKET_PACKET_H 1
/* Define if you have the header file. */
#define HAVE_SYS_CDEFS_H 1
/* Define if you have the header file. */
/* #undef HAVE_SYS_DLPI_H */
/* Define if you have the header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the header file. */
#define HAVE_SYS_PARAM_H 1
/* Define if you have the header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the header file. */
//#define HAVE_SYS_UIO_H 1
/* Define if you have the header file. */
#define HAVE_SYSLOG_H 1
/* Define if you have the header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the N_HDLC line discipline in linux/termios.h */
/* #undef HAVE_N_HDLC */
/* Define if bitfields are packed in reverse order */
#define PACK_BITFIELDS_REVERSED 1
/* Define to include debugging code */
#define DEBUGGING_ENABLED 1
/* Solaris moans if we don't do this... */
#ifdef __sun
#define __EXTENSIONS__ 1
#endif
-----------------------end of config.h -------------------------------------
5.external/rp-pppoe-3.10下创建Android.mk文件, 内容如下
-------------------- Android.mk --------------------------------------------
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=\
src/pppoe.c \
src/if.c \
src/debug.c \
src/common.c \
src/ppp.c \
src/discovery.c \
LOCAL_STATIC_LIBRARIES :=
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := pppoe
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
LOCAL_CFLAGS += '-DVERSION="3.10"' \
'-DPPPD_PATH="/system/bin/pppd"'
include $(BUILD_EXECUTABLE)
include $(call all-makefiles-under,$(LOCAL_PATH))
-------------------- end of Android.mk -------------------------------------
错误及解决方法:
1) /dev/pts/目录为空, pppoe 提示找不到文件 /dev.pts/0
内核配置添加如下选项
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
2) 提示 pppoe: read (asyncReadFromPPP): Session 8: I/O error
把内核中PPPOE的所有选项都支持上就万事大吉了
# CONFIG_WAN is not set
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_MPPE=y
CONFIG_PPPOE=y
CONFIG_PPPOL2TP=y
CONFIG_PPPOLAC=y
CONFIG_PPPOPNS=y
# CONFIG_SLIP is not set
CONFIG_SLHC=y
参考文档:
1. http://blog.csdn.net/linweig/article/details/5481355
2.下载rp-pppoe代码
wget -c http://www.roaringpenguin.com/files/download/rp-pppoe-3.10.tar.gz
3.把rp-pppoe-3.10.tar.gz解压到android的 external目录下
4.cd external/rp-pppoe-3.10/src
1) ./configure --host=arm-linux
2) vi config.h
一、注释掉 #define HAVE_SYS_UIO_H 1 要不然会提示重定义的警告
二、如果提示 if.c:34:26: error: net/ethernet.h: No such file or directory
注释掉 #define HAVE_NET_ETHERNET_H 1
三、我的config.h 内容如下
-------------------- config.h ---------------------------------------------
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* LIC: GPL */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have
#define HAVE_SYS_WAIT_H 1
/* Define to `int' if
/* #undef pid_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
/* #undef SETVBUF_REVERSED */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both
#define TIME_WITH_SYS_TIME 1
/* Define if your
/* #undef TM_IN_SYS_TIME */
#define HAVE_STRUCT_SOCKADDR_LL 1
/* The number of bytes in a unsigned int. */
#define SIZEOF_UNSIGNED_INT 4
/* The number of bytes in a unsigned long. */
#define SIZEOF_UNSIGNED_LONG 4
/* The number of bytes in a unsigned short. */
#define SIZEOF_UNSIGNED_SHORT 2
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strtol function. */
#define HAVE_STRTOL 1
/* Define if you have the header file. */
#define HAVE_ASM_TYPES_H 1
/* Define if you have the
#define HAVE_FCNTL_H 1
/* Define if you have the
#define HAVE_GETOPT_H 1
/* Define if you have the
#define HAVE_LINUX_IF_ETHER_H 1
/* Define if you have kernel-mode PPPoE in Linux file. */
/* #undef HAVE_LINUX_KERNEL_PPPOE */
/* Define if you have the
#define HAVE_LINUX_IF_PACKET_H 1
/* Define if you have the
#define HAVE_LINUX_IF_PPPOX_H 1
/* Define if you have the
/* #undef HAVE_NET_BPF_H */
/* Define if you have the
#define HAVE_NET_IF_ARP_H 1
/* Define if you have the
//#define HAVE_NET_ETHERNET_H 1
/* Define if you have the
#define HAVE_NET_IF_H 1
/* Define if you have the
#define HAVE_LINUX_IF_H 1
/* Define if you have the
/* #undef HAVE_NET_IF_DL_H */
/* Define if you have the
/* #undef HAVE_NET_IF_ETHER_H */
/* Define if you have the
/* #undef HAVE_NET_IF_TYPES_H */
/* Define if you have the
#define HAVE_NETINET_IF_ETHER_H 1
/* Define if you have the
#define HAVE_NETPACKET_PACKET_H 1
/* Define if you have the
#define HAVE_SYS_CDEFS_H 1
/* Define if you have the
/* #undef HAVE_SYS_DLPI_H */
/* Define if you have the
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the
#define HAVE_SYS_PARAM_H 1
/* Define if you have the
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the
#define HAVE_SYS_TIME_H 1
/* Define if you have the
//#define HAVE_SYS_UIO_H 1
/* Define if you have the
#define HAVE_SYSLOG_H 1
/* Define if you have the
#define HAVE_UNISTD_H 1
/* Define if you have the N_HDLC line discipline in linux/termios.h */
/* #undef HAVE_N_HDLC */
/* Define if bitfields are packed in reverse order */
#define PACK_BITFIELDS_REVERSED 1
/* Define to include debugging code */
#define DEBUGGING_ENABLED 1
/* Solaris moans if we don't do this... */
#ifdef __sun
#define __EXTENSIONS__ 1
#endif
-----------------------end of config.h -------------------------------------
5.external/rp-pppoe-3.10下创建Android.mk文件, 内容如下
-------------------- Android.mk --------------------------------------------
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=\
src/pppoe.c \
src/if.c \
src/debug.c \
src/common.c \
src/ppp.c \
src/discovery.c \
LOCAL_STATIC_LIBRARIES :=
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := pppoe
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
LOCAL_CFLAGS += '-DVERSION="3.10"' \
'-DPPPD_PATH="/system/bin/pppd"'
include $(BUILD_EXECUTABLE)
include $(call all-makefiles-under,$(LOCAL_PATH))
-------------------- end of Android.mk -------------------------------------
错误及解决方法:
1) /dev/pts/目录为空, pppoe 提示找不到文件 /dev.pts/0
内核配置添加如下选项
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
2) 提示 pppoe: read (asyncReadFromPPP): Session 8: I/O error
把内核中PPPOE的所有选项都支持上就万事大吉了
# CONFIG_WAN is not set
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_MPPE=y
CONFIG_PPPOE=y
CONFIG_PPPOL2TP=y
CONFIG_PPPOLAC=y
CONFIG_PPPOPNS=y
# CONFIG_SLIP is not set
CONFIG_SLHC=y
参考文档:
1. http://blog.csdn.net/linweig/article/details/5481355
更多相关文章
- Duplicate jar entry [android/support/design/widget/Coordinat
- Android如何调用Google Web Search?
- Android如何调用Google Web Search?
- Android(安卓)Bundle类
- Adnroid单元测试
- TabHost随着输入法软键盘出现而上浮的问题
- Android(安卓)访问Http被限制解决方法
- android应用程序组件之间的通讯
- 修改 ActivityManagerService.java 去掉 android 系统报错和程序