ZyboのPmod JFをbashで制御する
環境
- Zybo Z7-10 (4.19.0-xilinx-v2019.2)
- Analog Discovery 2 (以下「AD2」という)
シェルスクリプト
# cat <<EOF | \ tee mio.sh #!/bin/bash GPIO_NUM=\$((906+13)) if [ ! -d /sys/class/gpio/gpio\$GPIO_NUM ]; then echo \$GPIO_NUM > /sys/class/gpio/export;fi echo out > /sys/class/gpio/gpio\$GPIO_NUM/direction VAL=0 while true; do echo \$VAL > /sys/class/gpio/gpio\$GPIO_NUM/value sleep 1s VAL=\$((0x01&~VAL)) done EOF # bash mio.sh
動作確認
Pmod JFのPIN 1にAD2のDIO 0を接続し、PIN 5をAD2のGNDに接続する。
AD2からMIO-13を観測した様子を以下に示す。
Pmod JFのMIOをbashで操作できた pic.twitter.com/pmqBvUoDWm
— M.IIDAS (@m_iidas) 2019年12月29日
参考
https://reference.digilentinc.com/reference/programmable-logic/zybo-z7/reference-manual
Zyboでbashを使ってLチカする
環境
- Zybo Z7-10 (4.19.0-xilinx-v2019.2)
Lチカ
以下コマンドを入力する。
# cat <<EOF | \ tee blink.sh #!/bin/bash echo 913 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio913/direction LED=0 while true; do echo \$LED > /sys/class/gpio/gpio913/value sleep 1s LED=\$((0x01&~LED)) done EOF # bash blink.sh
デモ
ZYBOでbashからLチカ pic.twitter.com/hOJeW2GlHT
— M.IIDAS (@m_iidas) 2019年12月29日
PetaLinuxでLinuxイメージを作成する
環境
- Ubuntu 18.04.3
- PetaLinux 2019.2
- ZYBO Z7-10
前提
- PetaLinuxは
/opt/pkg/petalinux/2019.2/
にインストールされている - Vivadoでのプロジェクト名は
zybo_basic
とし、PSが配置されたハードウェアが作成されている
作成手順
環境設定
$ source /opt/pkg/petalinux/2019.2/settings.sh PetaLinux environment set to '/opt/pkg/petalinux/2019.2' WARNING: /bin/sh is not bash! bash is PetaLinux recommended shell. Please set your default shell to bash. INFO: Checking free disk space INFO: Checking installed tools INFO: Checking installed development libraries INFO: Checking network and other services WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution
作業ディレクトリの作成
ディレクトリ作成後にHardwareディレクトリにVivadoのプロジェクトをコピーしておく。
$ mkdir PetaLinux $ mkdir Projects $ mkdir Hardware
プロジェクト作成
$ cd Projects/ $ petalinux-create --type project --template zynq --name zybo_basic_ps INFO: Create project: zybo_basic_ps INFO: New project successfully created in /home/user/PetaLinux/Projects/zybo_basic_ps
設定
実行するとTUIが表示されるので、必要ならば設定を行う。
$ cd zybo_basic_ps/ $ petalinux-config --get-hw-description=../../Hardware/zybo_basic/ INFO: Getting hardware description... INFO: Rename zynq_1_wrapper.xsa to system.xsa [INFO] generating Kconfig for project [INFO] menuconfig project configuration written to /home/user/PetaLinux/Projects/zybo_basic_ps/project-spec/configs/config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. configuration written to /home/user/PetaLinux/Projects/zybo_basic_ps/project-spec/configs/config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. [INFO] sourcing bitbake [INFO] generating plnxtool conf [INFO] generating meta-plnx-generated layer [INFO] generating user layers [INFO] generating workspace directory [INFO] generating machine configuration [INFO] generating bbappends for project . This may take time ! [INFO] generating u-boot configuration files [INFO] generating kernel configuration files [INFO] generating kconfig for Rootfs [INFO] silentconfig rootfs [INFO] generating petalinux-user-image.bb
ビルド
$ petalinux-build [INFO] building project [INFO] sourcing bitbake [INFO] generating user layers [INFO] generating workspace directory INFO: bitbake petalinux-user-image Loading cache: 100% |####################################################################################| Time: 0:00:01Loaded 3978 entries from dependency cache. Parsing recipes: 100% |##################################################################################| Time: 0:00:05Parsing of 2893 .bb files complete (2885 cached, 8 parsed). 3980 targets, 169 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |###############################################################################| Time: 0:00:04Checking sstate mirror object availability: 100% |#######################################################| Time: 0:00:10Sstate summary: Wanted 887 Found 711 Missed 352 Current 0 (80% match, 0% complete) NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 3218 tasks of which 2362 didn't need to be rerun and all succeeded. INFO: Copying Images from deploy to images INFO: Creating /home/user/PetaLinux/Projects/zybo_basic_ps/images/linux directory NOTE: Failed to copy built images to tftp dir: /tftpboot [INFO] successfully built project
BOOT.BINの生成
$ petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot INFO: File in BOOT BIN: "/home/user/PetaLinux/Projects/zybo_basic_ps/images/linux/zynq_fsbl.elf" INFO: File in BOOT BIN: "/home/user/PetaLinux/Projects/zybo_basic_ps/images/linux/system.bit" INFO: File in BOOT BIN: "/home/user/PetaLinux/Projects/zybo_basic_ps/images/linux/u-boot.elf" INFO: Generating Zynq binary package BOOT.BIN... ****** Xilinx Bootgen v2019.2 **** Build date : Oct 23 2019-22:59:42 ** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved. INFO: Binary is ready. WARNING: Unable to access the TFTPBOOT folder /tftpboot!!! WARNING: Skip file copy to TFTPBOOT folder!!!
成果物のコピー
以下画像に示すように、FAT32でフォーマットしたSDカードにimages/linux/
にあるBOOT.BINとimage.ubをコピーする
ジャンパピンの設定
ジャンパピンJP5
を以下の画像のようにSD
にセットする。
実行
PROG UART
にUSBケーブルを差し込み、PuTTY等でコンソールを開くと以下のように起動ログが表示される。
なお、ユーザー名、パスワードともにroot
でログインできる。
ZYBOでLinux動いた pic.twitter.com/E6usJIbCWT
— M.IIDAS (@m_iidas) 2019年12月29日
参考
https://japan.xilinx.com/support/documentation/sw_manuals_j/xilinx2019_2/ug1144-petalinux-tools-reference-guide.pdf
https://qiita.com/iwatake2222/items/6e6915f7318689818368
KDEのタスクバーをWindows10風にする
環境
- Ubuntu 18.04.3
設定手順
タスクバー上で右クリックし、Alternativesを選択する。
Icons-onlyを選択を選択し、Switchボタンを押下する。
以下画像のようにアイコンのみが表示されていれば設定完了。
Webページを1つのHTMLとして保存するFirefoxアドオン「SingleFile」
Ubuntu 18.04.3 LTSでPetaLinux 2019.2のインストール中にawk: read error (Bad address)が発生する
環境
- Ubuntu 18.04.3 LTS
- PetaLinux 2019.2
問題
インストール中にawk: read error (Bad address)が発生する。
$ bash ./petalinux-v2019.2-final-installer.run /opt/pkg/petalinux/2019.2 INFO: Checking installation environment requirements... awk: read error (Bad address) Please refer to the PetaLinux Tools Installation Guide. Check the troubleshooting guide at the end of that manual, and if you are unable to resolve the issue please contact customer support with file: /home/user/petalinux_installation_log ./petalinux-v2019.2-final-installer.run: line 148: /tmp/tmp.tJD0mW7l5j/petalinux-env-check: No such file or directory ERROR: Failed to extract Petalinux installer...
解決方法
$ sudo apt install gawk
Hyper-V上のUbuntu 18.04.3にKDEを導入する
環境
導入
以下のコマンドを実行する。
$ sudo apt install -y kubuntu-desktop
インストールの途中で以下の画面が表示されるのでsddmを選択する。
xrdpで使用するデスクトップ環境をGNOMEからKDEへ変更する。
$ echo "startkde" > ~/.xsession $ cat <<EOF | \ sudo tee /etc/xrdp/startubuntu.sh #!/bin/sh export XDG_CURRENT_DESKTOP=KDE export XDG_DATA_DIRS=/usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop export XDG_CONFIG_DIRS=/etc/xdg/xdg-plasma:/etc/xdg:/usr/share/kubuntu-default-settings/kf5-settings exec /etc/xrdp/startwm.sh EOF $ cat <<EOF | \ sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-NetworkManager.pkla [Netowrkmanager] Identity=unix-group:sudo Action=org.freedesktop.NetworkManager.network-control ResultAny=yes ResultInactive=yes ResultActive=yes EOF $ cat <<EOF | \ sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-packagekit.pkla [Netowrkmanager] Identity=unix-group:sudo Action=org.freedesktop.packagekit.system-sources-refresh ResultAny=yes ResultInactive=auth_admin ResultActive=yes EOF $ reboot
確認
拡張セッションでKDE環境にログインできれば成功。