OpenWrt Forum Archive

Topic: Making small changes in a simple module

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

After 8 years of using OpenWrt I decided to dabble into development. I looked at bandwidthd code on sourceforge, and it looks like I can handle the changes that I want. Ideally, I want to create a new package, luci-app-bandwidthd to be able to see bandwidth screen as one of the tabs on the status page... but first things first.

I have a Linux system, and this is what I've done:

  1. Installed BuildRoot based on http://wiki.openwrt.org/doc/howto/buildroot.exigence

  2. Unfortunately, I found two different instructions for building individual packages: http://wiki.openwrt.org/doc/howto/build … e.packages and http://wiki.openwrt.org/doc/howtobuild/single.package Not sure which way is most current; I tried both.

  3. So, I ran the following:

svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment
cd attitude_adjustment
./scripts/feeds install -a
make defconfig
make prereq

make tools/install
make toolchain/install
make package/bandwidthd/compile
make package/bandwidthd/install
make package/index

Everything ran fine.

Now I have  bin/ar71xx/packages/ with libc, libgcc, Packages, and Packages.gz, but no bandwidth package. Second, I don't see the source code. There is package/feeds/packages/bandwidthd/ and feeds/packages/utils/bandwidthd/ that look very similar - but neither of them have any C code.

The documentation is very detailed and very helpful - so it is possible I missed something obvious. If that is the case, a gentle pointer to the right place would be greatly appreciated smile

What I do is:

cd ~
[[ -d ~/.openwrt ]] && rm -rf ~/.openwrt
[[ -d ~/aa ]] && rm -rf ~/aa

svn checkout svn://svn.openwrt.org/openwrt/branches/attitude_adjustment ~/aa
cd ~/aa

cat > ~/aa/feeds.conf <<EOF
src-svn packages svn://svn.openwrt.org/openwrt/packages
src-svn luci http://svn.luci.subsignal.org/luci/branches/luci-0.11
EOF

./scripts/feeds update
./scripts/feeds install -a

cat >> ~/aa/.config <<EOF
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_bandwidthd=m
EOF

make menuconfig
make defconfig
make V=s 

(Last edited by written_direcon on 17 Dec 2012, 07:50)

Thank you very much! It took two hours and over 6GB, but I see ./bin/ar71xx/packages/bandwidthd_2.0.1-4_ar71xx.ipk. Since I am now following your guidance, and not a wiki page, could you also answer a few questions:

  1. I can remove "stock" package from the router - opkg remove. But what is the best way to install from the server on the lan? Will opkg find it locally if I copy ipk to the router? I guess, I can access the file through ftp or http if necessary. Or somehow change opkg.conf?

  2. The only place where I can find C code is in ./build_dir/target-mips_r2_uClibc-0.9.33.2/bandwidthd-2.0.1. Is it the right place to make changes?

  3. Once I make the changes, what's the way to just build just the package? I wouldn't want to build all firmware images every time I make a small change in the C code smile

Thank you. Again, if it is documented somewhere, and I missed it - I apologize. I assume, it is something that everybody goes through once...

The discussion might have continued from here.