
There are many articles on the Internet on launching openwrt on Mikrotik devices via metarouter. All of them use the r29684 revision with an official patch supporting processors (devices RB400, RB700 series, RB900 series, RB2011 boards, RB1000, RB1100, RB1100AH ​​and RB800). For later versions, this patch is no longer suitable. It follows from this that all openwrt packages are old enough and it is almost impossible to collect updated software. And in new versions of openwrt, many new packages and libraries have appeared.
Searching on the Internet, did anyone manage to launch a fresh openwrt under the metarouter, stumbled upon the necessary
note . This article just copies its content, plus a small bonus on building 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 build directory (you need about 12 gigabytes of free space):
$ mkdir openwrt & cd openwrt
Download the openwrt patch and the openwrt sources themselves, and apply the patch:
$ wget http://openwrt.naberius.de/barrier_breaker/mr-mips/openwrt_metarouter_1407.patch $ git clone git://git.openwrt.org/14.07/openwrt.git barrier_breaker $ cd barrier_breaker $ patch -p1 -i ../openwrt_metarouter_1407.patch
Let's proceed to setting up the image:
$ make defconfig $ make prereq $ make menuconfig
Next, select the type of processor Mikrotik MetaROUTER MIPS in the target system item. You can also go through the additional packages that will be in the image, or eliminate unnecessary. You can start the assembly and go for a walk:
$ make -j $(nproc)
If the build is successful, then a ready image will appear
barrier_breaker / bin / mr-mips / openwrt-mr-mips-rootfs.tar.gzWe load the finished image on the USB flash drive (both on the built-in and on the external) mikrotik, go to the mikrotik web interface and in the tab, select the Image Image import metarouter, specify our newly created image and the required amount of RAM. That's all. It remains to run the virtual machine, go to the console of our image and proceed to the settings (a more detailed description of the settings can be found on the Internet, so I will not duplicate).
The main image is ready and lies in bin / mr-mips /, you can begin to build additional packages. Using the configurator menu, select the required software, install Asterisk11 for example:
$ ./scripts/feeds update -a $ ./scripts/feeds install -a $ make menuconfig
Assembly of additional packages ')
Packages for installation are ready, you can drink tea and run the assembly (to see the errors and the build process, run with the parameter V = s)
$ make -j $(nproc)
Additional packages appeared in the bin / mr-mips / packages / folder - to install, copy them into the system (for example, via scp) and run opkg install name_paccket.ipk.
This procedure is optional, as it is possible to install packages from the repository. Why, then, 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 assemble a module for asterisk, which is not in the repository. On forums where asterisk running on openwrt is discussed, you can find complaints that there is no module for app-queues. Let's try to collect it. The correct way is to read the openwrt manual and compile it. I decided to try right through and immediately climbed into the / barrier_breaker/package/feeds/telephony/asterisk-11.x/Makefile makefile, in which I found the lines at the end 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 selection of the modules being assembled# 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 rather 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,))
We add it to the make-file to other modules and run the assembly of 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 have just assembled. Ready images can be taken from the author of the
patch . That's all.