逍遥游

�ڴ治��, ��Ҫ����swap

sudo fallocate -l 2G /swapfile # �½� 2G ��С�� swap
sudo chmod 600 /swapfile # Ȩ��Ҫ��ȷ
sudo mkswap /swapfile # ��ʽ���� swap
sudo swapon /swapfile # ���� swap

free -h �鿴

�����ڴ�
export NODE_OPTIONS=”–max-old-space-size=1536”

����ʱ���ٽ���
npm install –unsafe-perm –no-audit –no-fund –maxsockets=1 –verbose

新版的armbian 在https://github.com/ophub/amlogic-s9xxx-armbian/releases里面,比我自己几年前编译的好多了, 但是wifi还是没有装驱动,可以手动编译一个

数码视讯的Q7的8189fs 驱动 ,注意, 必须要这个分支

1
2
3
4
5
6
7
8
git clone -b rtl8189fs  https://github.com/jwrdegoede/rtl8189ES_linux.git

然后就是编译
make -j4 ARCH=arm64 KSRC=/usr/lib/modules/$(uname -r)/build
sudo cp 8189fs.ko /usr/lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/
sudo depmod -a
sudo modprobe 8189fs

我这个armbian版本的内核比较新.6.1版本, 4.x版本也试过,没问题

先安装必要的包

如果venv没有,先安装,我的python是3.12 , 根据你版本安装

安装下面的包
apt update
apt install python3.12-venv
apt install python3.12-dev
apt install portaudio19-dev

创建虚拟环境
python3 -m venv env
source env/bin/activate

安装包
pip3 install pvporcupine
pip3 install wheel
pip3 install pyaudio
pip3 install requests
pip3 install websocket-client
pip3 install openai

因为我这个电视盒原来有个音频设备, 现在修改第二个声卡为缺省声卡, 就是用usb声卡作为缺省声卡

编辑这个文件, 如果没有创建一个
/etc/asound.conf

1
2
3
defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

调整声音大小用
alsamixer
打开这个程序可以看到usb声卡名称, 就说明上面设置对了

安装一个可以用python i2c 驱动一个显示屏的库
pip3 install luma.oled

前提是用一个CH347T做个一个usb 转i2c 的板
这个板的驱动可以github上面下载编译安装.

linux下面设置环境变量

包括在windows下面的bash等环境

1
2
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

Docker

上网桥接
docker network inspect bridge

ip addr show docker0
你会看到一个像 172.17.0.1 的地址,这个就是 Docker 容器与主机之间的网桥地址。

步骤 2:运行 Docker 容器并配置代理
你需要将容器的网络流量通过 Clash 代理,可以通过以下几种方式实现:

方法 1:在容器运行时设置环境变量
运行容器时,通过环境变量设置代理:

bash
复制代码

1
2
3
export HTTP_PROXY=http://172.17.0.1:7890
export HTTPS_PROXY=http://172.17.0.1:7890
export NO_PROXY=localhost,127.0.0.1

验证网络连接:

测试代理是否生效,例如:

bash
复制代码
curl https://www.google.com

  1. 使用 Docker Volumes(卷)
    Docker 卷允许你将容器的数据保存在主机的文件系统上。即使容器被删除,数据仍然保留在卷中。

创建和使用卷:

1
docker run -it --rm -v /path/on/host:/path/in/container node:18 bash

-v /path/on/host:/path/in/container:这将主机的 /path/on/host 目录与容器的 /path/in/container 目录进行挂载。所有写入 /path/in/container 的数据都会存储在主机的 /path/on/host 目录中。
示例:

1
docker run -it --rm -v ~/mydata:/data node:18 bash

在容器中对 /data 目录进行的所有更改都将保存在主机的 ~/mydata 目录中,即使容器停止或删除,数据也不会丢失。

过程记下来怕忘记了

  1. 打开amlogic 烧写软件, 打开Android的镜像.目前比较可行 晶晨S905L-R3300L-V21C-双直播当贝桌面-集成更多遥控适配-解决无线和直播卡顿问题-20180524版.img 这个文件, 打开烧录
  2. 靠近网口的usb (ba860盒子) 口连接到pc
  3. 短接C125 电容 (ba860盒子)
  4. 插入电源,不要松开C125 直到烧写完.
  5. ttl口接到PC,115200, 启动android.
  6. 插入我之前烧好了一个不记得什么系统的tf卡.
  7. 启动后,输入reboot update.
  8. 搞定后,可以换成armbian的系统卡.

