File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_install_netbsd_on_a_power_macintosh_g4___40__grey__41__.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Sun Nov 20 20:55:21 2011 UTC (2 years, 5 months ago) by mspo
Branches: MAIN
CVS tags: HEAD
import all of the how-to articles from the pkgsrc.se wiki

**Contents**

[[!toc]]

#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|Get_BSD]].
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:
<pre><code>
   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
</code></pre>
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.

* Set your terminal to VT100 

    # export TERM=vt100

* Remount root read-write using: 

    # mount -uw /

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.
<pre><code>
   reset-nvram
   setenv auto-boot? false
   setenv boot-device hd:2,ofwboot.xcf
   setenv boot-file hd:3,/netbsd
   reset-all
</pre></code>
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:
<pre><code>
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
</pre></code>
That's it, you now have a working NetBSD system on your G4. 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb