A week of NetBSD #1

I wanted to resume writing up notes about what I’d been working on as with the “A week of pkgsrc” series, this actually spans the last few weeks. 🙂

Things basically came together around the event of a late 2009 13″ MacBook entering my life. First port of call was to see state of NetBSD support since I last visited it.
I’m still running FreeBSD on my 11″ Air and so was keen to see if there had been any progress in NetBSD with regards to supporting the Intel based Macs. Unfortunately the same issue is still present, the system panics very early in the boot process kern/52229 when using the UEFI image and fails when enumerating CPUs present. I was able to get the system to boot using the conventional (non-UEFI) image by opting to boot without SMP & ACPI enabled. I used the MacBook install wiki article as a rough guide on gpt partitioning and got a daily image installed. The wiki article needed some attention as the syntax for commands did not apply but through this process I discovered a crash in gpt where a missing check in the source means that a null pointer is passed to one of the gpt commands.
e.g gpt show -a

Running the system without ACPI was not a good idea, turns out the thermal management does not get initialised and the system eventually switches off as a failsafe measure. I found this out through leaving the machine bulk building some of my packages, only to return to a machine that’s powered off.

GCC 6 has landed in NetBSD-HEAD and work is in progress to bring things into shape as the next revision of GCC shipped in NetBSD. Unfortunately cross compilation from macOS does not work at the moment (toolchain/53013) which limited my ability to experiment with different NetBSD kernel configuration while I was trying to look into the MacBook issue.

The one frustration with crash was that when the system panicked, the system would drop to DDB (the kernel debugger) but the keyboard would not be functioning. I realised that when running into panics on NetBSD/macppc in the past I’d always have a backtrace to include in my bug report. This was because the macppc kernel was built with the option to execute a backtrace command when entering the debugger and the amd64 one wasn’t. Asking on the tech-kern list to enable this option across the board I learnt of the shortfall of this approach and received suggestion on extending ddb, thus the dumpstack option was born and enabled by default. With this, setting ddb.onpanic sysctl to 2 for backtraces went away as well as setting the DDB_COMMANDONENTER option to run backtrace explicitly in kernel configuration files. The next step now is to extend DDB to show the panic message after the backtrace so that the panic message and the tail end of potentially lengthy trace is visible.

Up until very recently there was only support for PCIe based G5 PowerMacs using the POWERMAC_G5_11_2 kernel configuration in NetBSD, I am lacking such a system but do have a first gen G5 iMac which is PCI-X based. The initial work to bring up NetBSD on the G5 was actually done on a PCI-X based system long ago so I was curious what had diverged since then. Previous GSoC project participants used a repo in the NetBSD-gsoc sourecforge project to share their work, the two G5 related GSoC projects are there in a single repo. Some further work also took place on the port-macppc mailing list in 2013. It was a fun weekend albeit no further progress to seeing even a copyright notice on my part. However I learnt lots about the kernel build process, poked at lowcore.S and the boot process. I also learnt of an emulator called Mambo. Mambo was a full PowerPC system simulator, produced by IBM research. There are kernel configuration files to support Mambo (theoretically) in NetBSD & FreeBSD but unfortunately, I couldn’t find any binaries to try Mambo, along with that I also found the links for the PowerPC 970FX (G5 CPU) documentation all dead and the documentation removed from the IBM site. 🙁
To rule out the kernel working on a G5 but console being an issue, I tried experimenting with different frame buffers and found macofcons(4) broke the build (port-macppc/53004). After discussing with macallan@, macofcons(4) and the OFB_ENABLE_CACHE option have now been removed [1] [2], on the basis that though they may have worked at one point they cause more problems that solve.

macallan@ has been working on extending support for the G5 based systems  and it is now possible to boot NetBSD on both the early PCI-X based systems as well as the PCIe models thanks to his work. I was finally able to netboot NetBSD on my first gen G5 iMac, this should come in very handy for pkgsrc work.

The NetBSD/macppc website has a supported system page which was due a review. After a call for feedback on any discrepancies , the awacs(4) soundcard driver is now enabled and I’m looking for a source to find out which systems shipped with which chipsets. Along the way NetBSD gained modem drivers for some of these systems but the page still states they are not supported.

In NetBSD, there is support for different buffer queue strategies for disk I/O, on the tier 1 ports such as i386 & amd64, the per-priority cyclical scan strategy is enabled by default, to bring macppc on par, it is now also enabled there by default too. Now to document the option so that it’s somewhat like the description of another strategy for read priority. See BUFQ_READPRIO and BUFQ_PRIOCSCAN in options(4).

This weekend I’ve been testing the HEAD-llvm builds on i386 & macppc as well as ATF testing, but I’ll write about that in another time.

Thanks to jmcneil, martin, mrg, pgoyette, uwe for the help and suggestions.

FreeBSD on 11″ MacBook Air 5,1 (mid-2012)

