kemonine
/
lollipopcloud
Archived
1
0
Fork 0
This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
lollipopcloud/hardware/pine64.md

138 lines
5.4 KiB
Markdown

# Pine64 Notes
Some useful links
- [Pinouts](http://joey.hazlett.us/pine64/Pine%20A64%20Pin%20Assignment%20160119.pdf)
- [Battery Status/Level Script (3.10.x kernel only)](https://gist.github.com/pfeerick/05e5715733f00dcf303636c80abff598)
## Misc Notes
- Set ```console=serial``` in ```/boot/armbianEnv.txt``` to put *all* boot output on the serial console.
- If an emmc is installed in a sopine and blank, boot of armbian on an sd card will fail
- The sopine carrier board appears to have a 1.35mm barrel jack. Link to usb wire: [Amazon](https://amazon.com/gp/product/B01N2UILL7)
- The emmc, a64 and other large, non axp803 chips can take a 15mmx15mm heat sink. This one is good: [Mouser](https://www.mouser.com/ProductDetail/984-ATS-52150G-C1-R0)
- The pine64 3d printed cases need a little extra material removed around the micro-usb area to facilitate the sopine carrier board dc barrel jack connector
- Button top batteries probably will *NOT* work with the 18650 battery pack, use flat tops. Only 1/2 ish of the battery top will be exposed to contacts on the positive side of the pack
- PPS is broken in 4.19 kernels as of 2019/04/12 ; 4.14.x may be required for reliable PPS ; this is only needed if you want to build a stratum 0 ntp server
- As of 4.19.34 the ```/sys/class/power_supply``` device nodes appear to be populated, the existing 3.10.x kernel scripts for showing battery status can be adapted for the new device node names
- This is a good battery status script [https://gist.github.com/pfeerick/05e5715733f00dcf303636c80abff598](https://gist.github.com/pfeerick/05e5715733f00dcf303636c80abff598)
- The axp803 appears to charge the battery pack even with 2 cores of the CPU at max, persistent load, adding persistent usb load on a usb disk will "net 0" the charger. You'll want a semi-idle setup for the batteries to charge over time with a sopine.
- The Samsung 3000mah 18650 batteries are a good fit for the battery pack sold by pine64.org and have good capacity and amp ratings.
- The top USB port on the sopine is a *host* port
## ZFS Notes
zfs is broken until 0.7.13, see the below links for info on how to set this up
- https://github.com/zfsonlinux/spl/issues/715
- https://github.com/zfsonlinux/zfs/wiki/Custom-Packages
Rough outline of installation
``` bash
wget sources
follow spl instructions (may warn/error about empty dkms module, this is OK)
follow zfs instructions (may warn/error about empty dkms module, this is OK)
cd zfs-0.7.13 && make deb-utils && for file in *.deb; do echo $file; done
Run sudo gdebi -q --non-interactive $file for each in the list that makes sense to install (omit test and dracut packages)
dkms build spl/0.7.13
dkms install spl/0.7.13
dkms build zfs/0.7.13
dkms install zfs/0.7.13
systemctl enable zfs-import-cache zfs-import.target zfs-mount zfs-share zfs.target
```
## Monitor For Common Problems
For some reason the Pine64 and SOPine can have problems with "clock jumps" (ie. jumping forward 95 years) due to kernel bugs. They can also have major IO stalls when writing heavily to micro-sd cards, so much so the board becomes basically non-responsive for many minutes (upwards of 10).
The below Monit configuration and setup will monitor for both events and reboot the board in the event either happens. Currently this seems to be the least-worst option for recovery.
### Monit Install / Initial Config
``` bash
apt install monit
nano -w /etc/monit/monitrc
set mail-format { from: user@domain.tld }
set alert admin@domain.tld
set mailserver mail.domain.tld port 587
username "user@domain.tld" password "apassword"
using tls
set httpd port 2812 and
allow admin:apassword
allow guest:guest readonly
#with ssl { # enable SSL/TLS and set path to server certificate
# pemfile: /etc/ssl/certs/monit.pem
#}
```
### Monit Monitor for large clock jumps forward
```/usr/local/bin/check_clock_jump.py```
``` python
#!/usr/bin/env python3
import datetime
import sys
FORMAT_STRING = '%Y-%m-%d %H:%M:%S'
MAX_TIME_JUMP = datetime.timedelta(days=90)
CACHE_FILE = '/var/cache/last_time.check'
current_time = datetime.datetime.now()
last_time = current_time
try:
with open(CACHE_FILE, 'r') as f:
last_time = datetime.datetime.strptime(f.read().strip(), FORMAT_STRING)
except FileNotFoundError:
pass
timedelta = current_time - last_time
if timedelta > MAX_TIME_JUMP:
sys.exit(1)
with open(CACHE_FILE, 'w') as f:
f.write(current_time.strftime(FORMAT_STRING))
sys.exit(0)
```
``` bash
chmod a+x /usr/local/bin/check_clock_jump.py
cat > /etc/monit/conf.d/check_clock_jump.conf <<EOF
check program check_clock_jump with path /usr/local/bin/check_clock_jump.py
if status != 0
then exec "/bin/systemctl reboot"
as uid "root" and gid "root"
EOF
systemctl restart monit
```
### Monit monitor for ```card_busy_detect status: 0xe00``` kernel errors
``` bash
cat > /etc/monit/conf.d/card_busy_detect.conf <<EOF
# From docs: On startup the read position is set to the end of the file and Monit continues to scan to the end of the file on each cycle.
check file kernel path /var/log/kern.log
if content = ".*card_busy_detect status: 0xe00.*"
then exec "/bin/systemctl reboot"
as uid "root" and gid "root"
EOF
systemctl restart monit
```