不废话,直接上流程

服务区端

mt7621的cpu的一个路由器 ,跑mipsle的程序,

客户端

这个客户端时一个wr703n的路由器, 用来做mqtt server , 跑mips程序,其中把web控制页面透过frp共享出去. 端口为80 .

frpc.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[common]
server_addr = xxx.xxx.com
server_port = 7000


# decide if exit program when first login failed, otherwise continuous relogin to frps
# default is true
login_fail_exit = true


# auth token
token = xxxxxxxxxxxxx


#[ssh]
#type = tcp
#local_ip = 127.0.0.1
#local_port = 22
#remote_port = 6000


[tai_web]
type = http
local_port = 80
privilege_mode = true
custom_domains = abc.abc.com


custom_domains = abc.abc.com 这个域名必须域名解析器加上,让其解析到 服务器ip,或者服务器的域名.

下面自启动进程

必须先安装 nohup

1
2
opkg update
opkg install coreutils-nohup

增加下面这个文件

/etc/init.d/frpc

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

START=99

start() {
sleep 60; nohup /root/frp_0.35.1_linux_mips/frpc -c /root/frp_0.35.1_linux_mips/frpc.ini >/tmp/nohup.out 2>&1 &
}

stop() {
kill -9 `ps | grep '/root/frp_0.35.1_linux_mips/frpc' | grep -v 'grep' | awk '{print $1}'`
}

在/etc/rc.d/ 增加一个链接文件

ln -s /etc/init.d/frpc /etc/rc.d/S99frpc

/etc/apt/source.list

1
2
3
4
5
6
7
8
9
10
11
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

为了小孩多听粤语,想播放以前收音机里面的小说节目,于是做了一个这样的东西, 每天定时大约吃饭时间播放一集节目, 第一季节目就播三国演义把.

垃圾电视盒刷armbian, 接usb 声卡, 一个功放模块,一个控制模块, 三个模块都是自己做了, 控制模块是usb转串口,接一个单片机,控制功放模块的电源, 因为24小时不停待机,因此不播放的时候要休眠状态.
垃圾电视盒是没有IO的,所以有这个东西.

安装所有必须的东西
samba, cifs-utils , 音频文件在nas上,所以要装samba 共享.
stty,控制串口波特率等
sox , 播放mp3的的东西
apt-get install libsox-fmt-all 支持mp3
python, 控制脚本

python 脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python

import json
import os
import linecache
import sys



filename = 'cur_play_id.json'
list_name = 'play_list'
index=1


os.system('stty -F /dev/ttyUSB0 115200')
os.system ('echo ":9000020101aa\r\n" >> /dev/ttyUSB0')
os.system ('play sanya.mp3')

if len(sys.argv) > 1 :
list_name= sys.argv[1]

print(list_name)



try:

with open (filename) as f_obj:
ja=json.load(f_obj)
index=ja['cur_index']
index = index +1

except FileNotFoundError:
print("index file Not Found!@!!!")
index = 1


try:

play_file = linecache.getline(list_name,index).strip()
if play_file =='' :
print ("end of play list file")
else :
a_cmd = 'play ' + play_file
print(a_cmd)
os.system(a_cmd)
os.system ('echo ":9000020100aa\r\n" >> /dev/ttyUSB0')

except FileNotFoundError:
print ("Play List file not found!!")
os._exit(0)



data_dic = {'cur_index':index}

with open(filename,'w') as f:
json.dump(data_dic,f)



用法就是python play_mp3.py list.txt

生成播放列表文件的脚本

1
ls -1 |awk '{print i$0}' i=`pwd`'/' > list.txt

#设置mac

盒子mac 没有,
直接编辑 /etc/network/interfaces 文件,在 iface eth0 inet static 后面添加一行:
pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx(要改成的MAC)

1
2
3
4
5
iface eth0 inet static
pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx(要改成的MAC)
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

对于wifi 也是一样

另外一种说法 uboot 中设置,不过我试过不行

/boot/uEnv.ini  

dtb_name=/dtb/meson-gxl-s905d-phicomm-n1.dtb
bootargs=root=LABEL=ROOT_EMMC rootflags=data=writeback rw console=ttyAML0,115200n8 console=tty0 no_cons…………………..
ethaddr=42:b8:79:09:d8:ed

#设置时区

1
echo "Asia/Shanghai" > /etc/timezone && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#设置语言环境
/etc/environment

1
2
3
ARCH=arm64
LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"