-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
356 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
IMAGE_MB=512 | ||
MIRROR=http://mirrors.kernel.org/debian | ||
SYSTEM=debian | ||
ARCH=arm64 | ||
SUITE=stretch | ||
|
||
read -r -d '' EXTRA_PACKAGES << EOF | ||
alsa-utils | ||
bluez | ||
dosfstools | ||
dnsutils | ||
ifupdown | ||
insserv | ||
iputils-ping | ||
isc-dhcp-client | ||
kmod | ||
less | ||
libbluetooth3 | ||
locales | ||
net-tools | ||
openssh-client | ||
openssh-server | ||
parted | ||
rfkill | ||
systemd | ||
systemd-sysv | ||
udev | ||
vim-tiny | ||
wireless-tools | ||
wpasupplicant | ||
EOF | ||
|
||
HOSTNAME=nanopi_neo_plus2 | ||
LOCALE=en_US.UTF-8 | ||
|
||
post_install() { | ||
find "${ROOTFS}/usr/share/doc" ! -name copyright -type f -delete | ||
find "${ROOTFS}/usr/share/doc" -type d -delete > /dev/null 2>&1 | ||
rm -rf "${ROOTFS}/usr/share/man/"* | ||
rm -rf "${ROOTFS}/usr/share/info/"* | ||
rm -rf "${ROOTFS}/usr/share/lintian/"* | ||
|
||
cat >> "${ROOTFS}/etc/securetty" << EOF | ||
ttys0 | ||
EOF | ||
|
||
cp -r "${DIBS}/targets/nanopi_neo_plus2_overlay/"* "${ROOTFS}" | ||
sed -i "s/#PermitEmptyPasswords no/PermitEmptyPasswords yes/g" ${ROOTFS}/etc/ssh/sshd_config | ||
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" ${ROOTFS}/etc/ssh/sshd_config | ||
sed -i "s/UsePAM yes/UsePAM no/g" ${ROOTFS}/etc/ssh/sshd_config | ||
run_target /usr/sbin/update-rc.d firstboot defaults | ||
} |
4 changes: 4 additions & 0 deletions
4
targets/nanopi_neo_plus2_overlay/etc/apt/apt.conf.d/02nocache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Dir::Cache { | ||
srcpkgcache ""; | ||
pkgcache ""; | ||
} |
13 changes: 13 additions & 0 deletions
13
targets/nanopi_neo_plus2_overlay/etc/dpkg/dpkg.cfg.d/01_smalldisk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# block documentation | ||
path-exclude /usr/share/doc/* | ||
# keep copyright files for legal reasons | ||
path-include /usr/share/doc/*/copyright | ||
path-exclude /usr/share/man/* | ||
path-exclude /usr/share/groff/* | ||
path-exclude /usr/share/info/* | ||
# lintian stuff is small, but really unnecessary | ||
path-exclude /usr/share/lintian/* | ||
path-exclude /usr/share/linda/* | ||
# block non-us locales | ||
path-exclude /usr/share/locale/* | ||
path-include /usr/share/locale/en* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 | ||
/dev/mmcblk0p1 /boot vfat defaults 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: firstboot | ||
# Required-Start: $remote_fs $syslog | ||
# Required-Stop: | ||
# X-Start-Before: sshd | ||
# Default-Start: 2 3 4 5 S | ||
# Default-Stop: | ||
# Short-Description: First boot configuration. | ||
### END INIT INFO | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
|
||
test "$1" = "start" || exit 0 | ||
|
||
EXPAND_ROOTFS=0 | ||
MAKE_SWAP=1 | ||
SWAP_SIZE=128 | ||
|
||
test -f /boot/firstboot.txt && . /boot/firstboot.txt | ||
|
||
if [ "$EXPAND_ROOTFS" ] && [ $EXPAND_ROOTFS -gt 0 ]; then | ||
if [ "$MAKE_SWAP" ] && [ $MAKE_SWAP -gt 0 ]; then | ||
expand-rootfs.sh -s $SWAP_SIZE | ||
else | ||
expand-rootfs.sh | ||
fi | ||
fi | ||
|
||
/usr/bin/ssh-keygen -A | ||
update-rc.d firstboot disable | ||
|
||
exit 0 |
3 changes: 3 additions & 0 deletions
3
targets/nanopi_neo_plus2_overlay/etc/network/interfaces.d/eth0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
auto eth0 | ||
allow-hotplug eth0 | ||
iface eth0 inet dhcp |
4 changes: 4 additions & 0 deletions
4
targets/nanopi_neo_plus2_overlay/etc/network/interfaces.d/wlan0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
auto wlan0 | ||
allow-hotplug wlan0 | ||
iface wlan0 inet dhcp | ||
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf |
6 changes: 6 additions & 0 deletions
6
targets/nanopi_neo_plus2_overlay/etc/systemd/system/brcm-bluetooth.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
Description=Broadcom firmware and hci service | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/local/bin/brcm-bluetooth.sh |
2 changes: 2 additions & 0 deletions
2
targets/nanopi_neo_plus2_overlay/etc/udev/rules.d/10-brcm-bluetooth.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SUBSYSTEM=="rfkill", ACTION=="change", ATTR{name}=="sunxi-bt", ATTR{state}=="1", RUN+="/bin/systemctl --no-block start brcm-bluetooth.service" | ||
SUBSYSTEM=="rfkill", ACTION=="change", ATTR{name}=="sunxi-bt", ATTR{state}=="0", RUN+="/bin/systemctl --no-block stop brcm-bluetooth.service" |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/etc/wpa_supplicant/wpa_supplicant.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
country=US |
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/config.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PM=0 | ||
nv_by_chip=2 43430 0 nvram.txt 43430 1 nvram_ap6212.txt |
Binary file added
BIN
+328 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a0.bin
Binary file not shown.
Binary file added
BIN
+302 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a0_apsta.bin
Binary file not shown.
Binary file added
BIN
+328 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a0_p2p.bin
Binary file not shown.
Binary file added
BIN
+366 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a1.bin
Binary file not shown.
Binary file added
BIN
+366 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a1_apsta.bin
Binary file not shown.
Binary file added
BIN
+366 KB
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/fw_bcm43438a1_p2p.bin
Binary file not shown.
54 changes: 54 additions & 0 deletions
54
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/nvram.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#AP6212_NVRAM_V1.0_20140603 | ||
# 2.4 GHz, 20 MHz BW mode | ||
|
||
# The following parameter values are just placeholders, need to be updated. | ||
manfid=0x2d0 | ||
prodid=0x0726 | ||
vendid=0x14e4 | ||
devid=0x43e2 | ||
boardtype=0x0726 | ||
boardrev=0x1101 | ||
boardnum=22 | ||
macaddr=00:90:4c:c5:12:38 | ||
sromrev=11 | ||
boardflags=0x00404201 | ||
xtalfreq=26000 | ||
nocrc=1 | ||
ag0=255 | ||
aa2g=1 | ||
ccode=ALL | ||
|
||
pa0itssit=0x20 | ||
extpagain2g=0 | ||
|
||
#PA parameters for 2.4GHz, measured at CHIP OUTPUT | ||
pa2ga0=-168,7161,-820 | ||
AvVmid_c0=0x0,0xc8 | ||
cckpwroffset0=5 | ||
|
||
# PPR params | ||
maxp2ga0=90 | ||
txpwrbckof=6 | ||
cckbw202gpo=0x5555 | ||
legofdmbw202gpo=0x77777777 | ||
mcsbw202gpo=0xaaaaaaaa | ||
|
||
# OFDM IIR : | ||
ofdmdigfilttype=7 | ||
# PAPD mode: | ||
papdmode=2 | ||
|
||
il0macaddr=00:90:4c:c5:12:38 | ||
wl0id=0x431b | ||
|
||
#OOB parameters | ||
hostwake=0x40 | ||
hostrdy=0x41 | ||
usbrdy=0x03 | ||
usbrdydelay=100 | ||
deadman_to=0xffffffff | ||
# muxenab: 0x1 for UART enable, 0x10 for Host awake | ||
muxenab=0x10 | ||
# CLDO PWM voltage settings - 0x4 - 1.1 volt | ||
#cldo_pwm=0x4 | ||
|
54 changes: 54 additions & 0 deletions
54
targets/nanopi_neo_plus2_overlay/lib/firmware/ap6212/nvram_ap6212.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#AP6212_NVRAM_V1.0.1_20160606 | ||
# 2.4 GHz, 20 MHz BW mode | ||
|
||
# The following parameter values are just placeholders, need to be updated. | ||
manfid=0x2d0 | ||
prodid=0x0726 | ||
vendid=0x14e4 | ||
devid=0x43e2 | ||
boardtype=0x0726 | ||
boardrev=0x1101 | ||
boardnum=22 | ||
macaddr=00:90:4c:c5:12:38 | ||
sromrev=11 | ||
boardflags=0x00404201 | ||
xtalfreq=26000 | ||
nocrc=1 | ||
ag0=255 | ||
aa2g=1 | ||
ccode=ALL | ||
|
||
pa0itssit=0x20 | ||
extpagain2g=0 | ||
|
||
#PA parameters for 2.4GHz, measured at CHIP OUTPUT | ||
pa2ga0=-168,7161,-820 | ||
AvVmid_c0=0x0,0xc8 | ||
cckpwroffset0=5 | ||
|
||
# PPR params | ||
maxp2ga0=90 | ||
txpwrbckof=6 | ||
cckbw202gpo=0x5555 | ||
legofdmbw202gpo=0x77777777 | ||
mcsbw202gpo=0xaaaaaaaa | ||
|
||
# OFDM IIR : | ||
ofdmdigfilttype=7 | ||
# PAPD mode: | ||
papdmode=2 | ||
|
||
il0macaddr=00:90:4c:c5:12:38 | ||
wl0id=0x431b | ||
|
||
#OOB parameters | ||
hostwake=0x40 | ||
hostrdy=0x41 | ||
usbrdy=0x03 | ||
usbrdydelay=100 | ||
deadman_to=0xffffffff | ||
# muxenab: 0x1 for UART enable, 0x10 for Host awake | ||
muxenab=0x10 | ||
# CLDO PWM voltage settings - 0x4 - 1.1 volt | ||
#cldo_pwm=0x4 | ||
glitch_based_crsmin=1 |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/lib/firmware/brcm/brcmfmac43430-sdio.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib/firmware/ap6212/fw_bcm43438a0.bin |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib/firmware/ap6212/nvram.txt |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/lib/firmware/brcm/brcmfmac43430a1-sdio.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib/firmware/ap6212/fw_bcm43438a1.bin |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/lib/firmware/brcm/brcmfmac43430a1-sdio.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib/firmware/ap6212/nvram_ap6212.txt |
11 changes: 11 additions & 0 deletions
11
targets/nanopi_neo_plus2_overlay/usr/local/bin/brcm-bluetooth.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
DEVICE=/dev/ttyS3 | ||
BAUD=115200 | ||
MAC=aa:22:33:44:55:66 | ||
|
||
echo > $DEVICE | ||
brcm_patchram_plus --patchram /lib/firmware/ap6212/ --bd_addr $MAC --no2bytes --tosleep 5000 --baudrate $BAUD $DEVICE | ||
sleep 1 | ||
exec hciattach -n $DEVICE any $BAUD |
Binary file not shown.
107 changes: 107 additions & 0 deletions
107
targets/nanopi_neo_plus2_overlay/usr/local/bin/expand-rootfs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#!/bin/bash | ||
|
||
try() { | ||
output=$("$@" 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "error running \"$@\"" | ||
echo "$output" | ||
exit 1 | ||
fi | ||
} | ||
|
||
show_usage() { | ||
echo "Usage: $0 [-s SWAPSIZE]" >&2 | ||
echo "Where SWAPSIZE is a number in megabytes" >&2 | ||
exit 1 | ||
} | ||
|
||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
|
||
case $key in | ||
-s|--swap) | ||
SWAP_SIZE_MB="$2" | ||
shift | ||
;; | ||
*) | ||
show_usage | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
BLOCK_DEVICE=/dev/mmcblk0 | ||
|
||
if [[ ! -b ${BLOCK_DEVICE}p1 ]]; then | ||
echo "1st partition missing. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -b ${BLOCK_DEVICE}p2 ]]; then | ||
echo "2nd partition missing. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ -b ${BLOCK_DEVICE}p3 ]]; then | ||
echo "3rd partition exists. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ -b ${BLOCK_DEVICE}p4 ]]; then | ||
echo "4th partition exists. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
DEVICE_NAME=$(basename ${BLOCK_DEVICE}) | ||
DEVICE_SIZE=$(cat /sys/block/${DEVICE_NAME}/size) | ||
P1_POSITION=$(cat /sys/block/${DEVICE_NAME}/${DEVICE_NAME}p1/start) | ||
P1_SIZE=$(cat /sys/block/${DEVICE_NAME}/${DEVICE_NAME}p1/size) | ||
P2_POSITION=$(cat /sys/block/${DEVICE_NAME}/${DEVICE_NAME}p2/start) | ||
P2_SIZE=$(cat /sys/block/${DEVICE_NAME}/${DEVICE_NAME}p2/size) | ||
|
||
if [[ $P1_POSITION -gt $P2_POSITION ]]; then | ||
echo "1st partition comes after 2nd partition. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
let FREE_SIZE=$DEVICE_SIZE-$P2_POSITION-$P2_SIZE | ||
|
||
if [[ "$SWAP_SIZE_MB" -gt 0 ]]; then | ||
MAKE_SWAP=1 | ||
let P3_SIZE=$SWAP_SIZE_MB*2048 | ||
let P3_POSITION=$DEVICE_SIZE-$P3_SIZE | ||
if [[ $P3_SIZE -gt $FREE_SIZE ]]; then | ||
echo "Swap size larger than available space. Refusing to continue." >&2 | ||
exit 1 | ||
fi | ||
let FREE_SIZE=$FREE_SIZE-$P3_SIZE | ||
else | ||
MAKE_SWAP=0 | ||
fi | ||
|
||
let P2_SIZE=$P2_SIZE+$FREE_SIZE | ||
|
||
if [[ $MAKE_SWAP -eq 1 ]]; then | ||
sfdisk -u S --Linux --no-reread ${BLOCK_DEVICE} >/dev/null 2>&1 << EOF | ||
${P1_POSITION},${P1_SIZE},0x0C,- | ||
${P2_POSITION},${P2_SIZE},0x83,- | ||
${P3_POSITION},${P3_SIZE},0x82,- | ||
EOF | ||
|
||
try partprobe ${BLOCK_DEVICE} | ||
|
||
try mkswap ${BLOCK_DEVICE}p3 | ||
|
||
echo "/dev/mmcblk0p3 none swap sw 0 0" >> /etc/fstab | ||
|
||
try swapon /dev/mmcblk0p3 | ||
else | ||
sfdisk -u S --Linux --no-reread ${BLOCK_DEVICE} >/dev/null 2>&1 << EOF | ||
${P1_POSITION},${P1_SIZE},0x0C,- | ||
${P2_POSITION},${P2_SIZE},0x83,- | ||
EOF | ||
fi | ||
|
||
try resizepart ${BLOCK_DEVICE} 2 ${P2_SIZE} | ||
|
||
try resize2fs -f ${BLOCK_DEVICE}p2 |
1 change: 1 addition & 0 deletions
1
targets/nanopi_neo_plus2_overlay/var/lib/systemd/rfkill/platform-rfkill_bt:bluetooth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |