Launch of OpenWRT 14.07 on Mikrotik and an example of building Asterisk with an additional module

           There are many articles on the Internet about running openwrt on Mikrotik devices via metarouter. All of them use revision r29684 with an official patch that supports processors (RB400, RB700 series, RB900 series, RB2011 boards, RB1000, RB1100, RB1100AH ​​and RB800) for assembly. For later versions, this patch is no longer suitable. It follows that all openwrt packages are quite old and it’s almost impossible to build updated software. And in new versions of openwrt many new packages and libraries have appeared.
           After searching the Internet, did anyone manage to run a fresh openwrt under the metarouter, I came across the right note . This article just completely copies its contents, plus a small bonus for assembling packages. Let's get started (example for debian \ ubuntu systems):

    We put the necessary packages for work:
    $ sudo apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc zip

    Create a directory for the assembly (you need about 12 gigabytes of free space):
     $ mkdir openwrt & cd openwrt

    Download the patch for openwrt and the openwrt sources themselves, and apply the patch:
    $ wget
    $ git clone git:// barrier_breaker
    $ cd barrier_breaker
    $ patch -p1 -i ../openwrt_metarouter_1407.patch

    Let's set up the image:
    $ make defconfig
    $ make prereq
    $ make menuconfig

           Next, in the target system, select the type of processor Mikrotik MetaROUTER MIPS. You can also go through additional packages that will be in the image, or eliminate unnecessary ones. You can start assembling and go for a walk:
    $ make -j $(nproc)

    If the assembly is successful, then the finished image barrier_breaker / bin / mr-mips / openwrt-mr-mips-rootfs.tar.gz appears. We load the

           finished image onto a USB flash drive (you can use either the built-in or external) mikrotik, go to the web interface mikrotik'a and in the tab, metarouter, select Import Image, indicate our just created image and the desired number of RAM. That's all. It remains to start the virtual machine, go to the console of our image and proceed with the settings (a more detailed description of the settings can be found on the Internet, so I will not duplicate).

    Build and run Openwrt

    The main image is ready and lies in bin / mr-mips /, you can start building additional packages. Through the configurator menu, select the desired software, install for example, Asterisk11:
    $ ./scripts/feeds update -a
    $ ./scripts/feeds install -a
    $ make menuconfig

    Assembly of additional packages

    Packages for installation are ready, you can drink tea and start the assembly (to see errors and the assembly process, run with the parameter V = s)
    $ make -j $(nproc)

           Additional packages appeared in the bin / mr-mips / packages / folder - to install, copy them to the system (for example, via scp) and run opkg install name_paccket.ipk.
    This procedure is optional since you can install packages from the repository. Why then do you need to collect packages? The answer is simple: if the necessary packages are not in the repository or if additional modules to a specific package are needed.
           Let's try to build a module for asterisk, which is not in the repository. On forums that discuss asterisk running on openwrt, you can find complaints that there is no module for app-queues. Let's try to collect it. The correct option is to read the openwrt manual and build on it. I decided to try ahead and immediately crawled into the /barrier_breaker/package/feeds/telephony/asterisk-11.x/Makefile makefile, in which at the end I found lines responsible for building the modules.

    $ (eval $ (call BuildAsterisk11Module, pbx-lua, Lua, provides Lua resources for Asterisk, + libpthread + libc + liblua, / etc / asterisk / extensions.lua, extensions.lua, pbx_lua,))

    Comments on the choice of assembled modules
    # Params:
    # 1 - Package subname
    # 2 - Package title
    # 3 - Module description
    # 4 - Module dependencies
    # 5 - Full path to multiple conffiles
    # 6 - conf files
    # 7 - module files
    # 8 - sound files
    # 9 - binary files

    The comments describe each line. There are no third-party dependencies for the app-queue module, so the line is quite compact.

    $(eval $(call BuildAsterisk11Module,app-queue,Distribution queue call to agent,Each dynamic agent in each queue is now stored in the astdb,,,,app_queue,))

    Add it to the makefile to other modules and start building our module.
    $ make menuconfig
    $ make -j $(nproc)

    We include our module in the assembly

           If everything went well, then it remains to deliver the package we just collected. Ready-made images can be taken from the author of the patch . That's all.

    Also popular now: