GeekLAN

20/07/2014

GeekLAN is 10 years old

Filed under: General — Venture37 @ 8:54 pm

This blog started life with a zero dot release of wordpress on the end of a 512kb down/128k up cable modem connection 10 years ago. Originally I had intended to host it on my AlphaStation which at the time was acting as my gateway, running OpenBSD. Unfortunately gettext was broken on Alpha at the time which meant though php was available I couldn’t build extensions such as the mysql one, I had a slot 1 PIII which was my previous gateway using RRAS on Windows 2000 Server, it replaced the AlphaStation and assumed the role of gateway again, this time on OpenBSD.

Up until 2009 this blog was served from my bedroom by then on a VIA C7 mini-its board with a ADSL connection. At some point it gained an SSL certificate from CAcert & IPv6 connectivity. Through this domain I discovered that NTL overrode the TTL values for records in the early days, caching DNS records for a week by default. Blocked several IP addresses from Thailand for excessive hits to the site. Of all of the computers which I collected over the years, most are now gone. I still have the Cobalt Qube2, some Macs and the ThinkPad X61s, the rest found new homes or where thrown away. The most popular posts so far have been on Apple products, the post that’s still holds true is the Solaris installer misreporting disk failure if it finds a disk label other than the one it was expecting.

 

30/06/2014

Book review: The Art of Unix Programming

Filed under: General — Tags: , — Venture37 @ 10:59 pm

I picked this book by mistake, assuming that it was going to be a technically detailed book in line with the Advanced Programming in the Unix Environment book written by the late Richard Stevens, it turned out to be much more high level than that but I was not disappointed, It’s been a pleasure to read whilst travelling over the last month.
The book is 20 chapters split across four parts (context, design, implementation, community) with commentary from some big names of the UNIX world. There are lots of great advice in the book but I would look at what’s now available in regards to software today if I was looking to implement something. It does explain why lots of software relies on some common (and heavy weight?) components. Let me explain, long ago I was unaware that packages for the -current branch of OpenBSD were being built, whenever I grudgingly tried a new snapshot I went through & built my packages from the ports tree after a fresh install, then something would depend on XML related components & then pull in a bunch of things which would involve building ghostscript, on a Sun Blade 100, between Firefox & ghostscript, 24 hours would easily be wasted, I now understand that all that wasted time was thanks to someone taking the advice of ESR on how to prepare documentation for a software project.
Besides the dubious software recommendation (11-year-old book?) everything is explained in a clear manner that’s very easy to read.

Rule of Robustness: Robustness is the child of transparency and simplicity.
Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
Rule of Diversity: Distrust all claims for “one true way”.
Rule of Extensibility: Design for the future, because it will be here sooner than you think.

The Pragmatic Programmer articulates a rule for one particular kind of orthogonality that is especially important. Their “Don’t Repeat Yourself” rule is: every piece of knowledge must have a single, unambiguous, authoritative representation within a system. In this book we prefer, following a suggestion by Brian Kernighan, to call this the Single Point Of Truth or SPOT rule.

The book is critical of Microsoft & their approach to software, explaining some of the design decisions (some inherited from the world of VMS).

From a complexity-control point of view, threads are a bad substitute for lightweight processes with their own address spaces; the idea of threads is native to operating systems with expensive process-spawning and weak IPC facilities.

the Microsoft version of CSV is a textbook example of how not to design a textual file format.

Criticisms of MacOS are of version 9 and prior which don’t really apply to OS X e.g. single shared address space. There are explanations of why things are such in the world of Unix and lots of great advice.

The ’rc’ suffix goes back to Unix’s grandparent, CTSS. It had a command-script feature called “runcom”. Early Unixes used ’rc’ for the name of the operating system’s boot script, as a tribute to CTSS runcom.

most Unix programs first check VISUAL, and only if that’s not set will they consult EDITOR. That’s a relic from the days when people had different preferences for line-oriented editors and visual editors

When you feel the urge to design a complex binary file format, or a complex binary application protocol, it is generally wise to lie down until the feeling passes.

One of the main lessons of Zen is that we ordinarily see the world through a haze of preconceptions and fixed ideas that proceed from our desires.

Doug McIlroy provides some great commentary too

As, in a different way, was old-school Unix. Bell Labs had enough resources so that Ken was not confined by demands to have a product yesterday. Recall Pascal’s apology for writing a long letter because he didn’t have enough time to write a short one. —Doug McIlroy

