Skip to content

Instantly share code, notes, and snippets.

@promi
Last active December 14, 2017 01:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save promi/dffbae76855c9c7844e708826a02b9b7 to your computer and use it in GitHub Desktop.
Save promi/dffbae76855c9c7844e708826a02b9b7 to your computer and use it in GitHub Desktop.
MikroTik MetaROUTER OpenWRT build script for Debian Wheezy (Jessie?)
--- a/src/mklibs-readelf/elf.cpp
+++ b/src/mklibs-readelf/elf.cpp
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <unistd.h>
using namespace Elf;
--- a/bfd/doc/bfd.texinfo
+++ b/bfd/doc/bfd.texinfo
@@ -322,7 +322,7 @@ All of BFD lives in one directory.
@printindex cp
@tex
-% I think something like @colophon should be in texinfo. In the
+% I think something like @@colophon should be in texinfo. In the
% meantime:
\long\def\colophon{\hbox to0pt{}\vfill
\centerline{The body of this manual is set in}
@@ -333,7 +333,7 @@ All of BFD lives in one directory.
\centerline{{\sl\fontname\tensl\/}}
\centerline{are used for emphasis.}\vfill}
\page\colophon
-% Blame: doc@cygnus.com, 28mar91.
+% Blame: doc@@cygnus.com, 28mar91.
@end tex
@bye
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -7877,7 +7877,7 @@ If you have more than one @code{SECT} st
@printindex cp
@tex
-% I think something like @colophon should be in texinfo. In the
+% I think something like @@colophon should be in texinfo. In the
% meantime:
\long\def\colophon{\hbox to0pt{}\vfill
\centerline{The body of this manual is set in}
@@ -7888,7 +7888,7 @@ If you have more than one @code{SECT} st
\centerline{{\sl\fontname\tensl\/}}
\centerline{are used for emphasis.}\vfill}
\page\colophon
-% Blame: doc@cygnus.com, 28mar91.
+% Blame: doc@@cygnus.com, 28mar91.
@end tex
@bye
#!/bin/bash
# http://wiki.mikrotik.com/wiki/Manual:Metarouter#Building_your_own_OpenWRT_image
sudo apt-get -y install build-essential git libncurses5-dev libz-dev \
libssl-dev gawk subversion flex unzip
git clone https://git.openwrt.org/openwrt.git
mkdir openwrt/dl
mkdir -p openwrt/toolchain/binutils/patches/2.20.1
wget -c http://www.mikrotik.com/download/metarouter/openwrt-metarouter-1.2.patch
wget -c https://dev.openwrt.org/raw-attachment/ticket/12005/stdio.patch
wget -c https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.10.tar.xz \
-P openwrt/dl
wget -c https://gist.github.com/promi/dffbae76855c9c7844e708826a02b9b7/raw/b5d2025611969c5d00ce0f9d9de4077333943542/011-unistd.patch \
-O openwrt/tools/mklibs/patches/011-unistd.patch
wget -c https://gist.github.com/promi/dffbae76855c9c7844e708826a02b9b7/raw/4d04fa040cbede9149342ab3bdff22cca9db1d9c/binutils_bfd.patch \
-O openwrt/toolchain/binutils/patches/2.20.1/800-texinfo_bfd.patch
wget -c https://gist.github.com/promi/dffbae76855c9c7844e708826a02b9b7/raw/4d04fa040cbede9149342ab3bdff22cca9db1d9c/binutils_ld.patch \
-O openwrt/toolchain/binutils/patches/2.20.1/801-texinfo_ld.patch
cd openwrt
# git log | grep 29684 -B 10
git checkout 4cd49acd61e7810eca89b87971c568417cb701e7
patch -p0 < ../openwrt-metarouter-1.2.patch
patch -p0 < ../stdio.patch
# Set target system to "Microtik MetaROUTER MIPS"
make menuconfig
# Add -j5 or -j9 to use more cpu cores if needed
# make -j5
make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment