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
 
processor       : 1
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
 
processor       : 2
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
 
processor       : 3
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

instruction 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 #6 SMP PREEMPT Tue Jun 18 10:49:05 CST 2019 aarch64 aarch64 aarch64 GNU/Linux

OS버전에 대한 정보

X
user@localhost:~

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

논리 코어 수 확인

X
user@localhost:~

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

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

TensorFlow 라이브러리 다운로드

X
user@localhost:~

[user@localhost]$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.1.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.1.0

728x90
728x90

출처

Python 3.6 제거 (옵션)

Python 3 설치된 패키지 확인

X
user@localhost:~

[user@localhost]$ aptitude search '~i' | grep python

Python 3.6 제거

X
user@localhost:~

[user@localhost]$ sudo apt remove python3 python3-minimal python3.6 python3.6-minimal libpython3.6 libpython3.6-minimal
[user@localhost]$ sudo apt autoremove

Python 3.7 설치

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

X
user@localhost:~

[user@localhost]$ sudo apt update
[user@localhost]$ 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 소스 다운로드

X
user@localhost:~

[user@localhost]$ PYTHON_VERSION=3.7.7
[user@localhost]$ wget "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"

Python 빌드

X
user@localhost:~

[user@localhost]$ tar -xvf Python-$PYTHON_VERSION.tar.xz
[user@localhost]$ cd Python-$PYTHON_VERSION/
[user@localhost]$ sudo ./configure --enable-loadable-sqlite-extensions \
  --enable-optimizations \
  --enable-option-checking=fatal \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --without-ensurepip
[user@localhost]$ 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                                                           
 
 
Failed to build these modules:
_curses               _curses_panel                            
 
running build_scripts
copying and adjusting /home/pi/Python-3.7.7/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/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.7'

Python 3.7 설치

X
user@localhost:~

[user@localhost]$ sudo make install
[user@localhost]$ sudo ldconfig
[user@localhost]$ 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 '{}' +

pip 설치

X
user@localhost:~

[user@localhost]$ cd ~
[user@localhost]$ wget -O get-pip.py "https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py"
[user@localhost]$ sudo python3 get-pip.py --disable-pip-version-check --no-cache-dir "pip==20.1.1"

설치 확인

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)

728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

X
user@localhost:~

[user@localhost]$ cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 5 (v7l)
processor       : 0
BogoMIPS        : 1142.85
 
processor       : 1
BogoMIPS        : 1142.85
 
processor       : 2
BogoMIPS        : 1142.85
 
processor       : 3
BogoMIPS        : 1142.85
 
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5
 
Hardware        : sun8i
Revision        : 0000
Serial          : 44007867890c5817090e

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux bananapim2zero 3.4.113-sun8i #2 SMP PREEMPT Wed May 8 15:09:43 CEST 2019 armv7l armv7l armv7l 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

libstdc++6 라이브러리 업데이트

오류 메시지 ImportError: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so)

libstdc++.so.6 라이브러리가 지원하는 버전 확인

X
user@localhost:~

[user@localhost]$ strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_DEBUG_MESSAGE_LENGTH

libstdc++6 업데이트

X
user@localhost:~

[user@localhost]$ sudo apt-get install software-properties-common
[user@localhost]$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
[user@localhost]$ sudo apt-get update
[user@localhost]$ sudo apt-get upgrade
[user@localhost]$ sudo apt-get upgrade libstdc++6

libstdc++.so.6 라이브러리가 지원하는 버전 확인

X
user@localhost:~

[user@localhost]$ strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_DEBUG_MESSAGE_LENGTH

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)

파이썬 라이브러리 설치

X
user@localhost:~

[user@localhost]$ sudo pip3 install setuptools wheel
[user@localhost]$ pip3 install numpy
[user@localhost]$ sudo pip3 install h5py

swap 사이즈 설정