This tiny machine has been with me for a few years now, It has mostly run OS X though I have tried OpenBSD on it. Besides the screen resolution I’m still really happy with it, hardware wise. Software wise, not so much. I use an external disk containing a zpool with my data on it. Among this data are several source trees. CVS on a ZFS filesystem on OS X is painfully slow. I dislike that builds running inside Terminal.app are slow at the expense of a responsive UI. The system seems fragile, at the slightest push the machine will either hang or become unresponsive. Buggy serial drivers which do not implement the break signal and cause instability are frustrating.
Last week whilst working on Rump kernel builds I introduced some new build issues in the process of fixing others, I needed to pick up new changes from CVS by updating my copy of the source tree and run builds to test if issues were still present.
I was let down on both counts, it took ages to update source and in the process of cross compiling a NetBSD/evbmips64-el release, the system locked hard. That was it, time to look what was possible elsewhere. While I have been using OS X for many years, I’m not tied to anything exclusive on it, maybe tweetbot, perhaps, but that’s it.
On the BSDnow podcast they’ve been covering changes coming in to TrueOS (formerly PC-BSD – a desktop focused distro based on FreeBSD), their experiments seemed interesting, the project now tracks FreeBSD-CURRENT, they’ve replaced rcng with OpenRC as the init system and it comes with a pre-configured desktop environment, using their own window manager (Lumina). Booting the USB flash image it made it to X11 without any issue. The dock has a widget which states the detected features, no wifi (Broadcom), sound card detected and screen resolution set to 1366×768. I planned to give it a try on the weekend. Friday, I made backups and wiped the system. TrueOS installed without issue, after a short while I had a working desktop, resuming from sleep worked out of the box. I didn’t spend long testing TrueOS, switching out NetBSD-HEAD only to realise that I really need ZFS so while I was testing things out, might as well give stock FreeBSD 11-STABLE a try (TrueOS was based on -CURRENT). Turns out sleep doesn’t work yet but sound does work out of the box and with a few invocations of pkg(8) I had xorg, dwm, firefox, CVS and virtuabox-ose installed from binary packages. VirtualBox seems to cause the system to panic (bug 219276) but I should be able to survive without my virtual machines over the next few days as I settle in. I’m considering ditching VirtualBox and converting the vdi files to raw images so that they can be written to a new zvol for use with bhyve. As my default keyboard layout is Dvorak, OS X set the EFI settings to this layout. The first time I installed FreeBSD 11-STABLE, I opted for full disk encryption but ran into this odd issue where on boot the keyboard layout was Dvorak and password was accepted, the system would boot and as it went to mount the various filesystems it would switch back to QWERTY. I tried entering my password with both layout but wasn’t able to progress any further, no bug report yet as I haven’t ruled myself out as the problem.
Thunderbolt gigabit adapter – bge(4) and DVI adapter both worked on FreeBSD though the gigabit adapter needs to be plugged in at boot to be detected. The trackpad bind to wsp(4), left, right and middle clicks are available through single, double and tripple finger tap. Sound card binds to snd_hda(4) and works out of the box.
For wifi I’m using a urtw(4) Alfa adapter which is a bit on the large side but works very reliably.
A copy of the dmesg is here.

Virtualising retail Mac OS X images on OS X with virtualbox

For testing changes related to OS X in pkgsrc I revisited trying to get virtual machines of the various releases of OS X running to improve test coverage. At present I’m confined to testing on Tiger and Mavericks though I also have machines running Leopard and Lion but they need setting up.
By default, it’s not possible to boot an instance of Mac OS X from a genuine install image, on a Mac host, running OS X using virtualbox.
Searching around reveals using modified images intended for building Hackintosh as the solution most people use. Virtualbox supports OS X guests but when following the usual steps in the wizard to create a new VM & pointing it to your unmodified OS image, nothing much happens.
Depending on the version of OS X you’re trying to boot you’ll either end up with a XNU hang/panic or just dropped straight to an EFI prompt.
Again, depending on the version of OS X being attempted the issue differs. I’ve managed to install 10.7 to 10.10 successfully on virtualbox so far. 10.5 & 10.6 remain to be done.

10.7 – Lion

With the release of 10.7, Apple changed the way OS was packaged, the digital distribution came with a disk image named InstallESD.dmg nested inside an application named Install Mac OS X Lion.app. It’s possible to use this disk image with virtualbox as-is without change however the system will not boot from the image because it fails a test by the boot loader to ensure the image is being booted on a genuine Mac. In my case it is, but unfortunately the cpuid virtualbox presents to the operating system is not one that the OS recognise & so it fails.
The solution to this is to tell virtualbox to mask the cpuid of the guest, unfortunately depending on the version of hardware? or virtualbox that you’re using you may have to experiment with which ID works. I first tried the ID 00000001 000306a9 00020800 80000201 178bfbff listed in the post by BitTorrent engineering but it did not work on a Mid-2012 MacBookAir5,1 with VirtualBox 4.3.22 r98236.
Searching around I found the ID 1 000206a7 02100800 1fbae3bf bfebfbff to try in a comment on another guide which did work.

To create a working VM of Lion in virtual
1) Create a VM in virtualbox named something, type Mac OS X, version Mac OS X 10.7 Lion (64 bit).
2) Before booting the VM, switch to Terminal and change the cpuid of the guest by running
VBoxManage modifyvm something --cpuidset 1 000206a7 02100800 1fbae3bf bfebfbff
3) Right click on Install Mac OS X Lion.app, select “Show Package Contents” and navigate to Contents/SharedSupport. Copy InstallESD.dmg to a locate on your disk which is navigatable.
4) Start the VM & when asked for an install disk, point to the InstallESD.dmg which you copied out in the previous step. The system should boot without any need for further modification (most guides recommend other changes such as switching to a PIIX chipset).

10.8 – Mountain Lion and newer

With Montain Lion, InstallESD.dmg was changed once again, this time to contain multiple partitions (EFI, Boot/Rescue, Install), unfortunately it’s not possible to boot these images successfully as the notion of multiple partitions is not applicable to media such as optical so what happens is that the system is able to boot from the disk image & load the kernel but unable to continue to load the install environment.
What needs to happen is a new “flattened” image needs to be generated which is on a single partition & contains everything from the boot partition.
There is no need to modify any settings for the VM such as cpuid as previous or chipset as recommended by other guides like Engadgets

To flatten the image a tool called iESD is used.
iESD can either be installed via gem(1) or if you’re a pkgsrc user, I’ve created a WiP package.

The instruction in the Engadget guide pretty much covers everything needed. Just make sure that the disk images are fully detached before issuing the hdiutil commands, quickest way being to open Disk Utility.app, selecting mounted disk images & pressing eject or checkout the output of hdiutil info & using hdiutil detach $devicename to detach all device names associated with the disk images.

Restrictions on Apple hardware

I was recently looking for a link I thought I’d bookmarked on how to install recent versions of Mac OS X on EoL Apple hardware, specifically the Mac Pro. I was unsuccessful in finding the link I was looking for but I did find that  you can re-flash a MacPro1,1 with a MacPro2,1 EFI firmware, main benefit being microcode updates. Turns out the hardware in the first & second generation Mac Pro is identical bar the model of CPU available. There’s also modified images to bring the MacPro4,1 to 5,1 which seems to provide much more benefit than the previously mentioned modification.

This got me thinking about some of the issues I’d experienced with older apple hardware and the work arounds, it has been a while since I’ve posted something here so I wrote this post.

