Quantcast
Channel: Astr0baby's not so random thoughts _____ rand() % 100;
Viewing all articles
Browse latest Browse all 183

Running AIX 5.1 on qemu-system-ppc

$
0
0

Shorter entry here which will be mostly copying Artyem  Trasenko’s blog here https://tyom.blogspot.com/2019/04/aixprep-under-qemu-how-to.html  

If you have never installed AIX before this howto would help you get going

Installing AIX on Qemu!

A small note on the networking – I have used the following values

en0        10.0.2.12  
gateway    10.0.2.2   
nameserver 8.8.8.8

I will just add my bits and pieces to get the part I have done and added to the experience. This guide will work also for AIX 4.4.3 but not anything newer than 5.1

One can get  the AIX 5.1 installation media (ISOs) from WinWorld archive here https://winworldpc.com/product/aix/51

You will probably only want CD1, CD2 and CD3

IBM AIX 5.1-3 (LCD4_1061_06) (ISO) [PPC] Volume 1 5.1-3 (LCD4_1061_06) English ppc CD 358.71MB
IBM AIX 5.1-3 (LCD4_1061_06) (ISO) [PPC] Volume 2 5.1-3 (LCD4_1061_06) English ppc CD 170.86MB
IBM AIX 5.1-3 (LCD4_1061_06) (ISO) [PPC] Volume 3 5.1-3 (LCD4_1061_06) English ppc CD 303MB

So once you have all in place you can use the following scripts to get networking done

#Setup tap and bridge 
tunctl -t tap0 -u user
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
iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

