Contents

  1. Requirements
  2. Booting
  3. Sysinst
  4. Configure the Network
  5. Fetching pdisk
  6. Partitioning the hard disk
  7. Newfs
  8. Mounting root
  9. Create fstab
  10. Umount
  11. Using Sysinst
  12. First boot
  13. XF86Config
  14. mount /dev/wd0a /mnt2
  15. chroot /mnt2
  16. vi rc.conf
  17. passwd
  18. useradd -m -G wheel joe
  19. /etc/rc.d/sshd start
  20. vi /etc/fstab

Requirements

You will need an Apple Power Macintosh G4, the NetBSD macppc installation CD-ROM and a working internet connection. The installation CD-ROM

You can download the NetBSD/macppc installation CD-ROM from the NetBSD ?Mirrors. For example from: ftp://ftp3.de.netbsd.org/pub/NetBSD/iso/3.0.1/macppccd-3.0.1.iso

Booting

Please hold down the Keys Apple+Alt+O+F, after the Apple boot tone sounds to enter OpenFirmeware and enter:

boot cd:,ofwboot.xcf netbsd.macppc

Sysinst

Now, wait until sysinst shows up, but don't start the normal installation. We need to create an Apple HFS partition first that are readable by OpenFirmware. The current NetBSD disklabel isn't able to create the partitions yet.

Configure the Network

Please configure now your integrated gem0 (100baseTX) or wi0 (WLAN) NIC to have an internet connection to match your local network configuration and exit the sysinst program.

Fetching pdisk

We will need to fetch pdisk, the partition tool to partition the hard disk. To fetch pdisk from your local ftp mirror enter:

# cd /sbin
# ftp -a ftp://ftp3.de.netbsd.org/pub/NetBSD/arch/macppc/netbsd-pdisk/netbsd-pdisk.macppc-1-6

and rename it to pdisk

# mv netbsd-pdisk.macppc-1-6 pdisk

Partitioning the hard disk

Now we're going to partition the disk. Enter:

# pdisk /dev/wd0c

to start the pdisk program. Create a new partition map using i.

Create a partition with offset at 2p with the size 32m and type Apple_HFS using the C option. Name it boot.

Create a partition with offset at 3p with size Xg and bzb bit a (root) using the c option. Name is root. Now if you want to have the whole system on one partition (root) assign the rest of disk space here.

Create a partition with offset at 4p with size Xg and bzb bit b (swap) using the c option. Name is swap.

If you want to create further partitions like /tmp /var /home do the following

Create a partition with offset at 5p with size 1g and bzb bit e (tmp) using c option. Name is tmp.

Create a partition with offset at 6p with size 1g and bzb bit f (var) using c option. Name is var.

Create a partition with offset at 7p with size 5g and bzb bit g (usr) using c option. Name is usr.

Dump the partition configuration using p.

If you have configured the new partition map, it should look like this:


   1: Apple partition map
   2: 32m HFS boot
   3: 1g Apple_UNIX_SVR2 root /    a
   4: 1g Apple_UNIX_SVR2 swap      b
   5: 1g Apple_UNIX_SVR2 tmp       e
   6: 1g Apple_UNIX_SVR2 var       f
   7: 5g Apple_UNIX_SVR2 usr  /usr g
   8: *g Apple_UNIX_SVR2 home      h

Write the partition map using w.

Newfs

Now newfs your partitions:

# newfs /dev/wd0x

Note: Don't care about error messages that newfs couldn't touch the disklabel - that's right since we've created everything with pdisk.

Mounting root

Mount the root partition to /mnt2 and create following directories:

# mount /dev/wd0a /mnt2
# cd /mnt2
# mkdir etc tmp usr var home

Create fstab

Create the file fstab that should match your wd0 disklabel configuration.

# echo /dev/wd0a / ffs rw 1 1 >> /mnt2/etc/fstab
# echo /dev/wd0b none swap sw 0 0 >> /mnt2/etc/fstab
# echo /dev/wd0e /tmp ffs rw 1 2 >> /mnt2/etc/fstab
# echo /dev/wd0g /var ffs rw 1 2 >> /mnt2/etc/fstab
# echo /dev/wd0f /usr ffs rw 1 2 >> /mnt2/etc/fstab
# echo /dev/wd0h /home ffs rw 1 2 >> /mnt2/etc/fstab

Umount

Unmount /mnt2 again and enter sysinst.

# cd /
# umount /mnt2
# sysinst

Using Sysinst

In sysinst just use Re-install sets and proceed with the installation. After finishing these steps (equivalent to standard installation and which will create all device nodes in /dev) you can configure your Timezone and set a root password through going to the Utilities menu again.

First boot

Now we're ready for the first boot. Exit sysinstall and enter reboot.

# reboot

Leave the installation CD in your drive and enter:

boot cd:,ofwboot.xcf hd:3,/netbsd

Wait until netbsd boots into single user mode and use /bin/sh.

Cd to /etc and edit your rc.conf:

cd /etc
vi rc.conf

Please set:

rc_configured=YES
wscons=YES
hostname=my.powermac.g4
dhclient=yes

Please use /etc/ifconfig.gem0 if you don't have a DHCP Server in your network and remove dhclient=yes from rc.conf

Right now, set up your network. Either use dhclient to configure your network via DHCP

# dhclient gem0  

or manually specify your network using ifconfig.

