Press "Enter" to skip to content

Tag: openwrt

OpenWrt路由器架构判断

1, 怎么知道我的OpenWrt使用的是哪种架构的CPU?

$ opkg print-architecture | awk '{print $2}' | grep -v all | grep -v noarch   # 精确的命令
mips_24kc

$ uname -m    # 只能得到大致架构信息
mips

$ . /etc/openwrt_release ; echo $DISTRIB_ARCH
mips_24kc

2, 如何知道我的OpenWrt是32位的还是64位的?

$ cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 10 (v7l)

$ uname -m
armv7l    # 如果是64位系统, 这里会有64位字样出现

提示: ARMv7 都是32位CPU, armv8以上才是64位CPU.

$ echo $SHELL
/bin/ash

$ file /bin/ash
/bin/ash: symbolic link to busybox

$ which busybox
/bin/busybox

$ file /bin/busybox 
/bin/busybox: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1...
1 Comment

在OpenWrt/LEDE系统中处理JSON

在OpenWrt/LEDE系统中处理JSON的方法,这里记录一下。

假设有一个JSON文件

cat /etc/ss.json 
{
	"server": "8.8.8.8",
	"server_port": 443,
	"local_address": "0.0.0.0",
	"local_port": 7070,
	"password": "fuckgfang",
	"method": "aes_128_ctr",
	"timeout": "60",
	"protocol": "auth_aes128_sha1",
	"fast_open": false
}

处理方式1

$ jsonfilter -i /etc/ss.json -e "@.server"
8.8.8.8

$ CONF=/etc/ss.json
$ a=$(jsonfilter -i $CONF -e "@.server")
$ echo $a
8.8.8.8
1 Comment