Applying patch to the router made from the hello world documentation of Openwrt

I made a patch using the openwrt documentation of hello world...That can be found in the following file

saka@saka-VirtualBox:~/Music/source/build_dir/target-mips_24kc_musl/helloworld-1.0$ ls
functions.c  functions.h  helloworld.c  patches
saka@saka-VirtualBox:~/Music/source/build_dir/target-mips_24kc_musl/helloworld-1.0$ cd patches/
saka@saka-VirtualBox:~/Music/source/build_dir/target-mips_24kc_musl/helloworld-1.0/patches$ ls
100-add_module_files.patch  101-use_module.patch  series

How to apply these patches into the router file system and how to check if it is working?

I assume you're referring to https://openwrt.org/docs/guide-developer/helloworld/chapter7 yes?

That is explaining how to use quilt to manage patches. That is typically an advanced topic that is "only" if you need to modify kernel source or other source downloaded from remote repos, such as the hostap package, for example. If it just your own code, you can modify it directly and save the changes on your git branch.

I find the description at https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem much clearer.

1 Like

You do not apply patches to a running device, you apply them into a building environment, then build and install a whole firmware.

Perhaps you just need to cross-compile a program, instead.

1 Like

I made the patch as given in the documentation if that's correct how to locate the firmware that was made...else how to create a patch using build environment....

I am about to create a custom program that optimises the mesh path in a network..and I want to test such packages in the router how to go about it...

If I am not wrong the program I created can be implemented in the routers as

  1. Patch by using quilt

  2. Executable package as given here (https://openwrt.org/docs/guide-developer/helloworld/chapter5
    )

Will the complex programs work fine if made as executable package?

The basic steps are to:

  • Create a new package, including its Makefile
  • Build OpenWrt, with your new package included in the build
  • Either
    • Flash an image with your custom package included
    • Upload your custom package to your OpenWrt device and use opkg to install
4 Likes