Set up the development environment
It is good practice to keep the packages separated from OpenWrt’s source code. In order to do that, we can create a specific folder for our packages:
cd /home/openwrt/code/ mkdir hackathon
The OpenWrt build system uses a specific file called
feeds.conf.default which indicates the package feeds that will be made available during the firmware configuration stage. In order for the package containing the application to be made visible in the first place, it is necessary to include the new package feed into this file. We can do so executing:
cd ~/code/barrier_breaker echo "src-link hackathon /home/openwrt/code/hackathon" >> feeds.conf.default
Download the source code
Now, download the file luci-cell-location.zip and extract it in the
After having done this, you should already be able to compile the new package. In order to do so, it is needed to update the feeds in the first place and install the package so the OpenWrt build system has it indexed:
cd ~/code/barrier_breaker ./scripts/feeds update hackathon ./scripts/feeds install -a -p hackathon
make menuconfig and select the package to be compiled:
- Scroll down and select MaestroPackages. Press Enter.
- You should see a Hackathon entry now, press Enter again.
- You should see luci-cell-location. Type ‘m’.
- Press arrow-right to select Exit and press Enter.
- Repeat the step above until you get a prompt asking you to save the new configuration. Select Yes and press Enter.
Now, OpenWrt’s build system has all the information about your package and it is ready to be compiled. There is a custom script that will compile the package and copy it automatically to the router (provided that you have set up the SSH access). To execute it, run:
Install the package in the router
Once the make-script finishes its executing, the package for luci-cell-location should be present in the router’s filesystem. You can check that easily by executing following command in the router (which should display one result):
ls -l /tmp/luci-cell*
You can now install the package:
opkg install /tmp/luci-cell-location_1.1.0_ramips_24kec.ipk
After doing this, you should now have a new entry in the web interface of the router. Login to your router and go to Services > Cell Location. You will need to sign up to get a Google Geolocation API key and set it in the Settings tab. Once that is done, your router will display its approximate location based on its cellular data: