OpenWrt Forum Archive

Topic: How to change a source file without it being restored during make

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

The title says it all smile
I want to do a little change to a source and then make the package with the new source but every time I run "make" the source is being restored to its original state. Can I make it skip the restoration of the source?
Thanks

what is the path to the source file? I'd need to reboot in linux to check, but there is a path to the "originals" and a path to what the make command generates. Will reboot and get back to you.

EDIT: so openwrt/trunk/build_dir is not safe: this changes every time you run make (I think)

(Last edited by robthebrew on 1 Nov 2012, 14:38)

Thanks!
Are you sure there is a folder with the sources extracted where I could change them or do I have to extract them myself, change them, pack them again to a .tar.gz and put it back in place?

btw, if anybody knows, is there a way to do something like "make --noextract" ?

You can directly modify the source that lies in the main Openwrt source tree. e.g. [openwrt.git]/target/linux/ar71xx/base-files/sbin/wget2nand. But if you want to modify a source file from a package that is downloaded during the make process, you need to create a patch file for that package and place that patch file in /patches directory of the package. Then Openwrt make will automatically patch the downloaded sources again at the next make.

There can be several patch files, which will be applied in order.
Wiki has info, but a bit complicated: http://wiki.openwrt.org/doc/devel/patches

Bug tracker is down, so I am providing links to nbd's git mirror. See busybox package as example:

Main:
http://nbd.name/gitweb.cgi?p=openwrt.gi … b3;hb=HEAD

Patches dir:
http://nbd.name/gitweb.cgi?p=openwrt.gi … e1;hb=HEAD

Example, pacth for init/init.c :
http://nbd.name/gitweb.cgi?p=openwrt.gi … 51;hb=HEAD

Thank you very much for the detailed answer.

I ended up extracting the sources, modifying them and putting them back to an archive with the same name under the folder "dl". This way the files were extracted from my archive instead of from the original and I didn't have to create a patch for that.

Knowing how to create a pach it useful but fortunately I didn't need it this time.

The discussion might have continued from here.