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