Giter Club home page Giter Club logo

openwrt-binary-patching's Introduction

Patching mt76x0-common.ko Module on OpenWRT Devices

This guide explains how to replace and verify a patched mt76x0-common.ko kernel module on OpenWRT. The provided steps involve hex editing, copying, and verifying the module for a specific use case.

Replace patch

Replace occurrences of 122c54f2 with 122c3cf2 in the mt76x0-common.ko module and create a patched binary

hexdump -ve '1/4 "%.8x\n"' /rom//lib/modules/$(uname -r)/mt76x0-common.ko | \
sed -e 's/^122c54f2/122c3cf2/' | \
sed -re 's/(..)(..)(..)(..)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g' | \
xargs -n1 printf > /tmp/mt76x0-common.ko

Copy and Reboot

Copy the patched binary (mt76x0-common.ko) into its appropriate location and reboot.

cp /tmp/mt76x0-common.ko /lib/modules/$(uname -r)/mt76x0-common.ko

Verify Size

Verify the size of the patched module and the original module.

ls -ld /rom/lib/modules/$(uname -r)/mt76x0-common.ko /tmp/mt76x0-common.ko

Sample output:

-rw-r--r-- 1 root root 36348 Oct 23 16:16 /rom/lib/modules/5.10.149/mt76x0-common.ko
-rw-r--r-- 1 root root 36348 Feb 22 11:21 /tmp/mt76x0-common.ko

Verify MD5

Verify the MD5 checksum of the patched module and the original module.

md5sum /rom/lib/modules/$(uname -r)/mt76x0-common.ko /tmp/mt76x0-common.ko

Sample output:

e0969068be26377f507baadbd414344e /rom/lib/modules/5.10.149/mt76x0-common.ko
3fc05113be1a1a7e4d405cdbd6197ab1 /tmp/mt76x0-common.ko

Please note that the checks are specific to one of the OpenWRT devices. Each user/device might have its own size, kernel version, and MD5 sums for verification.

openwrt-binary-patching's People

Contributors

harryrosianto avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.