On the old world SCSI Macs (pre biege G3?) the drive vendor on the disk firmware with be identified as Apple which the Drive Setup utility (predecessor of Disk Utility) would look for, if it was not found, you would not be able to format your drive as HFS and hence be unable to install Mac OS. Work around was either finding another platform to format the disk or modify a copy of Drive Setup utility with ResEdit & add the drive to the necessary table.

The first of blue & white PowerMac G3 systems logic board shipped with a buggy CMD IDE controller which would corrupt data when doing DMA transfer, Apple shipped the disks in these systems with the firmware tied to PIO mode which was lots of fun when you came to replace the disk with a newer/bigger/faster one. To complete the replacement successfully, the new disk with need to be connected to a PC first & using the firmware utility provided by the vendor, make the same change of restricting the disks operation mode to PIO, otherwise it would not be possible to rely on the disk as data would be corrupted as you began writing to it, there was a recall for the motherboard If you were aware of the issue at the time.

The Mid/Late 2007 MacBook Pro (per advisory?) has the SATA port on the ICH8-M south bridge locked to SATA I even though it is capable of SATA II.

Most systems with user replaceable RAM are capable of taking more than official specification documents list. MacTracker – an application which lists specs & information about Apple hardware provides advertised & actual maximum memory capabilities of system. Not so much a software based restriction but a documentation one.

12″ PowerBook G4 PT 4

Due to various factors, I’ve not had much of a chance to play with the PowerBook much this month, earlier this moth a follow up to PR/48740 happened, requesting feedback on new changes which had been committed that I’ve not had a chance to test yet.
One thing I did do tonight was to re-flash the SuperDrive with a RPC-1 firmware image which turns the DVD drive region-free.
The firmware images are hosted on MacBook.fr and cover Macs all the way back to G3’s.
Flashing was straightforward though I could only re-flash with the version currently on the drive. It was not possible to flash a newer stock or region-free image on the drive.
Aside from the firmware on the DVD drive, Mac OS also tries to enforce region locking, the Region X utility can reset the Mac OS related setting regarding content region.

12″ PowerBook G4 PT 3

Since I last posted about dealing with pkgsrc on my PowerBook earlier this week, a patch has been committed which solves the linker issue on lang/gcc45 along with another fix related to how stripping of binaries is handled on Darwin. Unfortunately PR/48740 mentioned gcc44 to 46 suffer from the same issue but the patch has not been applied to gc44 or 46, I’m waiting to hear back from the committer.
One thing I forgot to mention in the previous post is that there is another issue with build process for GCC. There appears to be a deadlock issue where sh sits there chewing up CPU & context switching, at this point, aborting the build with & restarting again allows the build to continue.
Attaching to sh with gdb does not give any further insight as to what’s going on 🙁

Apple’s Darwin according to GCC

From gcc’s target definitions for Darwin (Mac OS X) systems

/* The definitions in this file are common to all processor types
running Darwin, which is the kernel for Mac OS X. Darwin is
basically a BSD user layer laid over a Mach kernel, then evolved
for many years (at NeXT) in parallel with other Unix systems. So
while the runtime is a somewhat idiosyncratic Mach-based thing,
other definitions look like they would for a BSD variant. */

/* Although NeXT ran on many different architectures, as of Jan 2001
the only supported Darwin targets are PowerPC and x86. */

/* One of Darwin's NeXT legacies is the Mach-O format, which is partly
like a.out and partly like COFF, with additional features like
multi-architecture binary support. */

12″ PowerBook G4 PT 2

As I wrote the previous post, the PowerBook was attempting to compile lang/gcc48 from pkgsrc & since then I’ve still been attempting to build lang/gcc48 with varying levels of success which led me to branch out from trying to build GCC 4.8 to the other 4.x releases on pkgsrc.

In-between roasting the PowerBook I managed to obtain a re-writable CD, that allowed me to install OpenBSD on the PowerBook. Everything went smoothly apart from some bug with installer/documentation. The OpenBSD install was short-lived as I swapped the 5400RPM HDD for an 64GB SSD, the empty partition is there ready for reinstall but the GCC builds have consumed most of the time with the computer so I’ve not got around to reinstalling on the new disk.

TS64GPSD330:

About This Mac 1.25GB RAM

Capacity: 59.63 GB
Model: TS64GPSD330
Revision: 20140121
Serial Number:
Removable Media: No
Detachable Drive: No
BSD Name: disk0
Protocol: ATA
Unit Number: 1
Socket Type: Internal
OS9 Drivers: No
S.M.A.R.T. status: Verified
Volumes:
Macintosh HD:
Capacity: 41.5 GB
Available: 26.21 GB
Writable: Yes
File System: Journaled HFS+
BSD Name: disk0s3
Mount Point: /

The laptop is now running with 1.25GB of RAM which has made a big difference, more than the SSD did, though the change is mainly visible in the apple supplied application binaries e.g System Preferences or Activity Monitor which don’t bounce on the dock whilst loading, click & it’s there, running.

Trying to install a newer version of GCC from pkgsrc has been quite painful, build attempts are taking up to 20+ hours before failing, depending on which languages / options are enabled.

I reverted to attempting to building with only C & C++ language support to speed up the time to success/fail. This reduced the build time down to 8-10 hours, it then became apparent (a little quicker) that all GCC 4.x releases in pkgsrc fail to build on Mac OS X Tiger.
GCC 4.4 was the easiest to fix as the only thing that prevented the build of the C/C++ language support was a space between the -I flag & the path to headers to include which caused the linker to complain, this issues is taken care of in lang/gcc47 & gcc48 but the fix wasn’t retroactively applied to previous releases.
Attempting to build with GCC 4.5 & newer revealed further issues.
Thanks to the maintainer of TigerBrew, Misty De Meo who was able to provide hints for issues that need to be addressed in-order to build a more recent version of GCC on Tiger, having gone through the same problems when adding support in TigerBrew.

“../../../libitm/config/powerpc/sjlj.S:155:Invalid mnemonic ‘FUNC'” whyyyyyyyy

— funroll misty (@mistydemeo) October 14, 2013

