Here are some tips.
It seems that netbsd-INSTALL.gz image which comes from 5.1 installation CD is ok but netbsd-GENERIC.gz and others were not tested so they crashed when I rebooted after installation. So here what I've done to solve this after installation is done but can not boot to netbsd:
Hold Alt+Win+o+f when starting PowerMAC to enter in OpenFirmware cmd line menu.
Boot with install netbsd image. Something like that:
0> boot cd:,\ofwboot.xcf \macppc\binary\kernel\netbsd-INSTALL.gz
When it boots you will be prompted for (I)nstall (S)hell ... choose 'S;.
Now from shell mount your root partition and chroot to it and set up your internet connection:
# mount /dev/wd0a /mnt2
# chroot /mnt2
# ifconfig gem0 192.168.1.10 255.255.255.0 up
# route add default 192.168.1.1
# echo "nameserver 192.168.1.1" > /etc/resolv.conf
Now you can download and compile your own kernel. Get syssrc.tgz from ftp.netbsd.org untar it and go to sys/arch/macppc/conf. Use GENERIC config as if you try to compile POWERMAC_G5 or some of the others result will be the same - kernel crash on next reboot.
# cp GENERIC G4
# vi G4
# config G4
# cd ../compile/G4
# make depend
# cp /netbsd /netbsd.old
# cp netbsd /netbsd
If you want your Xorg server to work you need to add these lines to kernel config file and recompile it:
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
options WSDISPLAY_COMPAT_USL # VT handling
options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
Now you just use: X -configure and then test your config with: X -config xorg.conf.new