openWrt软件移植简述

进入package目录下,新建目录my_netcat。

编写如下Makefile


include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=netcat //软件名字
PKG_RELEASE:=1 //当前Makefile版本
PKG_SOURCE_URL:= http://sourceforge.net/projects/netcat/files/netcat/0.7.1/ //软件下载目录
PKG_VERSION:=0.7.1 //软件版本
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz //软件下载名字(跟在软件目录后形成完整下载路径)
include $(INCLUDE_DIR)/package.mk
define Package/my_netcat
  SECTION:=net//软件类型
  CATEGORY:=Base system //make menuconfig 存在的一级目录
  TITLE:=This simple utility reads and writes data across TCP or UDP network connections.
  URL:=http://sectools.org/tool/netcat/
endef
define Package/my_netcat/install //安装软件
    $(INSTALL_DIR) $(1)/usr/sbin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/netcat $(1)/usr/sbin/my_netcat
endef
$(eval $(call BuildPackage,my_netcat))


添加完成后,回到根目录make meuconfig


wKioL1M5PXaiguXPAAqyId4sHxw998.jpg

勾选my_netcat,make V=99完成编译


root@DreamBox:/usr/bin# m
md5sum      mkdir       mknod       mktemp      mount_root  mv
mesg        mkfifo      mkswap      mount       mtd         my_netcat
root@DreamBox:/usr/bin# my_netcat -h
GNU netcat 0.7.1, a rewrite of the famous networking tool.
Basic usages:
connect to somewhere:  my_netcat [options] hostname port [port] ...
listen for inbound:    my_netcat -l -p port [options] [hostname] [port] ...
tunnel to somewhere:   my_netcat -L hostname:port -p port [options]

Mandatory arguments to long options are mandatory for short options too.
Options:
 -c, --close                close connection on EOF from stdin
 -e, --exec=PROGRAM         program to exec after connect
 -g, --gateway=LIST         source-routing hop point[s], up to 8
 -G, --pointer=NUM          source-routing pointer: 4, 8, 12, ...
 -h, --help                 display this help and exit
 -i, --interval=SECS        delay interval for lines sent, ports scanned
 -l, --listen               listen mode, for inbound connects
 -L, --tunnel=ADDRESS:PORT  forward local port to remote address
 -n, --dont-resolve         numeric-only IP addresses, no DNS
 -o, --output=FILE          output hexdump traffic to FILE (implies -x)
 -p, --local-port=NUM       local port number
 -r, --randomize            randomize local and remote ports
 -s, --source=ADDRESS       local source address (ip or hostname)
 -t, --tcp                  TCP mode (default)
 -T, --telnet               answer using TELNET negotiation
 -u, --udp                  UDP mode
 -v, --verbose              verbose (use twice to be more verbose)
 -V, --version              output version information and exit
 -x, --hexdump              hexdump incoming and outgoing traffic
 -w, --wait=SECS            timeout for connects and final net reads
 -z, --zero                 zero-I/O mode (used for scanning)

Remote port number can also be specified as range.  Example: '1-1024'


成功移植netcat.

你可能感兴趣的:(openwrt)