OPIでFedora22のメモ

loborisさんがリリースしている、Fedora22 のMinimal がどんなものテスト。

以下、備忘録です。Cで、GPIO ピンで光らせる部分まで確認。

 

・Fedora22_Minimal.img をsdcard に dd。要注意で。

$ sudo dd bs=1m if=./Fedora22_Minimal.img of=/dev/rdisk3

・BOOT パーティションの中は、orange pi pc の用途にあったものにリネーム。

[junkhack@OrangePi ~]$ ll /media/boot/
合計 10695
-rwxr-xr-x 1 root root    35724 10月 13 14:08 script.bin
-rwxr-xr-x 1 root root 10915616 10月 13 14:08 uImage

 

・SDCard 挿入、起動

・DHCP で起動するので、IP を固定に。以下のようになじみのあるeth0 に名前変更。

[root@opi 13:35:56 network-scripts]# ll ifcfg-*
-rw-r--r-- 1 root root 364 Jan  1  1970 ifcfg-LoBoInternet
-rw-r--r-- 1 root root 389 Dec 19 13:15 ifcfg-eth0
-rw-r--r-- 1 root root 254 Apr  9  2015 ifcfg-lo
[root@opi 13:36:06 network-scripts]# 

 

・中を変更

[root@opi 13:36:07 network-scripts]# cat ifcfg-eth0 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=c0a09f2a-3229-4901-9689-7deb7e356848
DEVICE=eth0
ONBOOT=yes
DOMAIN=junkhack
IPADDR=192.168.1.42
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.17
DNS2=192.168.1.1
[root@opi 13:36:23 network-scripts]# 

 

・root のプロンプトを変更。好みで。

[root@opi 13:35:08 ~]# tail -n 3 .bash_profile 
PS1="[\u@opi \t \W]# "
export LANG=C

[root@opi 13:35:16 ~]# 

 

・タイムゾーン設定

[root@opi 13:34:18 ~]# timedatectl set-timezone Asia/Tokyo

・後方の空きパーティション拡大。スクリプトが同梱されているので。ない場合は、git にあるので参照。

[root@opi 13:37:46 ~]# find / -name fs_resize
/usr/local/bin/fs_resize
[root@opi 13:37:59 ~]# 

[root@opi 13:39:25 ~]# fs_resize

 

リブート

・cpu周波数のツールを入れ、ポリシーを見てみる。interactiveのようです。

[root@opi 13:43:15 ~]# dnf install cpufrequtils

[root@opi 13:51:19 ~]# cpupower frequency-info
analyzing CPU 0:
  driver: cpufreq-sunxi
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 2.00 ms.
  hardware limits: 480 MHz - 1.54 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, interactive, performance
  current policy: frequency should be within 480 MHz and 1.54 GHz.
                  The governor "interactive"★ may decide which speed to use
                  within this range.
  current CPU frequency is 480 MHz (asserted by call to hardware).
  cpufreq stats: 60.0 MHz:0.00%, 120 MHz:0.00%, 240 MHz:0.00%, 312 MHz:0.00%, 408 MHz:0.00%, 480 MHz:96.37%, 504 MHz:0.00%, 600 MHz:0.00%, 648 MHz:0.00%, 720 MHz:0.00%, 816 MHz:0.01%, 912 MHz:0.00%, 1.01 GHz:0.95%, 1.10 GHz:0.06%, 1.20 GHz:0.21%, 1.34 GHz:0.17%, 1.44 GHz:0.01%, 1.54 GHz:2.21%  (173)
[root@opi 13:51:22 ~]# 

 

参考

http://oneofis05users.seesaa.net/article/288446337.html

    ■ Interactive

    より速いondemandを、ということで考案された。CPUがアイドル状態から

    抜けるとサンプリングを増やして追従を上げる。反応はondemandより良いが、

    最大クロックに上げるまでには間を取る。マルチタスクで忙しい仕事とゆっくり

    した仕事が交互にあっても、最大最小に切り替え時に一気に上下せず少し間を取って、

    中間のクロックを取る。パフォーマンス的にはondemandより良い。

    画面オンで早くトップスピードに上げるので、画面オンの時間が短く、それを

    繰り返すような使用法ではバッテリー消費が多くなる。

 

・kernel をあげてみる。上げる前は以下。

