export TARGET=arm-linux export ARCHIVE=/xgcc/archive export SOURCE=/xgcc/src export BUILD=/xgcc/build export TOOLS=/xgcc mkdir -p $ARCHIVE $SOURCE $BUILD
cd $SOURCE tar zxvf $ARCHIVE/binutils-2.13.2.tar.gz mkdir $BUILD/binutils cd $BUILD/binutils $SOURCE/binutils-2.13.2/configure --target=$TARGET --prefix=$TOOLS/$TARGET make make install PATH=$PATH:$TOOLS/$TARGET/bin export PATH
cd $SOURCE tar jxvf $ARCHIVE/linux-sla300-20021224-rom1_20.tar.bz2 cd linux make menuconfig ("load an Alternate Configuration File" を選んで "arch/arm/def-configs/discovery-MV" と入力して OK を押す) (あとはそのまま Exit で終了する。"Do you wish to save your new kernel configuration?" は Yes と答える) mv Makefile Makefile.bak sed "s/arm-linux-//g" < Makefile.bak | sed "s/SUBARCH = arm/# SUBARCH = arm/g" | sed "s/# SUBARCH :=/SUBARCH :=/g" > Makefile make dep (includeだけを用意する)
cd $SOURCE tar zxvf $ARCHIVE/gcc-core-2.95.3.tar.gz mkdir $BUILD/gcc cd $BUILD/gcc mv $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux.bak sed "s/TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC/TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h/g" \ < $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux.bak > $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux $SOURCE/gcc-2.95.3/configure --target=$TARGET --prefix=$TOOLS/$TARGET --enable-shared --disable-threads # --with-newlib ln -sf $SOURCE/linux/include/asm-arm $SOURCE/gcc-2.95.3/include/asm ln -sf $SOURCE/linux/include/linux $SOURCE/gcc-2.95.3/include/linux make make install
cd $SOURCE tar zxvf $ARCHIVE/glibc-2.2.2.tar.gz cd glibc-2.2.2 tar zxvf $ARCHIVE/glibc-linuxthreads-2.2.2.tar.gz # ftp://ftp.linux.org.uk/pub/armlinux/toolchain/src-3.2/build-toolchainに書かれているパッチ perl -pi -e 's/i386/arm*)\n\tlibc_cv_gcc_unwind_find_fde=yes\n\tarch_minimum_kernel=2.0.10\n\t;;\n i386/' sysdeps/unix/sysv/linux/configure perl -pi -e 's/weak_alias \(__old_sys_nerr/\/\/ $&/' sysdeps/unix/sysv/linux/arm/errlist.c mkdir $BUILD/glibc cd $BUILD/glibc CC=$TARGET-gcc AR=$TARGET-ar RANLIB=$TARGET-ranlib $SOURCE/glibc-2.2.2/configure --host=$TARGET --with-headers=$SOURCE/linux/include --enable-add-ons --prefix=$TOOLS/target/$TARGET # makeinfo時にエラーになる部分の修正 mv $SOURCE/glibc-2.2.2/manual/stdio.texi $SOURCE/glibc-2.2.2/manual/stdio.texi.bak sed "s/@ref{,/@ref{Top,/" < $SOURCE/glibc-2.2.2/manual/stdio.texi.bak > $SOURCE/glibc-2.2.2/manual/stdio.texi make make install
rm -fR $BUILD/gcc mkdir $BUILD/gcc cd $BUILD/gcc # t-linux を元に戻す rm $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux mv $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux.bak $SOURCE/gcc-2.95.3/gcc/config/arm/t-linux $SOURCE/gcc-2.95.3/configure --target=$TARGET --prefix=$TOOLS/$TARGET --enable-shared --with-headers=$TOOLS/target/$TARGET/include make make install
cd $SOURCE rm -fR linux tar jxvf $ARCHIVE/linux-sla300-20021224-rom1_20.tar.bz2 cd linux make menuconfig ("load an Alternate Configuration File" を選んで "arch/arm/def-configs/discovery-MV" と入力して OK を押す) (あとはそのまま Exit で終了する。"Do you wish to save your new kernel configuration?" は Yes と答える) make dep cp -R include/linux $TOOLS/$TARGET/$TARGET/sys-include cp -R include/asm-arm $TOOLS/$TARGET/$TARGET/sys-include/asm cp -fR $TOOLS/target/$TARGET/include/* $TOOLS/$TARGET/$TARGET/sys-include rm -fR $TOOLS/target/$TARGET/include ln -sf $TOOLS/$TARGET/$TARGET/sys-include $TOOLS/target/$TARGET/include
mv $TOOLS/$TARGET/$TARGET/lib/ldscripts $TOOLS/target/$TARGET/lib rmdir $TOOLS/$TARGET/$TARGET/lib ln -s $TOOLS/target/$TARGET/lib $TOOLS/$TARGET/$TARGET/lib
cd $BUILD cat > helloworld.c << EOF #include "stdio.h" main() { printf("Hello, world. This is ARM Linux.\n"); } EOF arm-linux-gcc -O2 -o helloworld helloworld.c # file helloworld として # helloworld: ELF 32-bit LSB executable, ARM, version 1 (ARM), dynamically linked (uses shared libs), not stripped # と出れば合格。 # 試しにできあがった "helloworld" を実機に持って行って動作するか試してみよう。
新しくログインし直したときなどは環境変数を設定する必要がある。 export TARGET=arm-linux export ARCHIVE=/xgcc/archive export SOURCE=/xgcc/src export BUILD=/xgcc/build export TOOLS=/xgcc PATH=$PATH:$TOOLS/$TARGET/bin export PATH (ログアウトするか再起動するまで有効)
ダウンロード (39.2MB)
最終更新日: 2003/05/26 23:23:54