First, let’s download the sources of a distribution, compile it as it comes and install it in the router. The next step would be to modify a part of it as you need. Download the source code from WhiteRussian distribution from this page:
Use this URL:
unzip and move to the whiterussian-0.9/ folder. You should start by reading the README file or follow these instructions.
type the following command if you want to change setup options before compiling the distribution:
> make menuconfig
In my case, I didn’t need to mess with that configuration. Probably you won’t need.
The way OpenWrt is created is as follows: All you download are configuration files. When you run the compilation scripts, they will download the source files from the Linux kernel and other programs needed, like the sources of the gcc compiler, the libraries for STD, and others. In the case of WhiteRussian, it downloads the sources for kernel version 2.4. Be aware that it will download the zip of the sources only if it’s not found under the /dl folder of the root folder. So, the first time you compile it, it will download all the libraries and the kernel. The next time this won’t happen, unless files are deleted from /dl folder.
If you want to modify the sources, what I’ve done so far is modifying the Linux kernel. Because WhiteRussian downloads the kernel from a well known Linux kernel download website, it’s necessary to tell the compilation scripts that I want it to download my modified version of the source files. In my case, I downloaded the source files for the kernel, applied a patch, zipped again, and uploaded it to my website. Then I found the configuration file I needed to modify, which is found here:
And opened the Makefile. There I found the variable LINUX_HEADERS_SITE, which was set to the Linux kernel download website, and changed it to the following:
I also modified the LINUX_KERNEL_MD5SUM, which of course changed when I compiled the sources again. (The md5sum the file comes with should be the one for the kernel files located in the Linux website, which of course doesn’t change)
Then I ran “make clean” and “make” to see the changes.