adnan wrote:Is it means that I have to locate the downloaded code inside the openwrt build root directory ? or ?
No, you do not need to unpack the source code of your new program into the OpenWRT build directory. You can unpack it wherever you want to. In fact, it is recommended to unpack the sourcecode outside of the build directory.
adnan wrote:why does it necessary to set the path variable?
The path variable ensures that commands such as 'cc' that the external source's makefile invokes get directed to the cross-compilation tools that are built as part of the OpenWRT Buildroot's build process. These tools are capable of building binary images that can run on the target system. This is the essence of what cross-compilation does.
adnan wrote:I can not understand that where should I put the downloaded code to be compile. Inside the openwrt build root directory there is a file name "Makefile" and my downloaded source directory has a file named "Makefile" . Should I patch them for compiling??
I recommend you unpack your new program's source code somewhere else, say, '/home/user/myshinyprogram/'
It is possible to integrate your external program to be a part of the OWRT build process, so that it gets compiled and placed to the root filesystem image that you can then flash to your router. This is known as adding a new package into the OWRT.
But I recommend you do not attempt this yet. Creating a new package is not necessary in order to test your program, and it is quite difficult to do unless you know the ins and outs of the OWRT build system.