# ifconfig gem0 192.168.0.124 netmask 255.255.255.0

Fetch pkgsrc.tar.gz

ftp -a ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz 

and extract it to /usr

tar xvfz pkgsrc.tar.gz -C /usr

Install hfsutils from sysutils

# cd /usr/pkgsrc/sysutils/hfsutils 
# make install clean 

Format your boot partition through:

# hformat /dev/wd0d

Place your ofwboot.xcf file of your installation cdrom (mount /dev/cd0a /mnt) to that partition:

# hcopy /mnt/ofwboot.xcf :

Reboot and enter OpenFirmware and enter following commands:

# eject cd 

You don't need the installation disk anymore.


   reset-nvram
   setenv auto-boot? false
   setenv boot-device hd:2,ofwboot.xcf
   setenv boot-file hd:3,/netbsd
   reset-all

Next time you reboot your mac you get kicked into OpenFirmware directly. Just type:

boot 

and you will boot into NetBSD :-)

XF86Config

As for X11 here is my XF86Config file:


Section "Files" 
    FontPath    "/usr/X11R6/lib/X11/fonts/local/"
    FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath    "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath    "/usr/X11R6/lib/X11/fonts/CID/"
    FontPath    "/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "ServerFlags"
    Option      "blank time"    "10"    # 10 minutes
    Option      "standby time"  "20"
    Option      "suspend time"  "30"
    Option      "off time"      "60"
    Option      "PCI type"      "UniNorth"
EndSection

Section "InputDevice"
    Identifier "Keyboard1"  
    driver  "keyboard"      
    option "protocol" "wskbd"
    option "device"  "/dev/wskbd1"
    Option  "AutoRepeat"    "500 5"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "macusb"
    Option      "XkbLayout"     "us"
    Option      "XkbModel"      "macusb"
    Option      "XkbLayout"     "us"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "wsmouse"
    Option      "Device"        "/dev/wsmouse0"
    Option      "ZAxisMapping"  "4 5"
EndSection  
Section "Monitor"
    Identifier  "Generic Monitor"
    HorizSync   27-100         # multisync
    VertRefresh 50-75         # multisync 
    Option      "dpms"
EndSection
Section "Device"
    Identifier  "Rage128 Pro"
    Driver      "ati"
    BusID       "PCI:0:16:0"
EndSection
Section "Screen"
    Identifier          "Screen1"
    Device              "Rage128 Pro"
    Monitor             "Generic Monitor"
    DefaultDepth        16      
    HorizSync   27-100         # multisync
    VertRefresh 50-75         # multisync 
    Option      "dpms"
EndSection  
Section "Device"
    Identifier  "Rage128 Pro"
    Driver      "ati"
    BusID       "PCI:0:16:0"
EndSection
Section "Screen"
    Identifier          "Screen1"
    Device              "Rage128 Pro"
    Monitor             "Generic Monitor"
    DefaultDepth        16      
    SubSection "Display"
        Depth           8
        Modes           "1280x1024"
    EndSubSection
    SubSection "Display"
        Depth           16
        Modes           "1024x768"
    EndSubSection
  EndSection
Section "ServerLayout"
    Identifier  "Main Layout"
    Screen      "Screen1"
    InputDevice "Mouse1"        "CorePointer"
    InputDevice "Keyboard1"     "CoreKeyboard"
EndSection

That's it, you now have a working NetBSD system on your G4.

This is a really nice page, thank you. I just installed NetBSD 6.1.5 onto the notoriously quirky iMac G4 (take a look at some of the Debian/MintPPC/Ubuntu posts to see how nicely it plays with the nouveau driver) and I needed some workarounds, but otherwise these instructions worked well. I wanted to add this comment for people with that system, since it doesn't play nice.

follow these instructions closely, except alter the following:

don't bother trying to set up networking with sysinst- it doesn't do dhcp on this computer

pdisk is included on the 6.1.5 cd, so it doesn't need downloaded

newfs won't work on this setup with the command listed above, use #newfs /dev/rwd0c

(r for raw)

after installing the sets quit sysinst and chroot into the new installation

mount /dev/wd0a /mnt2

chroot /mnt2

edit the rc.conf

vi rc.conf

change configured to YES, dhclient=yes hostname=yourhost wscons=yes sshd= yes

add a root password

passwd

add a user and put her in group wheel

useradd -m -G wheel joe

give them a password too.

start sshd

/etc/rc.d/sshd start

edit fstab one more time to enable pty (needed to ssh in, at least on my computer)

vi /etc/fstab

add the line

ptyfs /dev/pts ptyfs rw 0 0

save, exit, reboot, boot cd:,ofwboot.xcf hd:3,/netbsd

and when the computer comes back up, it will show the kernel messages and then nothing. the messages will then scroll off the screen and there'll be an invisible console present. hence the need for ssh ssh in from another computer, and do whatever configuration you want from that console or, hit enter a few times to specify terminal type, etc, type your name, hit enter, password, hit enter, and then startx. x will load with twm as the window manager.

I can't get hformat to work with this version or this computer. It compiled correctly, but it will not format my boot partition. So I just use the cd to boot.

Thanks for your work putting this together! NetBSD was my savior when the Debian family switched from nv to nouveau. the iMac G4 needs nv.

Comment by Timothy in the wee hours of Monday night, November 25th, 2014
Add a comment