Skip to content

Instantly share code, notes, and snippets.

View mcprat's full-sized avatar

Michael Pratt mcprat

  • Ohio
  • 23:21 (UTC -04:00)
View GitHub Profile
@mcprat
mcprat / fwupgrade.sh
Created June 26, 2020 03:29
ENS202EXT OEM upgrade process
#!/bin/sh
. /lib/upgrade/common.sh
firmware="/tmp/firmware.img"
tmpdir="/tmp/_upgrade"
output="/dev/ttyS0"
fw_env_config="/etc/fw_env.config"
sectorsize="$([ -f "${fw_env_config}" ] && grep "/dev/mtd1 " "${fw_env_config}" | sed -e "s/^\([^ \t]*[ \t]*\)\{4\}.*/\1/g")"
if [ -f "/etc/modelname" ]; then
@mcprat
mcprat / before-upgrade.sh
Created June 26, 2020 03:31
ENS202EXT OEM upgrade process pre-script
#!/bin/sh
rootfs_mtd="$(cat /proc/mtd | grep \"rootfs\" | cut -d : -f 1)"
rootfs_size="$(($( ( fw_printenv | grep ^rootfs_size= | cut -d = -f 2 ) 2>&- )))"
if [ ! -f "/rom/note" -a -n "${rootfs_mtd}" -a ${rootfs_size} -gt 0 ]; then
. /lib/functions/boot.sh &&
umount -l /jffs &&
pivot /rom /mnt &&
umount -l /mnt &&
{
@mcprat
mcprat / dmesg.log
Created June 26, 2020 08:07
ENS202EXT first boot kernel log ath79 master - jffs2 fixed no config restore
[ 0.000000] Linux version 5.4.48 (pi@SDDesk) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r13342+179-e35e40ad82)) #0 Tue Jun 23 20:20:29 2020
[ 0.000000] printk: bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[ 0.000000] MIPS: machine is Engenius ENS202EXT
[ 0.000000] SoC: Atheros AR9341 rev 1
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000000000000-0x0000000003ffffff]
@mcprat
mcprat / dmesg.log
Created June 29, 2020 18:41
ENS202EXT openwrt ath79 stable 19.07.3
[ 0.000000] Linux version 4.14.180 (pi@SDDesk) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11063-85e04e9f46)) #0 Sat May 16 18:32:20 2020
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[ 0.000000] MIPS: machine is Engenius ENS202EXT
[ 0.000000] SoC: Atheros AR9341 rev 1
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
@mcprat
mcprat / repo.md
Last active January 21, 2021 04:22
Adafruit Blinka FT232H SPI NOR flash chip scripts
@mcprat
mcprat / msvcrt-functionkey-dict.py
Last active October 10, 2022 23:17
msvcrt.getch() function key scan codes to ANSI escape code dictionary
# SPDX-License-Identifier: (GPL-2.0-only OR Apache-2.0)
"""
Windows function key scan codes to ANSI escape code dictionary:
Pause/Break, Ctrl+Alt+Del, Ctrl+Alt+arrows not mapable
Input: ordinal of char from msvcrt.getch()
Output: bytes string of ANSI escape sequence for linux/xterm
numerical used over linux specifics for Home and End
VT or CSI escape sequences used when linux has no sequence
@mcprat
mcprat / .config
Created July 16, 2020 11:16
.config for master WR710N build (DEVICE_PACKAGES missing)
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_generic=y
CONFIG_TARGET_ath79_generic_DEVICE_tplink_tl-wr710n-v1=y
CONFIG_HAS_SUBTARGETS=y
CONFIG_HAS_DEVICES=y
CONFIG_TARGET_BOARD="ath79"
CONFIG_TARGET_SUBTARGET="generic"
CONFIG_TARGET_PROFILE="DEVICE_tplink_tl-wr710n-v1"
@mcprat
mcprat / ovpn.sh
Created August 6, 2020 17:57
ASH shell Openwrt Openvpn .ovpn script
#!/bin/sh
PKI_DIR=/etc/easy-rsa/pki
CRT_DIR=/etc/easy-rsa/pki/issued
KEY_DIR=/etc/easy-rsa/pki/private
OUTPUT_DIR=/etc/openvpn
BASE_CONFIG=/etc/openvpn/client.confbase
cat ${BASE_CONFIG} >> ${OUTPUT_DIR}/${1}.ovpn
echo -e '<ca>' | cat >> ${OUTPUT_DIR}/${1}.ovpn
cat ${PKI_DIR}/ca.crt >> ${OUTPUT_DIR}/${1}.ovpn
@mcprat
mcprat / history.txt
Created August 6, 2020 18:16
ASH shell Openwrt Openvpn server setup process
cd /etc/easy-rsa/pki
export EASYRSA_PKI="/etc/easy-rsa/pki"
export EASYRSA_REQ_CN="organization"
easyrsa init-pki
easyrsa gen-dh
easyrsa build-ca nopass
easyrsa build-server-full organization nopass
easyrsa build-client-full stream
easyrsa build-client-full program
@mcprat
mcprat / client.confbase
Created August 6, 2020 18:18
Openwrt Openvpn example client configuration baseline
client
dev tun
proto udp
remote organization.com 9105
resolv-retry infinite
nobind
persist-key
persist-tun
keepalive 10 120
remote-cert-tls server