pynqz2-Ubuntu相关知识学习

1. pynq 的网络通信问题

参考 :https://blog.csdn.net/yph001/article/details/80177154

  • 网络通信的基本流程
         路由器A ================================路由器B

           |                 INTERNET              |        

           |                                       |

        交换机A                                   交换机B

        |    |                                   |    |

        |    |                                   |    |
      PC-A    PC-B                              PC-C   PC-D         

其中,一般来说,路由器的LAN接口的IP地址就是你所在局域网中的网关,是连接内网和外网用的设备。

1)ifconfig命令被用于配置和显示Linux内核中网络接口的网络参数

xilinx@pynq:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::205:6bff:fe01:c581  prefixlen 64  scopeid 0x20<link>
        ether 00:05:6b:01:c5:81  txqueuelen 1000  (Ethernet)
        RX packets 21671  bytes 6118382 (6.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30363  bytes 19184522 (19.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 29  base 0xb000

eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.99  netmask 255.255.255.0  broadcast 192.168.2.255
        ether 00:05:6b:01:c5:81  txqueuelen 1000  (Ethernet)
        device interrupt 29  base 0xb000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback `本地回环`)
        RX packets 48302  bytes 5524669 (5.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48302  bytes 5524669 (5.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

加一些注释:

  • 1.本地回环地址,不属于任何一个有类别地址类。它代表设备的本地虚拟接口,所以默认被看作是永远不会宕掉的接口。在windows操作系统中也有相似的定义,所以通常在不安装网卡前就可以ping通这个本地回环地址。一般都会用来检查本地网络协议、基本数据接口等是否正常的

2)使用nm-tool来查看查看IP,网关,DNS

-bash: nm-tool: command not found

emm,在pynq上不存在可能是

3)查看内核 IP 路由表

xilinx@pynq:~$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

网络通信测试的基本流程

  • ping 网关IP:检测主机到网关之前是否能够正常通信
xilinx@pynq:~$ ping -c 3 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.077 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.065 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.080 ms

--- 0.0.0.0 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2072ms
rtt min/avg/max/mdev = 0.065/0.074/0.080/0.006 ms

发现没有问题

  • ping DNS域名服务器,因为pynq上的Ubuntu没有此指令,也无法查看DNS。
  • ping 外网地址
    发现没法ping 通

结果分析
当到网关之间ping不通,则更多的是主机到路由器连线的问题
当到DNS之间ping不通,则更多的是域名解析服务器出现了问题
当到外网不通,而前面两项都能够ping通,则表面路由器与外网通信存在问题

2. 为什么SSH打不开?

2.1 什么是SSH?

有待学习

2.2 如何在PYNQ上打开SSH

见 ##3.pynq如何联网

3. pynq如何联网

玩嵌入式一定要参考官方文档
比如:https://pynq.readthedocs.io/en/latest/getting_started/pynq_z2_setup.html

3.1Network connection

Once your board is setup, you need to connect to it to start using Jupyter notebook.

3.1.1 Ethernet

If available, you should connect your board to a network or
router with Internet access. This will allow you to update your board
and easily install new packages.

3.1.2 Connect to a Computer

You will need to have an Ethernet port available
on your computer, and you will need to have permissions to configure
your network interface. With a direct connection, you will be able to
use PYNQ, but unless you can bridge the Ethernet connection to the
board to an Internet connection on your computer, your board will not
have Internet access.
You will be unable to update or load new
packages without Internet access.

Connect directly to a computer (Static IP):

  1. Assign your computer a static IP address
  2. Connect the board to your computer’s Ethernet port
  3. Browse to http://192.168.2.99

Connect to a Network Router
If you connect to a router, or a network with a DHCP
server, your board will automatically get an IP address. You must make
sure you have permission to connect a device to your network,
otherwise the board may not connect properly.

Connect to a Router/Network (DHCP):

Connect the Ethernet port on your board to a router/switch Connect
your computer to Ethernet or WiFi on the router/switch Browse to
http:// Optional: see Change the Hostname below
Optional: see Configure Proxy Settings below

网口SSH
这种需要用到网口线,把板子和电脑连接起来,板子的默认IP是192.168.2.99,本地网口地址也需要设置成192.168.2.x。

在这里插入图片描述

点击OPEN,输入用户名:xilinx,再输入密码(不显示):xilinx

参考文章:
PYNQ上手 3.上网配置
PYNQ上手 4.PUTTY登陆

最后我成功ping通外网
在这里插入图片描述
方法:https://blog.csdn.net/Sherlock_2/article/details/108561547?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&dist_request_id=53b5e787-aa7c-46ae-afd3-db335c1ef6d4&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
不用配置DNS

后来我这又出现一些问题,就是我的电脑网线链接过校园网后,再接pynq就登不上192.168.2.99了,我找到如下帖子:
https://blog.csdn.net/weixin_44278403/article/details/107774834

4. Linux系统各个目录的作用

/

这就是根目录。对你的电脑来说,有且只有一个根目录。所有的东西,我是说所有的东西都是从这里开始。举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录)开始,再进入到home目录。

