728x90

출처

Python 3.7.9 설치

기존에 설치 되어 있는 Python 삭제

pi@NanoPi-NEO2-Black:~$ sudo apt remove python3 python3.6 python3.6-minimal python3.6-dev python3-pip 
pi@NanoPi-NEO2-Black:~$ sudo apt autoremove

Python을 설치하기 전에 Python을 빌드하는 데 필요한 필수 패키지를 설치

pi@NanoPi-NEO2-Black:~$ sudo apt update 
pi@NanoPi-NEO2-Black:~$ sudo apt install -y --no-install-recommends libbluetooth-dev tk-dev uuid-dev wget ca-certificates gnupg2 dirmngr gcc build-essential wget zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev

Python 소스 다운로드

pi@NanoPi-NEO2-Black:~$ PYTHON_VERSION=3.7.9
pi@NanoPi-NEO2-Black:~$ wget "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"

Python 빌드

pi@NanoPi-NEO2-Black:~$ tar -xvf Python-$PYTHON_VERSION.tar.xz
pi@NanoPi-NEO2-Black:~$ cd Python-$PYTHON_VERSION/
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo ./configure --enable-loadable-sqlite-extensions \
  --enable-optimizations \
  --enable-option-checking=fatal \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --without-ensurepip
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo make -j 2 PROFILE_TASK='-m test.regrtest --pgo \
  test_array test_base64 test_binascii test_binhex test_binop test_bytes test_c_locale_coercion \
  test_class test_cmath test_codecs test_compile test_complex test_csv test_decimal test_dict \
  test_float test_fstring test_hashlib test_io test_iter test_json test_long test_math test_memoryview \
  test_pickle test_re test_set test_slice test_struct test_threading test_time test_traceback test_unicode'
 
... 생략 ...
 
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _lzma                 _sqlite3           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
 
 
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           
 
running build_scripts
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/pyvenv -> build/scripts-3.7
changing mode of build/scripts-3.7/pydoc3 from 644 to 755
changing mode of build/scripts-3.7/idle3 from 644 to 755
changing mode of build/scripts-3.7/2to3 from 644 to 755
changing mode of build/scripts-3.7/pyvenv from 644 to 755
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
make[1]: Leaving directory '/home/pi/Python-3.7.9'

Python 3.7.9 설치

pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo make install 
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo ldconfig 
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo find /usr/local -depth \
  \( \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
  -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \) -exec rm -rf '{}' +
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ echo 'export PATH=$PATH:/usr/local/sbin' >> ~/.bashrc
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ source ~/.bashrc

pip 설치

pi@NanoPi-NEO2-Black:~/Python-3.7.9$ cd ~
pi@NanoPi-NEO2-Black:~$ wget -O get-pip.py "https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py" 
pi@NanoPi-NEO2-Black:~$ sudo python3 get-pip.py --disable-pip-version-check --no-cache-dir "pip==20.0.2"

설치 확인

pi@NanoPi-NEO2-Black:~$ python3 --version 
Python 3.7.9
pi@NanoPi-NEO2-Black:~$ pip3 --version 
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
728x90
728x90

출처

Docker 설치

