Changes between Version 5 and Version 6 of ARM_QEMU
- Timestamp:
- Feb 5, 2008 2:49:28 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ARM_QEMU
v5 v6 1 1 2 What do we need:3 * QEMU ARM Emulator (download binaries from http://www.qemu.org)4 * GNU ARM toolchain (download binaries from http://www.gnuarm.com/)5 * Linux kernel source (download from http://www.kernel.org)6 * textinfo7 2 8 == Setting up Development Environment==3 == Toolchain Directory Structure == 9 4 10 === QEMU ARM Emulator Installation === 5 For this tutorial, we will put the toolchain in '''{{{/arm}}}''' directory rather than the usual {{{/usr/local}}}. I prefer this approach since it's easier to manage (for example, to delete everything when things don't work or when we're finished with it, or to put it on portable drive to be carried to different system). 11 6 12 TBD. 13 14 === Colinux Installation === 15 16 === Download, Install, Run === 17 18 ==== Create a Disk for ARM Development ==== 19 20 1. Create 3GB blank file with Cygwin: 21 {{{ 22 # under cygwin! 23 $ cd /cygdrive/path/to/colinux 24 $ dd if=/dev/zero of=disk_armdev bs=1k count=3000000 25 }}} 26 (note: the above count is ''three million''). 27 1. Stop Colinux: 28 {{{ 29 # from colinux: 30 $ shutdown -h now 31 }}} 32 1. Edit your configuration: 33 {{{ 34 cobd3=f:\colinux\disk_armdev 35 }}} 36 1. Restart colinux: 37 {{{ 38 net start colinux 39 }}} 40 1. Format and mount the new disk: 41 {{{ 42 # In colinux: 43 $ mkfs -t ext3 /dev/cobd3 44 $ mkdir /arm 45 $ mount /dev/cobd3 /arm 46 }}} 47 48 === Directory Structure === 49 7 We'll put files related to installation in '''{{{/arm/setup}}}''' directory: 50 8 {{{ 51 /arm/download 52 /arm/srcs 53 /arm/objs 9 /arm 10 +- setup 11 +- download --> Put downloaded .tgz files here 12 +- srcs --> Unpack .tgz source files here 13 +- objs --> Build sources here 54 14 }}} 55 15 56 == Tools == 16 Once the toolchain is built, they'll be installed in these directories: 17 {{{ 18 /arm 19 +- arm-elf 20 +- bin 21 +- include 22 +- info 23 +- lib 24 .. etc.. 25 }}} 26 27 This tutorial assumes that you have write access to '''{{{/arm}}}''' directory. 28 29 == Prepare Toolchains == 57 30 58 31 === Download Latest binutils, GCC, and newlib === 59 32 60 binutils: 61 http://ftp.gnu.org/gnu/binutils/ 62 63 GCC: 64 http://ftp.gnu.org/gnu/gcc/ 65 66 newlib: 67 ftp://sources.redhat.com/pub/newlib/index.html 33 Download latest toolchain: 34 * binutils: http://ftp.gnu.org/gnu/binutils/ 35 * gcc: http://ftp.gnu.org/gnu/gcc/ 36 * newlib: ftp://sources.redhat.com/pub/newlib/index.html 68 37 69 38 {{{ 70 $ mkdir -p /arm/ download71 $ cd /arm/ download39 $ mkdir -p /arm/setup/download 40 $ cd /arm/setup/download 72 41 $ wget -c http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2 73 42 $ wget -c http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 74 43 $ wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz 75 44 }}} 45 46 You will also need '''mkinfo''' from '''texinfo''' package to build the toolchain (for building the manuals etc). On Debian based system (Debian, Ubuntu, etc.) you can install it with: 47 {{{ 48 $ sudo apt-get install texinfo 49 }}} 50 Or if you're with !RedHat (Fedora, etc), you can install it with: 51 {{{ 52 $ yum install texinfo 53 }}} 54 76 55 77 56 === Preparing to build === … … 80 59 81 60 {{{ 82 $ mkdir -p /arm/s rcs83 $ cd /arm/s rcs61 $ mkdir -p /arm/setup/srcs 62 $ cd /arm/setup/srcs 84 63 $ tar xjf ../download/binutils-2.18.tar.bz2 85 64 $ tar xjf ../download/gcc-3.4.6.tar.bz2 … … 88 67 89 68 90 ==== Prepare newlib to be built along with gcc ====91 92 {{{93 $ cd gcc-3.4.694 $ ln -s ../newlib-1.16.0/newlib .95 $ cd ..96 }}}97 98 99 69 === Build Everything === 100 70 … … 102 72 103 73 {{{ 104 $ mkdir -p /arm/ objs/binutils-arm105 $ cd /arm/ objs/binutils-arm74 $ mkdir -p /arm/setup/objs/binutils-arm 75 $ cd /arm/setup/objs/binutils-arm 106 76 $ ../../srcs/binutils-2.18/configure --target=arm-elf --prefix=/arm 107 77 $ make 108 $ cd ..78 $ make install 109 79 }}} 80 ''(if you're wondering, that will take 5 minutes on a Core2Duo 2GHz)'' 110 81 111 82 ==== Update binutils Path ==== 112 83 113 Before we build gcc below, we need to first add the path to (thew newly installed) binutils:84 Before we build gcc and the rest of the toolchain, add the path to (thew newly installed) binutils. 114 85 86 (if you're using Bash): 115 87 {{{ 116 88 $ export PATH=/arm/bin:$PATH … … 120 92 ==== Build gcc ==== 121 93 94 First prepare newlib to be built along with gcc: 122 95 {{{ 123 $ mkdir /arm/objs/gcc-arm 124 $ cd /arm/objs/gcc-arm 125 $ ./../srcs/gcc-3.4.6/configure --target=arm-elf --prefix=/arm --enable-threads \ 126 --with-cpu=arm9 --enable-languages=c --disable-nls \ 127 --with-newlib 96 $ cd /arm/setup/srcs/gcc-3.4.6 97 $ ln -sd ../newlib-1.16.0/newlib . 98 }}} 99 100 Now lets build the beast: 101 {{{ 102 $ mkdir -p /arm/setup/objs/gcc-arm 103 $ cd /arm/setup/objs/gcc-arm 104 $ ../../srcs/gcc-3.4.6/configure --target=arm-elf --prefix=/arm --enable-threads \ 105 --with-cpu=arm9 --enable-languages=c,c++ \ 106 --disable-nls --with-newlib --disable-shared \ 107 --with-float=soft 128 108 $ make 129 109 $ make install 110 $ cd .. 130 111 }}} 131 112 ''(if you're wondering again, that will take about 8 minutes on a Core2Duo 2GHz)'' 132 113 133 114 == PJSIP == … … 138 119 $ cd /your/pjproject/directory 139 120 $ make distclean 140 $ ./aconfigure --host=arm-elf --disable-floating-point --disable-sound 141 $ cat << EOF > user.mak 142 export CFLAGS += -msoft-float 143 EOF 121 $ ./aconfigure --host=arm-elf --disable-floating-point --disable-sound CFLAGS='-msoft-float' 144 122 $ make dep 145 123 $ make 146 124 125 }}} 126 127 == Common Problems == 128 129 === Link Errors Because of Floating Point Mismatch === 130 131 You may get error about ''configure not being able to create executable'', and {{{config.log}}} reveals error message similar to: 132 133 ''ERROR: foo uses hardware FP, whereas bar uses software FP'' 134 135 I think, this error was caused by lack of {{{--with-float=soft}}} when configuring gcc. 147 136 148 137 149 }}}