mtoolsについてのメモ
利用環境
VirtualBox 6.0.12 platform packages
CentOS-7-x86_64-DVD-1908.iso
30日でできるOS自作入門 という本を買って勉強している
環境の構築(CentOSへNASMインストールはこちら)
これの途中で、FATタイプのディスクイメージを作る際、ちょっと調べたメモ
mtoolsとは
UNIX上でマウントせずにMS-DOSのファイルにアクセスするためのツール郡
主な情報
- Mtools - Wikipedia
- 2.2 Drive letters - Mtools 4.0.23
- mtoolsの使い方が知りたい - ITmedia エンタープライズ
- mformatのオプション
主要な使い方
mformat --helpにて
-Bがブートセクタの指定
-f ファイルサイズ
-C MS-DOSファイル・システムを作成する
-i The drive letter : (colon) has a special meaning. It is used to access image files which are directly specified on the command line using the -i options.
Example: mcopy -i my-image-file.bin ::file1 ::file2 .
使用例
以下のような記述をmakefileに記述する。
FATフォーマットのイメージファイルを作成する。(MayBoot.binの512バイトがブートセクタ)
mformat -f 1440 -C -B MayBoot.bin -i $@ ::
OS本体をイメージに書き込む
mcopy -i $@ ${OSNAME}.sys ::