현재 swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           495M         85M        337M        524K         72M        388M
Swap:          247M         96M        151M
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       63376   24648   5
/dev/zram1                              partition       63376   24616   5
/dev/zram2                              partition       63376   24584   5
/dev/zram3                              partition       63376   24544   5
[user@localhost]$ sudo swapoff /dev/zram0
[user@localhost]$ sudo swapoff /dev/zram1
[user@localhost]$ sudo swapoff /dev/zram2
[user@localhost]$ sudo swapoff /dev/zram3
[user@localhost]$ sudo zramctl --reset /dev/zram0
[user@localhost]$ sudo zramctl --reset /dev/zram1
[user@localhost]$ sudo zramctl --reset /dev/zram2
[user@localhost]$ sudo zramctl --reset /dev/zram3
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram0
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram1
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram2
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram3
[user@localhost]$ sudo mkswap /dev/zram0
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=e6662e60-e230-4c77-8bf5-fad980fcc8d4
[user@localhost]$ sudo mkswap /dev/zram1
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=3047af26-0e95-4da6-99de-7f27b6bacc1f
[user@localhost]$ sudo mkswap /dev/zram2
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=0777059c-8ec4-4db5-833c-d4a12204f2a4
[user@localhost]$ sudo mkswap /dev/zram3
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=e29b5ab6-9b7c-4298-a252-5492183d3c05
[user@localhost]$ sudo swapon /dev/zram0
[user@localhost]$ sudo swapon /dev/zram1
[user@localhost]$ sudo swapon /dev/zram2
[user@localhost]$ sudo swapon /dev/zram3
[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           495M        129M        283M        6.5M         82M        338M
Swap:          2.0G          0B        2.0G
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       524284  0       -1
/dev/zram1                              partition       524284  0       -2
/dev/zram2                              partition       524284  0       -3
/dev/zram3                              partition       524284  0       -4

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/tensorflow-2.1.0-cp37-none-linux_armv7l.whl

tensorflow 2.1.0 파이썬 페키지 설치

X
user@localhost:~

[user@localhost]$ export TMPDIR=/var/tmp
[user@localhost]$ pip3 install tensorflow-2.1.0-cp37-none-linux_armv7l.whl
 
 ... 생략 ...
 
Successfully built wrapt gast grpcio absl-py scipy termcolor
Installing collected packages: google-pasta, tensorflow-estimator, protobuf, wrapt, absl-py, idna, urllib3, certifi, chardet, requests, markdown, werkzeug, cachetools, pyasn1, pyasn1-modules, rsa, google-auth, grpcio, oauthlib, requests-oauthlib, google-auth-oauthlib, tensorboard, gast, keras-applications, astor, scipy, opt-einsum, termcolor, keras-preprocessing, tensorflow
Successfully installed absl-py-0.9.0 astor-0.8.1 cachetools-4.1.0 certifi-2020.4.5.1 chardet-3.0.4 gast-0.2.2 google-auth-1.13.1 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.28.1 idna-2.9 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.2.1 oauthlib-3.1.0 opt-einsum-3.2.0 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.1.1 tensorflow-2.1.0 tensorflow-estimator-2.1.0 termcolor-1.1.0 urllib3-1.25.8 werkzeug-1.0.1 wrapt-1.12.1

버전 확인

X
user@localhost:~

[user@localhost]$ python3
Python 3.7.7 (default, Apr 10 2020, 05:33:30) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.1.0'

728x90
728x90

출처

리눅스 정보 확인

CPU 정보 확인

X
user@localhost:~

[user@localhost]$ cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 5 (v7l)
processor       : 0
BogoMIPS        : 1142.85
 
processor       : 1
BogoMIPS        : 1142.85
 
processor       : 2
BogoMIPS        : 1142.85
 
processor       : 3
BogoMIPS        : 1142.85
 
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5
 
Hardware        : sun8i
Revision        : 0000
Serial          : 44007867890c5817090e

커널에 대한 정보

X
user@localhost:~

[user@localhost]$ uname -a
Linux bananapim2zero 3.4.113-sun8i #2 SMP PREEMPT Wed May 8 15:09:43 CEST 2019 armv7l armv7l armv7l 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

libstdc++6 라이브러리 업데이트

오류 메시지 `GLIBCXX_3.4.22' not found

libstdc++.so.6 라이브러리가 지원하는 버전 확인

X
user@localhost:~

[user@localhost]$ strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_DEBUG_MESSAGE_LENGTH

libstdc++6 업데이트

X
user@localhost:~

[user@localhost]$ sudo apt-get install software-properties-common
[user@localhost]$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
[user@localhost]$ sudo apt-get update
[user@localhost]$ sudo apt-get upgrade
[user@localhost]$ sudo apt-get upgrade libstdc++6

libstdc++.so.6 라이브러리가 지원하는 버전 확인

X
user@localhost:~

[user@localhost]$ strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_DEBUG_MESSAGE_LENGTH

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

TensorFlow 라이브러리 다운로드

X
user@localhost:~

[user@localhost]$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.1.0.armv6l/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.1.0

728x90
728x90

출처

리눅스 정보 확인

HW 정보 확인

X
user@localhost:~

[user@localhost]$ sudo apt-get install lshw
[user@localhost]$ sudo lshw
bananapim2zero            
    description: Computer
    width: 32 bits
  *-core
       description: Motherboard
       physical id: 0
     *-memory
          description: System memory
          physical id: 0
          size: 495MiB
     *-cpu:0
          physical id: 1
          bus info: cpu@0
          size: 1008MHz
          capacity: 1008MHz
          capabilities: cpufreq
     *-cpu:1
          physical id: 2
          bus info: cpu@1
          size: 1008MHz
          capacity: 1008MHz
          capabilities: cpufreq
     *-cpu:2
          physical id: 3
          bus info: cpu@2
          size: 1008MHz
          capacity: 1008MHz
          capabilities: cpufreq
     *-cpu:3
          physical id: 4
          bus info: cpu@3
          size: 1008MHz
          capacity: 1008MHz
          capabilities: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt cpufreq
  *-usbhost:0
       product: SW USB2.0 'Open' Host Controller (OHCI) Driver
       vendor: Linux 3.4.113-sun8i ohci_hcd
       physical id: 1
       bus info: usb@2
       logical name: usb2
       version: 3.04
       capabilities: usb-1.10
       configuration: driver=hub slots=1 speed=12Mbit/s
  *-usbhost:1
       product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
       vendor: Linux 3.4.113-sun8i ehci_hcd
       physical id: 2
       bus info: usb@1
       logical name: usb1
       version: 3.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
     *-usb
          description: USB hub
          product: USB 2.0 Hub
          vendor: Terminus Technology Inc.
          physical id: 1
          bus info: usb@1:1
          version: 1.11
          capabilities: usb-2.00
          configuration: driver=hub maxpower=100mA slots=4 speed=480Mbit/s
        *-usb:0
             description: Keyboard
             product: Smart Control
             vendor: HL 0000 00 00 00 01
             physical id: 1
             bus info: usb@1:1.1
             version: 1.00
             capabilities: usb-1.10
             configuration: driver=usbhid maxpower=200mA speed=12Mbit/s
        *-usb:1
             description: Generic USB device
             product: USB 2.0 10/100M Ethernet Adaptor
             vendor: Kontron (Industrial Computer Source / ICS Advent)
             physical id: 2
             bus info: usb@1:1.2
             version: 1.01
             capabilities: usb-1.10
             configuration: driver=qf9700 maxpower=120mA speed=12Mbit/s
  *-network:0
       description: Wireless interface
       physical id: 3
       logical name: wlan0
       serial: cc:b8:a8:aa:b7:b4
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=wl driverversion=0 multicast=yes wireless=IEEE 802.11
  *-network:1
       description: Ethernet interface
       physical id: 4
       logical name: eth0
       serial: 7a:24:59:9a:a1:b8
       size: 10Mbit/s
       capacity: 100Mbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=sunxi_geth driverversion=SUNXI Gbgit driver V1.1 duplex=half link=no multicast=yes port=MII speed=10Mbit/s
  *-network:2
       description: Ethernet interface
       physical id: 5
       logical name: enx00e04c534458
       serial: 00:e0:4c:53:44:58
       size: 100Mbit/s
       capacity: 100Mbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=qf9700 driverversion=22-Aug-2005 duplex=full firmware=QF9700 USB Ethernet ip=192.168.0.3 link=yes multicast=yes port=MII speed=100Mbit/s

instruction set architecture (ISA)

X
user@localhost:~

[user@localhost]$ uname -i
armv7l

swap 사이즈 설정

현재 swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           495M        129M        136M         19M        228M        324M
Swap:          247M          0B        247M
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       63376   0       5
/dev/zram1                              partition       63376   0       5
/dev/zram2                              partition       63376   0       5
/dev/zram3                              partition       63376   0       5
[user@localhost]$ sudo swapoff /dev/zram0
[user@localhost]$ sudo swapoff /dev/zram1
[user@localhost]$ sudo swapoff /dev/zram2
[user@localhost]$ sudo swapoff /dev/zram3
[user@localhost]$ sudo zramctl --reset /dev/zram0
[user@localhost]$ sudo zramctl --reset /dev/zram1
[user@localhost]$ sudo zramctl --reset /dev/zram2
[user@localhost]$ sudo zramctl --reset /dev/zram3
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram0
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram1
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram2
[user@localhost]$ sudo zramctl --find --size 512M
/dev/zram3
[user@localhost]$ sudo mkswap /dev/zram0
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=db53f0c1-5ca4-41cb-acae-ba8c61e17827
[user@localhost]$ sudo mkswap /dev/zram1
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=f2b75b1c-77e6-485d-adfa-df2f3a7abc01
[user@localhost]$ sudo mkswap /dev/zram2
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=9612064a-508e-4c7f-8f7f-07d1a5cbe79d
[user@localhost]$ sudo mkswap /dev/zram3
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=cc344046-c130-4f79-9d33-fc0882cf3f6a
[user@localhost]$ sudo swapon /dev/zram0
[user@localhost]$ sudo swapon /dev/zram1
[user@localhost]$ sudo swapon /dev/zram2
[user@localhost]$ sudo swapon /dev/zram3
[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           495M        134M        132M         19M        228M        319M
Swap:          2.0G          0B        2.0G
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       524284  0       -1
/dev/zram1                              partition       524284  0       -2
/dev/zram2                              partition       524284  0       -3
/dev/zram3                              partition       524284  0       -4

Bazel 설치

출처 : トマト農家のロボット創り Robot creation by tomato farmer: Build Bazel(0.29.0) on Raspberry Pi 4

JDK 설치

X
user@localhost:~

[user@localhost]$ sudo apt install openjdk-8-jdk

Bazel 다운로드 및 설치

X
user@localhost:~

[user@localhost]$ mkdir bazel
[user@localhost]$ cd bazel
[user@localhost]$ wget https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-dist.zip
[user@localhost]$ unzip bazel-0.29.1-dist.zip
[user@localhost]$ sudo env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" VERBOSE=yes BAZEL_JAVAC_OPTS="-J-Xms384m -J-Xmx1024m" bash ./compile.sh
[user@localhost]$ sudo cp output/bazel /usr/local/bin/bazel

Tensorflow Lite 빌드

Tensorflow 소스 다운로드

X
user@localhost:~

[user@localhost]$ wget https://github.com/tensorflow/tensorflow/archive/v2.1.0.tar.gz
[user@localhost]$ tar -zxvf v2.1.0.tar.gz
[user@localhost]$ cd tensorflow-2.1.0/

Tensorflow Lite 빌드

X
user@localhost:~

[user@localhost]$ tensorflow/lite/tools/make/download_dependencies.sh
tensorflow/lite/tools/make/download_dependencies.sh: line 59: 1: Usage: download_and_extract URL DIR
pi@bananapim2zero:~/tensorflow-2.1.0$
[user@localhost]$ sed -i "/^EIGEN_URL=/c\EIGEN_URL=\"\$(grep -o 'https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/.*tar.gz' \"\${BZL_FILE_PATH}\")\"" tensorflow/lite/tools/make/download_dependencies.sh
[user@localhost]$ tensorflow/lite/tools/make/download_dependencies.sh

컴파일 옵션 변경

BPI-M2 ZERO 리소스 부족으로 컴파일 오류가 발생하므로 컴파일 옵션 변경

X
user@localhost:~

[user@localhost]$ vi tensorflow/lite/tools/make/build_lib.sh

-j 옵션값을 4에서 2로 변경

make -j 2 BUILD_WITH_NNAPI=false -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile

Tensorflow Lite 빌드

X
user@localhost:~

[user@localhost]$ sudo tensorflow/lite/tools/make/build_lib.sh
+ set -e
+++ dirname tensorflow/lite/tools/make/build_lib.sh
++ cd tensorflow/lite/tools/make
++ pwd
+ SCRIPT_DIR=/home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make
+ TENSORFLOW_DIR=/home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make/../../../..
+ make -j 4 BUILD_WITH_NNAPI=false -C /home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make/../../../.. -f tensorflow/lite/tools/make/Makefile
make: Entering directory '/home/pi/tensorflow-2.1.0'

Python 패키지 빌드, 설치

X
user@localhost:~

[user@localhost]$ sudo apt install swig
[user@localhost]$ tensorflow/lite/tools/pip_package/build_pip_package.sh
[user@localhost]$ pip3 install /tmp/tflite_pip/python3/dist/tflite_runtime-2.1.0-cp37-cp37m-linux_armv7l.whl
Defaulting to user installation because normal site-packages is not writeable
Processing /tmp/tflite_pip/python3/dist/tflite_runtime-2.1.0-cp37-cp37m-linux_armv7l.whl
Requirement already satisfied: numpy>=1.12.1 in /home/pi/.local/lib/python3.7/site-packages (from tflite-runtime==2.1.0) (1.18.2)
Installing collected packages: tflite-runtime
Successfully installed tflite-runtime-2.1.0

728x90
728x90

출처

Python 3.7 설치

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

X
user@localhost:~

[user@localhost]$ sudo apt update
[user@localhost]$ sudo apt install -y --no-install-recommends libbluetooth-dev tk-dev uuid-dev wget ca-certificates gnupg2 dirmngr python python3 gcc build-essential wget zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev

Python 소스 다운로드

X
user@localhost:~

[user@localhost]$ PYTHON_VERSION=3.7.7
[user@localhost]$ wget "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"

Python 빌드

X
user@localhost:~

[user@localhost]$ tar -xvf Python-3.7.7.tar.xz
[user@localhost]$ cd Python-3.7.7/
[user@localhost]$ sudo ./configure --enable-loadable-sqlite-extensions \
  --enable-optimizations \
  --enable-option-checking=fatal \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --without-ensurepip
[user@localhost]$ 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                  _dbm                  _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.7/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.7/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.7'

Python 3.7 설치

X
user@localhost:~

[user@localhost]$ sudo make install
[user@localhost]$ sudo ldconfig
[user@localhost]$ 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 '{}' +
[user@localhost]$ python3 --version
[user@localhost]$ cd /usr/local/bin \
  && sudo ln -s idle3 idle \
  && sudo ln -s pydoc3 pydoc \
  && sudo ln -s python3 python \
  && sudo ln -s python3-config python-config

pip 설치

X
user@localhost:~

[user@localhost]$ cd ~
[user@localhost]$ wget -O get-pip.py "https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py";
[user@localhost]$ sudo python3 get-pip.py --disable-pip-version-check --no-cache-dir "pip==20.0.2"

설치 확인

X
user@localhost:~

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

728x90
728x90

출처

swap 사이즈 설정

현재 swap 사이즈 확인

X
user@localhost:~

[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           998M        125M        814M        544K         58M        849M
Swap:          499M        141M        357M
[user@localhost]$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram1                              partition       511416  145384  5
[user@localhost]$ sudo swapoff /dev/zram1
[user@localhost]$ sudo zramctl --reset /dev/zram1
[user@localhost]$ sudo zramctl --find --size 2048M
/dev/zram1
[user@localhost]$ sudo mkswap /dev/zram1
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=2b7262ae-3011-45d4-b3b5-c1d4eec0d5b6
[user@localhost]$ sudo swapon /dev/zram1
[user@localhost]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           998M        217M        706M        4.7M         75M        754M
Swap:          2.0G          0B        2.0G

Bazel 설치

출처 : トマト農家のロボット創り Robot creation by tomato farmer: Build Bazel(0.29.0) on Raspberry Pi 4

Bazel 다운로드 및 설치

X
user@localhost:~

[user@localhost]$ mkdir bazel
[user@localhost]$ cd bazel
[user@localhost]$ wget https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-dist.zip
[user@localhost]$ unzip bazel-0.29.1-dist.zip
[user@localhost]$ sudo env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" VERBOSE=yes BAZEL_JAVAC_OPTS="-J-Xms384m -J-Xmx1024m" bash ./compile.sh
[user@localhost]$ sudo cp output/bazel /usr/local/bin/bazel

Tensorflow Lite 빌드

Tensorflow 소스 다운로드

X
user@localhost:~

[user@localhost]$ wget https://github.com/tensorflow/tensorflow/archive/v2.1.0.tar.gz
[user@localhost]$ tar -zxvf v2.1.0.tar.gz
[user@localhost]$ cd tensorflow-2.1.0/

Tensorflow Lite 빌드

X
user@localhost:~

[user@localhost]$ sudo tensorflow/lite/tools/make/download_dependencies.sh
tensorflow/lite/tools/make/download_dependencies.sh: line 59: 1: Usage: download_and_extract URL DIR
[user@localhost]$ sed -i "/^EIGEN_URL=/c\EIGEN_URL=\"\$(grep -o 'https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/.*tar.gz' \"\${BZL_FILE_PATH}\")\"" tensorflow/lite/tools/make/download_dependencies.sh
[user@localhost]$ sudo tensorflow/lite/tools/make/download_dependencies.sh
[user@localhost]$ sudo tensorflow/lite/tools/make/build_lib.sh
+ set -e
+++ dirname tensorflow/lite/tools/make/build_lib.sh
++ cd tensorflow/lite/tools/make
++ pwd
+ SCRIPT_DIR=/home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make
+ TENSORFLOW_DIR=/home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make/../../../..
+ make -j 4 BUILD_WITH_NNAPI=false -C /home/pi/tensorflow-2.1.0/tensorflow/lite/tools/make/../../../.. -f tensorflow/lite/tools/make/Makefile
make: Entering directory '/home/pi/tensorflow-2.1.0'
make: Nothing to be done for 'all'.
make: Leaving directory '/home/pi/tensorflow-2.1.0'

Tensorflow Lite C, C++ 예제 컴파일, 실행

X
user@localhost:~

[user@localhost]$ cd tensorflow/lite/examples/minimal
[user@localhost]$ ls
BUILD  minimal.cc
[user@localhost]$ bazel build
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=124
INFO: Reading rc options for 'build' from /home/pi/tensorflow-2.1.0/.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone --strategy=Genrule=standalone -c opt --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --config=v2
INFO: Found applicable config definition build:v2 in file /home/pi/tensorflow-2.1.0/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
WARNING: Usage: bazel build  .
Invoke `bazel help build` for full description of usage and options.
Your request is correct, but requested an empty set of targets. Nothing will be built.
DEBUG: Rule 'io_bazel_rules_docker' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556410077 -0400"
DEBUG: Call stack for the definition of repository 'io_bazel_rules_docker' which is a git_repository (rule definition at /home/pi/.cache/bazel/_bazel_pi/1e5f7ce23473dd292c5d0e986c50b880/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
 - /home/pi/.cache/bazel/_bazel_pi/1e5f7ce23473dd292c5d0e986c50b880/external/bazel_toolchains/repositories/repositories.bzl:37:9
 - /home/pi/tensorflow-2.1.0/WORKSPACE:37:1
INFO: Analyzed 0 targets (0 packages loaded, 0 targets configured).
INFO: Found 0 targets...
INFO: Elapsed time: 47.550s, Critical Path: 0.13s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
[user@localhost]$ ls
BUILD  minimal.cc
[user@localhost]$ cd ../../tools/make/gen/linux_armv7l/bin/
[user@localhost]$ ./minimal
minimal <tflite model>

Tensorflow Lite 패키지 빌드, 설치

X
user@localhost:~

[user@localhost]$ pip3 install /tmp/tflite_pip/python3/dist/tflite_runtime-2.1.0-cp37-cp37m-linux_armv7l.whl
Defaulting to user installation because normal site-packages is not writeable
Processing /tmp/tflite_pip/python3/dist/tflite_runtime-2.1.0-cp37-cp37m-linux_armv7l.whl
Requirement already satisfied: numpy>=1.12.1 in /usr/local/lib/python3.7/site-packages (from tflite-runtime==2.1.0) (1.18.2)
Installing collected packages: tflite-runtime
Successfully installed tflite-runtime-2.1.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
 
processor       : 1
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
 
processor       : 2
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
 
processor       : 3
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

instruction 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 Tue Apr 16 10:39:33 CST 2019 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

spirom 펌웨어 업데이트

2020년 5월 이전 생산된 모델의 경우 1GB 보드는 spirom 펌웨어를 업데이트해야 새로운 Linux 이미지 실행 가능

부팅로그 - 디버그 USB to UART로 Serial로 확인 - 1G가 모델에서 2G로 표시되는 오류

C1:80000000
C2
?_?
C3h
hwsetting size: 00000950
C4
f 
5-5
Goto FSBL: 0x80008000
Welcome to FSBL ....

REG32(VO_SW_SEC_1)=01C00000
[FSBL] Secure: 0x0000BEEE
[FSBL] DCache Enable: 0x00000000
[FSBL] SVP = N
********** FW_TYPE_BOOTCODE **********
    FW Image to 0x00100000, size=0x000841E0 (0x001841E0)
    FW Image fr 0x881313E8 
kmcp_bypass copy audio bin
FSBL: plat_gic_setup
FSBL: plat_gic_setup_percpu
FSBL Jumps to LK


U-Boot 2015.07 (May 27 2019 - 09:38:38 +0800)

CPU  : Cortex-A53 Quad Core - AARCH64
Board: Realtek QA Board
DRAM:  2 GiB
Watchdog: Disabled
mapping memory 0x20000000-0x40000000 non-cached
flushing dcache successfully.
nor flash id [0x00ef4018]
sector 256k en: 0

Flash the spirom

1. Prepare a bootable sdcard with bpi linux image flashed.
2. Connect debug serial cable to PC terminal.
3. Prepare a udisk with fat32 format, copy the right spirom firmware, spiloader-1GB.bin or spiloader-2GB.bin to udisk. Plug udisk to board.3.Press "Esc" and power on the board to enter uboot command mode.
4. Flash the firmware to board,

Net:   Realtek PCIe GBE Family Controller mcfg = 0024
dev->name=r8168#0
Checking default environment
Hit Esc or Tab key to enter console mode or rescue linux:  3 
------------can't find tmp/factory/recovery
------------finished reboot_action

Press Esc Key

Enter console mode, disable watchdog ...

BPI-M4> usb start
starting USB...
rtk_usb_power_on:213: Realtek-usb: UFP cc2 detect type_c have power (status=0x18)
USB0:   Register 1000140 NbrPorts 1
Starting the controller
USB XHCI 1.10
scanning bus 0 for devices... Unknown request , typeReq = 0x200c 
1 USB Device(s) found
USB1:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus 1 for devices... Unknown request , typeReq = 0x200c 
unknown Description Type : b
4 USB Device(s) found
       scanning usb for storage devices...  address 4
1 Storage Device(s) found
BPI-M4>
BPI-M4> fatload usb 0:1 0x01500000 spiloader-1GB.bin
reading spiloader-1GB.bin
761248 bytes read in 60 ms (12.1 MiB/s)
BPI-M4> go 0x01500000
Starting application at 0x01500000 ...
flash_type: SPI
begin: 

nor flash id [0x00EF4018]
      sector 256k en: 0x00000000
      sector  64k en: 0x00000001
      sector  32k en: 0x00000001
      sector   4k en: 0x00000001
      page_program  : 0x00000001
      max capacity  : 0x01000000
      spi type name : WINBOND_W325Q128BV_128Mbit
init
spi : erase 0x00200000 bytes from 0x88100000
////////////////////////////////
spi : write hw setting&signature, start=0x88130800, len=0x00000BE8
..
spi : write bootcode, start=0x881313E8, len=0x00080B80
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
spi : write bootcode signature, start=0x881B1F68, len=0x00000020

spi : write fsbl, start=0x881B1F88, len=0x00007A08
..............................
spi : write parameter, start=0x88130000, len=0x00000428
.exit
Finish
reset...
C1:80000000
C2
?_?
C3h
hwsetting size: 00000950

적용 확인

C4
f 
5-5
Goto FSBL: 0x80008000
Welcome to FSBL ....

REG32(VO_SW_SEC_1)=01C00000
[FSBL] Secure: 0x0000BEEE
[FSBL] DCache Enable: 0x00000000
[FSBL] SVP = N
********** FW_TYPE_BOOTCODE **********
    FW Image to 0x00100000, size=0x00080BA0 (0x00180BA0)
    FW Image fr 0x881313E8 
kmcp_bypass copy audio bin
FSBL: plat_gic_setup
FSBL: plat_gic_setup_percpu
FSBL Jumps to LK


U-Boot 2015.07 (May 13 2020 - 17:12:53 +0800)

CPU  : Cortex-A53 Quad Core - AARCH64
Board: Realtek QA Board
DRAM:  1 GiB
Watchdog: Disabled

SD 확장

SD 확장전 용량확인

X
user@localhost:~

[user@localhost]$ df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              269344       0    269344   0% /dev
tmpfs              58016    1752     56264   4% /run
/dev/mmcblk0p2   6993924 5948764    673500  90% /
tmpfs             290076       0    290076   0% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs             290076       0    290076   0% /sys/fs/cgroup
tmpfs             290076       4    290072   1% /tmp
tmpfs              58012      24     57988   1% /run/user/1000
overlaid           58012      24     57988   1% /run/user/1000/pi-chromium
/dev/mmcblk0p1    258095  103390    154706  41% /media/pi/BPI-BOOT

SD FDisk

pi@bpi-iot-ros-ai:~$ sudo fdisk /dev/mmcblk0

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/mmcblk0: 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: 0x4ca45e69

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1      204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      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-62333951, default 2048): 729088
Last sector, +sectors or +size{K,M,G,T,P} (729088-62333951, default 62333951): 

Created a new partition 2 of type 'Linux' and of size 29.4 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@bpi-iot-ros-ai:~$ sudo shutdown -r now

SD 확장

X
user@localhost:~

[user@localhost]$ sudo resize2fs /dev/mmcblk0p2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p2 is now 7700608 (4k) blocks long.

SD 확장 확인

X
user@localhost:~

[user@localhost]$ df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              269344       0    269344   0% /dev
tmpfs              58016    1740     56276   3% /run
/dev/mmcblk0p2  30323692 5966332  23041984  21% /
tmpfs             290076       0    290076   0% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs             290076       0    290076   0% /sys/fs/cgroup
tmpfs             290076       4    290072   1% /tmp
tmpfs              58012      16     57996   1% /run/user/1000
overlaid           58012      16     57996   1% /run/user/1000/pi-chromium
/dev/mmcblk0p1    258095  103390    154706  41% /media/pi/BPI-BOOT

eMMC에 OS 설치

X
user@localhost:~

[user@localhost]$ sudo apt install pv
[user@localhost]$ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
[user@localhost]$ sudo bpi-copy 2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc.img
[sudo] password for pi: 
SRC=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc.img
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.img to BOOTDISK /dev/mmcblk1
==============================================================
Sun May 31 21:35:03 CST 2020
*** start COPY (blue led on ) .....
INFO: /dev/mmcblk1 : SD/eMMC !!
umount device: /dev/mmcblk1
umount /dev/mmcblk1p1
umount /dev/mmcblk1p2
==============================================================
IMGFILE=2020-05-18-ubuntu-18.04-mate-desktop-bpi-m4-aarch64-sd-emmc.img
==============================================================
img
729+1 records in[10.5MiB/s] [                                            <=>          ]
729+1 records out
7650410496 bytes (7.7 GB, 7.1 GiB) copied, 563.151 s, 13.6 MB/s
7.12GiB 0:09:23 [13.0MiB/s] [                                           <=>           ]
0+58925 records in
0+58925 records out
***  end  COPY (blue led off) .....
Sun May 31 21:44:28 CST 2020
==============================================================
RUNTIME 9:25
OK!! You can remove the BOOTDISK /dev/mmcblk1 now!!

jdk 1.8 설치

X
user@localhost:~

[user@localhost]$ sudo apt install openjdk-8-jdk

도커삭제 (옵션)

X
user@localhost:~

[user@localhost]$ sudo apt remove docker-ce

LibreOffice 제거 (옵션)

X
user@localhost:~

[user@localhost]$ sudo apt remove --purge libreoffice-core libreoffice-common
[user@localhost]$ sudo apt autoremove

Thunderbird 제거 (옵션)

X
user@localhost:~

[user@localhost]$ sudo apt remove --auto-remove thunderbird

Python 3.6 제거 (옵션)

Python 3 설치된 패키지 확인

X
user@localhost:~

[user@localhost]$ aptitude search '~i' | grep python

Python 3.6 제거

X
user@localhost:~

[user@localhost]$ sudo apt remove python3 python3-minimal python3.6 python3.6-minimal libpython3.6 libpython3.6-minimal
[user@localhost]$ sudo apt autoremove

Python 3.6 제거후 키보드, 마우스가 동작하지 않는 경우 설치

X
user@localhost:~

[user@localhost]$ sudo apt install xserver-xorg-input-all

728x90

+ Recent posts