ðHgeocities.com/adrianturcu/powerpc7800-80/powerpc7800-80.htmlgeocities.com/adrianturcu/powerpc7800-80/powerpc7800-80.htmldelayedx‚[ÔJÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈp<öŸOKtext/html°¹uöŸÿÿÿÿb‰.HWed, 22 Dec 2004 09:29:18 GMT *Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)en, *[ÔJöŸ Adrian's Home Page - Experience with Linux on PowerMac 7100/80 - OldWorld
     
  Experience with Linux on PowerMac 7100/80 - OldWorld

Last Updated on 20th of February 2003

   
       

A was saying to a friend of mine about my dream of installing Linux on more architectures that Intel based platforms. Guess what? He came back to me with an idea like he has a Macintosh, unused and dusty somewhere in his personal office. What if we'll put Linux on it and make it an Internet gateway? Well, at a glance everything was about to be "Hunky-Dory", after that it turned into a nightmare... Why do you think? 'Cause first thing first it's an old Mac, second not too many people are working with these type of Macs and the most important is that I really want to see how good we are (me and my friend) ... ö ... Bellow is the full story in technical terms (more or less)...

¬ Hardware Specs:

    - Model: PowerMac 7100/80
    - CPU: PowerPC 601
    - Architecture: NuBus
    - Installed RAM: 8MB on-board 96MB on available slots (2×16MB and 2×32MB)
    - Hdd: SCSI-1 600MB (original); replaced with 18.2GB SCSI-3 from IBM
    - Optical: Internal SCSI-1 CDROM
    - Graphics: on-board with 1MB VRAM + 1 board <name_to_come> reported as "NuBus PowerMac frame buffer device /nubus/radius "
    - Audio: <name_to_come>
    - NIC: <name_to_come>
    - Modem: external serial from Global Village Communication: TelePort 56 fax/modem w/h K56flex
    - Other: <name_to_come>

For <name_to_come> bits, I could not gather enough information. Once I'll have it, I'll update this section

¬ First days in paradise...

A good place to start is always the Internet. Because I use RedHat on my Intel based laptop, I thought that I can get the very same distribution for this Mac. Wrong, if is one version of RedHat for Mac I'd love to know, together with the link from where can I download ISOs... Anyway, with Google and a browser (Opera) I start digging the Internet. The good news is that even old the Mac is still there, the bad news not all the links are working.


¬ Details on how to make it work

First of all, this document is an extent if you want of plenty of other documents that people wrote over the time and publish them in the Internet. I tried to gather this valuable information that I struggled to get into one place that is easy for me to find (if you are here, I don't know how easy was for you and how much is worthing). Good starts are for these OldWorld NuBus Macs:

   - http://nubus-pmac.sourceforge.net/
   - http://mach-linux.org/
   - http://www.mklinux.org/
   - http://lists.linuxppc.org/
   - http://www.linux-mandrake.com/en/demos/PPC/FAQ/
   - http://www.yellowdoglinux.com/support/solutions/ydl_general/nubus.shtml


¬ First steps before Linux

Well, life is not pink... as you already know. I found that I don't have enough space on the original Hard disk. As I don't have a supplier for old SCSI disks I start searching for some other choices. The solution was a IBM SCSI-3 18.2GB with a converter to SCSI-1. I reinstalled MacOS on this disk using the following partition table:

Partition map (with 512 byte blocks) on '/dev/sda'
#: type name length base ( size )
1: Apple_partition_map Apple 63 @ 1
2: Apple_UNIX_SVR2 untitled 4096001 @ 4096704 ( 2.0G)
3: Apple_Driver43*Macintosh 74 @ 118
4: Apple_Patches Patch Partition 512 @ 192
5: Apple_HFS "MacOs" 4096000 @ 704 ( 2.0G)
6: Apple_UNIX_SVR2 untitled 4096001 @ 8192705 ( 2.0G)
7: Apple_UNIX_SVR2 untitled 8192001 @ 12288706 ( 3.9G)
8: Apple_Bootstrap untitled 20482 @ 20480707 ( 10.0M)
9: Apple_Free*Extra 54 @ 64
10: Apple_UNIX_SVR2 swap 409601 @ 20501189 (200.0M)
11: Apple_UNIX_SVR2 Buffer 14637530 @ 20910790 ( 7.0G)

Device block size=512, Number of Blocks=35548320 (17.0G)


The above partition table was obtained like this:
   - during MacOS installation I reserved 2GB for (partition 5) and leave the rest of space unpartitioned
   - after MacOS installation, when I finally managed to put the right Linux kernel (see bellow), during Linux install, I was able to generate the other partitions.

Now, you will ask why so many 2GB partitions? The answer is in the following note:

MkLinux filesystem partitions are limited, at present, to a maximum of just under two GB each. Therefore, if you want to have an overall MkLinux filesystem that will hold more than 2 GB, you'll need to use multiple partitions. README - MkLinux file on MkLinux CD

So, I had MacOS on 2GB partition and an big unpartitioned space.


¬ Choosing the right Linux distribution

It is a time when everybody has to make decisions. Lucky me that I did not have too many options when I start searching for ISO images for Linux distributions freely downloadable. I found out that for this machine (NuBus architecture, OldWorld and all the others) I can have MkLinux and YellowDog, any of them with more or less different ways to be installed on my system. I start downloading MkLinux and read through most of the available documentation for this. Well, the docs are quite old and most of the links as I said before broken.

For MkLinux one is able to chose between DR1, pre-R1 and DR3 (check the mirrors). "DR" stands for Developer Release. The first and the last are stable distros as people say. I have downloaded these two and try to install them (the story is bellow)

For YellowDog there are plenty of choices:
- Pomona 2.0
- Fuji 2.1
- Rome 2.2
- Dayton 2.3

As I said, I have started with MkLinux DR1. I did all it's written in README-MkLinux file on MkLinux CD, most of tasks in MacOS side (copying Extensions, Control Panel and Preferences files and Hdd setup). After these preparations, the reboot of the system in Linux install mode end-up with a big disappointment: the kernel was booting as far as I'm concerned perfectly, but when was time for init script to run anaconda, "the beast" crashed in an unexpected mode with errors about virtual memory :( I was searching for this error in the Internet, but finally I gave up with DR1 and start with DR3.

After another ~600 megs downloaded (lucky me I was on a 2 meg line), I was quite happy to see the installer starting (true is that the screen was now in very pale shade of dark-gray). My good mood was vanished quickly though: anaconda wouldn't want to start the packages installation. Into another session (Ctrl+F5 I believe) I was able to see that "the snake" was complaining about the very same think like in DR1: virtual memory, while on the first session it was stalling. Well, I was confused about my hardware knowledge a bit: most of the people playing with these old machines were reporting installations with 64 megs of physical RAM, 64 megs of swap and a starting ramdisk of 16 megs. My Mac (well is not mine, but still) have 104 megs physical RAM, 200 megs swap and I was starting with 16 megs of initial ramdisk. I had increased the ramdisk and restart, but I had the same result. Last hope was Yellow Dog.

So, back once again to the 2 meg line and download Pomona (Yellod Dog 2.0). The installation went perfectly smooth. I wasn't very demanding in terms of packages installation, just a basic proposed type I thought will do for me (about 400 megs). As I said, perfect install, after reboot, I had the surprise that my keystrokes were not having the expected result on the screen. Gees... I took a brake as I was totally disappointed. Few days latter, scavenging in the mail lists for NuBus and Linux, I found a kernel which was supposed to solve the problems with the typing: MachKernel-input-20010619.gz. A big hurray and a very large smile on my face, that was the result of booting the Mac in Linux with the new kernel.

Conclusions: The system (PowerMac 7100/80) finally start in Linux using:
- Pomona (Yellow Dog 2.0) for source CD install (perfect install)
- MachKernel-YDL2.0-20010618.gz to start the installation process
- MachKernel-input-20010619.gz to boot in a normal fashion (real keystrokes support).

Footnote: Don't try the input kernel for install, it will not work.

The input kernel (version 2.4.6-pre3) doesn't have the modules library (everything is built-in), which sometimes it is not quite good. The next logical step for me was to build my own kernel with my desired shape.


¬ Kernel

   § First bits ...

At the time I was start playing with this Mac, the latest stable kernel version was 2.4.20. As I prefer to run Linux, always against the latest stable version of the kernel (old habits never change), here I go: start gathering the required packages to build this kernel (details in every kernel tree) and to install them on this Mac.

Don't be surprised to find that to build the kernel for these NuBus-es requires to apply some patches, kindly provided here by Etsushi Kato (best regards from a linux nerd). And also, don't be an adventurous (unless is really need it) and start with "make nubus_config", then proceed with your customize.


   § Latest update ...

The stable kernel 2.4.20 with the patches from Etsushi, did not work for me. Compilation (~ 3 hours) was fine, booting this kernel was a disaster as it wasn't going far then switching to color frame buffer, with no errors on the screen. I have even downgraded to the "pre" versions of this kernel and apply the corresponding patches, still no success and the same results after reboot. Without frame buffer support the kernel stopped at "Starting kswapd". As I was not having a serial cable with Mac terminator at one side, to connect to serial port and try to get more information about the errors and also to be able to gather all data from the screen, I said to me enogh is enough, let's try another stable kernel version.
It turned up in a real success with stable vanilla 2.4.19 and the patch for 2.4.19-rc3 from Etsushi. Being to this point, I will put as prerequisites for anybody interested in:
   » vanilla 2.4.19 from www.kernel.org
   » patch-2.4.19-rc3-020722.bz2
   » start with "make nubus_config"
   » personalise with "make menuconfig". Here is my .config file
   » compile as usual with "make dep clean bzImage modules modules_install"
   » transfer the resulted bzImage file into Apple Mac partition under "System Folder/Extensions" as "Mach Kernel"
   » enjoy the reboot

¬ Tips and tricks ...

Yes, you better believe it... Tips and tricks as usual after spending hours with compilation on this old box. Sorry I did not put this as a starter in the á la carté menu that you read. Cross-compilation is big and endless subject to talk about. But it will save our ar##s of getting fat in the chair, if we possess a high performance box. My patience went to an end when I compiled the kernel on this Mac few times (5-6 times with 2.4.20 and 1 time 2.4.19). Definetelly has to be an easier way to do it. I had this laptop in front of me, which is quite fast, and I was paying a lot of time with the lazy Mac to compile a kernel or anything else. Two articles made me smile a bit and hope a lot:

- lists.linuxppc.org/linuxppc-nubus/200103/msg00035.html
- penguinppc.org/embedded/cross-compiling/

Both of them very well detailed and very helpful. I am not a programmer, but I like to fancy with compilers and scripts. I combined them with another useful resource from LFS (their manual) and I manged to compile my kernel for Mac in less then ½ hour. Building the cross environment took me 2 days to make it work, but it's worth trying. And besides, I took it as a new challenge. Don't be scared, with the instructions bellow, to build your own cross environment it will take you about 1-2 hours, depending on how fast is your system. So, don't give up so easy. Step-by-step then:

     § Step 0

I will not recommend you this:

    Take some valium, cross compiles are hard...

as I have seen in a message about cross-building documentation. Cross compiles are hard, indeed, but what's easy now?

     § Step 1

Back to business, prepare the cross environment, dedicating a directory were you will run everything. It's like a chroot-ed environment, but you'll never chroot in:

#### shell-env.sh

LFS=/LFS/mac/lfs
target=powerpc-linux
prefix=$LFS
libs=$prefix/lib
inc=$prefix/include
PATH=$PATH:$prefix/$target/bin:$prefix/bin

export LFS target prefix libs inc PATH


You can change LFS variable to anything you want, but keep in mind it should be different than system directories (like /usr or /etc) Create that directory and run

# .<PATH_TO_THIS_SCRIPT>/shell-env.sh

     § Step 2

Execute this script to create the directory structure (as LFS documentation stats for creating the chroot-ed environment):

cd $LFS &&
mkdir -p bin boot dev/pts etc/opt home lib mnt proc root sbin tmp var opt &&
for dirname in $LFS/usr $LFS/usr/local
do
mkdir $dirname
cd $dirname
mkdir bin etc include lib sbin share src var
ln -s share/man man
ln -s share/doc doc
ln -s share/info info
cd $dirname/share
mkdir dict doc info locale man nls misc terminfo zoneinfo
cd $dirname/share/man
mkdir man{1,2,3,4,5,6,7,8}
done
cd $LFS/var &&
mkdir -p lock log mail run spool tmp opt cache lib/misc local &&
cd $LFS/opt &&
mkdir bin doc include info lib man &&
cd $LFS/usr &&
ln -s ../var/tmp tmp


     § Step 3

Extract files from RPMs for PPC into $LFS/sources:

# rpm2cpio glibc-2.2.4-19k.ppc.rpm | cpio -id
# rpm2cpio glibc-devel-2.2.4-19k.ppc.rpm | cpio -id


Inside $LFS/sources run

# mv usr/include/ ..
# cp -a lib ../
# cp -a usr/lib/* ../lib

The RPMs are available on YellowDog CD that you already have (you installed your Linux on Mac).

     § Step 4

Change directory into $LFS/lib and run:

# ls -al | grep "\.\.\/\.\.\/" | \
   awk '{target=substr($11,11); system("ln -sf " target " " $9)}'


Why? Because there are broken links we have to fix.

     § Step 5

Chose the kernel version and copy:

<linux-ver>/include/linux/* into $LFS/include/linux/.
<linux-ver>/include/asm-ppc/* into $LFS/include/asm/.

     § Step 6

Make sure you are in $LFS directory and all LFS variables are defined. This is achieved running

# .<PATH_TO_THIS_SCRIPT>/shell-env.sh

Any mistake in defining the variables it will result with a disaster for you performant box!!!

     § Step 7

Download binutils-2.13.90.0.2.tar.gz and unpack it under $LFS/usr/src
Change drectory into $LFS/usr/src/binutils-2.13.90.0.2 and run:

# ./configure --prefix=$prefix --target=$target --disable-nls
# make
# make install

     § Step 8

Download gcc-2.95.3 and unpack it under $LFS/usr/src
Change directory into $LFS/usr/src/gcc-2.95.3 and run

# mkdir ../gcc-build && cd ../gcc-build
# ../gcc-2.95.3/configure --target=$target --prefix=$prefix \
--with-libs=$libs --with-headers=$inc --disable-shared \
--disable-threads --disable-nls
# make all-gcc
# make install


     § Step 9

Run this commands to create the appropriate links to specific libraries and binaries:

# cd $LFS/bin &&
ls -1 | grep powerpc | awk -Fpowerpc\-linux\- '{system("ln -s powerpc-linux-"$2" "$2)}' &&
cd $LFS/usr/lib &&
ls -1 $LFS/powerpc-linux/lib/ | awk '{system("ln -s $LFS/powerpc-linux/lib/"$1)}' &&
cd $LFS/lib &&
ln -sf ../bin/cpp &&
cd $LFS/usr/lib &&
ln -sf ../../bin/cpp &&
cd $LFS/bin &&
ln -sf gcc cc


     § Step 10

Now, that you have created the cross compile environment it's time to build the kernel. Presumming that you have already downloaded the vanilla kernel, unpack it under $LFS/usr/src, apply the patch for NuBus-es (see above in prerequisites) and make the following changes in the Makefile under linux kernel tree:
- modify the line for architecture to read ARCH := ppc
- modify the line for cross-compile to read CROSS_COMPILE = powerpc-linux- « Don't forget the last dash!
Proceed with kernel configuration and compilation like you would be on your Mac, but don't leave the cross environment.

     § Step 11

Make a backup copy of you running kernel on Mac (the backup have to be on Apple partition) and transfer the cross compiled one from the performant box into Apple filesystem like you already know. Reboot your Mac and pray to have a well compiled kernel, otherwise the victim will crash. You still can revert to the stable kernel because you did the backup. Isn't it?

Footnote: This cross compile thing is good when your performant box is a different architecture than PPC. If your speedy box is PPC, there you go, you can directly compile everything on it and just transfer the resulted files onto the old Mac. Just make sure that you comply with all requirements for compatible architectures.



¬ RPM rebuild

The whole story with cross compile, led me to think I can do even RPM rebuilts in a cross build manner. Well, I was not that lucky this time. As you can see in the message "Re: cross-build documentation?" from Jeff Jonson on Google groups, there are not too many people who succeed to do this. So, I had to do this on Mac. I knew from the very beggining that will take me days, but I start doing it, even I still don't know why. Details on how to do this in one step with appropriate scripts is still to come on this page. The idea is basicaly:
- to install all *.src.rpm files
- to have plenty of disk space
- to understand the rules that govern RPMs building without braking their dependencies (this is a nightmare)
- to be in a good mood to do it (it will take a lot of time - as I said, days, because my Mac is very old)
So, keep in touch with this page section.


¬ End conclusion...

Once again, Linux as an OpenSource operating system, proved that has less boundaries (virtually none) than any other proprietary system. It is able to run on old boxes and very diverse architectures. You already heard this, but having an old box in a corner of your house, it's not so hopeless to make it run and to reuse it even for test purposes. The aim with this box was to make it work with Linux as will be used as an Internet gateway for home. It has plenty of disk space with the new Hdd, so can be a backup host (running Samba on it was not such a bad idea). Besides, it has a powerfull firewall built into kernel. This iptables doesn't stop to impress me every day. It's good, reliable, secure and free. Thanks again to all OpenSource developers.

So, I had Linux running on a NuBus Macintosh. The next move is to built a RS/6000 with Linux and IF... I'll have a chance on a SPARC box (especially those Sun Enterprise running Solaris 2.6 for people that don't understand how good is an OS upgrade).


¬ Useful links - to be updated

- all the links above and bellow
- www.kernel.org for the latest kernel source
- www.cs.ubc.ca/cgi-bin/ftp/linux/yellowdoglinux/iso/type/ for YellowDog ISOs (which worked for me)








   
       

  ¤ November 2000  -  Adrian Turcu