I’m not sure how many iterations other builds use but on pkgsrc gcc is built with 3 iterations of tests where binaries generated are compared at each iteration. The tests would fail on the third iteration, forcing dwarf2 format for debug data allowed the tests to succeed. As the G4 is a 32-bit PowerPC CPU, the build then failed when it came to 64-bit binaries, disabling multilib support resolved this issue, the build then failed as the linker & assembler bundled with XCode 2.5 were too old & missing functionality. Bug 52482 covers this issue.

gmake[4]: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CC_FOR_TARGET=/usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/" "CFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "CXXFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "CFLAGS_FOR_BUILD=-pipe -O2 -I/usr/pkg/include -I/usr/include" "CFLAGS_FOR_TARGET=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "INSTALL=/usr/bin/install -c -o root -g wheel" "INSTALL_DATA=/usr/bin/install -c -o root -g wheel -m 644" "INSTALL_PROGRAM=/usr/bin/install -c -s -o root -g wheel -m 755" "INSTALL_SCRIPT=/usr/bin/install -c -o root -g wheel -m 755" "LDFLAGS=-L/usr/pkg/lib" "LIBCFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "LIBCFLAGS_FOR_TARGET=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "MAKE=/usr/pkg/bin/gmake" "MAKEINFO=/usr/pkgsrc/lang/gcc48/work/.tools/bin/makeinfo --split-size=5000000 --split-size=5000000 " "SHELL=/bin/sh" "RUNTESTFLAGS=" "exec_prefix=/usr/pkg/gcc48" "infodir=/usr/pkg/gcc48/info" "libdir=/usr/pkg/gcc48/lib" "includedir=/usr/pkg/gcc48/include" "prefix=/usr/pkg/gcc48" "tooldir=/usr/pkg/gcc48/powerpc-apple-darwin8" "gxx_include_dir=/usr/pkg/gcc48/include/c++/" "AR=ar" "AS=/usr/pkgsrc/lang/gcc48/work/build/./gcc/as" "LD=/usr/pkgsrc/lang/gcc48/work/build/./gcc/collect-ld" "RANLIB=ranlib" "NM=/usr/pkgsrc/lang/gcc48/work/build/./gcc/nm" "NM_FOR_BUILD=" "NM_FOR_TARGET=nm" "DESTDIR=" "WERROR=" DO=all multi-do # /usr/pkg/bin/gmake gmake[4]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' gmake[3]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' gmake[2]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' Checking multilib configuration for libitm... gmake[2]: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' /usr/pkg/bin/gmake all-recursive gmake[3]: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Making all in testsuite gmake[4]: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm/testsuite' gmake[4]: Nothing to be done for 'all'. gmake[4]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm/testsuite' gmake[4]: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' /bin/sh ./libtool --mode=compile /usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/bin/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/lib/ -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/include -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.8.2/libitm -I../../../gcc-4.8.2/libitm/config/powerpc -I../../../gcc-4.8.2/libitm/config/posix -I../../../gcc-4.8.2/libitm/config/generic -I../../../gcc-4.8.2/libitm -Wall -Werror -Wc,-pthread -g -pipe -O2 -I/usr/pkg/include -I/usr/include -MT sjlj.lo -MD -MP -MF .deps/sjlj.Tpo -c -o sjlj.lo ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S libtool: compile: /usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/bin/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/lib/ -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/include -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.8.2/libitm -I../../../gcc-4.8.2/libitm/config/powerpc -I../../../gcc-4.8.2/libitm/config/posix -I../../../gcc-4.8.2/libitm/config/generic -I../../../gcc-4.8.2/libitm -Wall -pthread -Werror -g -pipe -O2 -I/usr/pkg/include -I/usr/include -MT sjlj.lo -MD -MP -MF .deps/sjlj.Tpo -c ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S -fno-common -DPIC -o .libs/sjlj.o ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:155:Invalid mnemonic 'FUNC' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:250:Invalid mnemonic 'CALL' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:259:Invalid mnemonic 'END' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:262:Invalid mnemonic 'HIDDEN' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:263:Invalid mnemonic 'FUNC' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:407:Invalid mnemonic 'END' Makefile:496: recipe for target 'sjlj.lo' failed gmake[4]: *** [sjlj.lo] Error 1 gmake[4]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:697: recipe for target 'all-recursive' failed gmake[3]: *** [all-recursive] Error 1 gmake[3]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:360: recipe for target 'all' failed gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:16624: recipe for target 'all-target-libitm' failed gmake[1]: *** [all-target-libitm] Error 2 gmake[1]: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build' Makefile:889: recipe for target 'all' failed gmake: *** [all] Error 2 *** Error code 2 Stop. bmake: stopped in /usr/pkgsrc/lang/gcc48 *** Error code 1