[root@opi 13:55:50 src]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2 ext4       15G  1.1G   13G   8% /
udev           devtmpfs   10M     0   10M   0% /dev
tmpfs          tmpfs     201M  420K  201M   1% /run
tmpfs          tmpfs     502M     0  502M   0% /dev/shm
tmpfs          tmpfs     502M     0  502M   0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat       63M   11M   53M  17% /media/boot
tmpfs          tmpfs     101M     0  101M   0% /run/user/0
tmpfs          tmpfs     101M     0  101M   0% /run/user/1001
[root@opi 13:55:57 src]# 
[root@opi 13:55:57 src]# ll /boot/
total 12632
-rwxr-xr-x 1 root root    32768 Oct 13 23:08 boot0_OPI.fex
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_1080p50
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_480p
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_720p50
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_720p60
-rw-r--r-- 1 root root   901120 Oct 13 23:08 u-boot_OPI-emmc.fex
-rw-r--r-- 1 root root   901120 Oct 13 23:08 u-boot_OPI.fex
-rw-r--r-- 1 root root 10915616 Oct 13 23:08 uImage
[root@opi 13:56:16 src]# 
[root@opi 13:56:38 src]# ll /media/boot/
total 10695
-rwxr-xr-x 1 root root    35724 Oct 13 14:08 script.bin
-rwxr-xr-x 1 root root 10915616 Oct 13 14:08 uImage
[root@opi 13:56:46 src]# 

[root@opi 13:57:30 src]# uname -a
Linux OrangePi 3.4.39 #1 SMP PREEMPT Mon Oct 12 12:02:29 CEST 2015 armv7l armv7l armv7l GNU/Linux
[root@opi 13:57:34 src]# lsmod
Module                  Size  Used by
8189es                887631  0
[root@opi 13:57:41 src]# 

 

・消してしまってスクリプト上でチェックしているようで、ダミーを作成

[root@opi 14:21:02 src]# echo > /boot/uImage_OPI-2

・tar も入ってなかったのでいれておく。

[root@opi 14:25:05 src]# dnf install tar

・スクリプト実行

[root@opi 13:57:45 src]# ./update_kernel.sh 
Sat Dec 19 13:57:54 JST 2015
*********************************************************
Updating kernel, script.bin and /lib/modules for OrangePI
*********************************************************

Do you want to download script&kernel package from server, (y/N)?  y.


Unpacking ...
Files unpacked.
==============================================
Select the OrangePI board you want to upgrade:
  1   OrangePI 2
  2   OrangePI PLUS
  3   OrangePI PC
?  3
Updating OrangePI PC

===============================
Select hdmi display resolution:
  1   1080p 60Hz
  2   1080p 50Hz
  3    720p 60Hz
  4    720p 50Hz
?  1

Selected 1080p 60Hz

=====================================
Do you have HDMI->DVI adapter, (y/N)?  N
HDMI interface selected

================
CONTINUE, (y/N)?  y

kernel, script.bin and /lib/modules updated, please REBOOT.
AFTER REBOOT RUN:  sudo depmod -a
===========================================================

[root@opi 14:29:35 src]# 

 

・video 関連が新規追加されたようです。

[root@opi 14:30:04 src]# ll /boot/
total 24220
-rwxr-xr-x 1 root root    32768 Dec 19 14:27 boot0_OPI.fex
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_1080p50_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_1080p50_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_1080p60_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_1080p60_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_480p_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_480p_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_720p50_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_720p50_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_720p60_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_720p60_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_1080p50_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_1080p50_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_1080p60_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_1080p60_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_480p_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_480p_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_720p50_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_720p50_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_720p60_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_720p60_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_1080p50_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_1080p50_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_1080p60_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_1080p60_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_480p_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_480p_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_720p50_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_720p50_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_720p60_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_720p60_hdmi
-rw-r--r-- 1 root root   901120 Dec 19 14:27 u-boot_OPI-emmc.fex
-rw-r--r-- 1 root root   901120 Dec 19 14:27 u-boot_OPI.fex
-rw-r--r-- 1 root root 10917600 Dec 19 14:27 uImage_OPI-2
-rw-r--r-- 1 root root 10917592 Dec 19 14:27 uImage_OPI-PLUS
[root@opi 14:30:08 src]# 
[root@opi 14:30:09 src]# ll /media/boot/
total 21392
-rwxr-xr-x 1 root root    35812 Dec 19 14:29 script.bin
-rwxr-xr-x 1 root root    35724 Dec 19 14:29 script.bin.bak
-rwxr-xr-x 1 root root 10917600 Dec 19 14:29 uImage
-rwxr-xr-x 1 root root 10915616 Dec 19 14:29 uImage.bak
[root@opi 14:30:14 src]# 

