目录
交叉编译openssh网上资料很多,整理成了一个makefile文件,其中有一步发生错误,需要手动修改一下Makefile,还不能完全自动化编译.
.PHONY:all prepare build cleanCROSS:=arm-himix200-linuxCUR_DIR:=$(shell pwd)
OPENSSH_SRC_DIR:=$(CUR_DIR)/openssh-9.7p1
OPENSSH_INSTALL_DIR:=$(CUR_DIR)/openssh_install
ZIP_LIB_SRC_DIR:=$(CUR_DIR)/zlib
ZIP_LIB_INSTALL_DIR:=$(CUR_DIR)/zip_install
OPENSSL_SRC_DIR:=$(CUR_DIR)/openssl
OPENSSL_INSTALL_DIR:=$(CUR_DIR)/openssl_installall:prepare buildprepare:-@mkdir -p $(OPENSSH_INSTALL_DIR)/usr/local/bin -@mkdir -p $(OPENSSH_INSTALL_DIR)/usr/local/etc-@mkdir -p $(OPENSSH_INSTALL_DIR)/usr/libexec-@mkdir -p $(ZIP_LIB_INSTALL_DIR)-@mkdir -p $(OPENSSL_INSTALL_DIR)
ifneq ($(ZIP_LIB_SRC_DIR), $(wildcard $(ZIP_LIB_SRC_DIR)))-@git clone https://gitee.com/PatchLion_admin/zlib.git
endif
ifneq ($(OPENSSL_SRC_DIR), $(wildcard $(OPENSSL_SRC_DIR)))-@git clone https://gitee.com/fedorayang/openssl.git
endif
ifneq ($(OPENSSH_SRC_DIR), $(wildcard $(OPENSSH_SRC_DIR)))-@wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.7p1.tar.gz-@pushd $(CUR_DIR);tar -zxf openssh-9.7p1.tar.gz;popd
endif build:@pushd $(ZIP_LIB_SRC_DIR);prefix=$(ZIP_LIB_INSTALL_DIR) CC=$(CROSS)-gcc ./configure;popd@pushd $(ZIP_LIB_SRC_DIR);make -j4;make install;popd
# #https://blog.csdn.net/weixin_46639310/article/details/132587940@pushd $(OPENSSL_SRC_DIR);./config no-asm --prefix=$(OPENSSL_INSTALL_DIR) --cross-compile-prefix=$(CROSS)-;popd@pushd $(OPENSSL_SRC_DIR);make -j4;make install;popd @pushd $(OPENSSH_SRC_DIR);LD=$(CROSS)-ld CC=$(CROSS)-gcc ./configure --host=$(CROSS) --with-libs --with-zlib=$(ZIP_LIB_INSTALL_DIR) --with-ssl-dir=$(OPENSSL_INSTALL_DIR) --disable-etc-default-login;popd@pushd $(OPENSSH_SRC_DIR);make -j4;popd@pushd $(OPENSSH_SRC_DIR);cp scp sftp ssh sshd ssh-add ssh-agent ssh-keygen ssh-keyscan $(OPENSSH_INSTALL_DIR)/usr/local/bin/;popd@pushd $(OPENSSH_SRC_DIR);cp moduli ssh_config sshd_config $(OPENSSH_INSTALL_DIR)/usr/local/etc/;popd@pushd $(OPENSSH_SRC_DIR);cp sftp-server ssh-keysign $(OPENSSH_INSTALL_DIR)/usr/libexec;popd clean:-@pushd $(ZIP_LIB_SRC_DIR);make distclean;popd-@pushd $(OPENSSL_SRC_DIR);make distclean;popd -@pushd $(OPENSSH_SRC_DIR);make distclean;popd-@rm -rf $(ZIP_LIB_INSTALL_DIR)-@rm -rf $(OPENSSL_INSTALL_DIR) -@rm -rf $(OPENSSH_INSTALL_DIR)