OpenWRT交叉編譯非官方軟體sshpass

來源:互聯網
上載者:User

安裝編譯環境:

 代碼如下 複製代碼


apt-get install build-essential libncurses5-dev zlib1g-dev

下載交叉編譯環境及sshpass源碼:

 代碼如下 複製代碼

wget http://downloads.openwrt.org/backfire/10.03.1/brcm63xx/OpenWrt-SDK-brcm63xx-for-Linux-i686-gcc-4.3.3%2bcs_uClibc-0.9.30.1.tar.bz2
tar jxvf OpenWrt-SDK-brcm63xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2
mkdir -p OpenWrt-SDK-brcm63xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/package/sshpass
cd OpenWrt-SDK-brcm63xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/package/sshpass
wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz
tar zxvf sshpass-1.05.tar.gz
mv sshpass-1.05 src

sshpass目錄建立Makefile檔案:

 代碼如下 複製代碼

include $(TOPDIR)/rules.mk
 
# Name and release number of this package
PKG_NAME:=sshpass
PKG_RELEASE:=1.05
 
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
include $(INCLUDE_DIR)/package.mk
 
define Package/sshpass
 SECTION:=utils
 CATEGORY:=Utilities
 TITLE:=sshpass
endef
 
define Package/sshpass/description
 Sshpass is a tool for non-interactivly performing password authentication with SSH's
endef
 
# Specify what needs to be done to prepare for building the package.
define Build/Prepare
 mkdir -p $(PKG_BUILD_DIR)
 $(CP) ./src/* $(PKG_BUILD_DIR)/
endef
 
 
# Specify where and how to install the program.
define Package/sshpass/install
 $(INSTALL_DIR) $(1)/bin
 $(INSTALL_BIN) $(PKG_BUILD_DIR)/sshpass $(1)/bin/
endef
 
# This line executes the necessary commands to compile our program.
$(eval $(call BuildPackage,sshpass))

編譯sshpass:

 代碼如下 複製代碼

cd ../
make package/sshpass/compile

編譯成功的程式檔案:

 代碼如下 複製代碼

ls bin/brcm63xx/packages/
Packages  Packages.gz  sshpass_1.05_brcm63xx.ipk

編譯過程中如遇到以下錯誤:

 代碼如下 複製代碼

staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib/libc.so: undefined reference to `_dl_app_init_array’

需修改:

TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib

為:

 代碼如下 複製代碼

TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib -Wl,-rpath=$(TOOLCHAIN_DIR)/lib

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.