Banana Pi - BPI-M2+

OS/Banana Pi 2017.02.26 22:23 Posted by 파란크리스마스

Banana PI - BPI-M2+

출처 : BPI-M2+
【BPI-M2+】之mjpg-streamer测试和体验- Bananap讨论区- 烽火社区 ...
http://forum.banana-pi.org/c/Banana-pi-BPI-M2

SD 확장

SD 확장전 용량확인

$ df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7156088 4680932   2111636  69% /
devtmpfs          380800       0    380800   0% /dev
tmpfs             512036     800    511236   1% /dev/shm
tmpfs             512036   20248    491788   4% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             512036       0    512036   0% /sys/fs/cgroup
/dev/mmcblk0p1    261868  213188     48680  82% /boot
tmpfs             102408      36    102372   1% /run/user/1000

SD FDisk

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

Welcome to fdisk (util-linux 2.27.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: 14.7 GiB, 15811477504 bytes, 30881792 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: 0x0006c94a

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

Created a new partition 2 of type 'Linux' and of size 14.4 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

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

SD 확장

$ sudo resize2fs /dev/mmcblk0p2
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 3769088 (4k) blocks long.

SD 확장 확인

$ df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       14839632 4653484   9513188  33% /
devtmpfs          380800       0    380800   0% /dev
tmpfs             512036     316    511720   1% /dev/shm
tmpfs             512036    7456    504580   2% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             512036       0    512036   0% /sys/fs/cgroup
/dev/mmcblk0p1    261868  213188     48680  82% /boot
tmpfs             102408      28    102380   1% /run/user/1000

How to burn Linux image to eMMC

출처 : How to burn Linux image to eMMC
bpi-copy command

root@bpi-iot-ros-ai:~# uname -a
Linux bpi-iot-ros-ai 3.4.112-sun8i #2 SMP PREEMPT Mon May 30 20:34:33 CST 2016 armv7l armv7l armv7l GNU/Linux
root@bpi-iot-ros-ai:~# fdisk -l
Disk /dev/mmcblk0: 14.7 GiB, 15811477504 bytes, 30881792 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: 0x0006c94a

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *    204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      729088 30881791 30152704 14.4G 83 Linux


Disk /dev/mmcblk1: 7.3 GiB, 7818182656 bytes, 15269888 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


Disk /dev/mmcblk1boot1: 4 MiB, 4194304 bytes, 8192 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


Disk /dev/mmcblk1boot0: 4 MiB, 4194304 bytes, 8192 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

이미지 복원

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

$ sudo dd if=2016-07-21-ubuntu-mate-16.04-desktop-armhf-raspberry-pi-bpi-m2p-sd-emmc.img of=/dev/mmcblk1 bs=10MB
781+1 records in
781+1 records out
7818182656 bytes (7.8 GB, 7.3 GiB) copied, 1023.46 s, 7.6 MB/s

eMMC 부팅(SD동시 사용 - 적용실패)

출처 : Banana Pi M2+ with system on emmc, data on sd card - Allwinner H2/H3
Boot from eMMC with blank SD in slot (BPI-M3)

$ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p2  /               ext4   defaults,noatime  0       1
/dev/mmcblk0p1  /boot/          vfat    defaults          0       2
$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0boot0 179:16   0    4M  1 disk 
mmcblk0boot1 179:32   0    4M  1 disk 
mmcblk0      179:0    0  7.3G  0 disk 
쒋mmcblk0p1  179:1    0  256M  0 part /boot
붴mmcblk0p2  179:2    0    7G  0 part /
$ cat /boot/boot.cmd
#setenv device mmc
#setenv partition 0:1
setenv bpi bananapi
setenv board bpi-m64
setenv chip a64
setenv service linux
setenv kernel Image
setenv initrd initrd.img
setenv dtb pine64-plus.dtb
 
setenv bootargs "console=ttyS0,115200n8 no_console_suspend earlycon=uart,mmio32,0x01c28000 mac_addr=${ethaddr} board=${board} root=${root} rootwait panic=10 consoleblank=0 enforcing=0 loglevel=2"
 
 
setenv fdt_filename "${bpi}/${board}/${service}/${dtb}"
setenv kernel_filename "${bpi}/${board}/${service}/${kernel}"
setenv initrd_filename "${bpi}/${board}/${service}/${initrd}"
 
run load_dtb load_kernel load_initrd boot_kernel
 
## Recompile with:
## mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
## mkimage -C none -A arm -T script -d boot.cmd boot.scr

generate boot.src

$ sudo mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
Image Name:   
Created:      Sun Feb  26 11:55:34 2017
Image Type:   ARM Linux Script (uncompressed)
Data Size:    805 Bytes = 0.79 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 797 Bytes = 0.78 kB = 0.00 MB
$ sudo shutdown -r now

GPIO사용 (BPI-WiringPi)

출처 : Supports BananaPi BPI -M1 / M1Plus / M2 / M2P / M3

기존 설치된 wiringpi 삭제

$ sudo apt-get remove wiringpi
$ sudo apt autoremove

wiringpi 설치

$ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git -b BPI_M2P
$ cd BPI-WiringPi
$ chmod +x ./build
$ sudo ./build

GPIO 확인

$ gpio -v
gpio version: 2.26
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
 
Banana Pi Details:
  Type: Model BM, Revision: 1.2, Memory: 1024MB, Maker: BPI 
$ gpio readall
 +-----+-----+---------+------+---+---Pi ---+---+------+---------+-----+-----+
 | CPU | wPi |    Name   | Mode | V | Physical | V | Mode |   Name    | wPi | CPU |
 +-----+-----+-----------+------+---+----++----+---+------+-----------+-----+-----+
 |     |     |      3.3v |      |   |  1 || 2  |   |      | 5v        |     |     |
 |  12 |   8 |     SDA.1 | ALT5 | 0 |  3 || 4  |   |      | 5V        |     |     |
 |  11 |   9 |     SCL.1 | ALT5 | 0 |  5 || 6  |   |      | GND       |     |     |
 |   6 |   7 |      PWM1 | ALT3 | 0 |  7 || 8  | 0 | ALT4 | UART3-TX  | 15  | 13  |
 |     |     |       GND |      |   |  9 || 10 | 0 | ALT4 | UART3-RX  | 16  | 14  |
 |   1 |   0 |  UART2-RX | ALT5 | 0 | 11 || 12 | 0 | OUT  | UART3-CTS | 1   | 16  |
 |   0 |   2 |  UART2-TX | ALT5 | 0 | 13 || 14 |   |      | GND       |     |     |
 |   3 |   3 | UART2-CTS | ALT5 | 0 | 15 || 16 | 1 | ALT4 | UART3-RTS | 4   | 15  |
 |     |     |      3.3v |      |   | 17 || 18 | 0 | ALT3 | GPIO.PC04 | 5   | 68  |
 |  64 |  12 | SPI0_MOSI | ALT4 | 0 | 19 || 20 |   |      | GND       |     |     |
 |  65 |  13 | SPI0_MISO | ALT4 | 0 | 21 || 22 | 0 | ALT5 | UART2-RTS | 6   | 2   |
 |  66 |  14 |  SPI0_CLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | SPI0-CS   | 10  | 67  |
 |     |     |       GND |      |   | 25 || 26 | 0 | ALT3 | GPIO.PL07 | 11  | 71  |
 |  19 |  30 |     SDA.0 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.0     | 31  | 18  |
 |   7 |  21 | GPIO.PA07 | ALT3 | 0 | 29 || 30 |   |      | GND       |     |     |
 |   8 |  22 | GPIO.PA08 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | GPIO.PL02 | 26  | 354 |
 |   9 |  23 | GPIO.PA09 | ALT3 | 0 | 33 || 34 |   |      | GND       |     |     |
 |  10 |  24 | GPIO.PA10 | ALT3 | 0 | 35 || 36 | 0 | ALT3 | GPIO.PL04 | 27  | 356 |
 |  17 |  25 | SPDIF-OUT | ALT3 | 0 | 37 || 38 | 0 | ALT3 | GPIO.PA21 | 28  | 21  |
 |     |     |       GND |      |   | 39 || 40 | 0 | ALT3 | GPIO.PA20 | 29  | 20  |
 +-----+-----+-----------+------+---+----++----+---+------+-----------+-----+-----+
 | CPU | wPi |    Name   | Mode | V | Physical | V | Mode |   Name    | wPi | CPU |
 +-----+-----+---------+------+---+---Pi ---+---+------+---------+-----+-----+

detect I2C chips

출처 : i2cdetect(8): detect I2C chips - Linux man page

$ ls /dev/*i2c*
/dev/i2c-0  /dev/i2c-1
$ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --  

jdk1.8 설치

출처 : 우분투(Ubuntu) Oracle(Sun) Java JDK 설치 - 사르기스

OpenJDK 제거

$ sudo apt-get purge openjdk*

repository 추가

$ sudo add-apt-repository ppa:webupd8team/java

repository index 업데이트

$ sudo apt-get update

JDK 설치

$ sudo apt-get install oracle-java8-installer

JAVA_HOME 환경변수 추가

$ sudo vi /etc/profile

내용 추가 export JAVA_HOME=/usr/lib/jvm/java-8-oracle

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

pi4j

촐처 : Java I/O library for Raspberry Pi (GPIO, I2C, SPI, UART) http://www.pi4j.com
BUILDING AN EXECUTABLE PI4J JAR

$ sudo apt install maven
$ git clone https://github.com/Pi4J/pi4j.git
$ cd pi4j/pi4j-native
$ mvn package

pi4j pwm 오류

촐처 : How to: banana pi BPI-M3 install BPI-WiringPi - Linux - banana pi ...

PWM 관련 오류가 있어 수정해 보려고 했으나 포기

val pwmWrite 0 <= X <= 1024
Or you can set new range by yourself by pwmSetRange(range
저작자 표시
신고


 

티스토리 툴바