您尚未登录。

#1 2021-04-11 09:04:16 分享评论

哇酷小二
管理员
注册时间: 2020-04-22
已发帖子: 2,127
积分: 1907

全志 A33 官方 dragonboard SDK 建立 SSHD 服务器, 电脑通过WIFI连接A33 SSHD服务器 [分享]

①. 下载 dropbear 源码 dropbear-2020.81_src.tgz , 解压到任意目录, 修改Makefile的gcc路径:

比如的电脑gcc路径: /opt/A33/dragonboard/out/sun8iw5p1/dragonboard/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc

那这样修改:

CC=/opt/A33/dragonboard/out/sun8iw5p1/dragonboard/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc
AR=/opt/A33/dragonboard/out/sun8iw5p1/dragonboard/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-ar
RANLIB=/opt/A33/dragonboard/out/sun8iw5p1/dragonboard/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-ranlib
STRIP=/opt/A33/dragonboard/out/sun8iw5p1/dragonboard/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-strip

然后执行make 命令, 目录下面的drop 就是我们需要的文件


②. 新建WIFI配置文件 /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant 
ctrl_interface_group=0 
ap_scan=1 
network={
ssid="whycan"       
psk="13800138000"
}

联网:

wpa_supplicant -B -d -i wlan0 -c /etc/wpa_supplicant.conf

获取ip:

dhcpc -i wlan0

③. 把步骤1生成dropbear可执行文件拷贝到根文件系统/usr/sbin/目录

建立: /etc/init.d/S50dropbear

#!/bin/sh
#
# Starts dropbear sshd.
#

# Allow a few customizations from a config file
test -r /etc/default/dropbear && . /etc/default/dropbear

start() {
        DROPBEAR_ARGS="$DROPBEAR_ARGS -R"

        # If /etc/dropbear is a symlink to /var/run/dropbear, and
        #   - the filesystem is RO (i.e. we can not rm the symlink),
        #     create the directory pointed to by the symlink.
        #   - the filesystem is RW (i.e. we can rm the symlink),
        #     replace the symlink with an actual directory
        if [ -L /etc/dropbear \
             -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
        then
                if rm -f /etc/dropbear >/dev/null 2>&1; then
                        mkdir -p /etc/dropbear
                else
                        echo "No persistent location to store SSH host keys. New keys will be"
                        echo "generated at each boot. Are you sure this is what you want to do?"
                        mkdir -p "$(readlink /etc/dropbear)"
                fi
        fi

        printf "Starting dropbear sshd: "
        umask 077

        start-stop-daemon -S -q -p /var/run/dropbear.pid \
                --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
        [ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
        printf "Stopping dropbear sshd: "
        start-stop-daemon -K -q -p /var/run/dropbear.pid
        [ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        restart
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?

改变文件可执行属性: chmod +x /etc/init.d/S50dropbear



④. 重启dropbear:

/etc/init.d/S50dropbear restart

⑤. 如果需要变更密码请输入 passwd root

⑥. 客户端可以用ssh连接该服务器了

⑦. 板上备份文件

tar cvf /tmp/udisk/sshd_server_backup2.tar /etc/dropbear/ /etc/wpa_supplicant.conf /etc/init.d/S50dropbear /usr/sbin/dropbear /etc/passwd /etc/shadow

⑧. 打包到文件系统:
在这个目录下 /opt/A33/dragonboard/buildroot/target/dragonboard/rootfs/

mkdir /etc/dropbear/ -p

复制板上的 /etc/wpa_supplicant.conf /etc/init.d/S50dropbear /usr/sbin/dropbear /etc/passwd /etc/shadow 等文件

然后执行 build.sh 打包固件命令, 生成img即烧录文件.

离线

#2 2021-04-20 10:24:59 分享评论

无痕
会员
注册时间: 2021-02-04
已发帖子: 28
积分: 15

Re: 全志 A33 官方 dragonboard SDK 建立 SSHD 服务器, 电脑通过WIFI连接A33 SSHD服务器 [分享]

哇酷小儿大佬,我遇到问题,希望能跟你取得联系,私底下交流

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn