[[PageOutline]] * [http://wiki.openwrt.org/about/toolchain OpenWrt Buildroot – About - OpenWrt Wiki] * [http://d.hatena.ne.jp/sdkt4a/20080814/1218655463 OpenWrtのクロスコンパイル環境をDebianに構築してhello,worldするよ! - sdkt4aの日記] * [https://wiki.projectmeshnet.org/Build_for_OpenWRT Build for OpenWRT - meshwiki] * [http://d.hatena.ne.jp/nyaxt/20120212#1329014697 FON2100E openwrt backfire 10.03.1用クロスコンパイル環境の構築 2012-02-12 - nyaxtのPC作業ログ] = target system = * /proc/cpuinfo {{{ system type : Atheros AR7161 rev 2 machine : Buffalo WZR-HP-AG300H processor : 0 cpu model : MIPS 24Kc V7.4 BogoMIPS : 452.19 wait instruction : yes microsecond timers : yes tlb_entries : 16 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ff8, 0x0ffc, 0x0ff8, 0x0ff8] ASEs implemented : mips16 shadow register sets : 1 kscratch registers : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available }}} == host system type == * mitty@starseed:~$ wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" -O config.guess * mitty@starseed:~$ wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" -O config.sub * mitty@starseed:~$ chmod +x config.* * mitty@starseed:~$ ./config.guess {{{ ./config.guess: unable to guess system type This script, last modified 2012-06-17, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run (./config.guess) is already up to date, please send the following data and any information you think might be pertinent to in order to provide the needed information to handle your system. config.guess timestamp = 2012-06-17 uname -m = mips uname -r = 3.3.6 uname -s = Linux uname -v = #1 Thu May 17 02:19:20 PDT 2012 /usr/bin/uname -p = /bin/uname -X = hostinfo = /bin/universe = /usr/bin/arch -k = /bin/arch = /usr/bin/oslevel = /usr/convex/getsysinfo = UNAME_MACHINE = mips UNAME_RELEASE = 3.3.6 UNAME_SYSTEM = Linux UNAME_VERSION = #1 Thu May 17 02:19:20 PDT 2012 }}} = buildroot = * Ubuntu 12.04 LTS x86_64 * mitty@precise:~$ sudo aptitude install subversion build-essential libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext libssl-dev xsltproc bison * mitty@precise:~$ mkdir openwrt * mitty@precise:~/openwrt$ svn co svn://svn.openwrt.org/openwrt/trunk/ {{{ (snip) U trunk Checked out revision 32026. }}} * mitty@precise:~/openwrt/trunk$ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/config * mitty@precise:~/openwrt$ cp config trunk/.config * mitty@precise:~/openwrt/trunk$ make prereq {{{ Collecting package info: done Collecting target info: done Checking 'working-make'... ok. Checking 'case-sensitive-fs'... ok. Checking 'getopt'... ok. Checking 'fileutils'... ok. Checking 'working-gcc'... ok. Checking 'working-g++'... ok. Checking 'ncurses'... ok. Checking 'zlib'... ok. Checking 'gawk'... ok. Checking 'flex'... ok. Checking 'unzip'... ok. Checking 'bzip2'... ok. Checking 'patch'... ok. Checking 'perl'... ok. Checking 'python'... ok. Checking 'wget'... ok. Checking 'git'... ok. Checking 'gnutar'... ok. Checking 'svn'... ok. Checking 'gnu-find'... ok. Checking 'getopt-extended'... ok. Checking 'non-root'... ok. }}} * mitty@precise:~/openwrt/trunk$ make -j 5 V=99 2>&1 | tee build.log | grep -i error {{{ (snip) make[2]: [package/rootfs-prepare] Error 2 (ignored) Compression errors: 0 [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big make[5]: [install] Error 1 (ignored) Compression errors: 0 [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big make[5]: [install] Error 1 (ignored) make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) }}} * mitty@precise:~/openwrt$ cat > test.c {{{#!cc #include int main(void) { printf("char -> %ld\n", sizeof(char)); printf("short -> %ld\n", sizeof(short)); printf("int -> %ld\n", sizeof(int)); printf("long -> %ld\n", sizeof(long)); printf("long long -> %ld\n", sizeof(long long)); printf("float -> %ld\n", sizeof(float)); printf("double -> %ld\n", sizeof(double)); printf("long double -> %ld\n", sizeof(long double)); return 0; } }}} * mitty@precise:~/openwrt$ gcc test.c -o test.x86 * mitty@precise:~/openwrt$ ./trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc test.c -o test {{{ mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined }}} * mitty@precise:~/openwrt$ file test test.x86 {{{ test: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped test.x86: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x53177842cbc614b1f4c71bae24df294892906443, not stripped }}} * mitty@precise:~/openwrt$ ./test.x86 {{{ char -> 1 short -> 2 int -> 4 long -> 8 long long -> 8 float -> 4 double -> 8 long double -> 16 }}} * mitty@precise:~/openwrt$ ./test {{{ bash: ./test: cannot execute binary file }}} * mitty@starseed:~$ uname -a {{{ Linux starseed 3.3.6 #1 Thu May 17 02:19:20 PDT 2012 mips GNU/Linux }}} * mitty@starseed:~$ ./test {{{ char -> 1 short -> 2 int -> 4 long -> 4 long long -> 8 float -> 4 double -> 8 long double -> 8 }}} = build others = * よくある(?)エラーなどは => [./oldmethod] == download toolcgain == * mitty@precise:~$ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 * mitty@precise:~$ tar xjf OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 == export ENVIRONMENT == * mitty@precise:~$ export STAGING_DIR=~/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ * mitty@precise:~$ export PATH=$PATH:$STAGING_DIR/bin/ == libiconv == * mitty@precise:~$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz * mitty@precise:~$ tar xzf libiconv-1.14.tar.gz * mitty@precise:~/libiconv-1.14$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux * mitty@precise:~/libiconv-1.14$ make * mitty@precise:~/libiconv-1.14$ make install == zlib == * mitty@precise:~$ wget http://zlib.net/zlib-1.2.7.tar.gz * mitty@precise:~$ tar xzf zlib-1.2.7.tar.gz * mitty@precise:~/zlib-1.2.7$ CC=mips-openwrt-linux-gcc AR=mips-openwrt-linux-ar RANLIB=mips-openwrt-linux-ranlib ./configure --prefix=$STAGING_DIR * mitty@precise:~/zlib-1.2.7$ make * mitty@precise:~/zlib-1.2.7$ make install == openssl == * mitty@precise:~$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz * mitty@precise:~$ tar xzf openssl-1.0.1c.tar.gz * mitty@precise:~/openssl-1.0.1c$ ./Configure --prefix=$STAGING_DIR --cross-compile-prefix=mips-openwrt-linux- gcc * mitty@precise:~/openssl-1.0.1c$ make * mitty@precise:~/openssl-1.0.1c$ make install == ncurses == * mitty@precise:~$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz * mitty@precise:~$ tar xzf ncurses-5.9.tar.gz * mitty@precise:~/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux --enable-echo --enable-const --enable-overwrite --disable-rpath --without-ada --without-debug --without-profile --without-progs --disable-big-core --disable-home-terminfo --with-normal --with-shared --with-terminfo-dirs=/usr/share/terminfo --with-default-terminfo-dir=/usr/share/terminfo * mitty@precise:~/ncurses-5.9$ make * mitty@precise:~/ncurses-5.9$ make install == readline == * mitty@precise:~$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.013.tar.gz * mitty@precise:~$ tar xzf readline-5.2.013.tar.gz * mitty@precise:~/readline-5.2.013$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-014 * mitty@precise:~/readline-5.2.013$ patch < readline52-014 * mitty@precise:~/readline-5.2.013$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux * mitty@precise:~/readline-5.2.013$ make * mitty@precise:~/readline-5.2.013$ make install == utvpn == * make install [#zlib], [#openssl], [#ncurses] and [#readline] * mitty@precise:~$ svn export http://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public/ * あるいは以下の様にする * mitty@precise:~$ wget 'http://utvpn.tsukuba.ac.jp/files/utvpn/v1.01-7101-public-2010.06.27/Source%20Code%20(Win32%20and%20Unix)/utvpn-src-unix-v101-7101-public-2010.06.27.tar.gz' * mitty@precise:~$ tar xzf utvpn-src-unix-v101-7101-public-2010.06.27.tar.gz * mitty@precise:~/utvpn-unix-v101-7101-public$ svn diff http://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public/ -r152:153 | patch -p0 {{{ patching file Makefile.mips patching file src/Mayaqua/Mayaqua.h }}} * mitty@precise:~/utvpn-unix-v101-7101-public$ cp $STAGING_DIR/include/openssl/* src/Mayaqua/openssl/ * [http://wiki.livedoor.jp/taiki_kondo/d/UT-VPN/Debian UT-VPN/Debian - 判ってるよねWiki - livedoor Wiki(ウィキ)] * [http://blog.falconsrv.net/2012/05/ut-vpnubuntu-1204.html Falcon’s Diary: UT-VPNのビルド方法(Ubuntu 12.04)] * mitty@precise:~/utvpn-unix-v101-7101-public$ make -f Makefile.mips CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld * mitty@precise:~/utvpn-unix-v101-7101-public$ make -f Makefile.mips install PREFIX=~/target