/root

这是系统管理员(root user)的目录。对于系统来说,系统管理员就好比是上帝,它能对系统做任何事情,甚至包括删除你的文件。因此,请小心使用root帐号。

/bin

这里存放了标准的(或者说是缺省的)linux的工具,比如像“ls”、“vi”还有“more”等等。通常来说,这个目录已经包含在你的“path”系统变量里面了。什么意思呢?就是:当你在终端里输入ls,系统就会去/bin目录下面查找是不是有ls这个程序。

/etc

这里主要存放了系统配置方面的文件。举个例子:你安装了samba这个套件,当你想要修改samba配置文件的时候,你会发现它们(配置文件)就在/etc/samba目录下。

/dev

这里主要存放与设备(包括外设)有关的文件(unix和linux系统均把设备当成文件)。想连线打印机吗?系统就是从这个目录开始工作的。另外还有一些包括磁盘驱动、USB驱动等都放在这个目录。

/home

这里主要存放你的个人数据。具体每个用户的设置文件,用户的桌面文件夹,还有用户的数据都放在这里。每个用户都有自己的用户目录,位置为:/home/用户名。当然,root用户除外。

/tmp

这是临时目录。对于某些程序来说,有些文件被用了一次两次之后,就不会再被用到,像这样的文件就放在这里。有些linux系统会定期自动对这个目录进行清理,因此,千万不要把重要的数据放在这里。

/usr

在这个目录下,你可以找到那些不适合放在/bin或/etc目录下的额外的工具。比如像游戏阿,一些打印工具拉等等。/usr目录包含了许多子目录:/usr/bin目录用于存放程序;/usr/share用于存放一些共享的数据,比如音乐文件或者图标等等;/usr/lib目录用于存放那些不能直接运行的,但却是许多程序运行所必需的一些函数库文件。你的软件包管理器(应该是“新立得”吧)会自动帮你管理好/usr目录的。

/opt

这里主要存放那些可选的程序。你想尝试最新的firefox测试版吗?那就装到/opt目录下吧,这样,当你尝试完,想删掉firefox的时候,你就可以直接删除它,而不影响系统其他任何设置。安装到/opt目录下的程序,它所有的数据、库文件等等都是放在同个目录下面。

举个例子:刚才装的测试版firefox,就可以装到/opt/firefox_beta目录下,/opt/firefox_beta目录下面就包含了运行firefox所需要的所有文件、库、数据等等。要删除firefox的时候,你只需删除/opt/firefox_beta目录即可,非常简单。

/usr/local

这里主要存放那些手动安装的软件,即不是通过“新立得”或apt-get安装的软件。它和/usr目录具有相类似的目录结构。让软件包管理器来管理/usr目录,而把自定义的脚本(scripts)放到/usr/local目录下面,我想这应该是个不错的主意。

/media

有些linux的发行版使用这个目录来挂载那些usb接口的移动硬盘(包括U盘)、CD/DVD驱动器等等。

5.Ubuntu 更换国内源

1.备份原来的源

sudo cp -r /etc/apt/sources.list /etc/apt/sources_init.list

如下:

xilinx@pynq:/etc/apt$ sudo cp -r /etc/apt/sources.list.d /etc/apt/sources_init.list
xilinx@pynq:/etc/apt$ ls
apt.conf.d  preferences.d  sources_init.list  sources.list.d  trusted.gpg.d

注意: sources_init.list 保存了从前的源
2.更换源

sudo gedit /etc/apt/sources.list

插曲:Ubuntu系统命令终端提示 sudo: gedit:找不到命令
嗯, 直接安装就好了

sudo apt-get install gedit

然后出现第二个问题

xilinx@pynq:/etc/apt$ sudo gedit /etc/apt/sources.list.d
Unable to init server: Could not connect: Connection refused
(gedit:3523): Gtk-WARNING **: 09:22:44.348: cannot open display:

查阅资料:

远程连接服务器或者工作站的时候,通常不能打开一个GUI图形用户,而且在打开过程中会出现诸如:

(gedit:46927): Gtk-WARNING : cannot open display: 或者:

指令名:Cannot connect to display 的提示。那么如何解决这个问题呢?

把它分为两种链接方式:用windows下的cmd链接远程的linux,另一种是用本地的linux系统链接远程的linux(两种的远程机器均为linux系统,我感觉不是linux系统也没关系吧!)。

这个命令用于打开UI窗口,Putty上并无此功能
在这里插入图片描述
最后换了清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

嗯,换了源也无法下载luvcview

xilinx@pynq:/etc/apt$ sudo apt-get install luvcview
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package luvcview

注:最后我还是把getdit remove了

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值