Edit an Existing Package

Im new to the OpenWrt Dev environment, but not development.
All I want to do is take a copy of mjpg-streamer and modify it for my use.
I can get see the source in the build_dir, and can edit it, but anything like make clean etc and I loose edits.
I have looked at the 'documentation' for using quilt etc, and to be honest if doesnt make much sense.
Is there anyway to simply get the package, modify the source without fighting it trying to sync back to git?


1 Like

Yes this seems what Im after to a fashion, however I change a file (input_uvc.c to input_uvc.cpp) and it doesnt like that. "Cant find file to patch plugins/input_uvc/input_uvc.cpp" and even more oddly it seems to find the input_uvc.c file to build still, even though its deleted.
Oh and it even deletes my input_uvc.cpp file not when I try to rebuild package....
Is there a better example on paching to be found anywhere

Patches can also delete and create files.
Have quilt track the entire directory, then make all of your changes as required and then quilt refresh.
Check this patch is as you’d expect before moving forward.


OK so Patch is new to me, been a windows programmer too long, and I think I have mucked things up now.
I deleted the input_uvc.c file and created an input_uvc.cpp file....that was the last thing I did that went well :frowning:
Now building gives the below, the input_uvc.c file stays gone but it also removes the input_uvc.cpp file.

Applying ./patches/030-remove-git-hash-version-number.patch using plaintext:
patching file CMakeLists.txt
patching file plugins/input_uvc/CMakeLists.txt
patching file plugins/input_uvc/input_uvc.c
can't find file to patch at input line 965
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|--- a/plugins/input_uvc/input_uvc.cpp

+++ b/plugins/input_uvc/input_uvc.cpp
No file to patch. Skipping patch.
1 out of 1 hunk ignored
Patch failed! Please fix ./patches/030-remove-git-hash-version-number.patch!

Is there a simple way to 'checkout' the mjpg-streamer code, edit it locally and build as normal, make?

"Working with patches" documents how to work with quilt.

Alternatively research diff -u you copy a certain file to make an original file.
You edit the file and then diff -u the edited file with the original file now you have a patch file.
Make the diff from the directory you want to use to patch, see below to get the correct file path.

When you are done with setup then add your patches (I have different patches) with:
patch -p1 < patchfile
-p1 removes the first / in the path if there is any change as needed

I have this more or less automated with some scripts

1 Like

Thanks all, I have managed now to get to the point where I can build the mjpg streamer as basically a new package which is great.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.