Apple provides updates as part of their open source initiative, cctools contain the as & ld sources but sadly with the move to intel & the startup of the Hackintosh scene Apple has made it a little difficult to build things, their first move was to stop generating the iso of Darwin builds & the documentation seems non-existent now. Funnily enough the legacy information on the iPhone jailbreak & Hackintosh scene seems to be the commonly available documentation, that is ofcourse after you’ve excluded bug reports from fink & mac/darwinports in your search results. The main problem with building the open-source components is the bespoke build mechanism which seems to have various issues with Mac OS X, mainly missing header files, with TigerBrew, they seem to work around this issue by using the headers from a newer version of OS X. Through my search for a solution I discovered the OpenDarwin project, the project repackaged the source for the open source Apple components around the GNU toolchain. A version is available in pkgsrc in emulators/darwin_lib though it’s intended for NetBSD/PowerPC to provide binary compatibility, sadly the version it attempts to build is older than the version available with XCode 2.5. The OpenDarwin site is broken & the project doesn’t appear to be in development but I was able to find a repository on Apples MacOS Forge for the OpenDarwin cctools which contained the cctools-758. This was sufficient to allow GCC 4.x to build successfully, AS & AS_TARGET variables need to be set to where the new version of as(1) installed from odcctools however. GCC 4.7 built successfully with C, C++, Fortran, Objective C, Objective C++ & Fortran support. The code is in a SVN repository, you can obtain precompiled binaries of old versions of svn from collab.net.
Using built-in specs. COLLECT_GCC=/usr/pkg/gcc47/bin/gcc COLLECT_LTO_WRAPPER=/usr/pkg/gcc47/libexec/gcc/powerpc-apple-darwin8/4.7.3/lto-wrapper Target: powerpc-apple-darwin8 Configured with: ../gcc-4.7.3/configure --enable-languages='c obj-c++ objc java fortran c++' --enable-shared --enable-long-long --with-local-prefix=/usr/pkg/gcc47 --enable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc++ -static-libgcc -L/usr/pkg/lib ' --with-dwarf2 --disable-multilib --disable-nls --with-gmp=/usr/pkg --with-mpc=/usr/pkg --with-mpfr=/usr/pkg --with-ecj-jar=/usr/pkgsrc/distfiles/ecj-4.5.jar --enable-java-home --with-os-directory=darwin --with-arch-directory=powerpc --with-jvm-root-dir=/usr/pkg/java/gcc47 --with-java-home=/usr/pkg/java/gcc47 --with-system-zlib --enable-__cxa_atexit --with-gxx-include-dir=/usr/pkg/gcc47/include/c++/ --with-libintl-prefix=/usr/pkg --prefix=/usr/pkg/gcc47 --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --infodir=/usr/pkg/gcc47/info --mandir=/usr/pkg/gcc47/man Thread model: posix gcc version 4.7.3 (GCC)
While attempting to get things to build, lang/gcc48 was updated in pkgsrc and languages were separated out to individual packages with gcc48 becoming a wrapper around this, these changes are very much in their infancy and have issues which need to be addressed. As it currently stands, it’s not possible to build individual languages as there is ties which need to be removed e.g attempting to build lang/gcc48-cc++ will build in lang/gcc48-fortran. For me, the next step is to get these changes prepared correctly & submitted for inclusion in pkgsrc, for the duration of getting things to run I hard coded the paths for as(1) & defined the configure arguments globally, where as these changes are specific to Tiger & prior / 32-bit PowerPC specific. Then there’s dealing with odcctools, I’m not sure if it will require a new package or emulators/darwin_lib should be extended. emulators/darwin_lib introduces more than just odcctools hence my leaning towards a separate package. I also want to try out building from a RAM disk using Make RAM disk to see if build can be sped up any further. Since I wrote the previous article I found out how to set the location in F.lux, thanks to co-developer of F.lux, Michael Herf

@sevanjaniyan try https://justgetflux.com/map.html

— Michael Herf (@herf) May 4, 2014

It seems that some people opt to cross-compile for OS X on another platform, including macports developers (sorry, I didn’t make a note of the bug report where the developer explained building packages on Linux). iTerm 0.10 from the original project is now my terminal emulator with the Inconsolata font, the font smoothing isn’t that great on this machine when using white text on black background so I’ve opted for the opposite here & it’s working out well.
There is a MAC POWERPC ? blog which provides regular articles. I found an article on how to rebuild the PowerBook battery with new cells if it should fail.

Following the instructions from floodgap.com to update the curl-ca-bundle bundled with OS X I discovered that the version included in Tiger was from 2000!!

/usr/share/curl/curl-ca-bundle.crt - Last Modified: Thu Mar 2 09:32:46 CET 2000, These were automatically extracted from Netscape Communicator 4.72's certificate database (the file `cert7.db')

12″ PowerBook G4

PowerBook G4
With the talk on Twitter & App.net about old computers I started to get nostalgic. I had cleared out most of my collection back in 2012 & been resisting the urge to resume hoarding again largely, having successfully put off the purchase of a Ubiquiti EdgeRouter Lite to run FreeBSD on, I remembered that I was offered a G4 PowerBook a few months back which I turned down. It was still available if I wanted to take it, which made very happy. a 12″PowerBook6,4 that I’d assumed it was going to be a 15″ model. I’ve been playing about with it for the past couple of days, wiping the pre-installed copy of Leoapard & going through the Panther to Tiger path.

20140404-022224.jpg
The system is now running 10.4.11, patching was a lot of fun, java update after java update, pretty sure it didn’t seem that bad at the time.
20140404-020714.jpg
It was interesting to see that there was no iTunes update made available, having to manually fetch v9.2.1 from kb DL1056. Safari was updated to v4.1.3.

With no more updates on offer from the software update facility I disabled the java & macromedia plugins by moving them out of /Library/Internet Plug-ins & /Library/Application Support.

Going back to Tiger was a mixture of pleasure & pain, visually, I much prefer the brighter white look of aqua, as opposed to the grey theme which introduced in Leopard. Terminal.app in Tiger is not that great, font smooth is particularly poor, I may have to resort to sourcing a copy of the original iTerm. Plan9 from userspace built without issues using gcc from XCode 2.5, but I guess finder doesn’t like something about the bundled transparent icon of Glenda on the dock as it shows up with a white background & though acme launches correctly, the icon continues to bounce on the dock.
20140404-020905.jpg
F.lux 1.1 is the last supported PowerPC build which runs on Tiger, no support for UK in location settings of this build.
TenFourFox takes the place of Firefox as an up to date, maintained version for the PowerPC Mac’s. Python was updated to 2.7.6 using a package straight from python.org.

There is a PowerPC Software site, which contains links to the last builds of popular software which supported the PowerPC Mac’s.

Mercurial & Ruby built successfully from source, pkgsrc also bootstrapped without any issue, the system is currently building GCC 4.8 from pkgsrc.
Needed to declare MACOSX_DEPLOYMENT_TARGET=10.4 otherwise the build process would fail with ld: flag: -undefined
dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment
variable set to: 10.1

The system currently has 512MB of RAM & a 74GB HDD, 40GB allocated to OS X & the remaining intended for use with OpenBSD, will have to netinstall OpenBSD as I don’t have any blank CD’s with me, no USB hub, the USB ports don’t provide sufficient power to run a Zalman Virtual CD and I suspect the system is unable to boot from USB anyway. Been looking on Amazon for IDE SSD drives but probably will increase the RAM first.
20140404-020959.jpg

20140404-022158.jpg

Mac displays prohibition sign when booting from install media

I wanted to re-configure my 11″ MacBook Air so that it dual boots Mac OS X as well as OpenBSD but found that I was unable to boot from a USB flash drive containing 10.8.5.
Booting from a flash drive resulted in a prohibition sign in place of the apple logo with the spiral animation continuing to spin.

