728x90

출처

CPU

Amlogic S905X3 quad core Cortex-A55 (2.0xxGHz)

eMMC

X
user@localhost:~

pi@bananapi:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0          7:0    0 48.8M  1 loop /snap/core18/1936
loop1          7:8    0   27M  1 loop /snap/snapd/10494
loop2          7:16   0 15.2M  1 loop /snap/ubuntu-mate-welcome/627
loop3          7:24   0   16K  1 loop /snap/software-boutique/56
loop4          7:32   0    8K  1 loop /snap/ubuntu-mate-pi/11
loop5          7:40   0 14.9M  1 loop /snap/ubuntu-mate-welcome/578
loop6          7:48   0 27.9M  1 loop /snap/snapd/11843
loop7          7:56   0 48.9M  1 loop /snap/core18/2068
mmcblk0      179:0    0 14.6G  0 disk 
mmcblk0boot0 179:32   0    4M  0 disk 
mmcblk0boot1 179:64   0    4M  0 disk 
mmcblk0rpmb  179:96   0    4M  0 disk 
mmcblk1      179:128  0 14.9G  0 disk 
├─mmcblk1p1  179:129  0  256M  0 part /boot
└─mmcblk1p2  179:130  0  6.8G  0 part /

SM 확장

디스크 확인

X
user@localhost:~

pi@bananapi:~$ sudo fdisk -l | grep '^Disk'
Disk /dev/loop0: 48.85 MiB, 51200000 bytes, 100000 sectors
Disk /dev/loop1: 26.10 MiB, 28286976 bytes, 55248 sectors
Disk /dev/loop2: 15.17 MiB, 15900672 bytes, 31056 sectors
Disk /dev/loop3: 16 KiB, 16384 bytes, 32 sectors
Disk /dev/loop4: 8 KiB, 8192 bytes, 16 sectors
Disk /dev/loop5: 14.87 MiB, 15572992 bytes, 30416 sectors
Disk /dev/loop6: 27.9 MiB, 29237248 bytes, 57104 sectors
Disk /dev/loop7: 48.9 MiB, 51257344 bytes, 100112 sectors
Disk /dev/mmcblk0: 14.57 GiB, 15634268160 bytes, 30535680 sectors
Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk1: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disklabel type: dos
Disk identifier: 0x5e283d7d

기존 파티션을 삭제하고 새로 파티션 생성

X
user@localhost:~

pi@bananapi:~$ sudo fdisk /dev/mmcblk1
 
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): p
Disk /dev/mmcblk1: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5e283d7d
 
Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1      204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      729088 14940159 14211072  6.8G 83 Linux
 
Command (m for help): d
Partition number (1,2, default 2): 2
 
Partition 2 has been deleted.
 
Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-31116287, default 2048): 729088
Last sector, +/-sectors or +/-size{K,M,G,T,P} (729088-31116287, default 31116287): 
 
Created a new partition 2 of type 'Linux' and of size 14.5 GiB.
Partition #2 contains a ext4 signature.
 
Do you want to remove the signature? [Y]es/[N]o: Y
 
The signature will be removed by a write command.
 
Command (m for help): w
The partition table has been altered.
Syncing disks.
 
pi@bananapi:~$ sudo shutdown -r now

bpi-tool 설치

X
user@localhost:~

pi@bananapi:~$ sudo apt-get install pv
pi@bananapi:~$ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
 
bpi files:
/usr/bin/bpi-tools      v1.3.1(github)
/usr/bin/bpi-bootsel    v1.3.4(github)
/usr/bin/bpi-copy       v1.3.4(github)
/usr/bin/bpi-get        v1.3.7b(github)
/usr/bin/bpi-migrate    v1.3.11(github)
/usr/bin/bpi-hw v1.3.3(github)
/usr/bin/bpi-update     v1.3.8(github)

eMMC에 OS 설치

X
user@localhost:~

pi@bananapi:~$ sudo bpi-copy 2021-01-21-ubuntu-20.04-mate-desktop-bpi-m5-aarch64-sd-emmc.img.zip /dev/mmcblk0
SRC=2021-01-21-ubuntu-20.04-mate-desktop-bpi-m5-aarch64-sd-emmc.img.zip
DST=/dev/mmcblk0
COPYMODE=imagetodisk
imagetodisk
bpi-copy(v1.3.4(github)), bananapi image & disk tools
 
Usage: bpi-copy [OPTIONS]...
       bpi-copy [ --help | -v | --version ]
       bpi-copy IMGFILE
       bpi-copy IMGDIR
       bpi-copy IMGFILE DEVICE
       bpi-copy DEVICE IMGFILE
 
