Custom Configuration OpenWrt

Gateworks uses OpenWrt and it boots up by default properly.

However, the install can be tweaked however the user wants.

This must be done at COMPILE time however.

make menuconfig

At the command prompt in the trunk directory where the Gateworks code was checked out, type the command:

/gateworks-openwrt-x/gateworks-openwrt/trunk$ make menuconfig

You will be presented with a GUI that looks like so:

You can now make any changes, using the space bar to select different items. Select the asterisk next to the line item you want.

NOTE:Once you make any changes, exit and save.

There is a config file in the gateworks-openwrt directory as well as the trunk directory. If a 'make cns3xxx' (Laguna) is ran after doing a make menuconfig, it will wipe out the changes done in make menuconfig.

Therefore, run a make -j8 V=99 in the OpenWrt trunk directory, followed by a make images/laguna in the upper directory to get a fresh firmware.

/gateworks-openwrt/trunk$ make -j8 V=99

The newly generated firmware will contain the packages selected. The individual IPK files should also be listed at (for Laguna boards) /trunk/bin/cns3xxx/packages

Then, the make images/laguna command (Laguna) compiles the artifacts from trunk into a firmware binary (.bin) to be flashed to the board.

make images/laguna

Specific Examples

Turning on GDB Server

If you desire to turn on GDBServer you can do that in the make menuconfig. Go to the main menu item titled 'Development' and you will see it in there. Use the space bar to select the line with an asterisk as seen below:

Configuring Flags for Packages

Below is simply an example for something like StrongSwan:

OpenWrt like other OS build systems is a collection of recipes that provide instructions for fetching, patching, configuring, building, and packaging various apps so someone had to go and create that recipe for StrongSwan? and that creator decided what modules and configurations to use and/or be selected. For OpenWrt the recipes are based off of GNU make files and for strongswan you will find this recipe in package/feeds/packages/strongswan/Makefile which is symlinked to feeds/packages/net/strongswan (not really important until/unless you want to start revision controlling your changes then you need to understand that this is provided in the packages package feed which is not part of the main OpenWrt git). Looking at that file you can see that the author used PKG_MOD_AVAILABLE as a list of modules which ends up getting used in CONFIGURE_ARGS passed to the configure script to use --enable-<modname> and --disable-<modname>. So, assuming the 'forecast' module is enabled with a --enable-forecast you could simply add 'forecast' to the PKG_MOD_AVAILABLE list which will create a strongswan-mod-forecast option in the menuconfig that should enable what you need.

Configuring an IP Address

By default, Gateworks boards ship with as the default IP address. Sometimes this conflicts with other IP addresses. If desired, a configuration can be created to have the board come up with a different IP address.

Please note, the below is ONLY for building a image. It is VERY easy to change the IP address manually once the board is booted. Only use the below method if you have a specific reason as it is much more difficult than configuring the board via serial once it is up and booted.

WARNING: There is a 'preinit' network configuration is for preinit/failsafe (ie hit 'f' during boot for a failsafe terminal). This most likely is not what people usually need. Rather, see below.

For customizing the IP address which is in the configuration file /etc/config/network (or any other files) the correct way is to put files in a 'files' directory in the build directory:

cd trunk ;   # openwrt trunk
mkdir -p files/etc/config
cat << EOF >> files/etc/config/network
config interface lan
        option ifname   eth0
        option type     bridge
        option proto    static
        option ipaddr
        option netmask


DHCP would be:

option 'interface' 'lan'
    option 'ifname' 'eth0'
    option 'type' 'bridge'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'proto' 'dhcp'

This will modify the rootfs that was created in the build directory (ie trunk/target-arm_v6k_uClibc-

Option 2 - IP Configuration

Because the 'base-files' package installs /etc/config/network you can't install that file from any other package (or you'll have a packaging conflict) so your option is to 'modify' it from other packages. The OpenWrt way of doing this (and anything else UCI related that needs to run on the target and not the dev host) is to install per-package files into /etc/uci-defaults/. On boot these files are executed (then removed). The files are executed in alphabetic order and you can see what is there by looking at the rootfs for the target on the dev host in 'build_dir/target-arm_cortex-a9+neon_musl-1.1.11_eabi/root-imx6/etc/uci-defaults/'. The role of target/linux/imx6/base-files/etc/uci-defaults/02_network is to configure networking per base-board capabilities (like creating networks for boards with multiple NICs etc) but note that it doesn't remove /etc/config/network (but does create it if it doesn't exist yet) as it is expected (but not mandated) that these scripts use UCI commands 'modify' various UCI config files.

Last modified 14 months ago Last modified on 05/12/16 12:19:21

Attachments (2)

Download all attachments as: .zip