Build Boost on PPC64

•December 3, 2013 • Leave a Comment
./bootstrap.sh
./b2 architecture=combined address-model=32_64

VirtualBox settings for FreeBSD with ZFS

•June 25, 2013 • Leave a Comment

I am running amd64 FreeBSD 9.1 in VirtualBox with a ZFS RAIDZ file system, hosted on x86_64 ArchLinux.

Settings

General – Basic

  • Type: BSD
  • Version: FreeBSD (64 bit)

System – Motherboard

  • Base Memory: 4G
  • Chipset: ICH9
  • Enable I/O APIC

System – Processor

  • Processor(s): 4
  • Execution Cap: 75%

Storage:

  • Controller: IDE (used to mound CD/DVD)
  • Controller: SATA (3 seperate drives used for RAIDZ)

Network – Adapter 1

  • Attached to: NAT
  • Advanced – Adapter Type: Intel PRO/1000 MT
  • Advanced – Promiscuous Mode: Deny
  • Advanced – Mac Address: <default>
  • Advanced – Cable connect: check
  • Advanced – Port Forwarding:
  1. Name=Rule 1, Protocol=TCP, HostIP=<blank>,Host Port=2222,Guest IP=<blank>,Guest Port=22

FreeBSD Config

Content of /etc/rc.conf

hostname="lt04226-freebsd"
keymap="uk.cp850.kbd"
zfs_enable="YES"
ifconfig_em0="DHCP"
sshd_enable="YES"

Installing Arch Linux

•April 25, 2013 • Leave a Comment

Why this post?

I keep having to install Arch Linux on an encrypted drive.  I’ve taken the easy way out by using just two partitions (for /boot and /).

The information I have been using are split across several pages.  I list these at the end.  All the information I use is here in this page.
A word of caution, this page is likely to be out of date before it’s published.  Arch Linux is developed at a fairly rapid pace.  Nearly everything I’ve read about it is out of date.

Steps

1. Partition the disk (/boot, swap and /).
2. Encrypt /
3. Format the partitions
4. Mount the partitions
5. Configure WiFi
6. Install basic system software
7. Set up keymaps and time zone
8. Install boot loader and kernel

Further Comments

References

https://wiki.archlinux.org/index.php/Partitioning

https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS

https://wiki.archlinux.org/index.php/Installation_Guide

http://lifehacker.com/5680453/build-a-killer-customized-arch-linux-installation-and-learn-all-about-linux-in-the-process

http://www.leduotang.com/sylvain/node/178

Make

•April 25, 2013 • Leave a Comment

What is Make?

Make is a computer program that performs a series of tasks in an intelligent way.  It is used to compile documents, other computer programs, and is suitable for any serialised work flow where intermediate tasks may be complete and skipped or not complete and must be done.

What’s the big deal?

Make is used to build many computer systems.  But there isn’t just one Make,  They are similar (in that they all try to do the same job in the same way), but different in important ways (because they don’t).

The two I’d like to look at there are BSD Make as it appears on FreeBSD and GNU Make.

BSD Make

This is the default make on BSD systems.

BSD Make has the basic mechanisms.  It knows how to define a target, and how to define the dependencies to create that target.  It also has a macro language that allows symbols to be constructed and defined withing the execution of make.

The BSD Make system doesn’t know how to build any particular thing.  It must be instructed what to do.

The BSD approach to using make is to define a set of standard include files that define rules for specific tasks.  You then include the appropriate make file for your project.  And that’s it.  Your project knows how to do everything it needs to do on your system; install, uninstall, build, clean, archive …

GNU Make

This is the default make on GNU/Linux and current versions Mac OS;s XCode.

A GNU idel is to create Unix-like tools that are a little bit easier to use.  GNU Make is made a little easier to use by building in rules for compiling programs.  It knows how to compile Pascal, C, C++, Fortran, …, programs.

To see the built in rules, run:

make -p

The GNU approach initially seems helpful.  The makefile simply describes dependencies and GNU Make fills in the blanks.  The problem is it can’t know everything.  It can’t know how to install on differing systems for example.

The fix is a whole new set programs collectively know as AutoTools.  It has AutoConfig, AutoMake and LibTool.

AutoTools are required because GNU Make needs system specific instructions.  It needs the same instructions athat BSD Make gets from system specific

Examples

This example shows the makefiles for a simple project I have lying around.

BSDmakefile

#
# BSDmakefile
#
PROG_CXX = goodlistener
SRCS = main.cc config.cc dispatch.cc
MAN = goodlistener.1
MAKEOBJDIR = work
CXXFLAGS=-g

.include <bsd.prog.mk>

#
# GNU make file
#
CXX = -g

all: goodlistener

goodlistener: main.o config.o dispatch.o
    $(LINK.cc) -o $@ $^

A word on some oather make systems.

PMake

This can be BSD’s Parallel Make or Polytron’s Make.

Parallel Make is described here: http://www.freebsd.org/doc/en/books/pmake/

Polytron Make knew how to look into a PVCS (Polytron Version Control System) archive to decide whether a check out was required.

IMake

http://en.wikipedia.org/wiki/Imake

NMake

NMake was published by Microsoft Corporation and was commonly used on MS-DOS.  Visual Studio is the preferred build environment that Microsoft provide.

And first there was Unix

<brief history of Make from CSRG>

BSD Make

<overview of BSD Make

– makefile names: BSDmakefile, Makefile, makefile

– Rules thru system config files: See Art of Unix Programming http://www.catb.org/esr/writings/taoup/html/ch01s06.html#id2877777

– One target per directory

– A Sample project>

GNU Make

<Overview of FSF/GNU Philosophy

NOT UNIX

