nono 0.1.0 (2020/07/19)

nono は NetBSD とかで動作する OMRON LUNA-I とかのエミュレータです。 nono is OMRON LUNA-I emulator runs on NetBSD and so on.

ビルド方法 How to build

ビルドには以下が必要です。The following are required for build. wxWidgets は NetBSD(pkgsrc) なら pkgsrc/x11/wxGTK30 (OPTIONS:gtk2 推奨) です。 If you use NetBSD(pkgsrc), wxWidgets is pkgsrc/x11/wxGTK30 (OPTIONS:gtk2 is recommended).

アーカイブを展開したら以下のようにビルドします。 configure には環境変数 CC、CXX でコンパイラを指定することが出来ます。 また wx-config が標準的な名前で提供されていないために見付けられない場合には 環境変数 WX_CONFIG にパスを指定することが出来ます。 Extract the archive and build as following. You can specify C/C++ compiler using environment variable CC and CXX if configure cannot find standard name suitable compiler. Also, you can specify wx-config path using environment variable WX_CONFIG if configure cannot find wx-config.

% ./configure
% make depend
% make
% su
# make install

2つの実行ファイルがインストールされます。 nono が GUI 版実行ファイル、 nono-cli がコマンドライン版です。 Two executables will be installed. nono is GUI executable and nono-cli is command line executable.

コマンドラインオプション Command Line Option

-A file
ホストの file をロードして実行します。 ファイルが gzip 圧縮されていれば自動的に展開します。 (展開後の) ファイル形式は a.out (OMAGIC) か ELF で、 実際にはブートローダとカーネル程度しか想定していません。 設定ファイルの prom-image とともに指定されると -A のほうが優先します。 Loads and executes host's file. If the file is gzip'd, it is automatically extracted. The supported file format (after extracting) is a.out (OMAGIC) or ELF. Actually, it only assumes bootloaders or kernels. If this option is specified at the same time as prom-image in configuration file, this option preceeds.

-c vmdir
VM ディレクトリを指定します。省略するとカレントディレクトリとします。 Specifies the VM directory. If omitted, the current directory is used.

-f
高速モードで起動します。 GUI なら起動後にもメニューから変更できますが、その初期値を変えるだけです。 Boot as the fast mode. You can change this mode on GUI menu after boot, and the option only changes its initial state.

--fontsize height
GUI 版のみ。 全サブウインドウの起動時のフォントサイズを指定します。 height には 12, 16 のいずれかを指定します。デフォルトは 12 です。 GUI Only. Specifies the initial fontsize on all sub windows. height is one of 12 or 16. The default value is 12

-s scale
--scale scale
GUI 版のみ。 メインウィンドウの起動時のスケールを実数で指定します。 起動後にもメニューからプリセットされた倍率には変更可能ですが、 任意倍率は起動時のみ指定可能です (そのうちなんとかしたい)。 デフォルトは 1.0 です。 GUI Only. Specifies the initial main window scale in real number. You can change this scale on GUI menu after boot, but unlike this option, there are only a few preset choices (Should be improved in someday). The default value is 1.0

--show-config
設定ファイルと -V オプションを読み込んだ結果を表示します。 Shows the result of reading configuration file and parsing -V options.

-v
バージョンを表示します。 Shows the version.

-V name=value
設定ファイルの name=configvalue の代わりに このオプションの name=value を適用します。 Applies this option's name=value instead of name=configvalue in configuration file.

以下開発用。For developers:
-b hexaddr
デバッガのブレークポイントを 16進数で指定します。
-C
ログをコンソールにも出力します。 通常はログウィンドウにだけ出力されます。
-d
起動時にデバッガプロンプトで停止します。
-D
コンソールをデバッガとして使用します。 -d を指定しなくても起動時にプロンプトで停止します (そのうちなんとかしたい)
-L name1=level1[,name2=level2,...]
ログレベルを指定します。 カンマで区切って複数指定することも出来ます。 -Lhelp で name の一覧を表示します。
-M name[,name2,...]
起動時に表示するモニタウィンドウを指定します。 カンマで区切って複数指定することも出来ます。

設定 Configuration

VM の設定ファイルはその VM ディレクトリ内の nono.cfg です。 書式は key = value 形式で1行1項目ずつです。 keyvalue の前後の空白は取り除かれます。 また空行と "#" で始まる行は無視します。 知らないキーの行も無視します。 VM configuration file is nono.cfg in the VM directory. Its syntax is key = value format, one per line. White spaces before and after key and value are ignored. And, blank lines, lines beginning with "#", and lines with unrecognized key are also ignored.

設定項目は次の通りです。 The configuration items are:

vmtype = string
VM 種別を指定します。 今の所 string に 指定できるのは luna (LUNA-I) だけですが、省略不可です。 Specifies the VM type. For now, only luna (LUNA-I) can be specified for string. This field is mandatory.

debugger-port = integer
デバッガの TCP 待ち受けポート番号を指定します。 0 なら待ち受けを行いません。 デフォルトは 9999 です(適当)。

ethernet-hostdriver = string
イーサネットデバイスのホスト側ドライバを指定します。 nonetapbpf が指定できます。 none ならホスト側とは一切通信を行いません。 tapbpf かはホスト OS によってビルド時に決定します。 NetBSD なら tap です。

ethernet-macaddr = string
イーサネットデバイスの仮想マシン側の MAC アドレスを指定します。 XX:XX:XX:XX:XX:XX 形式で指定します。 auto なら自動的に決定します。 デフォルトは auto です。

luna-dipsw1 = string
本体前面 DIPSW#1-1..#1-8 の内容を指定します。 "0" を DOWN、"1" を UP として、 これを8つ並べた形式で、前から順に #1..#8 に対応します。 デフォルトは 11110111 です。 Specifies status of the front panel DIPSW#1-1..#1-8. "0" means DOWN and "1" means UP. The first character corresponds to #1 and the eighth character corresponds to #8. The default value is 11110111.
各スイッチの内容はここ (NetBSD/luna68k: Information) を参照してください。 See NetBSD/luna68k: Information about DIPSW.

