qemu

64bit なマシンから 32bit なソレをなんとかする方法があるはず、と man 見てたら -cpu ? 見てみ、との記述あり。

$ qemu -cpu ?
x86           qemu32
x86          coreduo
x86              486
x86          pentium
x86         pentium2
x86         pentium3
x86           athlon
x86             n270
$

ふむ。ディスクイメージとかカーネルとかデバッグ情報を 64bit な環境に持ってって試験してみよう。

# qemuctl -cpu qemu32 -m 8 -hdb hd_oldlinux.img -fda Image -boot a&

動きよったwww
別途 gdb なナニを試験します。これから晩メシ作成です。

スキを見て

煮込みに入ったスキにデバッガ起動してみたりなど

$ qemuctl -m 8 -hdb hd_oldlinux.img -fda Image -boot a -s -S&
$ gdb Image
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"/home/rms/Documents/linux-0.01/images/Image": not in executable format: File format not recognized
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
(gdb) symbol-file system
Reading symbols from /home/rms/Documents/linux-0.01/images/system...done.
(gdb) break main
Breakpoint 1 at 0x522f: file init/main.c, line 80.
(gdb) c
Continuing.

Breakpoint 1, main () at init/main.c:80
80      init/main.c: No such file or directory.
        in init/main.c
(gdb) list
75      in init/main.c
(gdb) 

む。ソースが無いからアレなのか。。ソースツリーは手元にあるので無理矢理ナニ。

$ qemuctl -cpu qemu32 -m 8 -hdb ../images/hd_oldlinux.img -fda Image -boot a -s -S&
$ gdb Image 
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"/home/rms/Documents/linux-0.01/linux-0.01-rm-3.5/Image": not in executable format: File format not recognized
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
(gdb) symbol-file system
Reading symbols from /home/rms/Documents/linux-0.01/linux-0.01-rm-3.5/system...done.
(gdb) break main
Breakpoint 1 at 0x522f: file init/main.c, line 80.
(gdb) c
Continuing.

Breakpoint 1, main () at init/main.c:80
80      {                       /* The startup routine assumes (well, ...) this */
(gdb) list
75              BCD_TO_BIN(time.tm_year);
76              startup_time = kernel_mktime(&time);
77      }
78
79      int main(void)          /* This really IS void, no error here. */
80      {                       /* The startup routine assumes (well, ...) this */
81      /*
82       * Interrupts are still disabled. Do necessary setups, then
83       * enable them
84       */
(gdb) 

オーゲーww