compatible but better tools

Better because of built in rules.

– How to see built in rules

– A Sample project>

The Demise of Apple?

•October 20, 2012 • Leave a Comment

Apple was brought back from the brink some years ago.  Since then, they benefited from a focused design program and their brand of sanitizing part of the wilderness of consumer digital music with iTunes and iPods.

The introduction of the iPhone has set a new paradigm in phone use, and the iPad has followed in its wake.  The products are beautiful inside out.  They’re a user’s dream as much as they are an engineer’s dream.

Since the untimely death of Steve Jobs, Apple seem to changing priorities.  Users/Customers seem to be less in focus.  Instead, the company seems more concerned with taking on other companies.  The recent disappointments with the iPhone 5 is a case in point.  Removing Google products from the device does not benefit customers.

The Ford Mondeo is arguably a cheaper and better car than a BMW 320d, but BMW outsells the Ford.  Maybe Apple should concentrate on beating the competition by delivering better service rather than fighting with competitors at the customer’s expense.

Recovering a Faulty ZFS Root FreeBSD System

•September 3, 2012 • Leave a Comment

Why this post?

I am running a FreeBSD system with a ZFS root filesystem.  This was described in a previous post, here.  I suspected the one of the drives is faulty and hoped this would prove a useful test for RAIDZ1.  But two days ago, the system refused to boot because it couldn’t mount the root filesystem.  This describes how I recovered the system.

Steps

1 Boot the host from the FreeBSD Install DVD.

2. Begin installation; select keyboard and hostname, then drop out to the shell at the first opportunity.

3. Import and repair the root filesystem.

# zpool import -f -o altroot=/mnt zroot
# zpool scrub zroot

4. Check the progress of the repair and wait until it’s finished.

# zpool status

5. Reboot the system

# reboot

Further Comments

Interestingly, zpool status did not report any problems with the physical disks.  Once repaired, the system worked correctly.

Installing FreeBSD 9.0 with Root on ZFS

•August 28, 2012 • 1 Comment

Why this post?

I hadn’t administered ZFS for a few years, and had never used it as the root filesystem before.  FreeBSD 9.0 no longer uses sysinstall, it uses bsdinstall.  The bsdinstall based instructions don’t work.

What’s wrong?  bsdinstall seems to re-mount the ZFS filesystem on /.  This breaks ZFS and the installation never completes.

Steps

1. Boot FreeBSD install DVD.

2. Begin installation; select keyboard and hostname, then drop out to the shell at the first opportunity.

3. Partition your disks.  I’m using 3 disks configured as RAIDZ1.

# gpart create -s gpt ada0
# gpart create -s gpt ada1
# gpart create -s gpt ada2
# gpart add -s 64K -t freebsd-boot -l boot0 ada0
# gpart add -s 64K -t freebsd-boot -l boot1 ada1
# gpart add -s 64K -t freebsd-boot -l boot2 ada2
# gpart add -s 8G -t freebsd-swap -l swap0 ada0
# gpart add -s 8G -t freebsd-swap -l swap1 ada1
# gpart add -s 8G -t freebsd-swap -l swap2 ada2
# gpart add -t freebsd-zfs -l disk0 ada0
# gpart add -t freebsd-zfs -l disk1 ada1
# gpart add -t freebsd-zfs -l disk2 ada2

4. Install the Protected MBR (pmbr) and gptzfsboot loader.

# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada2

5. Create the ZFS filesystem

# zpool create -o altroot=/mnt zroot raidz /dev/gpt/disk0 /dev/gpt/disk1 /dev/gpt/disk2
# zfs create zroot/usr
# zfs create zroot/home
# zfs create zroot/var
# zfs create zroot/var/tmp
# zfs create zroot/tmp
# chmod 1777 /mnt/tmp
# chmod 1777 /mnt/var/tmp

6. Perform the Installation, this is the full set but you clearly don’t want them all.

# cd /usr/freebsd-dist/
# tar –unlink -xpJf base.txz -C /mnt
# tar –unlink -xpJf kernel.txz -C /mnt
# tar –unlink -xpJf ports.txz -C /mnt
# tar –unlink -xpJf doc.txz -C /mnt
# tar –unlink -xpJf src.txz -C /mnt
# tar –unlink -xpJf games.txz -C /mnt

7. Fixup /etc/

# cat /tmp/bsdinstall_etc/rc.conf.hostname /tmp/bsdinstall_etc/rc.conf.keymap > /mnt/etc/rc.conf
# echo ‘zfs_enable=”YES”‘ >> /mnt/etc/rc.conf
# echo ‘ifconfig_en0=”DHCP”‘ >> /mnt/etc/rc.conf
#
# echo ‘zfs_load=”YES”‘ >> /mnt/boot/loader.conf
# echo ‘vfs.root.mountfrom=”zfs:zroot”‘ >> /mnt/boot/loader.conf
#
# chroot /mnt
# passwd
# tzsetup
# exit

From here on, if ZFS fails to initialize, type reboot to reboot the system, follow steps 1 and 2, then continue where you left off.

8. Complete the ZFS setup.

# zfs umount -a
# zpool export zroot
#
# zpool import -o cachefile=/tmp/zpool.cache zroot
# cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache
# zfs umount -a
#
# zfs set mountpoint=/ zroot
# reboot

Further Comments

Clearly the ZFS filesystem can be tuned further.  My first reference shows a reasonable configuration.  I am using raidz, so the number of copies can be set to 2 for permanent mount points.

References

Installing FreeBSD Root on ZFS (RAIDZ1) using GPT

Installing FreeBSD 9.0-RELEASE Root on ZFS using GPT

ZFS fails with bsdinstaller 9.0RC3