20131007-020816.jpg
Booting again but this time in verbose mode (command + v) showed that the kernel is waiting & repeating the message

Still waiting for root device

, I assumed this message was regarding the USB boot disk, it turns out it’s referring to onbroad SSD.

20131007-020903.jpg
Searching around I found a thread which used the remote recovery function along with a USB flash drive to restore the Mac (something which I was trying to completely avoid because my internet connection is really poor & the recovery process is slow), this reminded me of the recovery disk assistant which allows you to build a recovery disk as well as update the recovery partition on your system disk.
Attempting to boot from a recovery disk succeeded & allowed me to repartition the SSD in my macbook air with disk utility. I was then able to boot from the USB flash disk containing mac os x & reinstall successfully.

Edit: clarify that it was the SSD which was repartitioned in last paragraph.

OpenBSD on 11″ MacBook Air 5,1 (mid-2012)

While my MacBook was away at the service centre to have the SSD replaced I noticed the NetBSD wiki had marked the install guide as obsolete as it’s no longer required to build a custom kernel because the necessary changes have been integrated so that the generic kernel works out of the box.
The last time I tried to run OpenBSD on a MacBook Air was over the christmas holiday on a mid-2012 13″ model & while I managed to boot a multiuser system, USB support was very unstable & eDP support was missing from Xenocara.
Having received my MacBook back I decided to revisit Net/OpenBSD, I tried booting NetBSD/AMD64 6.1.1 & the 29/08/2013 AMD64 OpenBSD snapshot.
Both exhibited the same behavior, as soon as the kernel loaded into memory the screen would go blank, I attached a thunderbolt display which made displayed some output before going to a blank screen as the kernel probes for devices, I believe this is when OpenBSD now changes font.
I switched from the OpenBSD snapshot to what I (half asleep) thought was 5.4-RELEASE but it turned out to be a mislabelled iso of a snapshot from July. This time it worked fine using a Thunderbolt display, screen still goes blank otherwise.
Onboard wireless doesn’t work, instead I’m using a tiny urtwn(4) wireless adapter.

20130905-021145.jpg

