さて。

72.5kg

増えてる。。。。(運動しなくちゃ。)

 

という事で、ついに!C言語導入らしい。。(ワクワク)

ただ、一先ず先人に従い、コンパイラ及びリンカースクリプトを入れてみる。

『30日でできる!OS自作入門』を macOS Catalina で実行する - Qiita

 

$ brew install i386-elf-gcc

$ i386-elf-gcc -v

-bash: i386-elf-gcc: command not found

Orz...

やっぱ、いつも何かあるな。。。

ん?良くみると、install時の出力にヒントが!!

 

==> Installing dependencies for x86_64-elf-gcc: x86_64-elf-binutils

==> Installing x86_64-elf-gcc dependency: x86_64-elf-binutils

==> Downloading https://homebrew.bintray.com/bottles/x86_64-elf-binutils-2.34.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/57/57141264369389b9c50019aac6bb0f6dcf19935f20ea8fab57b56d4c4451066a?__gda__=exp=1589012995~hmac=7ab6dd4f

######################################################################## 100.0%

==> Pouring x86_64-elf-binutils-2.34.catalina.bottle.tar.gz

🍺  /usr/local/Cellar/x86_64-elf-binutils/2.34: 4,636 files, 236.3MB

==> Installing x86_64-elf-gcc

==> Downloading https://homebrew.bintray.com/bottles/x86_64-elf-gcc-9.3.0.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/a1/a18c6acf4979f96244584de989ab47791670bc5404e0eca8626708f9e3375702?__gda__=exp=1589013047~hmac=f55dd95c

######################################################################## 100.0%

==> Pouring x86_64-elf-gcc-9.3.0.catalina.bottle.tar.gz

🍺  /usr/local/Cellar/x86_64-elf-gcc/9.3.0: 587 files, 105.0MB

 

ふむ。なんか、名前変わってるのか?

$ x86_64-elf-gcc -v

組み込み spec を使用しています。

COLLECT_GCC=x86_64-elf-gcc

COLLECT_LTO_WRAPPER=/usr/local/Cellar/x86_64-elf-gcc/9.3.0/libexec/gcc/x86_64-elf/9.3.0/lto-wrapper

ターゲット: x86_64-elf

configure 設定: ../configure --target=x86_64-elf --enable-targets=all --enable-multilib --prefix=/usr/local/Cellar/x86_64-elf-gcc/9.3.0 --without-isl --disable-werror --without-headers --with-as=/usr/local/opt/x86_64-elf-binutils/bin/x86_64-elf-as --with-ld=/usr/local/opt/x86_64-elf-binutils/bin/x86_64-elf-ld --enable-languages=c,c++

スレッドモデル: single

gcc バージョン 9.3.0 (GCC) 

 

なるほど。。

まぁ、そういう事なら、一先ずこれで進めてみる。(しか無い。。)

で、nasmが原因でエラーになるいくつかの部分のコードを修正(;つけて飛ばすだけ)し、

実行してみる。

$ make run

make -r img

make -r haribote.img

nasm ipl10.nas -o ipl10.bin -l ipl10.lst

nasm asmhead.nas -o asmhead.bin -l asmhead.lst

x86_64-elf-gcc -march=i486 -m32 -nostdlib -T hrb.ld bootpack.c -o bootpack.hrb

/usr/local/opt/x86_64-elf-binutils/bin/x86_64-elf-ld: i386 architecture of input file `/var/folders/lq/kk7l39qx0j322v4gdb0whjlr0000gn/T//ccs5YXDB.o' is incompatible with i386:x86-64 output

collect2: エラー: ld はステータス 1 で終了しました

make[2]: *** [bootpack.hrb] Error 1

make[1]: *** [img] Error 2

make: *** [run] Error 2

ドーーーん!!!!(でたぁ〜!!!)

これは、なんかヤバイ雰囲気がする。。

という訳で、これも調べる。。

 

参った。。。

これは、簡単には解決できないかも。。。

 

頑張ろう。。。