Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2013 17:56:09 -0700
From:      Doug Hardie <bc979@lafn.org>
To:        "freebsd-stable@freebsd.org List" <freebsd-stable@freebsd.org>
Subject:   Re: Sanity Check on Mac Mini
Message-ID:  <28915479-B712-4ED0-A041-B75F2F59FECA@lafn.org>
In-Reply-To: <7F72BB49-8810-42A4-AC4F-9B6D3E61C6EB@lafn.org>
References:  <51CB1227-3A5F-4688-B48D-4D0E47A17572@lafn.org> <5138A742.3090200@wintek.com> <97F9BA96-A328-4EF9-8E39-A8160AF9EB7A@lafn.org> <CAN6yY1vgjwxOCVrvJkJ4AS%2BfXVQMbhJVKbtc=jo6BT-M2gP6qA@mail.gmail.com> <71F173FA-CB9C-43B4-A702-ABA82268EA83@lafn.org> <web-11073367@mailback3.g2host.com> <428C87E0-7CF4-4664-9EF2-8CD582927AAB@lafn.org> <web-11092803@mailback3.g2host.com> <7F72BB49-8810-42A4-AC4F-9B6D3E61C6EB@lafn.org>

next in thread | previous in thread | raw e-mail | index | archive | help
As I previously indicated, I have tested a couple more Minis and updated =
the instructions with what I learned.  Here is the revised version:

2.12	Installing FreeBSD on an Apple Mac Mini

The Mac Mini is an attractive server platform.  Its small, runs cool, =
low powered, and reasonably cheap.  There a variety of configurations =
available.  However, the bottom of the line seems to be a powerful =
server.

There are a few issues with installing FreeBSD on the mini.  Mostly they =
derive from the newer hardware it uses and that it uses EFI rather than =
a BIOS for booting.  There is not a simple install that will get the =
unit working, but the additional steps required are quite simple.  The =
goal of these instructions is to get FreeBSD 9.1-Release running as a =
headless server on a Late 2012 Mini, Model No A1347.  Its probably =
possible to setup the mini as a workstation, but that would require some =
additional effort to test the display and mouse interfaces and find =
fixes for any issues with those.

The original intent was to have the server without system source so that =
it could be maintained using freebsd-update.  However, that will =
probably have to wait until 9.2-Release is available.  In the meantime, =
freebsd-update has to be used with care since I believe it will replace =
the modified bge files.


2.12.1	Preparing for the Install

2.12.1.1	Automatic Startup after Power is Restored

Generally servers need to be automatically restarted after a power =
failure.  Start up the Mini in OS-X.  If this is a new unit, I go =
through the registration so that Apple has it on record for use with =
AppleCare.  Go to System Preferences and select Energy Saver.  I set Put =
hard disk to sleep when possible, Wake for network access, Allow power =
button to put the computer to sleep, and most importantly - Start up =
automatically after a power failure.  Note, shutting down the computer =
at this time will not permit it to come back on when power is applied.  =
You have to pull the power plug.  Apparently this setting is a bit =
mislabeled.  Its more like Return the Power to the last status.

These settings work properly with Mac OS-X.  I have not found a way to =
set the startup settings while running FreeBSD yet.  These settings do =
carry over to the FreeBSD install.  However, you may need to lock the =
energy saver preferences for that to happen.

Shutdown the Mini.


2.12.1.2	Preparing FreeBSD for the installation

You can select either the i386 or the amd64 distributions.  Both have =
been tested with these procedures and yield a working server.  The =
bottom of the line mini comes with 4 GB of memory installed.  The i386 =
distribution will only use 2 GB.  The remainder will not be used.  The =
amd64 distribution builds larger binary modules, but it will use all the =
memory.

Download the 9.1 Release distribution Memstick Image.  You will need to =
copy that to a memstick.  There are instructions in section 2.3.5 for =
copying the image to the memstick.  Obtain a display and USB keyboard =
and connect them to the mini.

With a browser go to svnweb.freebsd.org/base/head/sys/dev.  Click on the =
bge folder.  Click on the name if_bge.c.  Find Revision 245931.  Click =
on the download link and save the file.

Go back to the bge page and click on if_bgereg.h.  Find Revision 243686. =
Click on the download link and save the file.  Edit the saved =
if_bgereg.h file and add the following to the end:

#define	PCIER_DEVICE_CAP	0x4
#define	PCIER_DEVICE_CTL	0x8
#define	PCIEM_CAP_MAX_PAYLOAD		0x00000007
#define	PCIEM_CTL_RELAXED_ORD_ENABLE	0x0010
#define	PCIEM_CTL_NOSNOOP_ENABLE	0x0800
#define	PCIER_DEVICE_STA	0xa
#define	PCIEM_STA_CORRECTABLE_ERROR	0x0001
#define	PCIEM_STA_NON_FATAL_ERROR	0x0002
#define	PCIEM_STA_FATAL_ERROR		0x0004
#define	PCIEM_STA_UNSUPPORTED_REQ	0x0008

There was a change to some of the names in if_bgereg.h after the 9.1 =
Release was created, but before the corrections to the bge driver were =
included.  It would be possible to grab the appropriate earlier verion =
of if_bgereg.h, however, when rebuilding the kernel, there are other =
drivers that use the new names.  This seems to be the easiest approach.  =
Also, it worked.

Go back to the dev page and click on the mii folder.  Click on brgphy.c. =
 Find revision 244482.  Click on the download link and save the file.

Copy the saved files to another memstick.


2.12.2	Installing the 9.1 Release

Boot the mini using the memstick.  Hold down the Option key on the =
keyboard and power up the mini.  You will hear the hardware check beep =
and shortly thereafter the screen will show one or more boot icons.  =
Double click on the one named "Windows".  It will have a USB icon.

Continue through the normal installation procedure as detailed earlier =
in this chapter.  If you are building a FreeBSD only server, use the =
entire disk.  Also, be sure to install the system source.  You will need =
it later.

You will need to setup the disk using MBR partitioning and not the =
default GPT.  This part is a bit involved, but not difficult.  When =
during the install process you get to the Partitioning screen, select =
Guided.  Then select the desired disk.  I select Entire Disk as I only =
want FreeBSD on the system.

Find the correct disk in the Partition Editor.  You will want to select =
it and click on Modify.  Change the partition type to MBR.  Then when =
back at the Partition Editor list, select the drive and click on Create. =
 You will need to then add the first item which will not have a mount =
point.  Tab to OK and click.  Then click on Create again and add the / =
slice (freebsd-ufs).  The root partition must be first for the system to =
be able to boot.   Then Click on Create again and add a swap slice =
(freebsd-swap).  Then continue on through the normal install process.

At the end of the install you will be asked to reboot the mini.  Here is =
where the first problem may occur.  If you used the default GPT =
partitioning, pop out the memstick and let the system reboot, it will =
hang with an empty folder icon in the center of the display.

The problem is that the EFI boot loader can't find anything to boot.  =
There are several approaches that may work.  The Mac bless utility has =
been used to bless the boot disk so the boot loader can find it.  I =
found the following instructions for this.  However, they indicate that =
MBR partitioning is still required. =20

	a. We need to boot OSX from the install DVD again

	b. Choose a language =96> Utilities =96> Terminal

	c. Enter diskutil list =96> see the 64k? It is something like=20
	   =93/dev/disk0sX=94

	d. Enter bless =96device /dev/diskXXX =96setBoot =96legacy =
(where diskXXX is=20
	   the identifier you found one step before)

	e. Quit the =93installation process=94

	f. Reboot into FreeBSD=20

The one way that has been shown to work is to make sure the memstick is =
removed when you boot the mini.  Once you get the empty folder icon, =
plug the memstick back in.  The system will shortly boot from the =
internal disk.  There is no known explanation for this phenomena other =
than "it just works".

If you used MBR partitioning, then on boot, the system will sit with a =
blank screen for about a minute and then boot as normal.  Perhaps =
blessing the disk will speed this up.


2.12.3	Rebuilding the kernel to support the Ethernet Interface

Once the system has been rebooted, you will notice that ifconfig may not =
show the ethernet interface.  There are at least two different chips =
being used for that interface.  Some of the units work right out of the =
box.  Others do not.  I have two units and the only visible difference =
is the Part No.  Part Nu. MC815LL/A appears to be the older unit and the =
bge interface worked on install.  Part No MD387LL/A is newer and has the =
newer chips that require the driver update.

 If the bge interface does not show, then the bge driver needs to be =
updated to recognize the NIC.  Mount the second memstick with the files =
retrieved earlier and move them into the kernel source.  I used the =
following commands:

cp -p brgphy.c /usr/src/sys/dev/mii
cp -p if_bgereg.h /usr/src/sys/dev/bge
cp -p if_bge.c /usr/src/sys/dev/bge

then rebuild the kernel.  Note the instructions here are for GENERIC, =
but you can use KERNCONF to specify a custom kernel.

cd /usr/src
make buildkernel
make installkernel

Reboot the server as before.  Now ifconfig will show bge0 and it will =
work.  The mini is now running a useable version of 9.1-Release.  There =
are still some items remaining to be resolved:  Updating the kernel with =
the recent security patches, Disabling Bluetooth and Wireless to save =
power, and unattended rebooting.  These issues are still being =
addressed.


2.12.4	Running freebsd-update to get the Latest Security Updates

Freebsd-update provides a very convenient was to keep the system up to =
date with security updates.  It does require that you remain on the =
Release distribution and not use modified kernels.  Since the mini =
requires updates to the bge driver that will not be incorporated into =
the 9.1-Release, the modified bge files need to be save somewhere other =
than in /usr/src.  Freebsd-update will replace them in their normal =
locations with the "newer" ones that do not support the mini's NIC.  I =
saved a copy in my home directory along with a short script that copies =
them into the kernel.

Run:  freebsd-update fetch
Run:  freebsd-update install

Check the differences between the updated bge files and those in the =
kernel source.  If they have changed, the rebuild the kernel.  At the =
moment, the security updates have not affected the kernel so it did not =
need to be rebuilt.


2.12.5	Disabling Bluetooth and Wireless

Mac OS-X provides a way to disable both of these.  Ifconfig does not =
show either.  The Wireless NIC is not attached to a driver so is status =
is quite difficult to determine.  My guess is that the appropriate =
driver will need an update to enable it to be found and controlled.  The =
same seems to hold for the Bluetooth controller.


2.12.6	Other Versions of the Mac Mini

I tried installing on a Mac Mini 1,1 (quite old) and was completely =
unsuccessful.  I use that machine as an off-site backup so about the =
only thing it runs is rsync and cron.  Both of those work under OS-X so =
I left it that way.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28915479-B712-4ED0-A041-B75F2F59FECA>