OpenBSD 5.4-current (GENERIC.MP) #50: Mon Sep 2 13:43:54 MDT 2013
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error b1
real mem = 8475713536 (8083MB)
avail mem = 8242003968 (7860MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0000 (54 entries)
bios0: vendor Apple Inc. version "MBA51.88Z.00EF.B02.1211271028" date 11/27/2012
bios0: Apple Inc. MacBookAir5,1
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC SBST ECDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT DMAR MCFG
acpi0: wakeup devices P0P2(S4) PEG2(S4) EC__(S4) HDEF(S4) RP02(S4) ARPT(S4) RP05(S4) EHC1(S4) EHC2(S4) XHC1(S4) ADP1(S4) LID0(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz, 1896.01 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
cpu0: apic clock running at 99MHz
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz, 1895.70 MHz
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz, 1895.70 MHz
cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 1, core 0, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz, 1895.70 MHz
cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 2
acpiec0 at acpi0
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-153
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P2)
acpiprt2 at acpi0: bus -1 (PEG2)
acpiprt3 at acpi0: bus 2 (RP02)
acpiprt4 at acpi0: bus 3 (RP05)
acpicpu0 at acpi0: C3, C1, PSS
acpicpu1 at acpi0: C3, C1, PSS
acpicpu2 at acpi0: C3, C1, PSS
acpicpu3 at acpi0: C3, C1, PSS
acpibat0 at acpi0: BAT0 model "3545797981023400290" type 3545797981528607052 oem "3545797981528673619"
acpiac0 at acpi0: AC unit offline
acpibtn0 at acpi0: LID0
acpibtn1 at acpi0: PWRB
acpibtn2 at acpi0: SLPB
acpivideo0 at acpi0: IGPU
acpivout0 at acpivideo0: DD02
cpu0: Enhanced SpeedStep 1896 MHz: speeds: 2001, 2000, 1900, 1800, 1700, 1600, 1500, 1400, 1300, 1200, 1100, 1000, 900, 800 MHz
memory map conflict 0xe00f8000/0x1000
memory map conflict 0xfed1c000/0x4000
memory map conflict 0xffe70000/0x30000
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 3G Host" rev 0x09
vga1 at pci0 dev 2 function 0 "Intel HD Graphics 4000" rev 0x09
intagp0 at vga1
agp0 at intagp0: aperture at 0x90000000, size 0x10000000
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: 1366x768
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 7 Series xHCI" rev 0x04 at pci0 dev 20 function 0 not configured
"Intel 7 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
ehci0 at pci0 dev 26 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi
azalia0: codecs: Cirrus Logic CS4206, Intel/0x2806, using Cirrus Logic CS4206
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 7 Series PCIE" rev 0xc4: msi
pci1 at ppb0 bus 1
ppb1 at pci0 dev 28 function 1 "Intel 7 Series PCIE" rev 0xc4: msi
pci2 at ppb1 bus 2
"Broadcom BCM43224" rev 0x01 at pci2 dev 0 function 0 not configured
ppb2 at pci0 dev 28 function 4 "Intel 7 Series PCIE" rev 0xc4: msi
pci3 at ppb2 bus 3
ppb3 at pci3 dev 0 function 0 vendor "Intel", unknown product 0x1547 rev 0x03
pci4 at ppb3 bus 4
ppb4 at pci4 dev 0 function 0 vendor "Intel", unknown product 0x1547 rev 0x03: msi
pci5 at ppb4 bus 5
vendor "Intel", unknown product 0x1547 (class system subclass miscellaneous, rev 0x03) at pci5 dev 0 function 0 not configured
ppb5 at pci4 dev 3 function 0 vendor "Intel", unknown product 0x1547 rev 0x03: msi
pci6 at ppb5 bus 6
ppb6 at pci4 dev 4 function 0 vendor "Intel", unknown product 0x1547 rev 0x03: msi
pci7 at ppb6 bus 55
ppb7 at pci4 dev 5 function 0 vendor "Intel", unknown product 0x1547 rev 0x03: msi
pci8 at ppb7 bus 104
ppb8 at pci4 dev 6 function 0 vendor "Intel", unknown product 0x1547 rev 0x03: msi
pci9 at ppb8 bus 105
ehci1 at pci0 dev 29 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 22
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 vendor "Intel", unknown product 0x1e56 rev 0x04
ahci0 at pci0 dev 31 function 2 "Intel 7 Series AHCI" rev 0x04: msi, AHCI 1.3
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: SCSI3 0/direct fixed naa.0000000000000000
sd0: 115712MB, 512 bytes/sector, 236978176 sectors, thin
ichiic0 at pci0 dev 31 function 3 "Intel 7 Series SMBus" rev 0x04: apic 2 int 18
iic0 at ichiic0
iic0: addr 0x2c 03=fc 05=66 06=40 71=06 72=80 86=70 90=37 91=1c 92=35 93=3f 94=62 95=8c 96=63 97=85 98=24 99=04 9a=88 9f=7c a0=7f a1=b5 a2=bf a3=7b a4=28 a5=cf a6=64 a7=2d words 00=0000 01=0000 02=00fc 03=fc00 04=0066 05=6640 06=4000 07=0000
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns8250, no fifo
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
nvram: invalid checksum
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
uhub2 at uhub0 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
uvideo0 at uhub2 port 1 configuration 1 interface 0 "Apple Inc. FaceTime HD Camera (Built-in)" rev 2.00/80.25 addr 3
video0 at uvideo0
ugen0 at uhub2 port 1 configuration 1 "Apple Inc. FaceTime HD Camera (Built-in)" rev 2.00/80.25 addr 3
uhub3 at uhub1 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
uhub4 at uhub3 port 8 "Standard Microsystems product 0x2512" rev 2.00/b.b3 addr 3
uhub5 at uhub4 port 1 "Apple Inc. BRCM20702 Hub" rev 2.00/1.00 addr 4
uhub5: device problem, disabling port 1
uhidev0 at uhub5 port 2 configuration 1 interface 0 "Apple Computer product 0x820b" rev 2.00/1.00 addr 5
uhidev0: iclass 3/1, 2 report ids
ums0 at uhidev0 reportid 2: 3 buttons
wsmouse0 at ums0 mux 0
ugen1 at uhub5 port 3 "Apple Inc. Bluetooth USB Host Controller" rev 2.00/1.00 addr 6
uhidev1 at uhub4 port 2 configuration 1 interface 0 "Apple Inc. Apple Internal Keyboard / Trackpad" rev 2.00/2.19 addr 7
uhidev1: iclass 3/1, 9 report ids
ukbd0 at uhidev1 reportid 1: 8 variable keys, 6 key codes, country code 15
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhid0 at uhidev1 reportid 9: input=0, output=0, feature=3
uhidev2 at uhub4 port 2 configuration 1 interface 1 "Apple Inc. Apple Internal Keyboard / Trackpad" rev 2.00/2.19 addr 7
uhidev2: iclass 3/0, 68 report ids
uhid1 at uhidev2 reportid 68: input=511, output=0, feature=0
uhidev3 at uhub4 port 2 configuration 1 interface 2 "Apple Inc. Apple Internal Keyboard / Trackpad" rev 2.00/2.19 addr 7
uhidev3: iclass 3/1, 2 report ids
ums1 at uhidev3 reportid 2: 3 buttons
wsmouse1 at ums1 mux 0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (0f625884de9eca57.a) swap on sd0b dump on sd0b
clock: unknown CMOS layout
hw.sensors.cpu0.temp0=36.00 degC
hw.sensors.cpu1.temp0=36.00 degC
hw.sensors.cpu2.temp0=36.00 degC
hw.sensors.cpu3.temp0=36.00 degC
hw.sensors.acpibat0.volt0=7.50 VDC (voltage)
hw.sensors.acpibat0.volt1=7.23 VDC (current voltage)
hw.sensors.acpibat0.power0=12.26 W (rate)
hw.sensors.acpibat0.watthour0=42.41 Wh (last full capacity)
hw.sensors.acpibat0.watthour1=0.25 Wh (warning capacity)
hw.sensors.acpibat0.watthour2=0.10 Wh (low capacity)
hw.sensors.acpibat0.watthour3=6.90 Wh (remaining capacity), OK
hw.sensors.acpibat0.raw0=1 (battery discharging), OK
hw.sensors.acpiac0.indicator0=Off (power supply)
hw.sensors.acpibtn0.indicator0=On (lid open)

My 33KB SSD

Work issued me with a mid 2012 MacBook Air, one constant running issue has been rebooting on wake from sleep after a thunderbolt display has been attached or detached in previous state, with the upgrade to 10.8.3 I also started experiencing graphics glitches on wake. In the last week things took for the worse, Friday & Saturday I experienced my system going back to intial login screen on wake & after logging in having two concurrent sessions which meant some apps didn’t work correctly, Sunday night after a fresh reinstall, system failed to detect system disk but after 15 minutes everything was ok, on Monday I rebooted & the system displayed the progress bar at the boot screen as if it was flashing firmware though I’d not initiated an update.
Today I returned to my computer to find the system hung, power cycling the system produced the same flashing folder with a question mark which means unable to find system folder.
Booted off a 10.8.3 USB flash disk, disk utility reports a 33KB Sandforce SSD!

20130411-124209 AM.jpg

20130411-124233 AM.jpg

20130411-124248 AM.jpg

Rearranging the keys on Apple keyboards to the Dvorak layout

I’ve been using the dvorak for just under 8 months now according to the date (17/6/2011) on the printout I have pinned on my wall of the US Dvorak keyboard layout from Wikipedia.
Its been ok-ish so far, I’m used to the layout now but still prone to making mistakes, my main gripe with it is the position of the W & V keys, one slip of the finger when pasting something & you lose what you’re doing because you’ve just closed the window instead, this has happened on several occasion, usually when working remotely via an SSH session. It’s ok apart from that, just need to focus on keeping my hands still on the correct keys & letting the fingers do the work rather than move my hands around the keyboard.
Scrolling through the Dvorak simplified keyboard article on wikipedia, I saw a pair photos in the Mac OS section of a cordless keyboard & iBook with rearranged keys in a Dvorak layout.
I had assumed it wasn’t do-able & not looked into it further but a quick search showed it was pretty easy as this video shows.
To remove the keys from your keyboard just pull the top of the key to unclip & slide down to release, within a couple a minutes my cordless keyboard looked like this

Putting the keys back was pretty straight forward & went seamlessly, sliding the keys up to place into position & pushing down to clip into place, within a couple of minutes my keyboard looked like this

As this was easy & quick to do, I assumed the keyboard on my Macbook Pro would also be the same, so began pulling the keys off, most of the keys on the centre 2 rows came off without any problems but then I reached the right hand side of the keyboard & found keys which took a bit more persuasion to unclip & it was downhill from there.

I managed to pull most of plastic clip out of the pin sockets which are used to levy them, this took a bit of fidding to get back in but I managed to do it without breaking anything which was good but as I was a little rough handed on couple of them, I managed to pull the rubber spring off the face plate 🙁

Fortunately, putting the keys back on again wasn’t too much hassle, the two keys which had their spring come off initially missed key strokes but seem ok now (the spring needs to reseat into a better position?)

I’d like to make this change on my ThinkPad keyboard too but the keys which fit around the TrackPoint have different shapes to the rest of the keys.

L2TP/IPsec VPN clients unable to authenticate after 10.7.3 update

If you’re finding users are unable to dial-in via L2TP/IPsec VPN after upgrading Lion Server to 10.7.3 then check /var/log/ppp/vpnd.log
If you’re seeing DSAuth plugin: Failed to retrieve MPPE encryption keys from the password server: errno -14484, ctxt 4 logged on dial-in attempts then you’ll need to adjust your password policy.
There is an Apple support article HT4748 which covers how to make this change.
Thanks to the user bobgeo on the Apple discussion forums for the pointer.

Running nwdiag on Mac OS X

nwdiag is a tool written in python for generating network diagrams from text files, rack diagrams can also be built using the bundled rackdiag utility.
nwdiag requires PIL built with freetype2 support, if this is missing you’ll receive the following error when you try to generate a diagram:
ERROR: The _imagingft C module is not installed.

Following the instructions in the README file included with PIL, once the build process completes you’ll receive a summary:
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform darwin 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
--------------------------------------------------------------------
--- TKINTER support available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

It appears that freetype2 support is not built by default & I wasn’t paying enough attention so I missed the notice following the summary
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
.
After a brief search I came across this blog post which covered how to define the paths for the freetype library & header files.
Setting FREETYPE_ROOT in setup_site.py to
FREETYPE_ROOT = "/usr/X11/lib", "/usr/X11/include"
solved the problem & the summary listed --- FREETYPE2 support available when I reran the build process.
After that everything worked fine, the following config generated the image at the bottom of the page:
nwdiag {
inet [shape = cloud];
inet -- router;
router;
network office {
router;
"Mail server";
"Web server";
}
}

Network diagram generated using nwdiag

The project is still in its infancy and there are features missing for implementing common elements from a cisco discipline (like representing etherchannel) but it’s promising as you can put a simple diagram together very quickly.

Connecting to shared calendars on ical server using the Lightning extension for Thunderbird

To access a shared resource/location calendar on a iCal server from the Lightning extension for you’ll need the GUID for the calendar you wish to access, see my previous post on how to obtain it.

Once you’ve obtained the GUID, construct a url using the following convention (assuming you’re connecting to the server via SSL)
https://yourserver.somewhere.local:8443/calendars/__uids__/your-shared-cal-guid/calendar/
Switch to Thunderbird, go to File > New > Calendar…
Select “On the Network” from the wizard & press continue
Select “CalDAV” as the format & for the location specify the URL you constructed using the convention above & press continue.
Once you’ve specify a name for the shared calendar & pressed continue you should have access to the shared calendar.

Connecting to shared calendars on ical server using an iPhone

To access the shared resource/location calendar on a iCal server from an iPhone via the caldav protocol you’ll need the GUID of the shared calendar.

First, find the GUID of calendar on the server using the calendarserver_manage_principals command, eg
sudo calendarserver_manage_principals --search shared
1 matches found:

your shared cal (Resource)
GUID: 6x3331a8-as12-ea2x-4ou1-ndeb3ct4wa686
Record name(s): 6x3331a8-as12-ea2x-4ou1-ndeb3ct4wa686

Then on the iPhone (assuming the device is unmanaged), create a new CalDAV calendar account & fill in the correct server, username & password field & hit next.
Assuming everything went ok, you should be back on the “Mail, Contacts, Calendars” page, select the new calendar you just created & advanced settings.
Edit the “Account URL”, replacing the UID on the end of the url with the GUID of the shared calendar you noted down on the first step.
eg:
https://username@yourserver.somewhere.local:8443/principals/__uids__/6x3331a8-as12-ea2x-4ou1-ndeb3ct4wa686

CUPS generates “Internal server error” when visiting administration page

It seems that Mac OS Lion server (10.7.0) may have been released with a broken CUPS configuration. Visiting http://localhost:631/admin would generate an “Internal server error”, this seems to be addressed in newer builds (my Macbook Pro which was install from a 10.7.2 image does not exhibit the problem yet a customers server which came bundled with 10.7.0 (upgraded to 10.7.1 > 10.7.2) does).
To resolve the issue sudo cupsctl --debug-logging
Then switch off the debug logging with sudo cupsctl --no-debug-logging

I suspect the problem is due to a missing directory because comparing the default, previous & current revisions of the /etc/cups/cupsd.conf did not show anything that could cause problems.
I’d also go far as to say that you don’t need to turn on debug logging in-order to resolve this issue, it can be any of the options that can be set via cupsctl as it checks the configuration of the system, this is just a theory as I was unable to dig further because I was on a production system. Resetting the printing system did not solve the issue when attempted previously.

Improving the speed of a SawTooth G4 PowerMac

Disable the onboard Broadcom chipset network card & stick a Intel i82558B chipset network card in the system, I used a Compaq NC3121 which can be picked up off ebay for next to nothing. The card doesn’t specifically have to be i82558B based, I think OS X supports the entire range of the Intel chipsets supported under the *BSD fxp driver.