Warning: Try to write 2021-01-21-ubuntu-20.04-mate-desktop-bpi-m5-aarch64-sd-emmc.img.zip to BOOTDISK /dev/mmcblk0
==============================================================
Sat 12 Jun 2021 06:01:17 PM IST
*** start COPY (blue led on ) .....
INFO: /dev/mmcblk0 : SD/eMMC !!
umount device: /dev/mmcblk0
==============================================================
IMGFILE=2021-01-21-ubuntu-20.04-mate-desktop-bpi-m5-aarch64-sd-emmc.img.zip
==============================================================
zip
7.12GiB 0:02:12 [55.0MiB/s] [                                                          <=>                              ]
0+113169 records in
0+113169 records out
***  end  COPY (blue led off) .....
Sat 12 Jun 2021 06:03:35 PM IST
==============================================================
RUNTIME 2:18
OK!! You can remove the BOOTDISK /dev/mmcblk0 now!!

WiringPi

X
user@localhost:~

pi@bananapi:~$ git clone https://github.com/BPI-SINOVOIP/amlogic-wiringPi
pi@bananapi:~$ cd amlogic-wiringPi
pi@bananapi:~/amlogic-wiringPi$ chmod a+x build
pi@bananapi:~/amlogic-wiringPi$ sudo ./build

WiringPi 핀 배열

X
user@localhost:~

pi@bananapi:~/amlogic-wiringPi$ gpio readall
 +-----+-----+---------+------+---+--- M5 ---+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3V |      |   |  1 || 2  |   |      | 5V      |     |     |
 | 493 |   8 |   SDA.2 | ALT1 | 1 |  3 || 4  |   |      | 5V      |     |     |
 | 494 |   9 |   SCL.2 | ALT1 | 1 |  5 || 6  |   |      | 0V      |     |     |
 | 481 |   7 |  IO.481 |   IN | 1 |  7 || 8  | 1 | ALT1 | TxD1    | 15  | 488 |
 |     |     |      0V |      |   |  9 || 10 | 1 | ALT1 | RxD1    | 16  | 489 |
 | 479 |   0 |  IO.479 |   IN | 1 | 11 || 12 | 1 | IN   | IO.504  | 1   | 504 |
 | 480 |   2 |  IO.480 |   IN | 1 | 13 || 14 |   |      | 0V      |     |     |
 | 483 |   3 |  IO.483 |   IN | 1 | 15 || 16 | 1 | IN   | IO.476  | 4   | 476 |
 |     |     |    3.3V |      |   | 17 || 18 | 1 | IN   | IO.477  | 5   | 477 |
 | 484 |  12 |    MOSI | ALT4 | 1 | 19 || 20 |   |      | 0V      |     |     |
 | 485 |  13 |    MISO | ALT4 | 1 | 21 || 22 | 1 | IN   | IO.478  | 6   | 478 |
 | 487 |  14 |    SLCK | ALT4 | 1 | 23 || 24 | 1 | OUT  | SS      | 10  | 486 |
 |     |     |      0V |      |   | 25 || 26 | 1 | IN   | IO.492  | 11  | 492 |
 | 474 |  30 |   SDA.3 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.3   | 31  | 475 |
 | 490 |  21 |  IO.490 |   IN | 1 | 29 || 30 |   |      | 0V      |     |     |
 | 491 |  22 |  IO.491 |   IN | 1 | 31 || 32 | 0 | IN   | IO.495  | 26  | 495 |
 | 482 |  23 |  IO.482 |   IN | 0 | 33 || 34 |   |      | 0V      |     |     |
 | 503 |  24 |  IO.503 |   IN | 1 | 35 || 36 | 0 | IN   | IO.432  | 27  | 432 |
 | 505 |  25 |  IO.505 |   IN | 0 | 37 || 38 | 1 | ALT4 | IO.506  | 28  | 506 |
 |     |     |      0V |      |   | 39 || 40 | 0 | IN   | IO.500  | 29  | 500 |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+--- M5 ---+---+------+---------+-----+-----+

728x90
728x90

출처

openssl 라이브러리 소스 다운로드

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ wget http://www.openssl.org/source/openssl-1.1.1g.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf openssl-1.1.1g.tar.gz