[root@opi 15:35:40 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | grep gpio
diff: 3.4.39/build: No such file or directory
diff: 3.4.39-01-lobo/build: No such file or directory
Files 3.4.39/kernel/drivers/gpio/gpio-sunxi.ko and 3.4.39-01-lobo/kernel/drivers/gpio/gpio-sunxi.ko differ
Files 3.4.39/kernel/drivers/w1/masters/w1-gpio.ko and 3.4.39-01-lobo/kernel/drivers/w1/masters/w1-gpio.ko differ
diff: 3.4.39/source: No such file or directory
diff: 3.4.39-01-lobo/source: No such file or directory
[root@opi 15:35:45 modules]# 

[root@opi 15:31:41 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | wc -l
diff: 3.4.39/build: No such file or directory
diff: 3.4.39-01-lobo/build: No such file or directory
diff: 3.4.39/source: No such file or directory
diff: 3.4.39-01-lobo/source: No such file or directory
197
[root@opi 15:31:54 modules]# 


[root@opi 15:45:18 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | grep 'Only in'
::
Only in 3.4.39-01-lobo/kernel/drivers/input: serio
Only in 3.4.39-01-lobo/kernel/drivers/input: touchscreen
Only in 3.4.39-01-lobo/kernel/drivers/media: dvb
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gl860
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_benq.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_conex.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_cpia1.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_etoms.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_finepix.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_jeilinj.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_jl2005bcd.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_kinect.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_konica.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_mars.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_mr97310a.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_nw80x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov519.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov534.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov534_9.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac207.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac7302.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac7311.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_se401.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sn9c2028.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sn9c20x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sonixb.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sonixj.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca1528.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca500.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca501.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca505.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca506.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca508.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca561.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq905.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq905c.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq930x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_stk014.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_stv0680.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sunplus.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_t613.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_topro.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_tv8532.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_vc032x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_vicam.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_xirlink_cit.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_zc3xx.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: m5602
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: stv06xx
diff: 3.4.39/sourceOnly in 3.4.39-01-lobo/kernel/drivers/media/video: tveeprom.ko
: No such file or directory
Only in 3.4.39-01-lobo/kernel/drivers: misc
diff: Only in 3.4.39-01-lobo/kernel/drivers/net/wireless: rtl818x
3.4.39-01-lobo/sourceOnly in 3.4.39-01-lobo/kernel/drivers/net/wireless: zd1201.ko
: No such file or directory
Only in 3.4.39-01-lobo/kernel/drivers/net/wireless: zd1211rw
Only in 3.4.39-01-lobo/kernel/net: 802
Only in 3.4.39-01-lobo/kernel/net: bridge
Only in 3.4.39-01-lobo/kernel/net: llc
[root@opi 15:45:24 modules]# 

 

・gpio_sunxi がロード

[root@opi 14:32:15 ~]# sudo depmod -a

[root@opi 14:36:36 ~]# uname -a
Linux OrangePi 3.4.39-01-lobo #1 SMP PREEMPT Sun Oct 25 14:46:41 CET 2015 armv7l armv7l armv7l GNU/Linux

[root@opi 14:33:14 ~]# ls /sys/class/gpio_sw/
ls: cannot access /sys/class/gpio_sw/: No such file or directory
[root@opi 14:33:16 ~]# 

[root@opi 14:33:17 ~]# modprobe gpio_sunxi
[root@opi 14:33:34 ~]# 
[root@opi 14:33:35 ~]# lsmod
Module                  Size  Used by
gpio_sunxi              8233  0
8189es                901572  0
[root@opi 14:33:43 ~]# 
[root@opi 14:34:04 ~]# ls /sys/class/gpio_sw/
PA10  PA13  PA14  PA15  PA21  PA3  PA6  PA7  PA8  PA9  PC3  PC4  PC7  PD14  PG6  PG7  PG8  PG9  PL10  normal_led  standby_led
[root@opi 14:34:05 ~]# 

・基板上の電源LED の隣の緑LED が点灯、消灯

[root@opi 14:34:58 ~]# echo 1 > /sys/class/gpio_sw/standby_led/data
[root@opi 14:35:13 ~]# echo 0 > /sys/class/gpio_sw/standby_led/data

・WiringOP を入れる準備。c関連を面倒なのでグループインストール

[root@opi 14:41:48 WiringOP]# dnf group list
Last metadata expiration check performed 1:47:22 ago on Sat Dec 19 12:56:05 2015.
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Available groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries★
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Fedora Eclipse
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   Robotics
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers
[root@opi 14:43:30 WiringOP]# dnf group install "C Development Tools and Libraries"

 

・WiringOP ビルド

[root@opi 14:50:36 WiringOP]# ./build 
wiringPi Build script
=====================


WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] softServo.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
gpio.c:801:13: warning: 'doPadDrive' defined but not used [-Wunused-function]
 static void doPadDrive (int argc, char *argv [])
             ^
gpio.c:889:13: warning: 'doGbw' defined but not used [-Wunused-function]
 static void doGbw (int argc, char *argv [])
             ^
gpio.c:931:13: warning: 'doGbr' defined but not used [-Wunused-function]
 static void doGbr (int argc, char *argv [])
             ^
[Compile] extensions.c
[Compile] readall.c
[Compile] pins.c
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringBP v2, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

[root@opi 14:50:59 WiringOP]# 

 

・テストソース

[root@opi 14:54:54 gpio]# cat blink.c 
#include <wiringPi.h>

// Define GPIO Pin number wPi
#define LED 16
// delay 1 = 2msec
#define MSEC 500
// blink count 100 = 1sec
#define LOOP 100

// Main function
int main(void) {
        int i;

        // Initialize WiringPi
        wiringPiSetup ();

        // Set GPIO pin to output mode
        pinMode(LED, OUTPUT);

        // Repeat LED blinking 10 times
        for(i=0; i<LOOP; i++){
                digitalWrite(LED, LOW);
                delay(MSEC);
                digitalWrite(LED, HIGH);
                delay(MSEC);
        }

        // Turn off LED
        digitalWrite(LED, LOW);

        return 0;
}

 

・ビルド、実行

[root@opi 14:55:01 gpio]# gcc -o blink blink.c -lwiringPi -lpthread
[root@opi 14:55:26 gpio]# 
[root@opi 14:55:27 gpio]# ll
total 12
-rwxr-xr-x 1 root root 6592 Dec 19 14:55 blink
-rw-r--r-- 1 root root  624 Dec 19 14:54 blink.c
[root@opi 14:55:30 gpio]# ./blink 
^C
[root@opi 14:55:53 gpio]# 

[root@opi 14:56:19 gpio]# gpio readall
 +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 |   2 |  -1 |    SDA.0 |      |   |  3 || 4  |   |      | 5V       |     |     |
 |   3 |  -1 |    SCL.0 |      |   |  5 || 6  |   |      | 0v       |     |     |
 |   4 |   6 | IO6 PA06 |  OUT | 0 |  7 || 8  |   |      | TxD3     |     |     |
 |     |     |       0v |      |   |  9 || 10 |   |      | RxD3     |     |     |
 |  17 |  -1 |     RxD2 |      |   | 11 || 12 | 0 | OUT  | IO1 PD14 | 1   | 18  |
 |  27 |  -1 |     TxD2 |      |   | 13 || 14 |   |      | 0v       |     |     |
 |  22 |  -1 |     CTS2 |      |   | 15 || 16 | 0 | OUT  | IO4 PC04 | 4   | 23  |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OUT  | IO5 PC07 | 5   | 24  |
 |  10 |  -1 |     MOSI |      |   | 19 || 20 |   |      | 0v       |     |     |
 |   9 |  -1 |     MISO |      |   | 21 || 22 |   |      | RTS2     |     |     |
 |  11 |  -1 |     SCLK |      |   | 23 || 24 |   |      | SPI-CE0  |     |     |
 |     |     |       0v |      |   | 25 || 26 |   |      | CE1      |     |     |
 |   0 |  -1 |    SDA.1 |      |   | 27 || 28 |   |      | SCL.1    |     |     |
 |   5 |   7 |  IO7 PA7 |  OUT | 0 | 29 || 30 |   |      | 0v       |     |     |
 |   6 |   8 |  IO8 PA8 |  OUT | 0 | 31 || 32 | 0 | OUT  | IO9 PG08 | 9   | 12  |
 |  13 |  10 | IO10 PA9 |  OUT | 0 | 33 || 34 |   |      | 0v       |     |     |
 |  19 |  12 | IO12PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | IO13PG09 | 13  | 16  |
 |  26 |  14 | IO14PA20 | ALT3 | 0 | 37 || 38 | 0 | OUT  | IO15PG06 | 15  | 20  |
 |     |     |       0v |      |   | 39 || 40 | 0 | OUT  | IO16PG07 | 16  | 21  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+
[root@opi 14:56:27 gpio]#