Running SunOS 4.1.4 on QEMU on my laptop

had an successful attempt to install and run SunOS 4.1.4 on my laptop using QEMU SPARC processor emulation mode.

Here is the command I started with:

$ bin/qemu-system-sparc -M SS-20 -m 512 -cpu "TI SuperSparc 60" -serial telnet:0.0.0.0:3001,server \
-bios bios/my-sun/ss20_v2.25_rom -nographic -hda dsks/test-sun414-root-dsk.raw -cdrom iso/sunos414.iso

Where:

  • hda = dsks/test-sun414-root-dsk.raw
  • cdrom = iso/sunos414.iso

EPROM output:

ok devalias
...
disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
disk2 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@2,0
disk1 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@1,0
disk0 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@0,0

And here is how QEMU sees block devices:

(qemu) info block
scsi0-hd0: removable=0 io-status=ok file=dsks/test-sun414-root-dsk.raw ro=0 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
scsi0-cd2: removable=1 locked=0 tray-open=0 io-status=ok file=iso/sunos414.iso ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]

Here is how the EPROM sees block devices:

ok probe-scsi-all
/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000
Target 0
Unit 0 Disk QEMU QEMU HARDDISK 1.2.
Unit 1 Disk QEMU QEMU HARDDISK 1.2.
Unit 2 Disk QEMU QEMU HARDDISK 1.2.
Unit 3 Disk QEMU QEMU HARDDISK 1.2.
Unit 4 Disk QEMU QEMU HARDDISK 1.2.
Unit 5 Disk QEMU QEMU HARDDISK 1.2.
Unit 6 Disk QEMU QEMU HARDDISK 1.2.
Unit 7 Disk QEMU QEMU HARDDISK 1.2.
Target 2
Unit 0 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 1 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 2 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 3 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 4 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 5 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 6 Removable Read Only device QEMU QEMU CD-ROM 1.2.
Unit 7 Removable Read Only device QEMU QEMU CD-ROM 1.2.

I was faced with an error from the installation media, I don’t exactly remember the error since it was long ago but I assume it’s with the MAKEDEV script that creates device files failing to create device files in RAM disk installation image, and the solution was:

setenv sbus-probe-list f
reset

boot disk2:d (CDROM)

[ MAKEDEV trick ]

boot disk0:b -sw
 
boot disk0:a
...

Then fake MAKEDEV

# cd /dev
# mv MADEDEV MAKEDEV.orig
# ln -s /bin/true MAKEDEV
# ln -s sd1a sr0
# ln -s rsd1a rsr0

Here is the dmesg from the running system:

Sep 12 18:20
SuperSPARC: PAC ENABLED
SunOS Release 4.1.4 (GENERIC) #2: Fri Oct 14 11:09:47 PDT 1994
Copyright (c) 1983-1993, Sun Microsystems, Inc.
cpu = SUNW,SPARCstation-20
mod0 = TI,TMS390Z50 (mid = 8)
mem = 523840K (0x1ff90000)
avail mem = 510951424
cpu0 at Mbus 0x8 0x240000
entering uniprocessor mode
Ethernet address = 0:0:0:0:0:0
espdma0 at SBus slot f 0x400000
esp0 at SBus slot f 0x800000 pri 4 (onboard)
sd1 at esp0 target 1 lun 0
sd1:
sd3: non-CCS device found at target 0 lun 0 on esp0
sd3 at esp0 target 0 lun 0
sd3:
ledma0 at SBus slot f 0x400010
le0 at SBus slot f 0xc00000 pri 6 (onboard)
SUNW,bpp0 at SBus slot f 0x4800000 pri 3 (sbus level 2)
zs0 at obio 0x100000 pri 12 (onboard)
zs1 at obio 0x0 pri 12 (onboard)
fdc: no RQM - stat 0xc0
fdc: no RQM - stat 0xc0
SUNW,fdtwo0 at obio 0x700000 pri 11 (onboard)
root on sd3a fstype 4.2
swap on sd3b fstype spec size 98800K
dump on sd3b fstype spec size 98788K
le0: AUI Ethernet

And finnally here is the actual command for installation

$ bin/qemu-system-sparc -m 512 -serial telnet:0.0.0.0:3001,server -M SS-20 -cpu "TI SuperSparc 60" \
-bios bios/my-sun/ss20_v2.25_rom -nographic -net user -hda dsks/test-sun414-root-dsk.raw -hdb iso/sunos414.iso

References:

Karma score (contribution analysis system)

ChangeLog:

17 October, 2013: Initial draft (Tamer)

Introduction:

Karma score is a contribution analysis scoring system that help identifying if a user is active contributor to a community by give a score to certain activities. For example when a user login to the community portal it would award them certain score for logging in (for example 20 points), when a user reviews a comment and give it a score they would be given another higher score, and the same goes to posting reviews or comments but with higher score.

This activities would then recorded in a database table (or any other persistent store so that later when a function requires the Karma score of a user it will easily find it on that table.

At anytime, Karma score would be the sum of all individual score awarded to the user by different subsystems and categories of the community portal.

How it works:

Create a database table with the following fields:

  • User ID: ID representing the user in the system
  • Date and time: Date and time user was awarded Karma
  • Action description: Type of action done by user, for example login, comment review or posting comments etc.
  • Karma award: Score awarded for this action, which is a numeric value

Assume there is a subroutine called add_karma(user_id, action_descr, karma) which takes as parameter name suggest three values to insert them in the Karma table.

So for example when at user login, the function gets called from the login code as:

add_karma(1001, “Login action”, 20);

Which adds a record in the Karma table for the user (ID 1001) awarding them a 20 points for logging in.

So at any point in time whenever a subsystem wants Karma score for a user they would call another subroutine (get_karma_score())that would sum all records in the Karma table and returns it as Karma score for the user.

Two or more time threshold should be defined by the system, one for expiring old records for all users and the other(s) define time threshold for decreasing action scores, for example, after 10 days decrease login score from 20 to 10, etc.

A nightly job should run on the table to honour those thresholds and recalculate new Karma scores if any.

Krama decays over time:

Karma score should be influenced by the time a user performed the actions they got awarded to, for example, a user posted a review in the past 10 days should have more Karma score than a user who did a post last year. A nightly job should crawler the Karma log table and expire actions falling beyond certain time threshold, it might also decrease scoring of actions for users if they passed certain time threshold as well. So than a user logged in today would have Karma score more than a user who logged in 3 weeks ago.

This would reflect if a user is active and heavily contributing to the community or just a visitor.

Usage:

Karma score is a contribution weight, which means it reflects how a user is active and contributing to the community. The higher the score the more contribution user has performed.

Users with higher Karma score is designated to be active users, which is a personal evaluation to the activities done by user, if combined with other factors like Credibility score (how other evaluate my contribution) or Spam/report counter would give more insight of how legitimate their future contribution are or if they are worthy or not.

References: