Mikrotik Metarouter: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
Строка 1: Строка 1:
 
=Mikrotik Metarouter=
 
=Mikrotik Metarouter=
 
==Подготовка==
 
==Подготовка==
  +
  +
* Install Xcode or at least Xcode command line tools from the MacOSX App Store
  +
* Install brew.
  +
* Install additional formulae:
   
 
<PRE>
 
<PRE>
 
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz
 
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz
 
</PRE>
 
</PRE>
  +
diffutils is required to ensure quilt refreshes patches correctly.
  +
  +
gnu-getopt is keg-only, so force linking it:
  +
<PRE>
  +
brew ln gnu-getopt --force
  +
</PRE>
  +
  +
OS X by default comes with a case-insensitive filesystem. OpenWrt won't build on that. As a workaround, create a (Sparse) case-sensitive disk-image that you then mount in the finder and use as build directory:
  +
<PRE>
  +
hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
  +
</PRE>
  +
<PRE>
  +
hdiutil attach OpenWrt.sparseimage
  +
</PRE>
  +
Another option if using an APFS formatted disc is to create a case-sensitive APFS volume.
  +
  +
Change to /Volumes/OpenWrt
  +
cd /Volumes/OpenWrt
  +
(Your newly created and mounted disk image)
  +
  +
Now proceed normally (git clone…)
  +
Useful things to put in .bash_profile:
  +
  +
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
  +
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
  +
  +
export GIT_PS1_SHOWDIRTYSTATE=1
  +
export GIT_PS1_SHOWSTASHSTATE=1
  +
export GIT_PS1_SHOWCOLORHINTS=1
  +
#export GIT_PS1_SHOWUNTRACKEDFILES=1
  +
export GIT_PS1_SHOWUPSTREAM="auto"
  +
  +
# Watch the escapes for " in the following
  +
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND;} __git_ps1 \"\[\033[0;33m\]\u@\h \[\033[1;34m\]\w\[\033[0m\]\" \"\[\033[1;34m\] \$\[\033[0m\] \""
  +
These instructions worked on OS X 10.10.3, building trunk Rev. 45337 on 9.April.2015.
  +
  +
Install Xcode or at least Xcode command line tools from the MacOSX App Store
  +
Install brew.
  +
Add duplicates repository to homebrew for grep formulae:
  +
brew tap homebrew/dupes
  +
Install additional formulae:
  +
brew install coreutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz
  +
gnu-getopt is keg-only, so force linking it:
  +
brew ln gnu-getopt --force
  +
To get rid of “date illegal option” you can add to your .bash_profile:
  +
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  +
Now proceed normally (git clone…)
  +
These instructions worked for me on OS X 10.10, building 14.07
  +
  +
Install pkgsrc.
  +
Install prerequisites:
  +
pkgin install getopt coreutils gawk gtar findutils
  +
Now proceed normally (git clone…)
  +
These instructions worked for me on OS X 10.9.5, building 14.07 branch “Barrier Breaker”.
  +
  +
Install brew.
  +
Install prerequisites:
  +
brew install asciidoc binutils coreutils findutils gawk gettext gnu-getopt gnu-tar openssl xz
  +
BuildRoot expects 'getopt' to be GNU getopt, so symlink it into place:
  +
ln -s `brew --prefix gnu-getopt`/bin/getopt `brew --prefix`/bin/gnugetopt
  +
Follow the Linux instructions starting with Downloading Sources
  +
If you run into any additional steps required, please add them to this page!
  +
These instructions worked for me on OS X 10.13.6, High Sierra, openwrt 18.06.0
  +
  +
Makefile will bomb unless you rename gxargs to xargs.
  +
ln -s /usr/local/bin/gxargs /usr/local/bin/xargs
  +
Create an APFS volume with case-sensitivity enabled
  +
Add “brew install gnutime”
  +
18.06.0 Use non-dev build. Dev build seems to be broken at this time. Use 18.06.0 branch in git
  +
—- For OS X 10.15 aka Catalina add the following variable to your environment, else toolchain build will fail at kernel-headers
  +
  +
MACOSX_DEPLOYMENT_TARGET=10.14 (with Xcode 11.3 + this is no longer required)
  +
  +
Some packages/dependencies (eg. glib2) require internationalisation tools such as gettext. By default brew installs this as 'keg only' so will require adding to the path to be discovered: echo 'export PATH=“/usr/local/opt/gettext/bin:$PATH”' » ~/.zshrc
  +
  +
OpenWrt on MacOS - Catalina 10.15.3 2020/03/02
  +
  +
Install xcode (v11.3.1 (11C504)) Install Homebrew
  +
  +
Install the following brew packages (items in brackets are auto-installed dependencies as at time of writing) items after the ‘-‘ describe which OpenWrt dependencies the package satisfies.
  +
  +
grep (pcre) - grep gawk (gmp, mpfr, readline) - awk gnu-tar - tar gnu-getopt - long getopts coreutils - fileutils/filestat findutils - gfind & gxargs wget (gettext, libunistring, libidn2, openssl@1.1) - wget
  +
  +
optional but recommended if you’re going to work with patches/patchwork/pull requests:
  +
  +
diffutils - diff git-extras - git-pw, git-pr quilt (gnu-sed) - quilt
  +
  +
As a one-liner: brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt
  +
  +
Some of the Homebrew packages are what is known as ‘Keg only’, in other words the commands they provided are NOT linked into /usr/local/bin because they can potentially conflict with the MacOS provided versions. Homebrew no longer supports force linking them either (e.g. brew ln gnu-getopt –force). Whilst it is possible to solve that issue by including the relevant command directory in the PATH, a neater solution is to manually link the 2 commands required into /usr/local/bin.
  +
  +
The diff from diffutils is newer than that provided by MacOS and subtly changes the way that quilt patch refreshes work. Without it a lot of unnecessary patch churn is generated.
  +
  +
gnu-getopt requires specific linking into /usr/local/bin - linking as gnugetopt avoids conflicting with system getopt and is still found by the build system: (cd /usr/local/bin ; ln -s ../opt/gnu-getopt/bin/getopt gnugetopt)
  +
  +
Similarly some OpenWrt packages in the packages feed (e.g. glib2) require msgfmt from gettext (cd /usr/local/bin ; ln -s ../opt/gettext/bin/msgfmt msgfmt)
  +
  +
Ensure /usr/local/bin is in your PATH.

Версия 17:18, 21 июня 2020

Mikrotik Metarouter

Подготовка

  • Install Xcode or at least Xcode command line tools from the MacOSX App Store
  • Install brew.
  • Install additional formulae:
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz

diffutils is required to ensure quilt refreshes patches correctly.

gnu-getopt is keg-only, so force linking it:

brew ln gnu-getopt --force

OS X by default comes with a case-insensitive filesystem. OpenWrt won't build on that. As a workaround, create a (Sparse) case-sensitive disk-image that you then mount in the finder and use as build directory:

hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
hdiutil attach OpenWrt.sparseimage

Another option if using an APFS formatted disc is to create a case-sensitive APFS volume.

Change to /Volumes/OpenWrt cd /Volumes/OpenWrt (Your newly created and mounted disk image)

Now proceed normally (git clone…) Useful things to put in .bash_profile:

. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash . /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh

export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1 export GIT_PS1_SHOWCOLORHINTS=1

  1. export GIT_PS1_SHOWUNTRACKEDFILES=1

export GIT_PS1_SHOWUPSTREAM="auto"

  1. Watch the escapes for " in the following

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND;} __git_ps1 \"\[\033[0;33m\]\u@\h \[\033[1;34m\]\w\[\033[0m\]\" \"\[\033[1;34m\] \$\[\033[0m\] \"" These instructions worked on OS X 10.10.3, building trunk Rev. 45337 on 9.April.2015.

