9。ファイル転送
このセクションでは、ファイル転送を容易にするために、ネットワーク ケーブルまたは Wi-Fi を介して PC と armom ボードを同じ LAN に配置することを選択する必要があります。
ネットワークケーブルまたは Wi-Fi を使用してネットワークに接続する場合は、「V. ネットワーク接続と設定」セクションを参照してください。
armom ボードの場合、ファイル転送には 2 つの方法をお勧めします。
SSHリンク
NFSマウント
それらの違いは次のとおりです。
ssh リンクを介して転送できるのは通常のファイルのみであり、リンク ファイルは転送できません
NFS マウントを介して、Ubuntu と armom ボード間で任意のファイルを転送できます
Wi-Fi を使用することを選択した場合は、次のコマンドを使用して Wi-Fi のオンとオフの制御を試みることができます (コマンドに慣れるためのみであり、必須ではありません)。
sudo ip link set dev wlan0 up //Turn on wlan0 device, but will not affect the power status of wifi
sudo ip link set dev wlan0 down //Turn off wlan0 device, but will not affect the power status of wifi
sudo rfkill block wifi //Completely turn off Wi-Fi hardware
sudo rfkill unblock wifi //Completely turn on WIFI hardware
ip a or ip addr show //Used to display and operate the IP layer (network layer) properties of the network interface, mainly used to display information such as the IP address to the user
ip link show //Used to display and operate the link layer properties of the network interface, you can see whether the interface is disabled, display the MAC address, display the interface speed, and do not directly display the IP address configuration
sudo nmtui //Graphical interface configuration wifi
9.1 SSH リンクを使用してファイルを転送する場合:
- Windows デスクトップ環境では、Windows キー (フィールド アイコン キー) + r キーを同時に押し、ポップアップ オプション ボックスに cmd と入力し、Enter キーを押して、cmd ターミナルに ipconfig と入力します。
- armom ボードのシリアル ターミナルに sudo nmtui と入力し、ポップアップ グラフィカル インターフェイスで [接続のアクティブ化] を選択し、矢印キーで接続する WiFi 名を選択して、Enter キーを押します。 1 秒後、パスワードを要求するダイアログ ボックスが表示されます。接続するにはパスワードを入力してください
- armom ボードのステップ 1 のウィンドウの下にある cmd 環境に表示される IP アドレスに ping を実行します。 ping ができる場合は、ルーターが PC とボードに同じネットワーク セグメント IP アドレスを割り当てたことを意味します。
- mobaXterm ソフトウェアを介してボードに接続し、armsom ボードで ip a を使用してボードの IP を表示します。次に、PC で mobaXterm を開き、ssh 経由でボードに接続します。
ssh通信の注意点は以下の2点です。
1. ssh can only transfer ordinary files, not link files
2. It can only be transferred to the folder whose group belongs to the user name entered in step 4 of Figure 1. If you want to transfer to other folders, please use the root user ssh to log in to the board
9.2 nfs を使用してファイルをマウントおよび転送する場合
NFSを利用して上記の実験環境を構築します。これには主に、ネットワークへの接続、ホスト上での NFS サービスの開始、およびボードへのファイル システムのマウントの 3 つのステップが含まれます。
私たちの目標は、開発ホストとボードの次のディレクトリをマッピングすることです。
開発ホストの共有ディレクトリ: /home/username/nfs
ボードマウントディレクトリ: /mnt
9.2.1 V同じ Wi-Fi に接続された仮想マシン ubuntu Armsom ボード
次のように、仮想マシンのモードをブリッジ モードに設定します。
仮想ネットワーク エディターで管理者権限を使用して、ブリッジ モードで使用されるネットワーク カードを専用の Wi-Fi ネットワーク カードに変更します。 vmware ソフトウェアでの変更手順は次のとおりです。
Windows のコントロール パネルで次の項目を見つけます。
仮想ネットワーク エディターで、ブリッジ モードで使用するネットワーク カードを上の図で選択した Wi-Fi デバイス名に変更します。
Windows では、Avery-m という名前の Wi-Fi に接続します。その後、Ubuntu も Wi-Fi ネットワーク カードを使用して、ブリッジ モードを利用してこの Wi-Fi に接続します。
Ubuntu で表示される IP は 172.20.10.13 です
Windows で表示される IP は 172.20.10.2 です
armom ボードの sudo nmtui コマンドを使用して、WiFi 設定のグラフィカル インターフェイスに入ります。
キーボードの矢印キーを使用して接続する Wi-Fi を選択し、Enter キーを押して接続を待ちます。正常に接続するには、次のインターフェイスに Wi-Fi パスワードを入力します。
接続が成功すると、IP は 172.20.10.11 になります。
9.2.2 Ubuntu NFS を有効にします
ubuntuで以下のコマンドを実行# Install nfs server
sudo apt-get install nfs-kernel-server
# ubuntu creates /nfs path
sudo mkdir /nfs
# Modify /etc/exports in ubuntu
sudo gedit /etc/exports
# Modify the /etc/exports file in the pop-up interface, add the following content at the end, remember to click save after modification
/nfs *(rw,sync,no_root_squash)
変更された /etc/exports ファイルの内容は次のとおりです。
# Then use the command to restart the nfs service
sudo /etc/init.d/nfs-kernel-server restart
# The meaning of this command is to use the TCP protocol to mount the /nfs path in the device with IP 172.20.10.13 (linux ubuntu IP, please modify it according to the actual situation) to the /mnt folder of the current armsom board
# Enter the following command in the armsom board:
sudo mount -t nfs -o proto=tcp,nolock 172.20.10.13:/nfs /mnt
この時点で、Ubuntu に新しいファイルを作成します。armsom ボードの /mnt パスの下に新しいファイルが表示され、nfs ファイル転送が成功したことが示されます。