I’d recommend the book for anyone involved with computers and not necessarily involved with Unix or open source variants/likes. The author does a great job of explaining the theory of an approach to developing software and the operating it typically runs on, It’s accessible, easy to read and doesn’t require a computer to work through. You may need one however if you want to read it online for free.

My ideal for the future is to develop a filesystem remote interface (a la Plan 9) and then have it implemented across the Internet as the standard rather than HTML. That would be ultimate cool. —Ken Thompson

28/06/2014

Zvol backed bhyve guest

Filed under: FreeBSD — Tags: , , , — Venture37 @ 5:11 pm

Things have moved forward in the world of bhyve since I last looked at it over a year ago, support for zvol backed guests where fixed long ago among other things such as the birth of vmrc by Michael Dexter.
To run a guest with a ZFS zvol as its disk is no different to running with a disk image, only thing is that my version of /usr/share/examples/bhyve/vmrun.sh (11.0-CURRENT r267869 at the time of writing) fails to start from the disk once the OS has been installed.

A typical deployment scenario would be

Create a zvol of some size, e.g. 10GB

zfs create -V 10g zroot/guest0

Start a guest which’ll boot from the FreeBSD install CD iso & install onto the zvol

# sh /usr/share/examples/bhyve/vmrun.sh -c 4 -m 1024M -t tap0 -d /dev/zvol/zroot/guest0 -i -I FreeBSD-10.0-RELEASE-amd64-disc1.iso guest0

Use the “ZFS – Automatic Root-on-ZFS” option from the Partitioning menu

As instructed in the bhyve section of the handbook, before rebooting, drop to the shell & edit /etc/ttys & replace the console line with

console "/usr/libexec/getty std.9600" xterm on secure

Shutdown the operating system
halt -p

Kill the guest
/usr/sbin/bhyvectl --destroy --vm=guest0

Create a new guest
bhyveload -m 4G -d /dev/zvol/zroot/guest0 guest0

Boot the new guest from the zvol
bhyve -c 1 -m 4G -A -H -P -s0:0,hostbridge -s 1:0,virtio-net,tap0 -s 2:0,ahci-hd,/dev/zvol/zroot/guest0 -s 31,lpc -l com1,stdio guest0