And this  slightly modified /etc/qemu-ifup  (place it in /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

Here is my loader script to make things easier

./qemu-system-ppc -m 192 -M 40p -bios q40pofw-serial.rom -serial telnet::4441,server -hda aix-hdd.qcow2 -cdrom ./cd.iso -net nic -net tap -vga none -nographic

So once we have AIX 5.1 installed we can start setting it up a little, I will include only short work-log notes I have made during my experimentation (which is still ongoing) so will probably add more as time goes by. I assume you have at least basic knowledge of some sort of UNIX environment.

You will need a good deal of additional software installed (I have used Michael Perzl’s legendary AIX Open Source Packages repo) from here -> http://www.perzl.org/aix/

To save some time I have collected all the needed RPMs (You will love the RPM dependency hell on these legacy UNIX systems, trust me) to my repository,  which can be downloaded from here http://45.76.81.249/AIX/aix-5.1/RPMs/ you should install all the RPMs from there. To transfer these packages to the emulated AIX 5.1 you can use ftp for example.

# rpm -Uvh name-or-package.rpm

To get a nice remote X11 desktop I use Xephyr (this will only work if your network is configured and works)

On AIX run 
# /usr/X11/bin/xdm

On Linux 
$ Xephyr -screen 980x640 -ac -query 10.0.2.12 :3

Compiling OpenSSH on AIX 5.1

Since AIX 5.1 does not have any kernel support for prng pseudodevices, there is no /dev/rand or /dev/urandom   So in order to compile OpenSSH we need to first download and build prngd

You can download it from my repo from  here http://45.76.81.249/AIX/aix-5.1/prngd-0.9.29.tar Or get it from Sourceforge project page https://sourceforge.net/projects/prngd/files/prngd/0.9.29/

ON AIX
Unpack the sources e.g.:

# gunzip -c prngd-0.9.29.tar.gz | tar xvf -
# cd prngd-0.9.29

Modify the Makefile according to the OS version:

# ln -s /usr/bin/gcc /usr/bin/cc

then build it

# gmake clean
# gmake

Install into some convenient directory, e.g.:

# cp contrib/AIX-4.3/prngd.conf.aix43 /etc/prngd.conf # entropy gathering commands
# cp in/prngd /usr/sbin/prngd

Configure it next  and create a subsystem:

# cat /var/adm/wtmp > /etc/prngd-seed # random seed
# mkssys -s prngd -p /usr/sbin/prngd -a '-f -c /etc/prngd.conf -s /etc/prngd-seed /dev/egd-pool' -u 0 -S -n 15 -f 9 -R -G local
# startsrc -s prngd

Add to /etc/rc.local:

startsrc -s prngd # start the subsystem on boot

Next we can download/compile OpenSSH , latest version that builds and works well is 6.9p1

https://openbsd.mirror.netelligent.ca/pub/OpenBSD/OpenSSH/portable/

OpenSSH 3.5p1 –> builds fine and works

# ./configure --with-prngd-socket=/dev/egd-pool
# gmake
# mkuser -m sshd
# gmake install

OpenSSH 4.9p1 — OK
OpenSSH 5.9p1 — OK
OpenSSH 6.9p1 — OK

# ./configure --with-prngd-socket=/dev/egd-pool
# gmake
# mkuser -m sshd
# gmake install
0509-150 Dependent module libcrypto.a(libcrypto.so.1.0.2) could not be loaded.
# ln -s /opt/freeware/lib/libcrypro.a /usr/lib
# gmake install

Next I have added some hints that migth get one going more

To get libm.a match libraries installed mount CD1 of AIX 5.1 and upload the bos.adt from CD1/intallp/ppc/bos.adt to the virtual AIX 5.1 and install it

# installp -acF -d . bos.adt

Additionally one can install more stuff like IBM C compilers and X11.motif X11.adt ..

# installp -acF -d . X11.adt 
# installp -acF -d . X11.motif

You can then do many things … one of the experients was compiling Prboom

You can try the binaries here http://45.76.81.249/AIX/aix-5.1/doom.tar

Latest Elinks 0.13 http://elinks.or.cz/download/elinks-current-0.13.tar.gz 

You can download the compiled RISC System/6000 binary+source here , just untar and gmake install   http://45.76.81.249/AIX/aix-5.1/elinks-0.13-20190426.tar

Latest stable PKGSRC Q1-2019 fails to bootstrap with the following error

To install CDE and run it instead of the boring mwm get the following packages from the CD1

Nice command to list last installed AIX packages via installp (from https://www.ibm.com/developerworks/community/blogs/brian/entry/how_to_show_most_recently_installed_filesets_on_aix?lang=en)

lslpp -qch | awk -F: '{printf "%-14s %-40s %-15s\n",$7,$2,$3}' |
sort | uniq | sed 's/70/-70/' | sort -t '/' -k 3,3n -k 1,1n -k 2,2n |
sed 's/-70/70/'

Here are the Dt relevant ones one needs

05/03/19 OpenGL.GL32.adt.demos 5.1.0.0 
05/03/19 OpenGL.GL32.adt.include 5.1.0.0 
05/03/19 OpenGL.GL32.adt.samples 5.1.0.0 
05/03/19 OpenGL.GL32.rte.base 5.1.0.0 
05/03/19 OpenGL.OpenGL_X.adt.include 5.1.0.25 
05/03/19 OpenGL.OpenGL_X.adt.samples 5.1.0.35 
05/03/19 OpenGL.OpenGL_X.dev.vfb 5.1.0.50 
05/03/19 OpenGL.OpenGL_X.rte.base 5.1.0.50 
05/03/19 OpenGL.OpenGL_X.rte.base+ 5.1.0.10 
05/03/19 OpenGL.OpenGL_X.rte.base_mp 5.1.0.10 
05/03/19 OpenGL.OpenGL_X.rte.pipe++ 5.1.0.35 
05/03/19 OpenGL.OpenGL_X.rte.pipe64++ 5.1.0.35 
05/03/19 OpenGL.OpenGL_X.rte.soft 5.1.0.50 
05/03/19 OpenGL.OpenGL_X.tools.base 5.1.0.0 
05/03/19 X11.adt.bitmaps 5.1.0.0 
05/03/19 X11.adt.ext 5.1.0.25 
05/03/19 X11.adt.imake 5.1.0.15 
05/03/19 X11.adt.include 5.1.0.0 
05/03/19 X11.adt.lib 5.1.0.0 
05/03/19 X11.adt.motif 5.1.0.0 
05/03/19 X11.vfb 5.1.0.15 
05/05/19 X11.Dt.ToolTalk 5.1.0.50 
05/05/19 X11.Dt.bitmaps 5.1.0.0 
05/05/19 X11.Dt.helpinfo 5.1.0.0 
05/05/19 X11.Dt.helpmin 5.1.0.0 
05/05/19 X11.Dt.helprun 5.1.0.0 
05/05/19 X11.Dt.lib 5.1.0.50 
05/05/19 X11.Dt.rte 5.1.0.50 
05/05/19 X11.apps.aixterm 5.1.0.35 
05/05/19 X11.apps.clients 5.1.0.0 
05/05/19 X11.apps.config 5.1.0.0 
05/05/19 X11.apps.custom 5.1.0.0 
05/05/19 X11.apps.msmit 5.1.0.50 
05/05/19 X11.apps.pm 5.1.0.0 
05/05/19 X11.apps.rte 5.1.0.0 
05/05/19 X11.apps.util 5.1.0.0 
05/05/19 X11.apps.xdm 5.1.0.25 
05/05/19 X11.apps.xterm 5.1.0.10 
05/05/19 X11.base.common 5.1.0.0 
05/05/19 X11.base.lib 5.1.0.50 
05/05/19 X11.base.rte 5.1.0.50 
05/05/19 X11.base.smt 5.1.0.25 
05/05/19 X11.fnt.Gr_Cyr_T1 5.1.0.0 
05/05/19 X11.fnt.coreX 5.1.0.0 
05/05/19 X11.fnt.defaultFonts 5.1.0.0 
05/05/19 X11.fnt.ibm1046 5.1.0.0 
05/05/19 X11.fnt.ibm1046_T1 5.1.0.0 
05/05/19 X11.fnt.iso1 5.1.0.25 
05/05/19 X11.fnt.iso2 5.1.0.0 
05/05/19 X11.fnt.iso3 5.1.0.0 
05/05/19 X11.fnt.iso4 5.1.0.0 
05/05/19 X11.fnt.iso5 5.1.0.0 
05/05/19 X11.fnt.iso7 5.1.0.0 
05/05/19 X11.fnt.iso8 5.1.0.0 
05/05/19 X11.fnt.iso8_T1 5.1.0.0 
05/05/19 X11.fnt.iso9 5.1.0.0 
05/05/19 X11.fnt.iso_T1 5.1.0.0 
05/05/19 X11.fnt.ksc5601.ttf 5.1.0.0 
05/05/19 X11.fnt.ucs.com 5.1.0.0 
05/05/19 X11.fnt.util 5.1.0.0 
05/05/19 X11.motif.lib 5.1.0.50 
05/05/19 X11.motif.mwm 5.1.0.35 
05/05/19 X11.vsm.lib 5.1.0.25 
05/05/19 bos.txt.bib 5.1.0.0 
05/05/19 bos.txt.bib.data 5.1.0.0 
05/05/19 bos.txt.hplj.fnt 5.1.0.0 
05/05/19 bos.txt.ibm3812.fnt 5.1.0.0 
05/05/19 bos.txt.ibm3816.fnt 5.1.0.0 
05/05/19 bos.txt.spell 5.1.0.0 
05/05/19 bos.txt.spell.data 5.1.0.0 
05/05/19 bos.txt.tfs 5.1.0.0 
05/05/19 bos.txt.tfs.data 5.1.0.0 
05/05/19 bos.txt.ts 5.1.0.35 
05/05/19 xlC.aix50.rte 5.0.2.2 
05/05/19 xlC.cpp 5.0.2.0 
05/05/19 xlC.rte 5.0.2.1

Once we have these on place we create a backup of a few files

# mv /usr/lib/X11/xdm/Xsession  /usr/lib/X11/xdm/Xsession.mwm
# cp /usr/dt/bin/Xsession /usr/dt/bin/Xsession.cde


Now the CDE (dt) Xsession has some strange keboard configurations that 
will effectively mess up the CDE session if you would want to use 
the keyboard (which we want) so I have modified it a little and uploaded 
to my site which you can get here 

http://45.76.81.249/AIX/aix-5.1/Xsession.cde

# cp Xsession.cde /usr/lib/X11/Xsession 
# /usr/bin/X11/xdm

And on the Linux machine that runs qemu-system-ppc 

$ Xephyr -screen 980x640 -ac -query 10.0.2.12 :3

We get a nice CDE desktop finally

Be patient, full CDE takes about 1 minute to load


Viewing all articles
Browse latest Browse all 183

Trending Articles