TweetFollow Us on Twitter

Why MkLinux?

Volume Number: 13 (1997)
Issue Number: 10
Column Tag: Tools Of The Trade

Why MkLinux?

by Rich Morin

Or, is grep really worth 500 MB of disk space?

So What Is MkLinux?

MkLinux is a port of the GNU System to the Power Macintosh. It provides a Unix-like user and programming environment, with hundreds of useful commands (software development and document preparation tools, network servers and tools, and other utilities. With very few exceptions (e.g., the boot code), all of the source code for MkLinux is freely redistributable.

The MkLinux port is based on the Linux 2.x kernel, which is used as a "single server" for the Mach 3 microkernel. Thus, the Linux kernel runs as a user-mode process, handling OS "personality" issues, while the Mach microkernel handles low-level I/O and resource allocation tasks. This two-part design has assorted benefits, including the ability to debug a new Linux server (as an application) while running the system on a older (trusted) server.

Because MkLinux has pre-emptive multitasking and runs as a "native" OS, it makes quite efficient use of the Power Macintosh hardware. A Power Mac 6100, for instance, is capable of serving as the local "unix box" for a dozen or more casual users and programmers. Aside from providing access to the normal range of unix tools, MkLinux supports a wide variety of network services, including FTP, HTTP, NFS, Telnet, and the X Window System.

Once a MkLinux system has booted, it is "just" a Linux system. That is, it has all of the standard Linux user and programming interfaces, system administration tools, etc. The big difference, however, is that MkLinux is running on an integrated hardware platform. Consequently, MkLinux system installation does not lose the administrator in a twisty maze of DMA vector and IRQ settings, jumpers, and other Intel-specific annoyances.

History and Current Status

Although MkLinux has been under development for a few years, it has only been available to the general public for a short while. Apple's first public announcement concerning MkLinux was made at the Free Software Foundation's First Conference on Freely Redistributable Software (February 1996). Since that time, Apple has issued several MkLinux Developer Releases. DR3, for instance, is expected to be available by the time you read this article.

MkLinux has never been a large-scale project for Apple Computer. Staffing has never exceeded five engineers, split between Apple and The Open Group Research Institute. The MkLinux Reference Release, although sponsored and assisted by Apple, was produced by Prime Time Freeware. Through the efforts of volunteers, large numbers of applications and drivers appear on MkLinux-related FTP sites. If Linux is the system where "everything is done by someone else", MkLinux is certainly well in line with this tradition.

The MkLinux user community is served by email lists, web sites, and other Internet-based facilities. The email lists are quite active; more than 5000 subscribers are currently registered. They handle MkLinux announcements, setup and programming issues, etc. The high signal-to-noise ratio of the lists reflects the cooperative attitude of the MkLinux community. The Apple MkLinux web site http://www.mklinux.apple.com contains announcements, news, online help, and pointers to other Internet-based resources.

Who Uses MkLinux?

The Macintosh is very popular in academia, whether in computer labs, professor's offices, or dormitory rooms. By making Linux available for the Power Macintosh, Apple allows these academic institutions (and associated individuals) to make better use of existing hardware. For instance, a computer science graduate student might write a device driver for MkLinux, then switch back to Mac OS to create the diagrams and write up a paper describing it.

As hinted above, MkLinux is also finding use as a network server. NuBus-based Power Macs are not considered very powerful by today's standards, but they perform quite well as MkLinux servers. In fact, a Power Mac 6100/60 is roughly equivalent in performance to an early Sun SparcStation 5 or a 90 MHz Pentium system. If the 6100 is already on hand (or cheaply available), it can be an economical and very convenient alternative to an Intel or Sparc-based system.

We are also starting to see quite a bit of interest from the Apple developer community. Developers have been quick to realize that MkLinux provides a very economical way to look at a Mach/unix system on the Power Macintosh. Better yet, both the source code and a large body of reference materials are available.

Apple's original motivation in sponsoring MkLinux, by the way, came from its Higher Education sales force. It seems that they got tired of hearing about the fact that Intel-based PCs were more versatile (running both Windows and Linux). So, when the MkLinux skunk works project got started, the Higher Ed folks were quick to support it.

MkLinux Basics

If you are already familiar with Intel-based Linux systems, feel free to skip down to the next section: a running MkLinux system is essentially indistinguishable from a running Intel-based Linux system. If you have used other unix-based systems, all you need to know is that (Mk)Linux provides extended versions of most traditional BSD and System V commands.

If you're still with us, you're probably wondering how much of a learning curve you're facing before you can be a productive MkLinux user and programmer. As usual, the news is mixed: the bad news is that it could take you years to learn everything about the entire system. The good news is that you can master the basics in a few hours and that you don't really need to know everything about MkLinux to be quite productive on it. So, let's get started...

Like MS-DOS, MkLinux has a command-oriented user environment. Although X Windows provides the ability to run graphical applications, it does not have the pervasive GUI-based semantics, let alone the consistent user interface guidelines, found in Mac OS. Hence, MkLinux windows tend to be "glass teletypes", used to communicate with a command line interpreter.

Unlike MS-DOS, however, MkLinux supples several command line interpreters, or "shells", along with hundreds of shell-oriented commands and "little languages". By combining these tools, either on the command line or as saved "shell scripts", you can make MkLinux do some pretty amazing things.

Let's say that one of your directories contains several hundred files, each of which contains one or more C routines. You want to look at some examples of how the routine "foo" is used, so you ask the MkLinux "grep" command to take a look:

rdm@mklinux 1: grep foo *.c
bar.c:  x = foo(...);
baz.c:  y = foodp(...);
baz.c:  z = foo(...);
...

Although the first line looks just fine, the second line shows that we weren't sufficiently precise in our search. So, we use the "-w" flag to tell grep to look for the "word" foo:

rdm@mklinux 2: grep -w foo *.c
bar.c:  x = foo(...);
baz.c:  z = foo(...);
...

There seem to be quite a lot of matching lines, however; let's just get a list of the file names:

rdm@mklinux 3: grep -lw foo *.c
bar.c
baz.c
...

How many files are there? Let's ask the MkLinux word count (wc) utility for a count:

rdm@mklinux 3: grep -lw foo *.c | wc -l
42

Now let's suppose that we want to copy all of the matching files off to a separate directory, for detailed examination and/or modification. MkLinux lets us do this very easily:

rdm@mklinux 4: mkdir hax
rdm@mklinux 5: cp `grep -lw foo *.c` hax

There are hundreds of commands in the MkLinux repertoire, yielding a staggering number of combinations. And, because sequences of commands can be saved as "shell scripts", creating new commands is a trivial process. MkLinux shells have most of the common programming constructs, including variables, control flow operators, etc. If you want more programming power, however, you can always drop into a language such as awk or perl.

The creation and (re-)use of simple commands is fundamental to the MkLinux way of doing things. Rather than try to create monolithic programs that can do every conceivable task, MkLinux programmers create small, general-purpose tools and combine them into task-specific commands and scripts.

In the example above, for instance, cp has no need to know anything about string searching and grep has no need to know anything about file copying. The combination, however, is able to do a rather powerful and specialized function (string-based file copying) with little effort.

Legal Issues

As an Apple developer, you are probably familiar with GCC, GDB, GNU Emacs, and other tools that have emerged from the GNU Project. As an implementation of the GNU System, MkLinux contains hundreds of these tools. In addition, it includes a great deal of BSD (Berkeley Software Distribution), Mach, and X Window System code. In short, MkLinux is a compilation of compilations, including a variety of software and associated legal restrictions.

Software developed by the GNU Project is (almost always) covered by the terms of the GNU General Public Licence (GPL). In addition, many programs developed by third parties (e.g., GhostScript and Perl) are also available under the GPL. Thus, if you plan to use MkLinux (or any other GNU software), a basic understanding of the GPL is advised.

The GNU GPL allows both non-commercial and commercial distribution, in either source or binary format, of materials it covers. It requires, however, that distributors of binary code make the source code economically available, upon request. It also prohibits any other restrictions (including collection copyrights) from being placed on the materials.

Thus, although you are free to examine, modify, redistribute, and use GPLed code, you are not free to turn it into proprietary code. In general, software developed using GNU tools is not affected by the GPL, save that use of libraries may "contaminate" developed code. For detailed information on the GNU Project and the GNU GPL, see the GNU web site http://www.gnu.org.

Much of the remaining freeware in the MkLinux distribution is covered by "University-style" licenses, such as those used by CMU, MIT, and UC Berkeley. These licenses require that the source code retain a notice showing its origins, but say nothing restricting the code's inclusion into commercial products.

Finally, you should expect to find a few "unique" licenses, ranging widely in both style and terms. You are on your own when dealing with these notices. Although these licenses normally allow free use within a given organization, their terms for distribution may prohibit external distribution, even for non-commercial purposes. So, be sure to read the fine print!

Porting Issues

Because MkLinux is closely based on Linux, it is able to build most Linux source archives with little trouble. The problems that do surface tend to stem from basic architectural incompatibilities such as byte ordering or the need for particular hardware. Finally, because of the Mach-based internal structure of MkLinux, Linux driver code does not port at all trivially.

Most Linux programs are written in an architecture-independent manner. At worst, they contain a few #ifdef statements. A few Linux programs, however, make assumptions about the ordering of bytes within words, etc. Because PowerPC CPUs address differently than Intel CPUs, this can cause programs to malfunction. There is also an assumption, on Intel-based platforms, that variables of type char are signed. MkLinux assumes that chars are unsigned, but a compiler option can be used to change this assumption.

If the source code comes from another variant of unix (e.g., BSD or System V), things can get a bit trickier. Although most unix system calls and library functions are standardized, each flavor of unix tends to have a few unique (or modified) interfaces. Linux is quite popular, however, so you should expect to find Linux-oriented #ifdef statements in most common freeware packages.

Porting non-trivial software from Mac OS, on the other hand, is likely to be a real challenge. The MkLinux system calls and library functions have many of the same capabilities of Mac OS routines, but their exact nature, names, and calling sequences are apt to to be very different. Be prepared to look up a lot of function definitions!

Worse, the event-driven model favored by Mac OS applications is not found in most MkLinux programs. Some window-based applications may be written in an event-driven manner, but that's about it. And, although X may look a bit like the Finder, it is a radically different environment, sharing few of the Finder's basic assumptions and rules. In short, you should treat MkLinux as a Linux system that happens to run on a Power Macintosh, rather than a weird variant of Mac OS.

MkLinux Resources

As noted above, MkLinux is well served by email lists, FTP sites, and web servers. The best starting point is Apple's MkLinux web server http://www.mklinux.apple.com. Look around this site for general information, late-breaking news, mailing lists, online help, and links to related sites. As the MkLinux community grows, volunteers will take up more and more of the burden of disseminating MkLinux-related information, but the Apple web site is likely to remain as the best starting point for any search.

The Linux community is well served by printed documentation, software collections, and online information resources. With the exception of some kernel- and hardware-related material, most of these resources are quite applicable to MkLinux. More generally, much of the unix literature is relevant to MkLinux. After all, MkLinux is basically a free version of unix.

All modesty aside, however, the definitive work on MkLinux is "MkLinux: Microkernel Linux for the Power Macintosh" (Prime Time Freeware, 1997, ISBN 1-881957-24-1, $50 MSRP). This Apple-sponsored product combines a 360-page introductory and reference manual with a MkLinux distribution CD-ROM and an HTML-basedreference CD-ROM, covering Linux, Mach, NeXT, and the Power Macintosh. For more information, visit the Prime Time Freeware web site http://www.ptf.com.


Rich Morin, rdm@ptf.com, is the editor of "MkLinux: Microkernel Linux for the Power Macintosh", published by Prime Time Freeware (http://www.ptf.com). A 30-year veteran of the computer industry, Rich writes for both SunExpert and UNIX Review magazines. His home system is a three-headed Power Macintosh 7100/80, running Mac OS. It is, however, networked to several local UNIX (MkLinux and SunOS) boxes.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.