| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | * [http://wiki.openwrt.org/about/toolchain OpenWrt Buildroot – About - OpenWrt Wiki] |
| | 4 | * [http://d.hatena.ne.jp/sdkt4a/20080814/1218655463 OpenWrtのクロスコンパイル環境をDebianに構築してhello,worldするよ! - sdkt4aの日記] |
| | 5 | * [https://wiki.projectmeshnet.org/Build_for_OpenWRT Build for OpenWRT - meshwiki] |
| | 6 | * [http://d.hatena.ne.jp/nyaxt/20120212#1329014697 FON2100E openwrt backfire 10.03.1用クロスコンパイル環境の構築 2012-02-12 - nyaxtのPC作業ログ] |
| | 7 | |
| | 8 | = buildroot = |
| | 9 | * Ubuntu 12.04 LTS x86_64 |
| | 10 | |
| | 11 | * mitty@precise:~$ sudo aptitude install subversion build-essential libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext libssl-dev xsltproc bison |
| | 12 | |
| | 13 | * mitty@precise:~$ mkdir openwrt |
| | 14 | |
| | 15 | * mitty@precise:~/openwrt$ svn co svn://svn.openwrt.org/openwrt/trunk/ |
| | 16 | {{{ |
| | 17 | (snip) |
| | 18 | |
| | 19 | U trunk |
| | 20 | Checked out revision 32026. |
| | 21 | }}} |
| | 22 | |
| | 23 | * mitty@precise:~/openwrt/trunk$ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/config |
| | 24 | * mitty@precise:~/openwrt$ cp config trunk/.config |
| | 25 | |
| | 26 | * mitty@precise:~/openwrt/trunk$ make prereq |
| | 27 | {{{ |
| | 28 | Collecting package info: done |
| | 29 | Collecting target info: done |
| | 30 | Checking 'working-make'... ok. |
| | 31 | Checking 'case-sensitive-fs'... ok. |
| | 32 | Checking 'getopt'... ok. |
| | 33 | Checking 'fileutils'... ok. |
| | 34 | Checking 'working-gcc'... ok. |
| | 35 | Checking 'working-g++'... ok. |
| | 36 | Checking 'ncurses'... ok. |
| | 37 | Checking 'zlib'... ok. |
| | 38 | Checking 'gawk'... ok. |
| | 39 | Checking 'flex'... ok. |
| | 40 | Checking 'unzip'... ok. |
| | 41 | Checking 'bzip2'... ok. |
| | 42 | Checking 'patch'... ok. |
| | 43 | Checking 'perl'... ok. |
| | 44 | Checking 'python'... ok. |
| | 45 | Checking 'wget'... ok. |
| | 46 | Checking 'git'... ok. |
| | 47 | Checking 'gnutar'... ok. |
| | 48 | Checking 'svn'... ok. |
| | 49 | Checking 'gnu-find'... ok. |
| | 50 | Checking 'getopt-extended'... ok. |
| | 51 | Checking 'non-root'... ok. |
| | 52 | }}} |
| | 53 | |
| | 54 | * mitty@precise:~/openwrt/trunk$ make -j 5 V=99 2>&1 | tee build.log | grep -i error |
| | 55 | {{{ |
| | 56 | (snip) |
| | 57 | |
| | 58 | make[2]: [package/rootfs-prepare] Error 2 (ignored) |
| | 59 | Compression errors: 0 |
| | 60 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 61 | make[5]: [install] Error 1 (ignored) |
| | 62 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 63 | make[5]: [install] Error 1 (ignored) |
| | 64 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 65 | make[5]: [install] Error 1 (ignored) |
| | 66 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 67 | make[5]: [install] Error 1 (ignored) |
| | 68 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big |
| | 69 | make[5]: [install] Error 1 (ignored) |
| | 70 | Compression errors: 0 |
| | 71 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 72 | make[5]: [install] Error 1 (ignored) |
| | 73 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 74 | make[5]: [install] Error 1 (ignored) |
| | 75 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 76 | make[5]: [install] Error 1 (ignored) |
| | 77 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big |
| | 78 | make[5]: [install] Error 1 (ignored) |
| | 79 | [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big |
| | 80 | make[5]: [install] Error 1 (ignored) |
| | 81 | make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) |
| | 82 | make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) |
| | 83 | }}} |
| | 84 | |
| | 85 | * mitty@precise:~/openwrt$ cat > test.c |
| | 86 | {{{#!cc |
| | 87 | #include <stdio.h> |
| | 88 | |
| | 89 | int main(void) { |
| | 90 | printf("char -> %ld\n", sizeof(char)); |
| | 91 | printf("short -> %ld\n", sizeof(short)); |
| | 92 | printf("int -> %ld\n", sizeof(int)); |
| | 93 | printf("long -> %ld\n", sizeof(long)); |
| | 94 | printf("long long -> %ld\n", sizeof(long long)); |
| | 95 | printf("float -> %ld\n", sizeof(float)); |
| | 96 | printf("double -> %ld\n", sizeof(double)); |
| | 97 | printf("long double -> %ld\n", sizeof(long double)); |
| | 98 | |
| | 99 | return 0; |
| | 100 | } |
| | 101 | }}} |
| | 102 | * mitty@precise:~/openwrt$ gcc test.c -o test.x86 |
| | 103 | * 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 |
| | 104 | {{{ |
| | 105 | mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined |
| | 106 | mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined |
| | 107 | mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined |
| | 108 | }}} |
| | 109 | |
| | 110 | * mitty@precise:~/openwrt$ file test test.x86 |
| | 111 | {{{ |
| | 112 | 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 |
| | 113 | 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 |
| | 114 | }}} |
| | 115 | |
| | 116 | * mitty@precise:~/openwrt$ ./test.x86 |
| | 117 | {{{ |
| | 118 | char -> 1 |
| | 119 | short -> 2 |
| | 120 | int -> 4 |
| | 121 | long -> 8 |
| | 122 | long long -> 8 |
| | 123 | float -> 4 |
| | 124 | double -> 8 |
| | 125 | long double -> 16 |
| | 126 | }}} |
| | 127 | |
| | 128 | * mitty@precise:~/openwrt$ ./test |
| | 129 | {{{ |
| | 130 | bash: ./test: cannot execute binary file |
| | 131 | }}} |
| | 132 | |
| | 133 | * mitty@starseed:~$ uname -a |
| | 134 | {{{ |
| | 135 | Linux starseed 3.3.6 #1 Thu May 17 02:19:20 PDT 2012 mips GNU/Linux |
| | 136 | }}} |
| | 137 | * mitty@starseed:~$ ./test |
| | 138 | {{{ |
| | 139 | char -> 1 |
| | 140 | short -> 2 |
| | 141 | int -> 4 |
| | 142 | long -> 4 |
| | 143 | long long -> 8 |
| | 144 | float -> 4 |
| | 145 | double -> 8 |
| | 146 | long double -> 8 |
| | 147 | }}} |
| | 148 | |
| | 149 | = build others = |
| | 150 | |
| | 151 | == zlib == |
| | 152 | * [http://www.crosscompile.org/static/pages/ZLib.html How to Cross Compile Zlib Compression Library - Step by Step Guide (crosscompile.org)] |
| | 153 | |
| | 154 | == openssl == |
| | 155 | * [http://www.crosscompile.org/static/pages/OpenSSL.html How to Cross Compile OpenSSL a Step by Step Guide (crosscompile.org)] |