Install Xcode or at least Xcode command line tools from the MacOSX App Store Install brew. Add duplicates repository to homebrew for grep formulae: brew tap homebrew/dupes Install additional formulae: brew install coreutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz gnu-getopt is keg-only, so force linking it: brew ln gnu-getopt --force To get rid of “date illegal option” you can add to your .bash_profile: PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" Now proceed normally (git clone…) These instructions worked for me on OS X 10.10, building 14.07

Install pkgsrc. Install prerequisites: pkgin install getopt coreutils gawk gtar findutils Now proceed normally (git clone…) These instructions worked for me on OS X 10.9.5, building 14.07 branch “Barrier Breaker”.

Install brew. Install prerequisites: brew install asciidoc binutils coreutils findutils gawk gettext gnu-getopt gnu-tar openssl xz BuildRoot expects 'getopt' to be GNU getopt, so symlink it into place: ln -s `brew --prefix gnu-getopt`/bin/getopt `brew --prefix`/bin/gnugetopt Follow the Linux instructions starting with Downloading Sources If you run into any additional steps required, please add them to this page! These instructions worked for me on OS X 10.13.6, High Sierra, openwrt 18.06.0

Makefile will bomb unless you rename gxargs to xargs. ln -s /usr/local/bin/gxargs /usr/local/bin/xargs Create an APFS volume with case-sensitivity enabled Add “brew install gnutime” 18.06.0 Use non-dev build. Dev build seems to be broken at this time. Use 18.06.0 branch in git —- For OS X 10.15 aka Catalina add the following variable to your environment, else toolchain build will fail at kernel-headers

MACOSX_DEPLOYMENT_TARGET=10.14 (with Xcode 11.3 + this is no longer required)

Some packages/dependencies (eg. glib2) require internationalisation tools such as gettext. By default brew installs this as 'keg only' so will require adding to the path to be discovered: echo 'export PATH=“/usr/local/opt/gettext/bin:$PATH”' » ~/.zshrc

OpenWrt on MacOS - Catalina 10.15.3 2020/03/02

Install xcode (v11.3.1 (11C504)) Install Homebrew

Install the following brew packages (items in brackets are auto-installed dependencies as at time of writing) items after the ‘-‘ describe which OpenWrt dependencies the package satisfies.

grep (pcre) - grep gawk (gmp, mpfr, readline) - awk gnu-tar - tar gnu-getopt - long getopts coreutils - fileutils/filestat findutils - gfind & gxargs wget (gettext, libunistring, libidn2, openssl@1.1) - wget

optional but recommended if you’re going to work with patches/patchwork/pull requests:

diffutils - diff git-extras - git-pw, git-pr quilt (gnu-sed) - quilt

As a one-liner: brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt

Some of the Homebrew packages are what is known as ‘Keg only’, in other words the commands they provided are NOT linked into /usr/local/bin because they can potentially conflict with the MacOS provided versions. Homebrew no longer supports force linking them either (e.g. brew ln gnu-getopt –force). Whilst it is possible to solve that issue by including the relevant command directory in the PATH, a neater solution is to manually link the 2 commands required into /usr/local/bin.

The diff from diffutils is newer than that provided by MacOS and subtly changes the way that quilt patch refreshes work. Without it a lot of unnecessary patch churn is generated.

gnu-getopt requires specific linking into /usr/local/bin - linking as gnugetopt avoids conflicting with system getopt and is still found by the build system: (cd /usr/local/bin ; ln -s ../opt/gnu-getopt/bin/getopt gnugetopt)

Similarly some OpenWrt packages in the packages feed (e.g. glib2) require msgfmt from gettext (cd /usr/local/bin ; ln -s ../opt/gettext/bin/msgfmt msgfmt)

Ensure /usr/local/bin is in your PATH.