PCRE 라이브러리 설치

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ wget https://acc.dl.osdn.jp/sfnet/p/pc/pcre/pcre/8.32/pcre-8.32.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf pcre-8.32.tar.gz
pi@bpi-iot-ros-ai:~$ cd pcre-8.32/
pi@bpi-iot-ros-ai:~/pcre-8.32$ ./configure --prefix=/usr/local
pi@bpi-iot-ros-ai:~/pcre-8.32$ make
pi@bpi-iot-ros-ai:~/pcre-8.32$ sudo make install

zip 라이브러리 설치

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ wget https://zlib.net/fossils/zlib-1.2.8.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf zlib-1.2.8.tar.gz
pi@bpi-iot-ros-ai:~$ cd zlib-1.2.8/
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ ./configure --prefix=/usr/localmake
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ make -j4
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ sudo make install

nginx 설치

nginx-vod-module 소스 다운로드

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ git clone https://github.com/kaltura/nginx-vod-module.git

nginx 소스 다운로드

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ wget http://nginx.org/download/nginx-1.19.7.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf nginx-1.19.7.tar.gz
pi@bpi-iot-ros-ai:~$ cd nginx-1.19.7/

빌드 환경 설정 - configure

  • --add-module=../nginx-vod-module : 스트리밍 관련 라이브러리 추가
  • --pid-path : pid 파일 생성 기본 경로 / 해당 옵션이 없는 경우 nginx.conf에서 설정 가능
X
user@localhost:~

pi@bpi-iot-ros-ai:~/nginx-1.19.7$ ./configure \
  --add-module=../nginx-vod-module \
  --prefix=/usr/local/nginx \
  --conf-path=/usr/local/nginx/conf/nginx.conf \
  --error-log-path=/usr/local/nginx/logs/error.log \
  --http-log-path=/usr/local/nginx/logs/access.log \
  --user=nginx \
  --group=nginx \
  --lock-path=/usr/local/nginx/system/nginx.lock \
  --pid-path=/usr/local/nginx/system/nginx.pid \
  --without-http_autoindex_module \
  --without-http_ssi_module \
  --with-file-aio \
  --with-http_ssl_module \
  --with-openssl=../openssl-1.1.1g \
  --with-openssl-opt=enable-weak-ssl-ciphers \
  --with-http_gunzip_module \
  --with-http_gzip_static_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module \
  --with-http_auth_request_module \
  --with-http_addition_module \
  --with-http_realip_module \
  --with-http_stub_status_module \
  --with-threads --with-stream \
  --with-stream_ssl_module \
  --with-http_v2_module \
  --http-client-body-temp-path=/var/cache/nginx/client_body_temp \
  --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
  --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
  --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
  --http-scgi-temp-path=/var/cache/nginx/scgi_temp

빌드

X
user@localhost:~

pi@bpi-iot-ros-ai:~/nginx-1.19.7$ make -j4

설치

X
user@localhost:~

pi@bpi-iot-ros-ai:~/nginx-1.19.7$ sudo make install
make -f objs/Makefile install
make[1]: Entering directory '/home/pi/nginx-1.19.7'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
cp conf/fastcgi_params \
        '/usr/local/nginx/conf/fastcgi_params.default'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
cp conf/uwsgi_params \
        '/usr/local/nginx/conf/uwsgi_params.default'
cp conf/scgi_params \
        '/usr/local/nginx/conf/scgi_params.default'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/system' \
        || mkdir -p '/usr/local/nginx/system'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
        || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory '/home/pi/nginx-1.19.7'

nginx 계정 추가

error.log에 해당 오류 발견시 계정 추가 필요 nginx: [emerg] getpwnam("nginx") failed

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo groupadd nginx
pi@bpi-iot-ros-ai:~$ sudo useradd -g nginx -s /bin/bash -m nginx

nginx 서비스 등록

nginx.service 파일 생성

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo vi /etc/systemd/system/nginx.service

 

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/system/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

nginx.service 서비스 등록

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo systemctl enable nginx.service
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /etc/systemd/system/nginx.service.

nginx.service 서비스 시작

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo systemctl start nginx.service

nginx.service 서비스 상태확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo systemctl status nginx.service

nginx 스트리밍 관련 환경 설정

nginx.conf 수정

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo vi /usr/local/nginx/conf/nginx.conf

 

    server {
        listen       80;
        server_name  localhost;

        # vod settings
        vod_mode local;
        vod_fallback_upstream_location /fallback;
        vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
        vod_last_modified_types *;
        vod_metadata_cache metadata_cache 512m;
        vod_response_cache response_cache 128m;
        gzip on;
        gzip_types application/vnd.apple.mpegurl;

        vod_segment_duration 1000;

        open_file_cache          max=1000 inactive=5m;
        open_file_cache_valid    2m;
        open_file_cache_min_uses 1;
        open_file_cache_errors   on;
        aio on;
        location /content/ {
                root /media_content/;
                vod hls;
                add_header Access-Control-Allow-Headers '*';
                add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
                add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
                add_header Access-Control-Allow-Origin '*';
                expires 100d;
        }

nginx.service 서비스 재시작

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo systemctl restart nginx.service

동영상 파일 복사

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo mkdir -p /media_content/content
pi@bpi-iot-ros-ai:~$ cd /media_content/content
pi@bpi-iot-ros-ai:/media_content/content$ wget https://www.radiantmediaplayer.com/media/big-buck-bunny-360p.mp4

동영상 구현 (hls.js)

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ cd /usr/local/nginx/html
pi@bpi-iot-ros-ai:/usr/local/nginx/html$ sudo vi player.htm

 

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" controls></video>
<script>
  if(Hls.isSupported()) {
    var video = document.getElementById('video');
    var hls = new Hls();
    hls.loadSource('http://192.168.0.87/content/big-buck-bunny-360p.mp4/index.m3u8');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      // video.play();
    });
  }
</script>

확인

728x90
728x90

출처

BPI-M4의 경우 전용 카메라, 모니터를 사용할 수 있는 확장 슬롯이 없고 기본 eMMC가 용량이 작아서 아쉬웠는데 M.2 E-Key로 SD 메모리를 확장 할 수 있어서 소개합니다.

SD 메모리 장착 전, 후
확장보드 장착 전, 후

리눅스 정보 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ uname -a
Linux bpi-iot-ros-ai 4.9.119-BPI-M4-Kernel #1 SMP PREEMPT Mon May 18 10:41:36 HKT 2020 aarch64 aarch64 aarch64 GNU/Linux

리눅스 배포판 버전 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ grep . /etc/*-release
/etc/armbian-image-release:# PLEASE DO NOT EDIT THIS FILE
/etc/armbian-image-release:BOARD=bananapim64
/etc/armbian-image-release:BOARD_NAME="Banana Pi M64"
/etc/armbian-image-release:BOARDFAMILY=sun50iw1
/etc/armbian-image-release:VERSION=5.41
/etc/armbian-image-release:LINUXFAMILY=pine64
/etc/armbian-image-release:BRANCH=default
/etc/armbian-image-release:ARCH=arm64
/etc/armbian-image-release:IMAGE_TYPE=user-built
/etc/armbian-image-release:BOARD_TYPE=csc
/etc/armbian-image-release:INITRD_ARCH=arm
/etc/armbian-image-release:KERNEL_IMAGE_TYPE=Image
/etc/lsb-release:DISTRIB_ID=Ubuntu
/etc/lsb-release:DISTRIB_RELEASE=18.04
/etc/lsb-release:DISTRIB_CODENAME=bionic
/etc/lsb-release:DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION="18.04.4 LTS (Bionic Beaver)"
/etc/os-release:ID=ubuntu
/etc/os-release:ID_LIKE=debian
/etc/os-release:PRETTY_NAME="Ubuntu 18.04.4 LTS"
/etc/os-release:VERSION_ID="18.04"
/etc/os-release:HOME_URL="https://www.ubuntu.com/"
/etc/os-release:SUPPORT_URL="https://help.ubuntu.com/"
/etc/os-release:BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
/etc/os-release:PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
/etc/os-release:VERSION_CODENAME=bionic
/etc/os-release:UBUNTU_CODENAME=bionic

dmesg 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ dmesg | grep pci
[    2.204941] [RTD139x PCIE] 98060000.pcie: PCIE host driver initial begin.
[    2.204973] [RTD139x PCIE] 98060000.pcie: PCIE Debug Mode off
[    2.441801] [RTD139x PCIE] 98060000.pcie: PCIE device has link down in slot 2
[    2.441833] [RTD139x PCIE] 98060000.pcie: rtk_pcie_139x_hw_initial fail
[    2.441886] [RTD139x PCIE]: probe of 98060000.pcie failed with error -22
[    4.922306] ehci-pci: EHCI PCI platform driver
[    4.922978] ohci-pci: OHCI PCI platform driver

블럭장치 확인

확장 드라이브 설치 전

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0  7.3G  0 disk 
├─mmcblk0p1  179:1    0  256M  0 part /media/pi/BPI-BOOT
└─mmcblk0p2  179:2    0  6.8G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk 
mmcblk0boot1 179:16   0    4M  1 disk 
mmcblk0rpmb  179:24   0  512K  0 disk

확장 드라이브 설치 후

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda            8:0    1 29.7G  0 disk 
└─sda1         8:1    1 29.7G  0 part /media/pi/3665-3463
mmcblk0      179:0    0  7.3G  0 disk 
├─mmcblk0p1  179:1    0  256M  0 part /media/pi/BPI-BOOT
└─mmcblk0p2  179:2    0  6.8G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk 
mmcblk0boot1 179:16   0    4M  1 disk 
mmcblk0rpmb  179:24   0  512K  0 disk

USB 정보 확인

확장 드라이브 설치 전

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda:c820 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

확장 드라이브 설치 후

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0bda:c820 Realtek Semiconductor Corp. 
Bus 001 Device 003: ID 05e3:0751 Genesys Logic, Inc. 
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

fdisk 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo fdisk -l
 
... 생략 ...
 
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
 
Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)

추가된 디스트의 파티션을 만들고 mount 하기

디스크 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo fdisk -l | grep '^Disk'
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 sectors
Disklabel type: dos
Disk identifier: 0xc69bd2d7
Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Disklabel type: dos
Disk identifier: 0x00000000

기존 파티션을 삭제하고 새로 파티션 생성

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo fdisk /dev/sda
 
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): p
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
 
Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)
 
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62333951, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-62333951, default 62333951): 
 
Created a new partition 1 of type 'Linux' and of size 29.7 GiB.
 
Command (m for help): w
The partition table has been altered.
Failed to remove partition 1 from system: Device or resource busy
Failed to add partition 1 to system: Device or resource busy
 
The kernel still uses the old partitions. The new table will be used at the next reboot. 
Syncing disks.

재부팅

X
user@localhost:~

pi@bpi-iot-ros-ai:/sd_disk$ sudo shutdown -r now

디스크 format

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo mkfs.ext4 /dev/sda1
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 7791488 4k blocks and 1949696 inodes
Filesystem UUID: ca144d66-31b2-4bac-ac7d-db0d6ccb0075
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
 
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:        
done

mount 할 디렉토리 생성

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo mkdir /sd_disk

mount

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo mount /dev/sda1 /sd_disk

확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            320M     0  320M   0% /dev
tmpfs            68M  6.0M   63M   9% /run
/dev/mmcblk0p2  6.7G  5.4G  992M  85% /
tmpfs           340M     0  340M   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           340M     0  340M   0% /sys/fs/cgroup
tmpfs           340M  4.0K  340M   1% /tmp
tmpfs            68M   16K   68M   1% /run/user/1000
overlaid         68M   16K   68M   1% /run/user/1000/pi-chromium
/dev/sda1        30G  128K   30G   1% /sd_disk
/dev/mmcblk0p1  256M   38M  218M  15% /media/pi/BPI-BOOT

자동 mount

UUID 확인

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo blkid
/dev/mmcblk0: PTUUID="c69bd2d7" PTTYPE="dos"
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="BPI-BOOT" UUID="D0B7-DA68" TYPE="vfat" PARTUUID="c69bd2d7-01"
/dev/mmcblk0p2: LABEL="BPI-ROOT" UUID="f28d8061-d9a4-495b-96f0-c3e5233eaa1d" TYPE="ext4" PARTUUID="c69bd2d7-02"
/dev/sda1: UUID="ca144d66-31b2-4bac-ac7d-db0d6ccb0075" TYPE="ext4"

fstab 파일에 파티션 추가

X
user@localhost:~

pi@bpi-iot-ros-ai:~$ sudo vi /etc/fstab

 

# 파티션 추가 
UUID=ca144d66-31b2-4bac-ac7d-db0d6ccb0075 /sd_disk ext4 defaults 0 0
728x90
728x90

리눅스 정보 확인

CPU 정보 확인

X
user@localhost:~

[user@localhost]$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 54.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
 
... 생략 ...

nstruction set architecture (ISA)

X
user@localhost:~

[user@localhost]$ uname -i
aarch64

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux bpi-iot-ros-ai 4.9.119-BPI-M4-Kernel #1 SMP PREEMPT Mon May 18 10:41:36 HKT 2020 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

X
user@localhost:~

[user@localhost]$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

X
user@localhost:~

[user@localhost]$ grep -c processor /proc/cpuinfo
4

메모리, swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
'              total        used        free      shared  buff/cache   available
Mem:           679M        273M        161M         21M        245M        270M
Swap:          255M          0B        255M

Tensorflow 설치된 Linux 이미지 eMMC에 설치

X
user@localhost:~

[user@localhost]$ sudo bpi-copy 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
SRC=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
DST=
COPYMODE=imagetodisk
imagetodisk
bpi-copy(v1.3.4(github)), bananapi image & disk tools
Usage: bpi-copy [OPTIONS]...
       bpi-copy [ --help | -v | --version ]
       bpi-copy IMGFILE
       bpi-copy IMGDIR
       bpi-copy IMGFILE DEVICE
       bpi-copy DEVICE IMGFILE
Warning: Try to write 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip to BOOTDISK /dev/mmcblk1
==============================================================
Sat Jun  6 22:43:02 CST 2020
*** start COPY (blue led on ) .....
INFO: /dev/mmcblk1 : SD/eMMC !!
umount device: /dev/mmcblk1
umount /dev/mmcblk1p2
umount /dev/mmcblk1p1
==============================================================
IMGFILE=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
==============================================================
zip
7.28GiB 0:06:07 [20.3MiB/s] [                                                         <=>                                 ]
0+108268 records in
0+108268 records out
***  end  COPY (blue led off) .....
Sat Jun  6 22:49:11 CST 2020
==============================================================
RUNTIME 6:9
OK!! You can remove the BOOTDISK /dev/mmcblk1 now!!

Python, pip 버전확인

X
user@localhost:~

[user@localhost]$ python3 --version
Python 3.7.7
[user@localhost]$ pip3 --version
pip 20.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

Tensorflow 버전확인

X
user@localhost:~

[user@localhost]$ python3
Python 3.7.7 (default, Jun  6 2020, 12:24:50) 
[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

출처

X
user@localhost:~

[user@localhost]$ sudo bpi-copy /dev/mmcblk1 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
SRC=/dev/mmcblk1
DST=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
COPYMODE=disktoimage
disktoimage
bpi-copy(v1.3.4(github)), bananapi image & disk tools
Usage: bpi-copy [OPTIONS]...
       bpi-copy [ --help | -v | --version ]
       bpi-copy IMGFILE
       bpi-copy IMGDIR
       bpi-copy IMGFILE DEVICE
       bpi-copy DEVICE IMGFILE
Info: Try to write /dev/mmcblk1 to BOOTDISK 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
==============================================================
Sat Jun  6 20:56:12 CST 2020
INFO: /dev/mmcblk1 : SD/eMMC !!
umount device: /dev/mmcblk1
==============================================================
IMGFILE=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip
==============================================================
zip
dd if=/dev/mmcblk1 bs=1M | pv | zip 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc_tensorflow-2.2.0.img.zip -
  adding: -25.2MiB 0:00:01 [25.2MiB/s] [ <=>                                                                               7456+0 records in24.6MiB/s] [            <=>                                                                              ]
7456+0 records out
7.28GiB 0:21:47 [5.70MiB/s] [              <=>                                                                            ]
7818182656 bytes (7.8 GB, 7.3 GiB) copied, 1307.85 s, 6.0 MB/s
 (deflated 66%)
Sat Jun  6 21:18:02 CST 2020
==============================================================
RUNTIME 21:50
OK!! You can remove the BOOTDISK /dev/mmcblk1 now!!

728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

X
user@localhost:~

[user@localhost]$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 54.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
 
... 생략 ...

i

nstruction set architecture (ISA)

X
user@localhost:~

[user@localhost]$ uname -i
aarch64

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux bpi-iot-ros-ai 4.9.119-BPI-M4-Kernel #1 SMP PREEMPT Mon May 18 10:41:36 HKT 2020 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

X
user@localhost:~

[user@localhost]$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

X
user@localhost:~

[user@localhost]$ grep -c processor /proc/cpuinfo
4

메모리, swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.5G        236M        533M         33M        802M        1.0G
Swap:            0B          0B          0B

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

X
user@localhost:~

[user@localhost]$ sudo apt update
[user@localhost]$ sudo apt install gfortran libopenblas-dev liblapack-dev libhdf5-dev
[user@localhost]$ pip3 --version
pip 20.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

TensorFlow 2.2.0 패키지 설치

TensorFlow 2.2.0 패키지 다운로드

X
user@localhost:~

[user@localhost]$ wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.2.0/tensorflow-2.2.0-cp37-none-linux_aarch64.whl

tensorflow 2.2.0 파이썬 페키지 설치

X
user@localhost:~

[user@localhost]$ export TMPDIR=/var/tmp
[user@localhost]$ pip3 install tensorflow-2.2.0-cp37-none-linux_aarch64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./tensorflow-2.2.0-cp37-none-linux_aarch64.whl
Requirement already satisfied: opt-einsum>=2.3.2 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (3.2.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.18.5)
Requirement already satisfied: grpcio>=1.8.6 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.29.0)
Requirement already satisfied: termcolor>=1.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.1.0)
Requirement already satisfied: tensorflow-estimator<2.3.0,>=2.2.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (2.2.0)
Requirement already satisfied: h5py<2.11.0,>=2.10.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (2.10.0)
Requirement already satisfied: wrapt>=1.11.1 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.12.1)
Requirement already satisfied: absl-py>=0.7.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (0.9.0)
Requirement already satisfied: keras-preprocessing>=1.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.1.2)
Requirement already satisfied: protobuf>=3.8.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (3.12.2)
Requirement already satisfied: gast==0.3.3 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (0.3.3)
Requirement already satisfied: astunparse==1.6.3 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.6.3)
Requirement already satisfied: scipy==1.4.1; python_version >= "3" in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.4.1)
Requirement already satisfied: tensorboard<2.3.0,>=2.2.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (2.2.2)
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)
Requirement already satisfied: google-pasta>=0.1.8 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (0.2.0)
Requirement already satisfied: six>=1.12.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.2.0) (1.15.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from protobuf>=3.8.0->tensorflow==2.2.0) (47.1.1)
Requirement already satisfied: google-auth<2,>=1.6.3 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.16.1)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.6.0.post3)
Requirement already satisfied: werkzeug>=0.11.15 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.0.1)
Requirement already satisfied: requests<3,>=2.21.0 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2.23.0)
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.2.2)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in ./.local/lib/python3.7/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.1)
Requirement already satisfied: rsa<4.1,>=3.1.4 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.1.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.2.8)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2020.4.5.1)
Requirement already satisfied: idna<3,>=2.5 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.25.9)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.6.1)
Requirement already satisfied: requests-oauthlib>=0.7.0 in ./.local/lib/python3.7/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.3.0)
Requirement already satisfied: pyasn1>=0.1.3 in ./.local/lib/python3.7/site-packages (from rsa<4.1,>=3.1.4->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.8)
Requirement already satisfied: zipp>=0.5 in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Requirement already satisfied: oauthlib>=3.0.0 in ./.local/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Installing collected packages: tensorflow
Successfully installed tensorflow-2.2.0

버전 확인

X
user@localhost:~

[user@localhost]$ python3
Python 3.7.7 (default, Jun  6 2020, 12:24:50) 
[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 정보 확인

X
user@localhost:~

[user@localhost]$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 54.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
 
... 생략 ...

i

nstruction set architecture (ISA)

X
user@localhost:~

[user@localhost]$ uname -i
aarch64

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux bpi-iot-ros-ai 4.9.119-BPI-M4-Kernel #1 SMP PREEMPT Mon May 18 10:41:36 HKT 2020 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

X
user@localhost:~

[user@localhost]$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

X
user@localhost:~

[user@localhost]$ grep -c processor /proc/cpuinfo
4

메모리, swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.5G        236M        533M         33M        802M        1.0G
Swap:            0B          0B          0B

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

TensorFlow 라이브러리 다운로드

X
user@localhost:~

[user@localhost]$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.2.0.aarch64/libtensorflow.tar.gz

TensorFlow 라이브러리 설치

X
user@localhost:~

[user@localhost]$ sudo tar -C /usr/local -xzf libtensorflow.tar.gz

Linker 설정

X
user@localhost:~

[user@localhost]$ 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;
}

예제 컴파일

X
user@localhost:~

[user@localhost]$ gcc hello.c -ltensorflow -o hello

예제 실행

X
user@localhost:~

[user@localhost]$ ./hello
TensorFlow C library version 2.2.0

728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

X
user@localhost:~

[user@localhost]$ 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)

X
user@localhost:~

[user@localhost]$ uname -i
aarch64

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux NanoPi-NEO2-Black 4.14.111 #1 SMP Thu Dec 19 19:12:27 CST 2019 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

X
user@localhost:~

[user@localhost]$ cat /etc/issue
Ubuntu 16.04.6 LTS \n \l

논리 코어 수 확인

X
user@localhost:~

[user@localhost]$ grep -c processor /proc/cpuinfo
4

swap 사이즈 설정

현재 swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.5G        276M        164M         33M        1.1G        989M
Swap:          255M          0B        255M
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/var/swap                               file            262140  0       -1

swap 서비스 종료 (swap 설정 파일 수정을 위해서)

X
user@localhost:~

[user@localhost]$ sudo /sbin/dphys-swapfile swapoff

swap 설정 파일 수정

X
user@localhost:~

[user@localhost]$ sudo vi /etc/dphys-swapfile


# CONF_SWAPSIZE=100
CONF_SWAPSIZE=1024

swap 서비스 시작

X
user@localhost:~

[user@localhost]$ sudo rm /var/swap
[user@localhost]$ sudo /sbin/dphys-swapfile setup
want /var/swap=1024MByte, generating swapfile ... of 1024MBytes
[user@localhost]$ sudo /sbin/dphys-swapfile swapon

현재 swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.5G        277M        431M         24M        862M        980M
Swap:          1.0G          0B        1.0G
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/var/swap                               file            1048572 0       -1

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

X
user@localhost:~

[user@localhost]$ sudo apt update
[user@localhost]$ sudo apt install gfortran libopenblas-dev liblapack-dev libhdf5-dev
[user@localhost]$ pip3 --version
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

TensorFlow 2.1.0 패키지 설치

TensorFlow 2.1.0 패키지 다운로드

X
user@localhost:~

[user@localhost]$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.1.0.aarch64/tensorflow-2.1.0-cp37-cp37m-linux_aarch64.whl

tensorflow 2.1.0 파이썬 패키지 설치

X
user@localhost:~

[user@localhost]$ export TMPDIR=/var/tmp
[user@localhost]$ pip3 install tensorflow-2.1.0-cp37-cp37m-linux_aarch64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./tensorflow-2.1.0-cp37-cp37m-linux_aarch64.whl
Requirement already satisfied: astor>=0.6.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (0.8.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.18.4)
Requirement already satisfied: keras-applications>=1.0.8 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.0.8)
Requirement already satisfied: grpcio>=1.8.6 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.29.0)
Requirement already satisfied: protobuf>=3.8.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (3.12.2)
Requirement already satisfied: tensorboard<2.2.0,>=2.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (2.1.1)
Requirement already satisfied: absl-py>=0.7.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (0.9.0)
Requirement already satisfied: opt-einsum>=2.3.2 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (3.2.1)
Requirement already satisfied: six>=1.12.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.15.0)
Requirement already satisfied: google-pasta>=0.1.6 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (0.2.0)
Requirement already satisfied: wrapt>=1.11.1 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.12.1)
Requirement already satisfied: tensorflow-estimator<2.2.0,>=2.1.0rc0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (2.1.0)
Requirement already satisfied: termcolor>=1.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.1.0)
Requirement already satisfied: wheel>=0.26; python_version >= "3" in /usr/local/lib/python3.7/site-packages (from tensorflow==2.1.0) (0.34.2)
Requirement already satisfied: gast==0.2.2 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (0.2.2)
Requirement already satisfied: keras-preprocessing>=1.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.1.2)
Requirement already satisfied: scipy==1.4.1; python_version >= "3" in ./.local/lib/python3.7/site-packages (from tensorflow==2.1.0) (1.4.1)
Requirement already satisfied: h5py in ./.local/lib/python3.7/site-packages (from keras-applications>=1.0.8->tensorflow==2.1.0) (2.10.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from protobuf>=3.8.0->tensorflow==2.1.0) (47.1.1)
Requirement already satisfied: werkzeug>=0.11.15 in ./.local/lib/python3.7/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (1.0.1)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in ./.local/lib/python3.7/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (0.4.1)
Requirement already satisfied: requests<3,>=2.21.0 in ./.local/lib/python3.7/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (2.23.0)
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python3.7/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (3.2.2)
Requirement already satisfied: google-auth<2,>=1.6.3 in ./.local/lib/python3.7/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (1.16.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in ./.local/lib/python3.7/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (1.3.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (1.25.9)
Requirement already satisfied: chardet<4,>=3.0.2 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (2.9)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (2020.4.5.1)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from markdown>=2.6.8->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (1.6.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (4.1.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (0.2.8)
Requirement already satisfied: rsa<4.1,>=3.1.4 in ./.local/lib/python3.7/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (4.0)
Requirement already satisfied: oauthlib>=3.0.0 in ./.local/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (3.1.0)
Requirement already satisfied: zipp>=0.5 in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (3.1.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./.local/lib/python3.7/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow==2.1.0) (0.4.8)
Installing collected packages: tensorflow
Successfully installed tensorflow-2.1.0
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.

버전 확인

X
user@localhost:~

[user@localhost]$ python3
Python 3.7.7 (default, Jun  1 2020, 00:48:31) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.1.0'

728x90

+ Recent posts