microblaze gcc step01
echoesI:000-gcc> cat step-01.txt
binutils のコンパイル
configure --prefix=~/sysroot/mb/ --target=microblaze
gcc のコンパイル
configure --target=microblaze --prefix=/home/ryos/FPGA_Linux/sysroot/mb --with-newlib --enable-multilib --disable-libssp --disable-newlib-atexit-dynamic-alloc --enable-optimize-memory --enable-languages=c,c++
ツールのバージョンを入れている。
build_gcc.sh:echo $TOOL_VERSION > $GCC_SRCDIR/gcc/DEV-PHASE
Xilinx 11.1 Build EDK_L.14 19 Sep 2010
Sinby sign-linux 0.00 9 12 2010
とする
あいかわらず microblaze-ar でおちる
じっせきがあるかもしれない(というか xilinx の提供している) ar を
ln -s してをつかう
xilinx はなぜか newlib をつくりなおしているが、必要がないと思われるので
newlib はそのまま
おそらく、xilkernel 用に必要なのでしょう。
TODO
ar 問題 -> 解決
newlib をつくりなおしている。本当に xilkernel 用か?
--enable-multilib
--disable-libssp
--disable-newlib-atexit-dynamic-alloc
--enable-optimize-memory
ここまでは
いつものことだからできるなぁ、、、
これだけだと素のコンパイラができるだけ
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
環境変数に CFLGAS="-O2 -fno-stack-protector" をつけて
configure --prefix=~/FPGA_Linux/install/mb-ulibc-linux/ --target=microblaze-ulibc-linux-gnu
make CFLAGS=... じゃ聞かないことを確認
うぎゃーやってもだめだった。
/* Goddamned sprintf doesn't permit MAXIMUM field lengths. */
sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
かいてあるじゃん、、、
最新の binutils は
_bfd_ar_spacepad に置き換えられている。パッチを当てて再度挑戦。
パッチは通ったけど不安があるので
sprintf_chk を使わないように gcc に指示をすることにした。
bfd/Makefile を書き換えて
archive.o だけを
次のコンパイルオプションを渡すことにした。
- O0 -fno-builtin-sprintf
- O2 -fno-builtin-sprintf
は変えてしまうので注意
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
LE がなかったので
peta 版の binutils に置き換える。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
gcc 再度コンパイル。->失敗
crti.o をコンパイルするところでエラー
peta の binutils はぺ多様らしい
peta の crti.s は該当箇所が削られている。それでいいのか?
TODO
crti.s 正しいのは?意味は?
めんどくさいな、、、、
ぺたで再再度コンパイル->失敗 まちがえていた。変な環境だった。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
gcc 再再再度コンパイルもう一度挑戦。
あでもだめか、、、
まぁいいや。
gcc 再再再度コンパイル->失敗
おなじところでこける。
crti.o をコンパイルするところでエラー
gcc-work/mb_gnu/src/gcc/gcc/config/microblaze/crti.s:11: Error: register expected, but saw 'rshr,r'
/gcc-work/mb_gnu/src/gcc/gcc/config/microblaze/crti.s:11: Error: register expected, but saw 'shr,r1'
mts rshr, r11
la r11, r0, _stack_end+4
mts rslr, r11
mts の r11 がないようだ。
なお、xilinx 提供の crti.o を逆アセンブルすると、
このコードは削除されていて(つまりぺたと同じ)なので、
ぺたが管理しているのかも。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
peta 版gcc で再再再再度コンパイルもう一度挑戦。
peta 版特有の 同じエラー
FPGA_Linux/install/mb-ulibc-linux/bin//microblaze-ulibc-linux-gnu-ld: crti.o: No such file: No such file or directory
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
newlib がないことに気が付いた。
newlib を ln -s して
peta 版gcc で再再再再再度コンパイルもう一度挑戦。
newlib コンパイル時にエラー -> 失敗
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
newlib がないんだから configure 時に外すことに気が付いた
newlib を ln -s をけずってもとにもどして
configure から --with-newlib をけずる。
configure --target=microblaze --prefix=/home/ryos/FPGA_Linux/sysroot/mb --enable-multilib --disable-libssp --disable-newlib-atexit-dynamic-alloc --enable-optimize-memory --enable-languages=c,c++
peta 版gcc で再再再再再再度コンパイルもう一度挑戦。
どうよこれで。
peta 版特有の 同じエラー
FPGA_Linux/install/mb-ulibc-linux/bin//microblaze-ulibc-linux-gnu-ld: crti.o: No such file: No such file or directory
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -----------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
あー手順間違えてたのか、、、、
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
まず linux の include を
素の gcc へコピーだ。
find include/ | cpio -pdumv ~/FPGA_Linux/install/mb/microblaze/
asm も こぴして ln -s
find arch/microblaze/include | cpio -pdumv ~/FPGA_Linux/i .....
include/microblaze/asm をつくってそこを
include/asm にシンボリックリンク
これで 素の gcc + linux kernel の sysroot ができたんんだ。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
これでやっと libc とかがコンパイルできるので libc をコンパイルする!!!
あーこれは peta 版じゃないな、、、
まぁいいや
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
uclibc
INSTALL を読む
make menuconfig で microblaze だけを指定する。
elf2flt を導入するべきかまよったが、ライブラリなので必要ないといいう結論。
find . -exec grep UCLIBC_FORMAT_FLAT {} \; -print
して問題なさそうなことを確かめた。
make CROSS=microblaze-
-
-
-
- -
-
-
ar でこけた、、、、
-O0 -fno-builtin-sprintf
で microblaze-ar をつくりなおし
確認
> nm bfd/archive.o | grep sprintf
U sprintf
よっしゃクリアー
-
-
-
- -
-
-
ar は通過するもなんかえらー
おー
例の type のばってんぐだ
/usr/include/asm/posix_types_64.h:10: error: redefinition of typedef '__kernel_ino_t'
./include/bits/kernel_types.h
ん?なんでこの人 /usr/include みてんのよ、、、
なんだよ i386 用を作っているぞ。
KERNEL_HEADERS="/usr/include"
を指定する必要があるようだ。
/*
CROSS_COMPILER_PREFIX もからだな、、、、
CROSS_COMPILER_PREFIX はなんか大丈夫そうだからそのまま
*/
KERNEL_HEADERS="/home/ryos/FPGA_Linux/install/mb/microblaze/include"
clean して再コンパイル
./include/bits/uClibc_page.h:23:28: error: linux/autoconf.h: No such file or directory
./include/bits/uClibc_page.h:34:2: warning: #warning Missing CONFIG_MICROBLAZE_nnK_PAGES, assuming 4K
自動生成されるみたい。
rem:linux> ln -s ../generated/
asm-offsets.h autoconf.h bounds.h compile.h utsrelease.h
rem:linux> ln -s ../generated/*.h .
シンボリックリンクする。
再度 clean してコンパイル
お〜 コンパイル通った。
適当なところにインストール
make CROSS=microblaze- PREFIX=/home/ryos/tmp/jgeil install
sysroot に移動
find . -print | cpio -pdumv =1
これで 素の gcc + linux kernel + uclibc の sysroot ができたんんんだ。
素の gcc の役目はここまで。
これで sysroot をセーブしよう。
ls backup/
microblaze-sysroot-uclibc.tar.gz