luna-dipsw2 = string
本体前面 DIPSW#2-1..#2-8 の内容を指定します。 書式は luna-dipsw1 と同じです。 デフォルトは 11111111 です。 Specifies status of the front panel DIPSW#2-1..#2-8. The same syntax as luna-dipsw1 is used. The default value is 11111111.
すべて "1"(UP) なら NetBSD/luna68k のブートローダは自動的にカーネルをロードして実行し、 どれかでも "0"(DOWN) にするとプロンプトで停止するようです。 (本当は #8 だけで制御するつもりだったんじゃないかという気がします) If the value is 11111111, NetBSD/luna68k bootloader will automatically load and execute the kernel. Otherwise, the bootloader will enter interactive mode. (I doubt that they actually wanted to switch with only #8)

mpu-clock = value
MPU のクロック数を MHz 単位で指定します。 デフォルトは 20MHz です。 Specifies the MPU clock in MHz. The default value is 20MHz.

prom-image = path
外部 ROM イメージファイルのパスを指定します。 path がファイル名のみなら VM ディレクトリとその親ディレクトリからこのファイル名を検索します。 path が相対パスなら VM ディレクトリからの相対パスになります (現在のディレクトリからではありません)。 空にすると内蔵 ROM を使用します。 デフォルトは空です。 Specifies the external ROM image file path. If the path does not have any path delimiters, the VM directory and then its parent directory will be searched. If the path is a relative path, it will be path from the VM directory, not from the current directory. If the path is empty, internal emulated ROM will be used. The default value is empty.

実機を持っていない場合はこの値を空に (= デフォルトのままに) しておくと、 nono 内蔵のなんちゃって下位互換 ROM で起動します。 If you does not have the real LUNA machines, you can boot with nono's internal downward compatible emulated ROM if you set this field empty (or leave it as the default).

実機を持っている場合は ROM ファイルを指定することで実機 ROM で起動できます。 ROM ファイルは実機の 0x41000000-0x4101ffff (128KB) を保存したものです。 If you have the real LUNA machines, you can boot with the real ROM spcifying the ROM file path. The ROM file is extracted from 0x41000000-0x4101ffff (128KB) from the real machine.

ram-size = value
搭載する RAM サイズを MB 単位で指定します。 デフォルトは 16MB です。 Specifies the RAM size in MB. The default is 16MB.

spc0-idN-image = devtype,path
SCSI デバイスを指定します。N には 0 から 7 が入ります。 ID 7 は本体が使用しますので指定しないでください。 値はデバイス種別 devtype とイメージパス path を ","(カンマ) で区切って並べた形式で、 今の所デバイス種別 devtype には "hd"(ハードディスク) のみ指定可能です。 ディスクイメージパスが相対パスなら VM ディレクトリからの相対パスになります。 Specifies SCSI device. N is 0 to 7. But don't specify ID 7 because the host uses it. The value is in a form of device type devtype and the image path path separated by ","(comma). For now, only "hd" (hard disk) can be specified for devtype. If the path is relative path, it is from the VM directory.

例えば、nono.cfg と同じディレクトリに置いたディスクイメージ luna.img を使う場合、 LUNA では通常 ID 6 をプライマリ HDD に割り当てるのでこんな感じになります。 For example, if you use disk image luna.img placed in the same directory as nono.cfg, since LUNA usually assigns ID 6 to the primary HDD, write as following:

spc0-id6-image = hd,luna.img

spc0-idN-writeprotect = integer
指定の SCSI デバイスへの書き込みを無視するかどうか指定します。 0 なら通常動作(書き込みを行う)です。 1 なら書き込みコマンドは成功したように振る舞いますが実際には ディスクイメージに一切書き戻しません。 fsck を気にせずカーネルのデバッグとかを行いたい場合にはどうぞ。 何が起きるか意味が分からない人は指定しないでください。 デフォルトは 0 です。 Specifies whether nono ignores writing to SCSI devices. 0 means normal operation (writes to the devices). If 1 is specified, nono will not actually write back to the disk image even though the write command is succeeded. nono's SCSI devices acts as write command is successfully done but it never writes back to the actual disk image. This is useful for kernel debugging because it does not require fsck after the kernel hangs. But don't use this flag if you don't understand this paragraph. The default value is 0.

実行してみる Try it

つついさんが NetBSD/luna68k 9.0 の liveimage を用意してくださっています (いつもありがとうございます)。 Tsutsui-san has provided NetBSD/luna68k 9.0 liveimage for this (Thanks as always).
  1. どこかに nono 用のディレクトリを用意し(例えば ~/nono/)、 その中に VM ディレクトリを用意します (例えば ~/nono/luna/)。 Create a directory for nono somewhere (for example ~/nono/), and create subdirectory for individual VMs in it (for example ~/nono/luna).
  2. http://teokurebsd.org/netbsd/liveimage/20200518-luna68k/ から イメージファイルをダウンロードして展開し、 VM ディレクトリ ~/nono/luna/ に置きます。 Download imagefile from http://teokurebsd.org/netbsd/liveimage/20200518-luna68k/, extract it and place it in the VM directory, ~/nono/luna.
  3. 同じく VM ディレクトリに設定ファイル nono.cfg を以下の内容で用意します。 Create a configuration file nono.cfg in the same VM directory, ~/nono/luna, with following contents:
    vmtype = luna
    spc0-id6-image = hd,liveimage-luna68k-raw-20200518.img
    
  4. nono -c ~/nono/luna で起動します (VM ディレクトリに自動的に NVRAM.DAT が作られます)。 Run as nono -c ~/nono/luna. (It creates NVRAM.DAT automatically in the VM directory)
  5. Emulated ROM Monitor が起動するので、 初回は以下のように入力すると NetBSD が起動します。 The emulated ROM Monitor will be executed. Then, only for the first time, entering the following can boot NetBSD.
    k
    [Enter]
    [Enter]
    d
    boot
    g
    x
    
    この内容は NVRAM.DAT に記録されているので次回以降は直接 NetBSD が起動します。 The information you have just entered is recorded in NVRAM, so next time it boots NetBSD automatically.

元ツイートはこちらOriginal tweet

ネットワーク設定 Setup network

設定ファイル nono.cfg に以下の行を追加します。 Add the following line to configuration file, nono.cfg.
ethernet-hostdriver = tap
次に VM ディレクトリかその親ディレクトリに nono-ifup、nono-ifdown というスクリプトを用意します。 nono は tap(4) をオープンし、 そのデバイス名を引数にこれらのスクリプトを呼びます。 Then, prepare two scripts named nono-ifup and nono-ifdown in the VM directory or its parent directory. nono will open tap(4) and invoke these scripts with the name of the device as an argument.

最もシンプルなケースだとおそらく For example, in the simplest case, probably,

# brconfig bridge0 create
# brconfig bridge0 add wm0
のようにして用意しておいた bridge0 に対して、 (sudo の設定は別途行ってから) 次のような nono-ifup、nono-ifdown を用意すれば wm0 の物理セグメントとブリッジできると思います。 If you setup bridge0 as above (and setup sudo) and prepare the following nono-ifup, nono-ifdown scripts, you can bridge between the guest network and host's wm0.
nono-ifup
#!/bin/sh
sudo ifconfig $1 up
sudo brconfig bridge0 add $1
nono-ifup
#!/bin/sh
sudo brconfig bridge0 delete $1
sudo ifconfig $1 down

既知の問題 Known problems

変更履歴 Changes

See changes.html.

ライセンス License

See nono-license.txt.

パッチの提供について About contributes

パッチを提供してくださる場合は以下に同意したものとします。 If you provide a patch to nono, you must agree to the following conditions:

Acknowledgements

nono は以下の広告条項を含むソースコードを利用しています。 nono uses source code with the following advertising clause.
This product includes software developed by Gordon Ross
This product includes software developed by the University of California, Lawrence Berkeley Laboratory.

nono project