pi@NanoPi-M4v2:~$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/containerd.io_1.2.6-3_arm64.deb
pi@NanoPi-M4v2:~$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce-cli_19.03.2~3-0~ubuntu-bionic_arm64.deb
pi@NanoPi-M4v2:~$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce_19.03.2~3-0~ubuntu-bionic_arm64.deb
pi@NanoPi-M4v2:~$ sudo dpkg -i containerd.io_1.2.6-3_arm64.deb
Selecting previously unselected package containerd.io.
(Reading database ... 155441 files and directories currently installed.)
Preparing to unpack containerd.io_1.2.6-3_arm64.deb ...
Unpacking containerd.io (1.2.6-3) ...
Setting up containerd.io (1.2.6-3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
pi@NanoPi-M4v2:~$ sudo dpkg -i docker-ce-cli_19.03.2~3-0~ubuntu-bionic_arm64.deb
pi@NanoPi-M4v2:~$ sudo dpkg -i docker-ce_19.03.2~3-0~ubuntu-bionic_arm64.deb
Selecting previously unselected package docker-ce.
(Reading database ... 155656 files and directories currently installed.)
Preparing to unpack docker-ce_19.03.2~3-0~ubuntu-bionic_arm64.deb ...
Unpacking docker-ce (5:19.03.2~3-0~ubuntu-bionic) ...
Setting up docker-ce (5:19.03.2~3-0~ubuntu-bionic) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for systemd (237-3ubuntu10.52) ...

Test Docker installation

pi@NanoPi-M4v2:~$ git clone https://github.com/friendlyarm/debian-jessie-arm-docker
pi@NanoPi-M4v2:~/debian-jessie-arm-docker$ sudo ./rebuild-image.sh

Sending build context to Docker daemon  3.072kB
Step 1/6 : FROM armhf/debian
Step 2/6 : COPY ./sources.list /etc/apt/sources.list
Step 3/6 : RUN apt-get update
Step 4/6 : RUN echo "root:fa" | chpasswd
Step 5/6 : USER root
Step 6/6 : RUN echo "all done."
pi@NanoPi-M4v2:~/debian-jessie-arm-docker$ sudo ./run.sh
root@6bd5e8aec566:/# ls
bin  boot  dev  etc  home  lib  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@6bd5e8aec566:/usr# exit
exit
pi@NanoPi-M4v2:~/debian-jessie-arm-docker$ 
728x90
728x90

출처

임시 디렉토리 생성

GStreamer HLS 관련 임시 파일 생성을 위한 디렉토리 생성합니다.

pi@NanoPi-M4v2:~$ mkdir hlstest

GStreamer 실행

playlist-root 옵션은 playlist.m3u8 파일 내 호출 주소를 전달 하기 위해서 외부 플레이어에서 접근 가능한 주소를 설정하고, location 옵션은 hls 관련 파일이 생성될 임시 작업 폴더를 지정합니다.

pi@NanoPi-M4v2:~$ gst-launch-1.0 rkisp device=/dev/video1 io-mode=4 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 \
  ! videoconvert ! clockoverlay ! x264enc tune=zerolatency ! mpegtsmux \
  ! hlssink playlist-root=http://192.168.0.5:8080 location=/home/pi/hlstest/segment_%05d.ts target-duration=5 max-files=5
Setting pipeline to PAUSED ...
media get entity by name: lens is null
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR rkisp_control_loop_impl.cpp:99: failed to get camera module info
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
XCAM ERROR rkisp_device.cpp:72: atomisp device(/dev/video1) try subdev format failed
Redistribute latency...
 
(gst-launch-1.0:2254): GStreamer-CRITICAL **: 09:06:59.673: gst_object_unref: assertion 'object != NULL' failed

윕서버 실행

HLS는 웹 스트리밍 프로토콜로 웹서버를 통해서 스트리밍 관련 파일을 전달하는데 GStreamer는 웹서버 기능이 없어서 python으로 웹서버를 이용하게 됩니다. 웹서비스 root 디렉토리로 이동하고 간이 웹서버를 실행합니다.

pi@NanoPi-M4v2:~$ cd hlstest/
pi@NanoPi-M4v2:~/hlstest$ python --version
Python 2.7.17
pi@NanoPi-M4v2:~/hlstest$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...

hls 주소

http://192.168.0.5:8080/playlist.m3u8

hls 재생

임시 디렉토리 목록 조회

pi@NanoPi-M4v2:~/hlstest$ ls 
playlist.m3u8 segment_00180.ts segment_00181.ts segment_00182.ts segment_00183.ts segment_00184.ts
728x90
728x90

출처

NanoPi M4V2 : 카메라(ov13850)

이지미출처 : File:M4-mipi-single-camera.jpg - FriendlyARM WiKi

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ dmesg | grep ov13850
[    1.137232] ov13850 1-0010: driver version: 00.01.01
[    1.137688] ov13850 1-0010: could not get module information!
[    1.138295] ov13850 1-0010: GPIO lookup for consumer reset
[    1.138308] ov13850 1-0010: using device tree for GPIO lookup
[    1.138344] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.138380] ov13850 1-0010: GPIO lookup for consumer pwdn
[    1.138391] ov13850 1-0010: using device tree for GPIO lookup
[    1.138423] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.142534] ov13850 1-0010: Detected OV00d850 sensor, REVISION 0xb1
[    1.143438] ov13850 2-0010: driver version: 00.01.01
[    1.143893] ov13850 2-0010: could not get module information!
[    1.144472] ov13850 2-0010: GPIO lookup for consumer reset
[    1.144484] ov13850 2-0010: using device tree for GPIO lookup
[    1.144519] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.144556] ov13850 2-0010: GPIO lookup for consumer pwdn
[    1.144567] ov13850 2-0010: using device tree for GPIO lookup
[    1.144597] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.149264] ov13850 2-0010: Unexpected sensor id(000000), ret(-5)

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video0
Format Video Capture Multiplanar:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 1280
           Size Image     : 614400
pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video1
Format Video Capture Multiplanar:
        Width/Height      : 1920/1568
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 3840
           Size Image     : 6021120
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev0 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev1 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev2 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ media-ctl -d /dev/media0 -p
Media controller API version 0.1.0
 
Media device information
------------------------
driver          rkisp1
model           rkisp1
serial          
bus info        
hw revision     0x0
driver version  0.0.0
 
Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 6 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                <- "rkisp1_dmapath":0 []
                <- "rockchip-mipi-dphy-rx":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV8_2X8/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                -> "rkisp1_selfpath":0 [ENABLED]
                -> "rkisp1_mainpath":0 [ENABLED]
        pad3: Source
                -> "rkisp1-statistics":0 [ENABLED]
 
- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 4: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Source
                -> "rkisp1-isp-subdev":0 []
 
- entity 5: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]
 
- entity 6: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
        pad0: Source
                -> "rkisp1-isp-subdev":1 [ENABLED]
 
- entity 7: rockchip-mipi-dphy-rx (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                <- "ov13850 1-0010":0 [ENABLED]
        pad1: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]
 
- entity 8: ov13850 1-0010 (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rockchip-mipi-dphy-rx":0 [ENABLED]

카메라(ov13850) 연결 확인

pi@NanoPi-M4v2:~$ dmesg | grep Async
[    1.839621] rkisp1: Async subdev notifier completed

gst-camera 설치

pi@NanoPi-M4v2:~$ cd /tmp/
pi@NanoPi-M4v2:/tmp$ git clone https://github.com/friendlyarm/gst-camera-sh.git
Cloning into 'gst-camera-sh'...
remote: Enumerating objects: 36, done.
remote: Total 36 (delta 0), reused 0 (delta 0), pack-reused 36
Unpacking objects: 100% (36/36), done.
pi@NanoPi-M4v2:/tmp$ sudo cp gst-camera-sh/*.sh /usr/bin/

카메라(ov13850) 캡쳐

pi@NanoPi-M4v2:/tmp$ gst-camera.sh -a photo -o 1.jpg
gst-launch-1.0: no process found
====================================================
=== GStreamer 1.1 command:
=== gst-launch-1.0 rkisp num-buffers=20 device=/dev/video0 io-mode=1 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=10/1 ! jpegenc ! multifilesink location="/tmp/isp-frame%d.jpg"
====================================================
{{{{{{ start take photo
Setting pipeline to PAUSED ...
media get entity by name: lens is null
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR rkisp_control_loop_impl.cpp:99: failed to get camera module info
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
XCAM ERROR rkisp_device.cpp:72: atomisp device(/dev/video0) try subdev format failed
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.759673858
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
}}}}}} end take photo

Image sensors OV13850 & OV4689 at the i2c ports 1 & 2

pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: UU -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ ls -l /sys/class/video4linux/
total 0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev0 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev1 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev2 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev3 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev4 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video0 -> ../../devices/platform/ff910000.rkisp1/video4linux/video0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video1 -> ../../devices/platform/ff910000.rkisp1/video4linux/video1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video2 -> ../../devices/platform/ff910000.rkisp1/video4linux/video2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video3 -> ../../devices/platform/ff910000.rkisp1/video4linux/video3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video4 -> ../../devices/platform/ff910000.rkisp1/video4linux/video4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video5 -> ../../devices/platform/ff920000.rkisp1/video4linux/video5
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video6 -> ../../devices/platform/ff920000.rkisp1/video4linux/video6
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video7 -> ../../devices/platform/ff920000.rkisp1/video4linux/video7
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video8 -> ../../devices/platform/ff920000.rkisp1/video4linux/video8
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video9 -> ../../devices/platform/ff920000.rkisp1/video4linux/video9

화이트 밸런스 조정 (실패)

pi@NanoPi-M4v2:~$ v4l2-ctl -d 1 --set-ctrl=white_balance_temperature_auto=1
unknown control 'white_balance_temperature_auto'
728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

pi@NanoPi-NEO2-Black:~$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4
 
 ... 생략 ...
 
Hardware        : Allwinnersun50iw2Family
Revision        : 0000
Serial          : 0000000000000000

instruction set architecture (ISA)

pi@NanoPi-NEO2-Black:~$ uname -i
aarch64

eMMC에 OS 설치

이미지 복원이 완료되면 SD 메모리를 제거하고 재부팅

eMMC 확인

pi@NanoPi-NEO2-Black:~$ sudo fdisk -l | grep Disk
Disk /dev/mmcblk0: 59.5 GiB, 63864569856 bytes, 124735488 sectors
Disklabel type: dos
Disk identifier: 0xd70475ff
Disk /dev/mmcblk1: 29.1 GiB, 31268536320 bytes, 61071360 sectors
Disk /dev/mmcblk1boot1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk1boot0: 4 MiB, 4194304 bytes, 8192 sectors

eMMC에 OS 설치

pi@NanoPi-NEO2-Black:~$ sudo dd if=nanopi-neo2-black_sd_friendlycore-xenial_4.14_arm64_20191219.img of=/dev/mmcblk1 bs=10MB
278+1 records in
278+1 records out
2787115008 bytes (2.8 GB, 2.6 GiB) copied, 123.871 s, 22.5 MB/s

원격 데스크톱 설치

desktop environment 설치

pi@NanoPi-NEO2-Black:~$ sudo apt install xfce4

Xrdp 설치

pi@NanoPi-NEO2-Black:~$ sudo apt install xrdp

xrdp 서비스 상태 확인

pi@NanoPi-NEO2-Black:~$ systemctl status xrdp
● xrdp.service - LSB: Start xrdp and sesman daemons
   Loaded: loaded (/etc/init.d/xrdp; bad; vendor preset: enabled)
   Active: active (running) since Fri 2021-01-15 16:59:06 UTC; 11s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/xrdp.service
           ├─15133 /usr/sbin/xrdp
           └─15135 /usr/sbin/xrdp-sesman

~/.xsession 생성 및 확인

pi@NanoPi-NEO2-Black:~$ ls /usr/bin/*session
/usr/bin/dbus-run-session  /usr/bin/xfce4-session
pi@NanoPi-NEO2-Black:~$ echo "xfce4-session" > ~/.xsession
pi@NanoPi-NEO2-Black:~$ cat ~/.xsession
xfce4-session

웹브라우저 설치

pi@NanoPi-NEO2-Black:~$ sudo apt install chromium-browser
728x90
728x90

출처

eMMC에 OS 설치

이미지 복원이 완료되면 SD 메모리를 제거하고 재부팅

eMMC 확인

pi@nanopim4v2:~$ fdisk -l | grep Disk
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/mmcblk2: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Disklabel type: gpt
Disk identifier: 73987B6B-4974-4C94-A3E8-58AB2EB7A946
Disk /dev/mmcblk1: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disklabel type: dos
Disk identifier: 0x75c728fe
Disk /dev/zram0: 50 MiB, 52428800 bytes, 12800 sectors
Disk /dev/zram1: 1.88 GiB, 1992282112 bytes, 486397 sectors

eMMC에 OS 설치

pi@nanopim4v2:~$ sudo dd if=Armbian_20.11.3_Nanopim4v2_focal_current_5.9.14_desktop.img of=/dev/mmcblk2 bs=10MB
368+1 records in
368+1 records out
3686793216 bytes (3.7 GB, 3.4 GiB) copied, 68.1611 s, 54.1 MB/s

원격 데스크톱 설치

Xrdp 설치

pi@nanopim4v2:~$ sudo apt install xrdp xorgxrdp

xrdp 서비스 상태 확인

pi@nanopim4v2:~$ sudo systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-01-04 00:48:08 KST; 24s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 9093 (xrdp)
      Tasks: 1 (limit: 4383)
     Memory: 712.0K
     CGroup: /system.slice/xrdp.service
             └─9093 /usr/sbin/xrdp
 
 1월 04 00:48:07 nanopim4v2 xrdp[9092]: (9092)(281473703223312)[INFO ] address [0.0.0.0] port [3389] mode 1
 1월 04 00:48:07 nanopim4v2 xrdp[9092]: (9092)(281473703223312)[INFO ] listening to port 3389 on 0.0.0.0
 1월 04 00:48:07 nanopim4v2 xrdp[9092]: (9092)(281473703223312)[INFO ] xrdp_listen_pp done
 1월 04 00:48:07 nanopim4v2 xrdp[9092]: (9092)(281473703223312)[DEBUG] Closed socket 7 (AF_INET6 :: port 338>
 1월 04 00:48:07 nanopim4v2 systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after st>
 1월 04 00:48:08 nanopim4v2 systemd[1]: Started xrdp daemon.
 1월 04 00:48:09 nanopim4v2 xrdp[9093]: (9093)(281473703223312)[INFO ] starting xrdp with pid 9093
 1월 04 00:48:09 nanopim4v2 xrdp[9093]: (9093)(281473703223312)[INFO ] address [0.0.0.0] port [3389] mode 1
 1월 04 00:48:09 nanopim4v2 xrdp[9093]: (9093)(281473703223312)[INFO ] listening to port 3389 on 0.0.0.0
 1월 04 00:48:09 nanopim4v2 xrdp[9093]: (9093)(281473703223312)[INFO ] xrdp_listen_pp done

~/.xsession 생성 및 확인

pi@nanopim4v2:~$ ls /usr/bin/*session
/usr/bin/dbus-run-session  /usr/bin/xfce4-session
pi@NanoPi-M4v2:~$ echo "xfce4-session" > ~/.xsession
pi@NanoPi-M4v2:~$ cat ~/.xsession
xfce4-session

한글폰트 설치

pi@orangepi4:~$ sudo apt install language-pack-ko fonts-nanum fonts-nanum-extra
728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4
 
 ... 생략 ...
 
Serial          : ca0a2ef4e6xxxxxx

instruction set architecture (ISA)

$ uname -i
aarch64

커널에 대한 정보

$ uname -a
Linux NanoPi-M4v2 4.4.179 #1 SMP Tue Mar 17 16:51:26 CST 2020 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

$ grep -c processor /proc/cpuinfo
6

메모리, swap 사이즈 확인

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           3.8G         76M        2.9G        8.8M        803M        3.6G
Swap:            0B          0B          0B

관련 라이브러리 설치, pip3 설치 확인

$ sudo apt update
$ sudo apt install gfortran libopenblas-dev liblapack-dev libhdf5-dev
$ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

파이썬 라이브러리 설치

$ sudo pip3 install setuptools wheel h5py

TensorFlow 2.2.0 패키지 설치

TensorFlow 2.2.0 패키지 다운로드

$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.2.0.aarch64/tensorflow-2.2.0-cp37-cp37m-linux_aarch64.whl

tensorflow 2.2.0 파이썬 페키지 설치

$ pip3 install tensorflow-2.2.0-cp37-cp37m-linux_aarch64.whl
 
Defaulting to user installation because normal site-packages is not writeable
Processing ./tensorflow-2.2.0-cp37-cp37m-linux_aarch64.whl
Requirement already satisfied: numpy<2.0,>=1.16.0 in /usr/local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.18.4)
Collecting protobuf>=3.8.0
  Downloading protobuf-3.11.3-py2.py3-none-any.whl (434 kB)
     |████████████████████████████████| 434 kB 223 kB/s 
Collecting grpcio>=1.8.6
  Downloading grpcio-1.28.1.tar.gz (19.5 MB)
     |████████████████████████████████| 19.5 MB 154 kB/s 
Collecting keras-preprocessing>=1.1.0
  Downloading Keras_Preprocessing-1.1.1-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 344 kB/s 
Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.14.0)
Collecting termcolor>=1.1.0
  Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Requirement already satisfied: h5py<2.11.0,>=2.10.0 in /usr/local/lib/python3.7/site-packages (from tensorflow==2.2.0) (2.10.0)
Collecting tensorboard<2.3.0,>=2.2.0
  Downloading tensorboard-2.2.1-py3-none-any.whl (3.0 MB)
     |████████████████████████████████| 3.0 MB 5.7 MB/s 
Collecting tensorflow-estimator<2.3.0,>=2.2.0
  Downloading tensorflow_estimator-2.2.0-py2.py3-none-any.whl (454 kB)
     |████████████████████████████████| 454 kB 6.2 MB/s 
Collecting wrapt>=1.11.1
  Downloading wrapt-1.12.1.tar.gz (27 kB)
Collecting scipy==1.4.1; python_version >= "3"
  Downloading scipy-1.4.1.tar.gz (24.6 MB)
     |████████████████████████████████| 24.6 MB 540 kB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting google-pasta>=0.1.8
  Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 2.3 MB/s 
Collecting opt-einsum>=2.3.2
  Downloading opt_einsum-3.2.1-py3-none-any.whl (63 kB)
     |████████████████████████████████| 63 kB 1.0 MB/s 
Collecting absl-py>=0.7.0
  Downloading absl-py-0.9.0.tar.gz (104 kB)
     |████████████████████████████████| 104 kB 7.4 MB/s 
Requirement already satisfied: wheel>=0.26; python_version >= "3" in /usr/local/lib/python3.7/site-packages (from tensorflow==2.2.0) (0.34.2)
Collecting gast==0.3.3
  Downloading gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Collecting astunparse==1.6.3
  Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from protobuf>=3.8.0->tensorflow==2.2.0) (46.2.0)
Collecting werkzeug>=0.11.15
  Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 6.4 MB/s 
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB)
Collecting markdown>=2.6.8
  Downloading Markdown-3.2.2-py3-none-any.whl (88 kB)
     |████████████████████████████████| 88 kB 3.1 MB/s 
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading tensorboard_plugin_wit-1.6.0.post3-py3-none-any.whl (777 kB)
     |████████████████████████████████| 777 kB 6.3 MB/s 
Collecting google-auth<2,>=1.6.3
  Downloading google_auth-1.14.3-py2.py3-none-any.whl (89 kB)
     |████████████████████████████████| 89 kB 3.2 MB/s 
Collecting requests<3,>=2.21.0
  Downloading requests-2.23.0-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 3.0 MB/s 
Collecting requests-oauthlib>=0.7.0
  Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata; python_version < "3.8"
  Downloading importlib_metadata-1.6.0-py2.py3-none-any.whl (30 kB)
Collecting pyasn1-modules>=0.2.1
  Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 7.6 MB/s 
Collecting cachetools<5.0,>=2.0.0
  Downloading cachetools-4.1.0-py3-none-any.whl (10 kB)
Collecting rsa<4.1,>=3.1.4
  Downloading rsa-4.0-py2.py3-none-any.whl (38 kB)
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 8.2 MB/s 
Collecting certifi>=2017.4.17
  Downloading certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
     |████████████████████████████████| 157 kB 7.9 MB/s 
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
     |████████████████████████████████| 126 kB 8.2 MB/s 
Collecting idna<3,>=2.5
  Downloading idna-2.9-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 2.6 MB/s 
Collecting oauthlib>=3.0.0
  Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 8.1 MB/s 
Collecting zipp>=0.5
  Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 2.4 MB/s 
Building wheels for collected packages: grpcio, termcolor, wrapt, scipy, absl-py
  Building wheel for grpcio (setup.py) ... 
  Created wheel for grpcio: filename=grpcio-1.28.1-cp37-cp37m-linux_aarch64.whl size=21720921 sha256=1c5d524edfe612fb392cb50ebacab9ec390e75cadf4113a2b8fce767d5b3c673
  Stored in directory: /home/pi/.cache/pip/wheels/1a/57/84/d91cbd4882f6ae0adc3acba56cbf0c2c75e0263118614d1fcf
  Building wheel for termcolor (setup.py) ... done
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=8b1f16963d32824d08c381271c4fe32337c5f127e36d4dd04e9e380ab1152e66
  Stored in directory: /home/pi/.cache/pip/wheels/3f/e3/ec/8a8336ff196023622fbcb36de0c5a5c218cbb24111d1d4c7f2
  Building wheel for wrapt (setup.py) ... done
  Created wheel for wrapt: filename=wrapt-1.12.1-cp37-cp37m-linux_aarch64.whl size=71545 sha256=f927060b151c53873a685a59f13015e5aaf6da67da4f741c02598f26bb308af0
  Stored in directory: /home/pi/.cache/pip/wheels/62/76/4c/aa25851149f3f6d9785f6c869387ad82b3fd37582fa8147ac6
  Building wheel for scipy (PEP 517) ... done
  Created wheel for scipy: filename=scipy-1.4.1-cp37-cp37m-linux_aarch64.whl size=45319976 sha256=e7af6941572f5cdea50661ee1134b471727bf6d4815695d2f3461af3930edcdc
  Stored in directory: /home/pi/.cache/pip/wheels/ff/bd/f9/ac5a9a019da5be2072e8a283f36d28b219762cebdd21ff3c68
  Building wheel for absl-py (setup.py) ... done
  Created wheel for absl-py: filename=absl_py-0.9.0-py3-none-any.whl size=121931 sha256=72ad0ed75f329456194bb9d3dce7390916534f26b08a15c81c480904644fd4ba
  Stored in directory: /home/pi/.cache/pip/wheels/cc/af/1a/498a24d0730ef484019e007bb9e8cef3ac00311a672c049a3e
Successfully built grpcio termcolor wrapt scipy absl-py
Installing collected packages: protobuf, grpcio, keras-preprocessing, termcolor, werkzeug, chardet, certifi, urllib3, idna, requests, oauthlib, requests-oauthlib, pyasn1, pyasn1-modules, cachetools, rsa, google-auth, google-auth-oauthlib, absl-py, zipp, importlib-metadata, markdown, tensorboard-plugin-wit, tensorboard, tensorflow-estimator, wrapt, scipy, google-pasta, opt-einsum, gast, astunparse, tensorflow
  WARNING: The script chardetect is installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script google-oauthlib-tool is installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script markdown_py is installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tensorboard is installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts estimator_ckpt_converter, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed absl-py-0.9.0 astunparse-1.6.3 cachetools-4.1.0 certifi-2020.4.5.1 chardet-3.0.4 gast-0.3.3 google-auth-1.14.3 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.28.1 idna-2.9 importlib-metadata-1.6.0 keras-preprocessing-1.1.1 markdown-3.2.2 oauthlib-3.1.0 opt-einsum-3.2.1 protobuf-3.11.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.23.0 requests-oauthlib-1.3.0 rsa-4.0 scipy-1.4.1 tensorboard-2.2.1 tensorboard-plugin-wit-1.6.0.post3 tensorflow-2.2.0 tensorflow-estimator-2.2.0 termcolor-1.1.0 urllib3-1.25.9 werkzeug-1.0.1 wrapt-1.12.1 zipp-3.1.0
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.

버전 확인

$ python3
Python 3.7.7 (default, May 12 2020, 15:55:46) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.2.0'
728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4
 
 ... 생략 ...
 
Serial          : ca0a2ef4e6xxxxxx

instruction set architecture (ISA)

$ uname -i
aarch64

커널에 대한 정보

$ uname -a
Linux NanoPi-M4v2 4.4.179 #1 SMP Tue Mar 17 16:51:26 CST 2020 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

$ grep -c processor /proc/cpuinfo
6

메모리, swap 사이즈 확인

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           3.8G         76M        2.9G        8.8M        803M        3.6G
Swap:            0B          0B          0B

TensorFlow C, C++ 라이브러리 설치

TensorFlow 라이브러리 다운로드

$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.2.0.aarch64/libtensorflow.tar.gz

TensorFlow 라이브러리 설치

$ sudo tar -C /usr/local -xzf libtensorflow.tar.gz

Linker 설정

$ sudo ldconfig

예제 hello.c

#include <stdio.h>
#include <tensorflow/c/c_api.h>

int main() {
  printf("TensorFlow C library version %s\n", TF_Version());
  return 0;
}

예제 컴파일

$ gcc hello.c -ltensorflow -o hello

예제 실행

$ ./hello
TensorFlow C library version 2.2.0
728x90

+ Recent posts