Skip to content

Instantly share code, notes, and snippets.

View svanheule's full-sized avatar

Sander Vanheule svanheule

View GitHub Profile
&switchcore {
port-leds {
compatible = "realtek,maple-port-led";
#address-cells = <3>;
#size-cells = <0>;
realtek,output-mode = "serial";
/*
* For lan_100-*, use rtl_hw_trigger values 'f' (Link/Act 100M/10M)
@svanheule
svanheule / rtl-switchcore.dts
Created May 14, 2021 10:58
Realtek switchcore binding
switchcore@1b000000 {
/* Generic Maple switchcore binding */
compatible = "realtek,switchcore-maple", "syscon", "simple-bus";
ranges = <0 0x1b000000 0x10000>;
/* child nodes */
};
switchcore@1b000000 {
/* RTL8380 rev. A specific binding, for potential quirks */
@svanheule
svanheule / patch-safeloader.py
Last active January 16, 2024 20:51
safeloader patching script for OpenWrt
#!/usr/bin/python3
# This file allows modifying a a safeloader factory image.
# It can be used to transplant a partition from one image into another, or to update the
# firmware version info.
# The procedure to calculate the hash and the required salt are described at:
# https://github.com/openwrt/openwrt/blob/master/tools/firmware-utils/src/tplink-safeloader.c
import argparse
import binascii
@svanheule
svanheule / parse.py
Created October 21, 2020 21:20
TP-Link OC200 image validation
#!/usr/bin/python3
import argparse
import binascii
import hashlib
import struct
# Image header starts with four uint32_be, followed by an MD5 digest
# * version (?)
# * magic number (0xaa55d98f)
# * header length (0x1000)