使用 QEMU 安装及运行AIX 5.1

前言

本文仅用于记录本人尝试在Linux上通过QEMU虚拟化Power5 CPU,安装并运行AIX5.1的过程。其中涉及的Ubuntu、和AIX 5.1安装过程仅适用于本过程。

参考了 neozeed (https://virtuallyfun.com/wordpress/2019/04/22/installing-aix-on-qemu)和 astr0baby (https://astr0baby.wordpress.com/2019/04/26/running-aix-5-1-on-qemu-system-ppc/)的文章。

 

版权和商标

版权

所使用的 q40pofw-serial.rom 固件 和 QEMU 源码均下载自 Artyem  Trasenko 的 github 站点(https://github.com/artyom-tarasenko/),版权的解释权归作者。

AIX操作系统是IBM公司拥有版权的闭源的商用操作系统,并非自由软件。请在安装完成后在24小时内删除。

商标

QEMU 是 Fabrice Bellard 在美国和/或其他国家或地区的注册商标。

Linux 是 Linus Torvalds 在美国和/或其他国家或地区的注册商标。

Ubuntu 是 Canonical Ltd. 在美国和/或其他国家或地区的注册商标。

IBM、ibm.com®、AIX、Lotus、Power5是 IBM Corporation 在美国和/或其他国家或地区的商标。

Microsoft、Internet Explorer、Windows 以及 Windows 徽标是 Microsoft Corporation 在美国和/或其他国家或地区的商标。

Intel 是 Intel Corporation 或其子公司在美国和其他国家或地区的商标或注册商标。

Oracle、JavaScript 和 Java 是 Oracle 和/或其关联机构的注册商标。

1 实验环境

1.1 硬件

DELL M3800 ( Intel(R) Core(TM)i7-4712HQ )

1.2 软件

Microsoft Windows 10 专业版 1903 [版本 10.0.18362.267]

Ubuntu 18.04.3 LTS  (Linux sv-ub-01 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux )

2 准备

2.1  下载

下载 Ubuntu Server 18.04.3 LTS 的光盘文件镜像 ubuntu-18.04.3-live-server-amd64.iso  (https://ubuntu.com/download/server

下载 AIX 5.1 的安装文件 (https://winworldpc.com/product/aix/51)。至少要下载CD1、CD2、CD3、CD4。

下载putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)用于连接Ubuntu和AIX,也可以使用其他终端。

下载 Xming (https://sourceforge.net/projects/xming/files/Xming-mesa/)用于连接AIX的X11 GUI。如果不需要图形界面,也可不安装。

2.2  设置

在Windows 10 中启用 Hyper-V

以管理员权限运行 Windows PowerShell ,创建一个使用静态地址的虚拟交换机:


PS C:\Windows\system32> New-VMSwitch -SwitchName "NAT" -SwitchType Internal -Verbose                                   

详细信息: New-VMSwitch 将创建新的虚拟交换机“NAT”。                                                                    
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
NAT  Internal


PS C:\Windows\system32> Get-NetAdapter 

为了查看 vEthernet (NAT)  的 ifIndex 编号

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
WLAN                      Dell Wireless 1560 802.11ac                  24 Up           XX-XX--XX-XX-XX-XX       135 Mbps
vEthernet (Ext Switch)    Hyper-V Virtual Ethernet Adapter #2          19 Up           XX-XX--XX-XX-XX-XX       135 Mbps
网桥                      Microsoft Network Adapter Multiplexo...      18 Up           XX-XX--XX-XX-XX-XX       135 Mbps
蓝牙网络连接              Bluetooth Device (Personal Area Netw...      13 DisconnectedXX-XX--XX-XX-XX-XX         3 Mbps
vEthernet (Default Swi... Hyper-V Virtual Ethernet Adapter             30 Up           XX-XX--XX-XX-XX-XX        10 Gbps
vEthernet (NAT)           Hyper-V Virtual Ethernet Adapter #3          37 Up           XX-XX--XX-XX-XX-XX        10 Gbps


PS C:\Windows\system32> New-NetIPAddress -IPAddress 192.168.204.1 -PrefixLength 24 -InterfaceIndex 37 -Verbose
详细信息: Performing operation "New" on Target "NetIPAddress -IPv4Address 192.168.204.1 -InterfaceIndex 37 -Store
Active"
详细信息: Performing operation "New" on Target "NetIPAddress -IPv4Address 192.168.204.1 -InterfaceIndex 37 -Store
Persistent"


IPAddress         : 192.168.204.1
InterfaceIndex    : 37
InterfaceAlias    : vEthernet (NAT)
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Tentative
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

IPAddress         : 192.168.204.1
InterfaceIndex    : 37
InterfaceAlias    : vEthernet (NAT)
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Invalid
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : PersistentStore

 

PS C:\Windows\system32> New-NetNat -Name NATNetwork -InternalIPInterfaceAddressPrefix 192.168.204.0/24 -Verbose

 

这样做的原因是默认的虚拟交换机总是随机改变DHCP的网段,如果使用静态IP,每次都要更改才能联网,增加了不必要的麻烦。该步骤非必须。

3 安装Linux

3.1 使用 Hyper-V 管理器安装Ubuntu

3.1.1 Hyper-V设置:

硬件兼容性:第一代

内存:4096MB

CPU:4

网络适配器:NAT

3.1.2  Ubuntu 安装过程

Install Ubuntu Server

语言:English

网络配置:

 文件系统:

 Install OpenSSH Server

不选择 Featured Server Snaps

安装后重启。

注意:如果Ubuntu逻辑卷空间不足,可以扩展相应逻辑卷

$ sudo lvdisplay
$ sudo lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv
$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

3.2 编译、安装QEMU

3.2.1 安装QEMU的依赖软件包

通过ssh连接ubuntu

$ sudo apt  update
$ sudo apt  upgrade
$ sudo apt  install build-essential pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev
$ sudo apt install python2.7

3.2.2 获取、编译QEMU源码

$ git clone --branch 40p-20190406-aix-boots --single-branch https://github.com/artyom-tarasenko/qemu.git
$ ./configure --target-list=ppc-softmmu --disable-sdl --disable-vnc --disable-gtk --python=python2.7

因为QEMU的宿主服务器不需要声卡,因此在编译前,编辑 config-host.mak 文件
删除

CONFIG_AUDIO_DRIVERS=oss
CONFIG_AUDIO_OSS=m

编译并安装

$ make -j4
$ make && make install

3.3 在 Ubuntu 上为QEMU虚拟机设置桥接网络

3.3.1 安装依赖工具包

$ sudo apt install uml-utilities
$ sudo apt install bridge-utils

3.3.2 设置桥接网络

$ su –

#Setup tap and bridge use root 
tunctl -t tap0 -u user01 
ifconfig tap0 up
brctl addbr br0
brctl setfd br0 0
ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
brctl addif br0 tap0
ifconfig tap0 0.0.0.0
sysctl net.ipv4.ip_forward=1

注意:上述命令中的user01为当前用户的用户名,不建议使用root。

3.3.3  网络防火墙设置

$ sudo iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

非必须,如果使用iptables防火墙的话。

3.3.4 修改QEMU网络启动脚本 /etc/qemu-ifup

#! /bin/sh
# Script to bring a network (tap) device for qemu up.
# The idea is to add the tap device to the same bridge
# as we have default routing to.

# in order to be able to find brctl
PATH=$PATH:/sbin:/usr/sbin
ip=$(which ip)

if [ -n "$ip" ]; then
ip link set "$1" up
else
brctl=$(which brctl)
if [ ! "$ip" -o ! "$brctl" ]; then
echo "W: $0: not doing any bridge processing: neither ip nor brctl utility not found" >&2
exit 0
fi
ifconfig "$1" 0.0.0.0 up
fi

switch=$(ip route ls |
awk '/^default / {
for(i=0;i<NF;i++) { if ($i == "dev") { print $(i+1); next; } }
}'
)

switch=br0

# only add the interface to default-route bridge if we
# have such interface (with default route) and if that
# interface is actually a bridge.
# It is possible to have several default routes too
for br in $switch; do
if [ -d /sys/class/net/$br/bridge/. ]; then
if [ -n "$ip" ]; then
ip link set "$1" master "$br"
else
brctl addif $br "$1"
fi
exit # exit with status of the previous command
fi
done

echo "W: $0: no bridge for guest interface found" >&2

3.3.5 获取能启动 AIX 的固件

$ wget https://github.com/artyom-tarasenko/openfirmware/releases/download/40p-20190413/q40pofw-serial.rom

3.3.6 上传AIX安装光盘镜像到Ubuntu

4 安装 AIX 5.1

4.1 创建虚拟硬盘文件

$ qemu-img create -f qcow2 aix5-hdd.qcow2 16G

4.2 启动QEMU虚拟机

为了避免安装出错,先使用不含网络连接的方式启动。

$ qemu-system-ppc -m 128 -M 40p -bios q40pofw-serial.rom -serial telnet::4441,server -hda aix5-hdd.qcow2 -vga none -nographic -net none -cdrom VOLUME1.iso

4.3 安装 AIX 5.1

telnet 到 192.168.204.182 的 4441 端口,开始安装。

挂载cdrom

.partitions cdrom

确定从 cdrom:2 引导

boot cdrom:2

虽然没有回显,键入 1 ,等待几秒,还是能通过的。

安装结束前会有驱动程序安装错误

FAILURES
--------
  Filesets listed in this section failed pre-installation verification
  and will not be installed.

  Missing Filesets
  ----------------
  The following filesets could not be found on the installation media.
  If you feel these filesets really are on the media, check for typographical
  errors in the name specified or, if installing from directory, check for
  discrepancies between the Table of Contents file (.toc) and the images that
  reside in the directory.

    devices.pci.00000010

  << End of Failure Section >>
 

可以忽略,系统安装完成后会自动重启。

重启时,选择disk启动

boot disk

一般使用vt100

选择最后一项 Task Completed - Exit to Login,安装完成后,会重新启动。

 重启时,选择disk启动

boot disk

使用root登录后,选择终端类型

# export TERM=vt100

确认通过 shutdown -Fh 可以正常关机,回显 ....Halt completed....


4.4 挂载虚拟网卡

4.4.1 启动QEMU虚拟机

$ sudo qemu-system-ppc -m 192 -M 40p -bios q40pofw-serial.rom -serial telnet::4441,server -hda aix5-hdd.qcow2 -vga none -nographic -L pc-bios -net nic -net tap  -cdrom VOLUME1.iso  -monitor mon:stdio

4.4.2 使用smitty安装网卡驱动

# export TERM=vt100
# smitty

注意:在putty默认键盘映射中,F3 为Esc-3 组合键,F4为Esc-4 组合键……

 

4.4.3 修补网卡驱动问题

在AIX上用root运行

# cat > lance-chg.asc
CuAt:
name = "ent0"
attribute = "busio"
value = "0x01000000"
type = "O"
generic = "D"
rep = "nr"
nls_index = 3

^D

注意:^D 在putty中为 Ctrl-D 组合键

# odmchange -o CuAt -q "name=ent0 and attribute=busio" lance-chg.asc
# rmdev -l ent0
# mkdev -l ent0
# ifconfig en0 10.0.2.12

4.4.4  设置网络地址

 

安装网络驱动后,可以在Linux主机ping 10.0.2.12


PING 10.0.2.12 (10.0.2.12) 56(84) bytes of data.
64 bytes from 10.0.2.12: icmp_seq=1 ttl=255 time=1.90 ms
64 bytes from 10.0.2.12: icmp_seq=2 ttl=255 time=0.437 ms
64 bytes from 10.0.2.12: icmp_seq=3 ttl=255 time=0.359 ms
^C
--- 10.0.2.12 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2021ms
rtt min/avg/max/mdev = 0.359/0.901/1.909/0.713 ms

从Linux主机telnet 10.0.2.12 后,可以用root登录。

4.5 安装CDE和其他软件

4.5.1 使用smitty安装CDE

Software Installation and Maintenance -- Install and Update Software -- Install Software Bundle --

选择 INPUT device / directory for software  [/dev/cd0]

选择 CDE

4.5.2 使用smitty安装topas

Software Installation and Maintenance -- Install and Update Software --  Install Software --

SOFTWARE to install [bos.adt*, bos.dosutil*, bos.data*, bos.net*, bos.perf*, perfagent.tools*]

注意:

如果需要更换安装CD镜像,可在 QEMU  monitor下运行如下命令:

QEMU 3.0.92 monitor - type 'help' for more information
(qemu) QEMU 3.0.92 monitor - type 'help' for more information
(qemu) info block
scsi0-hd0 (#block101): aix5-hdd.qcow2 (qcow2)
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[0]
    Cache mode:       writeback

scsi0-cd2 (#block316): VOLUME1.iso (raw, read-only)
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[2]
    Removable device: not locked, tray closed
    Cache mode:       writeback

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[20]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed
(qemu) eject scsi0-cd2
(qemu) info block
scsi0-hd0 (#block101): aix5-hdd.qcow2 (qcow2)
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[0]
    Cache mode:       writethrough

scsi0-cd2: [not inserted]
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[2]
    Removable device: not locked, tray open

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[20]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed
(qemu) change scsi0-cd2 VOLUME2.iso
(qemu) info block
scsi0-hd0 (#block101): aix5-hdd.qcow2 (qcow2)
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[0]
    Cache mode:       writethrough

scsi0-cd2 (#block649): VOLUME2.iso (raw, read-only)
    Attached to:      /machine/unattached/device[23]/scsi.0/legacy[2]
    Removable device: not locked, tray closed
    Cache mode:       writeback

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[20]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed
 

4.5.3 在Ubuntu上连接CDE

在windows上安装并启动Xming。

在Ubuntu上安装xephyr:

$ sudo apt install xserver-xephyr
$ Xephyr -screen 1024x768 -ac -query 10.0.2.12 :3

4.5.4 其他开源软件

从 Michael Perzl 的 legendary AIX Open Source Packages repo (http://www.perzl.org/aix/ ) 中,可以找到其他开源软件包,例如OpenJDK (Oracle 的开源 Java SDK)、unzip 、gcc等 。默认安装在 /opt 下。安装前注意分配 /opt 的容量,例如: chfs -a size=+1024000G /opt

 

  • 5
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值