Wednesday, December 7, 2022

NetBSD pkgsrc on Solaris 10/sparc

Anyone who still has a fondness for pre-Oracle Solaris knows the hell that is getting a functional C compiler installed and building common open source packages. One common way to deal with this problem, if you want up-to-date packages, is to use the pkgsrc collection, from the NetBSD project.

pkgsrc has been around for quite some time, having been forked from FreeBSD's ports collection in the late 1990s. Solaris support (initially termed "zoularis", for the initial build script creator, Christos Zoulas) was added just before the new millennium.

The theory is that pkgsrc is easy to get going, and the basic tasks needed are:

  1. download pkgsrc.tar.gz from NetBSD
  2. extract to /usr/pkgsrc
  3. cd to /usr/pkgsrc/bootstrap
  4. run ./bootstrap

Under Solaris 10, though, the system doesn't come with a functional C compiler, making the process a bit of a chicken and egg problem. After doing quite a bit of research, and digging through a lot of blogs, here is the process that worked for me:

  • install OpenCSW
    • https://cdn.opencsw.org/manual/for-administrators/getting-started.html
  • install GCC5 from the OpenCSW collection
    • CSWgcc5core
    • CSWgcc5g++
  • Using that gcc5 and related tools, install a newer version of gcc
    • Set your path to include /usr/sfw/bin and /usr/ccs/bin
# export PATH=/usr/sbin/:/usr/bin:/opt/csw/bin:/usr/sfw/bin:/usr/ccs/bin
    • I used gcc-9.3.0, which is apparently the final version that supports Solaris 10
# gtar zxvf gcc-9.3.0.tar.gz
# mkdir objdir
# cd objdir
# ~/gcc-9.3.0/configure --enable-obsolete --prefix=/op
t/gcc-9.3.0 --enable-languages=c,c++,fortran

# gmake
# gmake install
    • Add the gcc library directories to the runtime linker paths with crle
# crle -u -l /opt/gcc-9.3.0/lib
# crle -64 -u -l /opt/gcc-9.3.0/lib/sparcv9
    • Grab pkgsrc, I used current stable, which is at the moment 2022-Q3
    • Extract to /usr/pkgsrc
    • Bootstrap pkgsrc
# cd /usr/pkgsrc/bootstrap
      • set your path to include your new gcc and the /usr/ccs/bin tools, like ar, nm and friends and remove /usr/sfw
# export PATH=/usr/sbin:/usr/bin:/opt/gcc-9.3.0/bin:/usr/ccs/bin
# env CFLAGS=-O2 ./bootstrap
    • Once this is complete, add pkgsrc tools to your path
# export PATH=/usr/pkg/sbin:/usr/pkg/bin:/usr/sbin:/usr/bin:/opt/gcc-9.3.0/bin:/usr/ccs/bin
    • Edit your pkgsrc mk.conf to use the gcc version that you built
      • Add the following lines to /usr/pkg/etc/mk.conf:
GCCBASE=                /opt/gcc-9.3.0
USE_NATIVE_GCC=         yes
 
 
Now, you should be able to use the NetBSD pkgsrc collection to build a create variety of useful software on Solaris 10.

Sunday, November 20, 2022

IBM PC and Compatible Video Standards: the Early Days

For those who did not use IBM-compatible PCs in the 1980s and 1990s, it may be surprising to hear that there were many, many possible standards of monitors, video cards, and video modes. And many of these were incompatible in both documented and undocumented ways. To start with, we had the IBM-defined original video standards:

  • MDA
    • This was defined by the original IBM Monochrome Display adapter, commonly found in the IBM 5150 PC, 5160 XT, and 5170 AT. It was capable of monochrome text only, in 80 columns by 24 lines.
    • https://www.seasip.info/VintagePC/mda.html
  • CGA
    • The first CGA card was the IBM Color Graphics Adapter, giving the standard its name. CGA was commonly found in the same IBM PCs as MDA, but was also common in early clone PCs, XTs and ATs, as it was significantly cheaper to implement than EGA. CGA was capable of 40 and 80 column text, and multiple graphics modes from 160x100 to 640x200 with monochrome, 2, or 4 colors possible, depending on the mode. The original IBM card, and some clones, supported composite output with 16 colors, at low resolution.
    • https://www.seasip.info/VintagePC/cga.html
  • PC/jr
    • The introduction of the IBM PC/jr in 1983 added support for two new video modes to the CGA standard, 160x200 and 320x200 with 16 colors and 640x200 with 4 colors. This standard would become much more widely used with the introduction of the Tandy 1000 series of personal computers, by Radio Shack.
    • https://en.wikipedia.org/wiki/IBM_PCjr#Video
  • EGA
    • This standard was created by IBM's Enhanced Graphics Adapter. The EGA card was backwards-compatible to both CGA and MDA, and added support for up to 64 colors (with additional video RAM) and resolutions of up to 640x350. There were also 2 RCA-style connectors on the backplate, but they were not designed for CGA-style composite output.
    • https://en.wikipedia.org/wiki/Enhanced_Graphics_Adapter
  • PGA
    • The IBM Professional Graphics Adapter, which supported 640x480 with 256 colors out of a palette of 4096. This is quite a rare card, mostly used for CAD drafting and other high end graphics applications on the IBM PC, XT, and AT. It requires a dedicated monitor, and is not compatible with VGA. It does feature CGA backwards compatibility.
    • https://www.seasip.info/VintagePC/pgc.html
  • VGA
    • This is the IBM Video Graphics Array, which defined the standard for 16 color graphics at a resolution of 640x480 pixels, and 256 colors at 320x200. It produced analog output, rather than the digital output of the MDA, CGA and EGA cards, and used a DE-15 connector, rather than the DE-9 connector used for MDA, CGA and EGA. VGA was backwards-compatible with MDA, CGA and EGA modes, while not being able to be connected to RGBI digital monitors.
    • https://en.wikipedia.org/wiki/Video_Graphics_Array
  • 8514/A
    • IBM introduced the 8514/A adapter in 1987, and it extended the VGA standard with basic graphics acceleration, and a 1024x768 (interlaced) graphics mode. It was available only for the PS/2 line of systems, until compatible clone versions of the card became available.
    • https://en.wikipedia.org/wiki/IBM_8514
  • XGA
    • IBM introduced the XGA display standard of 1024x768 (non-interlaced) pixels at 256 colors, in 1990, again extending the VGA standard. Additionally, XGA (which was again only available for PS/2 systems, supported 64k colors at 640x480, which was a first for IBM original video cards on the PC. Interestingly, XGA, like the 8514, lacked support for 800x600, which was quite common in VGA clone video cards, at the time. There was a minor update to XGA, called XGA-2, which added support for 256 grey scale colors, and finally the addition of 800x600, with up to 64k colors.
    • https://ardent-tool.com/video/XGA1.html

And then, we had a variety of third-party created standards:

  • Hercules monochrome
    • The Hercules Graphics Card was introduced in 1982, having been designed so that its creator could edit his masters thesis in the Thai language. It provided very high resolution (for the time) monochrome graphics at 720x348 and backwards compatible text modes with the IBM MDA card. It was extremely popular, and clones of this card were found in many PCs up until the release of the 486, when most computers were supplied with VGA.
    • https://en.wikipedia.org/wiki/Hercules_Graphics_Card
    • https://www.seasip.info/VintagePC/hercplus.html
  • Plantronics ColorPlus
    • This card was a CGA-compatible video card that added support for 16 colors at 320x200 and 4 colors at 640x200. It was not widely supported, but a surprising number of CGA clone cards supported this standard.
    • https://www.seasip.info/VintagePC/plantronics.html
  • Tandy Graphics
    • Tandy's 1000 line of personal computers were very similar to IBM's failed PC/jr line, in both graphics and sound. They popularized the 320x200 16 color graphics mode, which was very widely supported in video games for DOS.
    • https://en.wikipedia.org/wiki/Tandy_Graphics_Adapter
  • SVGA
    • SVGA was created by the Video Electronics Standards Association (VESA), founded by NEC, in 1988. It popularized the 800x600 video mode, at 16 and 256 colors, and then went on to create official, rather than de-facto, standards for PC-compatible video output formats. 
    • https://en.wikipedia.org/wiki/Super_VGA

There were also a number of other video output standards, most either clones that enhanced CGA, EGA, or VGA.

Is it a wonder that nobody understands IBM PC graphics? What a huge list of somewhat mutually incompatible standards there were!

Saturday, October 15, 2022

Landing Softly with Linux in 1992

From a young age, I have been in love with UNIX, having been exposed to it at my mother’s office. She used to take me with her to the office, when she went into the office, on the weekends. Being a geek, this was nirvana, as my mother was a publisher who worked for a major satellite communications corporation. So, they had almost every type of publishing and graphics related hardware and software that was available, in the 1980s. On one of my earliest visits, my mother left me in front of a Wang-made UNIX System V system, and started Colossal Cave Adventure (ADVENT) for me. I was immediately entranced, and played for hours. Later that afternoon I got my first taste of the shell when I managed to exit from the game.


After that first experience, I pined for my own UNIX workstation. However, being a kid born in the mid 1970s, the cost of such an endeavor was far too large for my own means, and would have to wait for the availability of a free UNIX system that would run on the limited IBM PC clone hardware that I had at my disposal. The Softlanding Linux System, or SLS, for short, was one of the first complete Linux distributions, and was first available in August in 1992. That availability gave me my chance, as I was informed of its release by an older friend who lived in Washington, DC. He even made for me a partial copy of the 3.5” floppy-based installation media, but unfortunately either the copy was damaged, incomplete, or I was too lacking in understanding to get it working. However, that attempt did strongly re-motivate me to get a complete system working.

SLS was available for download from the Internet, or on CD or floppy from the publisher, or most commonly, copied from someone else who had downloaded it. For my second installation attempt, I bought a new box of cheap white-label 3.5” floppy disks from Egghead Software, which was one of the local computer store chains in Maryland, where I grew up. I then took those floppies with me to my high school, where I volunteered in the library and computer programming labs, to image with the new copy of SLS that I downloaded using their (for the time) fast 1.5 Mbps Internet connection. Once I had all of the disk images downloaded, I started creating floppy disks from them. Of course, being inexperienced, I had no idea what disks I would actually need, and which I could skip, so I made them all. This amounted to 22 floppy disks, and this is where I ran into my first significant problem: cheap floppy disks were unreliable! I had no computer, at school, to test the installation on, so every time I wanted to try to replace bad floppy disks, I had to go to Egghead, exchange the failed disks, and return to my high school, on the other side of town. I didn’t have access to a car, so this was all on my bike. Thus, I could make (at most) one attempt per day. It took me several weeks to finally get a complete set of installation media!

Once I had a complete installation set, the real fun began. I can still remember my nervousness as I erased DOS from my 105MB Seagate (yeah, I’m a geek, and I remember the exact hardware that I used!) hard drive, to prepare for the Linux build. Hard drives were very expensive, and I could not afford a second drive, or to get one large enough to also install DOS on. As you might expect, my first installation did not succeed. If my memory is correct, I got all of the software loaded on the system, but the bootloader (the software that starts Linux, when the system is powered on) failed to function properly. I repeated the installation process over and over, until I got a very basic running system.

Folks who didn’t use early Linux probably wonder why I didn’t ask for help, or just look on the Internet for a detailed explanation of the process. In the early 90s, you couldn’t just sign up with an Internet Service Provider, and use your fancy new telephone modem (the predecessor to today’s cable modems) to make a phone connection to the ‘net. In order to have an Internet connection, at the time, one had to be a scientific or educational institution. Commercial access to the Internet didn’t come about until 1995, in any widespread manner. So, I didn’t have anyone to ask, or any easy source of information, since my high school didn’t subscribe to USENET, which is the predecessor to today’s online forums. Because of that lack, I had to complete the process using only the documentation present on the installation media, and trial and error.

With my newly completed base system, I next wanted to be able to use a graphical environment, and not just a text-based command line interface. The system that provided such an interface, at the time, is called the X Window System, and was created by MIT in 1984. There was a version created for PC-based UNIXes, like Linux, and 386/Free/NetBSD, called XFree86, in 1991. That system was included on the installation media for SLS, but it was very much a manual process to configure it. Not only did you need to know exactly what video hardware was in your system, but you had to manually specify the exact parameters of the video signal that you wanted your system to produce. To get the necessary information, you needed to have the instruction manual for your monitor and your video card. If you made an error in the video configuration, not only would you not get a functional graphical environment, you could actually damage your monitor. Given all of this, and the fact that I, like many other computer users of the time, did not buy my monitor or video card new, it took me several weeks to get the X Window System properly configured.

Once the system was up and running, with the graphical user interface functional, I proceeded towards the last obstacle: customizing the Linux kernel. With modern operating systems, including Linux, you no longer have to build your own kernel, but with all UNIX variants until the mid 1990s, kernel compiling was required to add support for your specific hardware configuration. For example, if you wanted to add support for a sound card, like a Sound Blaster, Adlib, or Pro Audio Spectrum, you needed to build a custom kernel. Building the kernel was a mostly straightforward procedure, with one exception: you had to know exactly what hardware was in your system, and how it was configured. There was a large list of yes/no questions that had to be answered correctly, and once complete you could install the new kernel. If you made any errors, the new kernel would fail to boot the system, and you would have to fall back on the previous one (assuming that you hadn’t replaced it!).

With all of these caveats, and the clear complexity, you might well ask yourself why anyone would attempt to install and run Linux, in 1992. The answer varied by the individual, but for me, it gave access to the advanced tools and efficiency of a UNIX system, on PC hardware that were within my budget. All of the difficulties were just part of the journey.

Tuesday, September 20, 2022

Setting Apple Keyboards to Default to Function Keys, Instead of Media Keys

This is just a quick post, but many of y'all may have run into the same issue that I have; that Apple devices default to sending media actions (volume up/down, key backlight, screen brightness, etc.) instead of the normal function key (F1, F2, etc.).

TLDR:

$ echo options hid_apple fnmode=0 | sudo tee -a /etc/modprobe.d/hid_apple.conf

This sets the system to send the scan code for the function key by default, and to send the media action if you press the Fn key, along with the function key.