Port-macppc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Installing on a Power Macintosh G5
On Sun, Jun 01, 2025 at 06:54:26AM +0800, Sergey Fedorov wrote:
> On Sat, May 31, 2025 at 11:35?PM Martin Husemann <martin%duskware.de@localhost> wrote:
>
> > Nowadays I use a FAT partition to load
> > ofwboot and the kernel (as my root filesystem is on a sata controller
> > that OFW does not know about).
> >
>
> Could you please explain how to do the same?
I have no easy way to test a step-by-step instruction right now, but I can
describe my local setup and how to get there (and it is actually not
very complicated).
I did not have any MacOS on this machine (I got it without any media for
that and no disks), so I did the whole installation from within NetBSD
itself and only using base system tools.
First step is to boot some install medium. As you saw from Andreas' original
post this might be a challenge in itself, and in my case I used a NFS root.
For most non-G5 ppc machines you should be able to just boot the installer
CD.
From the installer you can exit to a shell prompt (terminate sysinst
via "x: Exit Install System" on the main screen or go via
"e: Utility menu" to "a: Run /bin/sh").
Now you need to identify the two disks involved (the one OF sees and you
want to boot from and the one you want to install NetBSD on).
Use something like:
$ dmesg | more
and page forward untill you find the SATA controllers. In my case they look
like this:
[ 1.000000] siisata0 at pci2 dev 4 function 0: vendor 1095 product 3124 (rev. 0x02)
[ 1.000000] siisata0: interrupting at irq 54
[ 1.000000] siisata0: SiI3124, 3.0Gb/s
[ 1.000000] siisata0: 64-bit 133MHz PCI-X
[ 1.000000] atabus0 at siisata0 channel 0
[ 1.000000] atabus1 at siisata0 channel 1
[ 1.000000] atabus2 at siisata0 channel 2
[ 1.000000] atabus3 at siisata0 channel 3
This is the one OF does not see, so my root disk will be attached to one of
its channels.
[ 1.000000] svwsata0 at pci7 dev 12 function 0: ServerWorks K2 SATA Controller (rev. 0x00)
[ 1.000000] svwsata0: bus-master DMA support present
[ 1.000000] svwsata0: using irq 0 for native-PCI interrupt
[ 1.000000] svwsata0: primary channel wired to native-PCI mode
[ 1.000000] atabus5 at svwsata0 channel 0
[ 1.000000] svwsata0: secondary channel wired to native-PCI mode
[ 1.000000] atabus6 at svwsata0 channel 1
[ 1.000000] svwsata0: secondary channel wired to compatibility mode
[ 1.000000] atabus7 at svwsata0 channel 2
[ 1.000000] svwsata0: secondary channel configured to compatibility mode
[ 1.000000] atabus8 at svwsata0 channel 3
[ 1.000000] svwsata1 at pci7 dev 12 function 1: ServerWorks K2 SATA Controller (rev. 0x00)
This is the on-board controller that OF knows, apparently the second one
has no devices so we can ignore it. The boot disk must hang off
atabus5-atabus8.
The disks are discovered later, like this:
[ 1.199995] siisata0 port 0: device present, speed: 3.0Gb/s
[ 1.209996] wd0 at atabus0 drive 0
[ 1.209996] wd0: <Samsung SSD 860 PRO 512GB>
[ 1.209996] wd0: drive supports 1-sector PIO transfers, LBA48 addressing
[ 1.209996] wd0: 476 GB, 992277 cyl, 16 head, 63 sec, 512 bytes/sect x 1000215216 sectors
wd0 is the main disk I want to use for root and swap.
[ 2.279994] atapibus0 at atabus4: 2 targets
[ 2.279994] cd0 at atapibus0 drive 0: <SONY DVD RW DW-U21A, , AADB> cdrom removable
[ 2.279994] cd0: drive supports PIO mode 4, DMA mode 2svwsata0 port 2: PHY offline
[ 2.279994] , Ultra-DMA mode 4 (Ultra/66)
[ 2.289997] cd0(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4 (Ultra/66) (using DMA)
[ 2.289997] svwsata0 port 3: PHY offline
[ 2.299994] svwsata0 port 0: PHY offline
[ 2.299994] wd1 at atabus6 drive 0
[ 2.299994] wd1: <Intenso SSD SATAIII>
[ 2.299994] wd1: drive supports 1-sector PIO transfers, LBA48 addressing
[ 2.299994] wd1: 111 GB, 232581 cyl, 16 head, 63 sec, 512 bytes/sect x 234441648 sectors
[ 2.309997] wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133), WRITE DMA FUA, NCQ (32 tags)
[ 2.309997] wd1(svwsata0:1:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA), WRITE DMA FUA EXT
The DVD drive attaches as cd0, and wd1 is the disk I want to use for booting.
Now for the manual part: since I did not have MacOS (and want to be easily
able to access and update the boot partition from within NetBSD) I used
a MBR to partition it:
$ fdisk -u wd1
it asks a stupid question about BIOS and geometry, ignore that (answer
with n) and you should see an empty partition table:
Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
No active partition.
Drive serial number: 0 (0x00000000)
Now select the partition number you want to change (0 - 3) and edit the
details. The result in my case looks like:
Partition table:
0: Primary 'big' DOS, 16-bit FAT (> 32MB) (sysid 6)
start 16, size 257040 (126 MB, Cyls 0/0/17-16/0/16)
1: NetBSD (sysid 169)
start 257056, size 234184592 (114348 MB, Cyls 16/0/17-14593/80/63)
PBR is not bootable: All bytes are identical (0x00)
2: <UNUSED>
3: <UNUSED>
No active partition.
Drive serial number: 0 (0x00000000)
The (1) partition is not really needed, I added it as fallback if the other
disk should die (see below).
For easy access from NetBSD you want these partition data also in the
disklabel, I think I used
$ mbrlabel wd1
for that and then edited the disklabel with
$ disklabel -i wd1
The net result in my setup looks like this:
# /dev/rwd1:
type: unknown
disk: g5boot
label: g5boot
[..]
5 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 234184592 257056 4.2BSD 0 0 0 # (Cyl. 255*- 232580)
c: 234441648 0 unused 0 0 # (Cyl. 0 - 232580)
e: 257040 16 MSDOS # (Cyl. 0*- 255*)
The only changes I made to mbrlabel output were setting a name for the
label (this is totally optional).
Now with a disklable you can create filesystems.
$ newfs_msdos /dev/rwd1e
and for rescue purposes (optional) a ffs:
$ newfs -O2 /dev/rwd1a
and then mount them and populate them. For the rescue file system I
just added the contents of the rescue set:
$ mount -o async /dev/wd1a /targetroot
$ cd /targetroot && tar xpzf /tmp/rescue.tgz
$ umount /targetroot
The boot partition is even simpler: just copy the kernel and ofwboot
there:
$ mount -t msdos /dev/wd1e /targetroot
$ cp /netbsd /targetroot
$ cp /usr/mdec/ofwboot.xcf /targetroot
$ umount /targetroot
Now we are mostly done, everything else can be handled by sysinst. I returned
to the sysinst installer (just exit the shell should be enough).
Then let the installer do a installation to wd0 (whole disk for NetBSD, default
partition sizes, ....) and at the end reboot the system.
I picked GPT as partitioning scheme, just for fun and my GPT looks like this:
$ gpt show -a wd0
start size index contents
0 1 PMBR
1 1 Pri GPT header
GUID: d1199eac-a57b-4fc8-be13-3bcac7f46bac
2 32 Pri GPT table
34 30 Unused
64 943718400 1 GPT part - NetBSD FFSv1/FFSv2
Type: ffs
TypeID: 49f48d5a-b10e-11dc-b99b-0019d1879648
GUID: 60d792d8-59f0-454e-a5d3-cb154da4f88a
Size: 450 G
Label: G5root
Attributes: None
943718464 56496704 2 GPT part - NetBSD swap
Type: swap
TypeID: 49f48d32-b10e-11dc-b99b-0019d1879648
GUID: 1a2866e2-011d-4d2d-87f5-6565fce670ff
Size: 27586 M
Label: G5swap
Attributes: None
1000215168 15 Unused
1000215183 32 Sec GPT table
1000215215 1 Sec GPT header
GUID: d1199eac-a57b-4fc8-be13-3bcac7f46bac
I manually tweaked the generated /etc/fstab later to include an entry
for the boot partition (which I mount on /ofw when needed):
NAME=G5root / ffs rw 1 1
NAME=G5swap none swap sw,dp 0 0
/dev/wd1e /ofw msdos rw,noauto
after rebooting the system I had to figure out the boot string and ended
up with something like:
> boot sd1:1,ofwboot.xcf netbsd
and when that booted I had to manually enter the reald root filesystem, so
I modified my kernel configuration to hard-wire that:
In my case I put it in POWERMAC_G5.local, but usually it should go in
GENERIC.local:
no config netbsd
config netbsd root on "wedge:G5root" type ffs
Build a new kernel with that and copied it to both / (on the real root
partition) and /ofw (the boot partition).
To not forget to do that I created a simple script "newkernel" that I run
to copy /tmp/netbsd to both partitions and do a backup (unless -k is
specified):
--8<--
#! /bin/sh
KERNEL=/tmp/netbsd
[ -r ${KERNEL} ] || { printf "no new kernel in ${KERNEL}!\n"; exit 1; }
mount /ofw
if [ "$1" != "-k" ]; then
printf "Moving old kernels to .old\n"
mv /ofw/netbsd /ofw/netbsd.old
mv /netbsd /netbsd.old
fi
printf "Copying new kernel\n"
cp ${KERNEL} /
cp ${KERNEL} /ofw
umount /ofw
-->8--
(not a very polished script, but seems to do the job).
And I think that is all the magic I had to do, now it all works automatically
and I keep forgetting all details.
Martin
Home |
Main Index |
Thread Index |
Old Index