These instruction skip the creation of networking which is covered in the FreeBSD handbook as linked to above.

Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014
root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (3399.54-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x306a9 Family = 0x6 Model = 0x3a Stepping = 9
Features=0x8f83ab7f
Features2=0xfe9a6257
AMD Features=0x20100800
AMD Features2=0x1
Standard Extended Features=0x200
TSC: P-state invariant
real memory = 5368709120 (5120 MB)
avail memory = 4103143424 (3913 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table:
ioapic0 irqs 0-23 on motherboard
random: initialized
module_register_init: MOD_LOAD (vesa, 0xffffffff80cfa5e0, 0) error 19
kbd1 at kbdmux0
acpi0: on motherboard
acpi0: Power Button (fixed)
atrtc0: port 0x70-0x71 irq 8 on acpi0
Event timer "HPET" frequency 10000000 Hz quality 550
Event timer "HPET1" frequency 10000000 Hz quality 450
Event timer "HPET2" frequency 10000000 Hz quality 450
Event timer "HPET3" frequency 10000000 Hz quality 450
Event timer "HPET4" frequency 10000000 Hz quality 450
Event timer "HPET5" frequency 10000000 Hz quality 450
Event timer "HPET6" frequency 10000000 Hz quality 450
Event timer "HPET7" frequency 10000000 Hz quality 450
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: port 0x408-0x40b on acpi0
pcib0: port 0xcf8-0xcff on acpi0
pci0: on pcib0
virtio_pci0: port 0x2000-0x201f mem 0xc0000000-0xc0001fff irq 16 at device 1.0 on pci0
vtnet0: on virtio_pci0
virtio_pci0: host features: 0x1018020
virtio_pci0: negotiated features: 0x18020
vtnet0: Ethernet address: 00:a0:98:7f:5a:41
virtio_pci1: port 0x2040-0x207f mem 0xc0002000-0xc0003fff irq 17 at device 2.0 on pci0
vtblk0: on virtio_pci1
virtio_pci1: host features: 0x10000044
virtio_pci1: negotiated features: 0x10000044
vtblk0: 40960MB (83886080 512 byte sectors)
isab0: at device 31.0 on pci0
isa0: on isab0
uart0: port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (9600,n,8,1)
uart1: port 0x2f8-0x2ff irq 3 on acpi0
sc0: at flags 0x100 on isa0
sc0: MDA
vga0: at port 0x3b0-0x3bb iomem 0xb0000-0xb7fff on isa0
atkbdc0: at port 0x60,0x64 on isa0
atkbd0: irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
ppc0: cannot reserve I/O port range
ZFS NOTICE: Prefetch is disabled by default if less than 4GB of RAM is present;
to enable, add "vfs.zfs.prefetch_disable=0" to /boot/loader.conf.
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
Timecounters tick every 10.000 msec
random: unblocking device.
Netvsc initializing... Timecounter "TSC-low" frequency 1699769676 Hz quality 1000
Trying to mount root from zfs:zroot/ROOT/default []...

23/06/2014

Verifying myself: I am 0x4ECB7B42 on pgp.mit.edu

Filed under: General — Tags: , , , — Venture37 @ 10:47 am

I’ve posted a PGP key for use under this domain to the key servers.

Email address: the word ending with the numbers three and seven at this domain (see field after Filed under & Tags on this blog post)
Key ID: 4ECB7B42
Fingerprint: 7BD6 2BFC 00E2 FAA1 5322 B9E4 D13F F837 4ECB 7B42

15/06/2014

Bricking & Unbricking a Dell Inspiron Mini 9

Filed under: General — Tags: , , — Venture37 @ 9:04 pm

I dusted off an old Dell Mini 9 netbook I had lying around, I’d stopped using it as the netbook refused to charge its battery once it’d run down completely (easily do-able if the machine is used lightly & could go up to a month without use), after the second battery It happend to, I gave up on it.
A side effect of the battery being run down was that it was not possible to flash the BIOS through windows, Phoenix WinPhlash refuses to write to the flash if there is no battery detected & exits with error code: -144.
This is not an issue on DOS using the phlash16 utility. Here lies a different kind of madness, as it’s attempting to write to the flash it stops using the mains & switches to battery power source, which if you have an unchargable battery results in bricking the netbook.
At this point, you can perform a flash recovery using a boot floppy containing a special boot sector, the phlash16 utility, some library and a copy of the image to flash named as BIOS.WPH generated with the BIOS recovery tool.
To initiate the recovery mode, the power and battery need to be removed, a USB floppy drive connected (of the left hand side ports only the USB port closest to the SD card reader worked on mine). With the Fn & B keys held down on the keyboard, connect the power whilst continuing to hold the keys down. At this point the power light should switch on. Press the power button & when you hear a beep, let go of the keyboard keys.
After a moment the system will begin reading the floppy & once reflashing commences, the system will begin beeping, once it has finished the system will reboot & startup normally.
I was unable to find working links for prepared images which I could write using dd so instead had to resort to finding another machine running Windows XP & a USB floppy drive but I’ve imaged the floppies I created so hopefully It wont be a repeated exercise.

The images can be written to a USB flash drive & used to recover a Mini 9

A04 Bios recovery image
A07 Bios recovery image

If you have a faulty or uncharged battery & you intend to use the phlash16 utility, remove the battery before attempting to flash the BIOS.

10/06/2014

Giving up on creating a port of OpenNMS

Filed under: FreeBSD — Tags: , , — Venture37 @ 1:18 am

After 5 years of going back & forth, I’ve decided to give up on trying to complete the OpenNMS ports for FreeBSD and dropped maintainership of the Java dependencies in the ports tree (net/jicmp, net/jicmp6, databases/jrrd, databases/iplike)

There are some issues which are show stoppers that need addressing upstream

  1. Separation of configuration & user data from the location of application binaries, Initially I began patching the source to look for files in a different location to the default so that things would integrate with the user land correctly but it soon became apparent that the patching would be a nightmare to maintain on an ongoing basis due to the number of patches required per configuration file. It was clear that things would need to be dealt with at the source rather than patched post release, a long running discussion with developers, bug reports raised, some (minor) patches submitted, 4+ years on, still ignored due to a lack of interest.
  2. Dynamically generated filenames, inherited from Google Web Toolkit, every build attempt generates new filename which make packing impossible.
    Update OpenNMS developer Benjamin Reed points to a possible fix
  3. Unreliable build process, maven fails between 2 to 3 times minimum which would cause lots of false alarms in an automated build environment e.g. the freebsd build cluster.
    This is somewhat of an improvement from a few years back where it would not be possible to build because repositories were not available for a day or two.

As it stands, the port is a shell which make it easy to install OpenNMS on FreeBSD but has major issues when it comes to upgrades or uninstallation. It’s best install dependencies from ports & install OpenNMS manually.

08/06/2014

System fails to boot with root on ZFS

Filed under: FreeBSD — Tags: , , — Venture37 @ 4:24 pm

I’d installed FreeBSD on my ThinkPad X61s when the head branch of the source tree was at 9-CURRENT, multi-booting it with Windows 7 & OpenBSD.
At the time I was not aware that it was possible to boot FreeBSD from a root file system on a ZFS volume from a disk partitioned using a MBR scheme. Instead, I opted to store /boot on a UFS filesystem.
This install existed for a couple of years, the ThinkPad got a roasting every once in a while to build a new release to install for updates. At some point support for 4K sectors in ZFS was improved, zpool status began to report degraded performance as the disk had been using 512byte sectors where in fact it could support 4K sized sectors.

Eventually, I deleted the existing slices in the FreeBSD partition & attempted to reinstall but found this time the system would not boot.
Booting from the install CD & issuing zpool import reported the new pool & old pool from the previous install.
Destroying a pool before deleting slices stopped this problem from re-occurring but the system still wouldn’t boot from a ZFS volume on a MBR partition.
The next step was to see if things would work if the whole disk was dedicated to FreeBSD, with a GPT partition scheme, things worked but switching to MBR, again, it failed to boot, hanging at a flashing cursor.
Over the next four months, many installs were attempted. On a MBR partitioned disk
FreeBSD failed to boot but PCBSD could by using GRUB.

I stopped trying any further at this point & took a break from it, one thing that had been raised at BSDCan was the possibility it could be lingering metadata, I’d thought as zpool(8) wasn’t reporting any existing pools when asked to import that this wasn’t the case. To give the benefit of a doubt, I ran dd on the disk with no difference in result.
This approach to clearing old pools seemed a little rough so over the weekend I looked into what other options are available.

The zpool(8) man page documents the labelclear option as

zpool labelclear [-f] device

Removes ZFS label information from the specified device. The device
must not be part of an active pool configuration.

-v Treat exported or foreign devices as inactive.

I still had the FreeBSD snapshot from the last attempt which I booted the X61s with, headed to the shell, deleted the existing partitions & issued
zpool labelclear -f /dev/ada0

Everything worked as intended after that.

Thanks to Allan Jude & everyone who chipped in at BSDCan.
Through the trial of getting this working Allan added the option to use a BSD partition scheme to the FreeBSD installer as well as MBR & GPT, which was previously unavailable.

03/06/2014

Inconsolata-g font

Filed under: General — Tags: , , — Venture37 @ 12:31 am

Looking through The Setup website, I found a reference to the Inconsolata-g font in the interview with Gary Bernhardt. I’ve been using Inconsolata as my terminal font for a while now and thought it’d make a nice change. The g variant is bigger than the stock font, the increase in size is from the dz variant according to the change list on the website. There is a 2pt difference in size between the two version of fonts, Inconsolata-g at 12pt is equivalent to Inconsolata at 14pt. On my MacBook Air, font smoothing doesn’t look right with Inconsolata-g lower than 14pt using the OpenType version.

 

Inconsolata
Inconsolata-g

29/05/2014

Switching from MySQL to MariaDB

Filed under: General — Tags: — Venture37 @ 11:44 am

This blog started life on MySQL 4.x & continued to live on 5.0 until today. Whilst performing maintenance, all the packages came up to date apart from two, the MySQL 5.0 client & server which had been long removed.
I was about to commence with installing version 5.5 when I remembered a conversation I had a couple of weeks back about MariaDB, after a quick check to see what the switchover entailed, I decided to install to MariaDB instead.
It’s intended to act as a drop in replacement for MySQL, my instance has been for serving blogs & other fairly common 3rd party open source software so I didn’t have to do much apart from run mysql_upgrade after install.
In /var/db/mysql/server.example.com.err MariaDB logged
Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50084, now running 50312. Please use mysql_upgrade to fix this error. to highlight the fact.

mysql_upgrade output:
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Processing databases
information_schema
mydb
mydb.wp_commentmeta Needs upgrade
mydb.wp_comments OK
mydb.wp_links OK
mydb.wp_options OK
mydb.wp_postmeta OK
mydb.wp_posts OK
mydb.wp_term_relationships OK
mydb.wp_term_taxonomy OK
mydb.wp_terms OK
mydb.wp_usermeta OK
mydb.wp_users OK
mysql
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category Needs upgrade
mysql.help_keyword Needs upgrade
mysql.help_relation OK
mysql.help_topic Needs upgrade
mysql.host OK
mysql.proc Needs upgrade
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name Needs upgrade
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_topic OK
mysql.proc OK
mysql.time_zone_name OK
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK

I decided to recreate my.cnf using the files shipped with MariaDB due to the introduction of new settings and a difference in values for existing settings.

27/05/2014

12″ PowerBook G4 PT 4

Filed under: OS X — Tags: , , , , — Venture37 @ 3:17 am

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.

24/05/2014

FPGA on a Sun Fire T1000

Filed under: SPARC / Solaris / OpenSolaris — Tags: , , — Venture37 @ 6:49 pm

There’s a Xilinix SPARTAN FPGA in the top left hand side of the motherboard, I’m guessing this is for the ILOM?

20140524-184816-67696696.jpg

23/05/2014

Building CoovaChilli on FreeBSD 10 & newer

Filed under: FreeBSD — Tags: , , — Venture37 @ 11:12 pm

I’ve been working on getting CoovaChilli running on FreeBSD 10 the past few weeks. The first problem was that the source code would not build. FreeBSD 10 shipped with clang instead of GCC as the default compiler which is not as forgiving as GCC, clang flagged up lots of issues with the code base such as lack of parameters for functions, one change needed which was a shortcoming of clang itself was the lack of support for nested functions.
The other problem was that CoovaChilli was using a structure that had been marked as deprecated in Net/Free/OpenBSD/Darwin for quite some time & with the release of 10.0, FreeBSD removed this structure from their codebase. This resulted in the tun(4) interface being initialised but no IP address being assigned to it, which was interesting, dhcp responses were still going out but obviously nothing could talk back to the IP address that coova was configured to be listening on (uamlisten).

All BSDs & derivatives were separated out from Linux in dev_set_address(), Linux was set to use the pre-existing method & the BSD & derivatives were switch to use the “new” ifaliasreq structure.

With these change, it’s possible for a client connected to a router running CoovaChilli to visit sites listed in uamallowed. These are sites which CoovaChilli allows to be browsed without needing authentication through the captive portal first. Next stage is to get the captive portal running along with a RADIUS server so that the previous revision of the setup guide can be updated. With the release of FreeRADIUS 3 configuration has changed somewhat, hence the old documentation for version 2 doesn’t necessarily apply.

These changes so far only allow the code to build without any features enabled, for example, enabling OpenSSL support yielded more errors which have not been fixed yet & I suspect others will show up as more options are switched on.

The work so far can be found here

Merged 3/6/2014

22/05/2014

Update to the Jails section of the FreeBSD Handbook

Filed under: FreeBSD — Tags: , , , — Venture37 @ 6:39 pm

Just short of four years ago I posted an article on setting up jails using the pre-built sets FreeBSD comes with.
The changes are now part of the Jails section of the FreeBSD Handbook as PR docs/189901 was closed today. The changes were generated at the doc sprints which happened at BSD Can 2014.

09/05/2014

12″ PowerBook G4 PT 3

Filed under: OS X — Tags: , , , , , — Venture37 @ 10:55 pm

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 :(

Revisiting the NeXT icon set for Mac OS X

Filed under: NeXT/OPEN/GNUSTEP — Tags: , , , , , — Venture37 @ 2:55 am

As I have a system running Mac OS X Tiger, I thought I’d give the NeXT icon set a try again, nearly all sites hosting the components required have now all shut down, thankfully for the Internet Archive copies were saved.
You can obtain a copy of ShapeShifter from here
I’d mirrored the eXec theme which is now unfetchable because it was available as a download from within ShapeShifter. Download, uncompress & rename eXec.guikit to eXec.guiKit before opening.
My NeXT icon set is available here
The original NeXT theme is available from here.
The NeXT icon set applied to Tiger
NeXT icons

NeXT icon set & eXec theme
NeXT eXec

NeXT icon set & NeXT 2.0 themeNeXT Icon set & NeXT 2.0 theme

Everything seems ok on Mac OS X 10.4.11 apart from Safari which causes the original OS X skin to display on the menu bar when it’s the active application.

07/05/2014

Apple’s Darwin according to GCC

Filed under: OS X — Tags: , , , , , — Venture37 @ 10:35 pm

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. */

05/05/2014

Issues with V6 UNIX

Filed under: *nix — Tags: , — Venture37 @ 9:43 pm

From the article Bringing up V6 Unix on the Ersatz-11 PDP-11 Emulator

V6 as distributed is strictly a 20th Century operating system. Literally. You can’t set the date to anytime in the 21st century, for two reasons.
First, the ‘date’ command only take a 2-digit year number. Second, even if you fix that, the ctime() library routine has a bug in it that makes it stop working in the closing months of 1999. (IIRC, it is that the number of 8-hour blocks since the epoch – January 1, 1970 – overflows a 15-bit integer at that point. ‘Vanilla’ V6 C doesn’t have unsigneds.)

I have ‘fixed’ copies of date.c and ctime.c; here and here. You can download them and install them; ctime.o goes in /lib/libc.a:

ar r /lib/libc.a ctime.o
The ‘date’ command has been extended to support 2- and 4-digit year numbers (to be upwardly compatible, the 2-digit ones assume 19xx). It has also been extended (for forgetful people like me :-) so that if you type:
date -
it will tell you what order the arguments go in.
The ‘fix’ in ctime() is really kludgy – sorry, I was in a hurry! It will also break in another 15 years or so (when the number of 8-hour periods overflows 16 bits). Someone else can fix that one!

04/05/2014

12″ PowerBook G4 PT 2

Filed under: OS X — Tags: , , , , — Venture37 @ 9:24 pm

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:

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.
About This Mac 1.25GB RAM
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.

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

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')

19/04/2014

Building RetroBSD on Mac OS X

Filed under: OS X — Tags: , , , — Venture37 @ 6:31 pm

Earlier this week it was announced on the RetroBSD forum that the official repository had moved to GitHub. Along with the move came changes which fixed previous issues with the build so now it is possible to build a RetroBSD image on Mac OS X.

As covered in the RetroBSD installation document, I installed the required dependencies from MacPorts & used the prebuilt PIC32 toolchain to build RetroBSD.

port install bison byacc flex libelf

The compiler was uncompressed to /usr/local to keep it inline with the code base & reduce the number of changes need to get thing to build.

I’d previously installed the command line tools from within Xcode, while this had installed clang & the rest of the toolchain into /usr, I was missing /usr/include, installing the command line tools manually with xcode-select --install fixed this.

Kernel built from the SVN code base on Google Code:
2.11 BSD Unix for PIC32, revision 892M build 2:
Compiled 2014-03-29 by xxx@xxx:
/xxx/retrobsd/sys/pic32/max32-eth
cpu: 795F512L 80 MHz, bus 80 MHz
oscillator: XT crystal, PLL div 1:2 mult x20
console: tty0 (5,0)
sd0: port SPI2, select pin C14
sd0: type SDHC, size 15339520 kbytes, speed 13 Mbit/sec
phys mem = 128 kbytes
user mem = 96 kbytes
root dev = rd0a (0,1)
root size = 102400 kbytes
swap dev = rd0b (0,2)
swap size = 2048 kbytes
temp0: allocated 30 blocks
/dev/rd0a: 588 files, 8752 used, 93247 free
temp0: released allocation
Starting daemons: update cron

2.11 BSD UNIX (pic32) (console)

Kernel built from the git code base on GitHub:
2.11 BSD Unix for PIC32, revision G38 build 1:
Compiled 2014-04-19 by xxx@xxx:
/xxx/retrobsd/sys/pic32/max32-eth
cpu: 795F512L 80 MHz, bus 80 MHz
oscillator: XT crystal, PLL div 1:2 mult x20
console: tty0 (5,0)
sd0: port SPI2, select pin C14
sd0: type SDHC, size 15339520 kbytes, speed 13 Mbit/sec
phys mem = 128 kbytes
user mem = 96 kbytes
root dev = rd0a (0,1)
root size = 102400 kbytes
swap dev = rd0b (0,2)
swap size = 2048 kbytes
/dev/rd0a: 588 files, 8752 used, 93247 free
Starting daemons: update cron

2.11 BSD UNIX (pic32) (console)

04/04/2014

12″ PowerBook G4

Filed under: OS X — Tags: , , , — Venture37 @ 2:27 am

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

Older Posts »

Powered by WordPress