NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server PT2

Get the PDF version of the guide here
All Info in this guide was sourced from the following pages (thnx guys) & the patch is a mod of Mike Passwalls original patch for linux
http://homepage.mac.com/nand/macosx/netboot.html (not english)
http://frank.gwc.org.uk/~ali/nb/
http://www.lysator.liu.se/~/torkel/computer/netboot-macosx.html
http://mike.passwall.com/macnc/

ToDo
Make a patch for dhcpd on OpenBSD 3.6
Make the whole thing run on OpenBSD

NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server

This project is still yet to be finished, at the moment Im using 2 box’s to carry out the installation, the aim is to have one box running OpenBSD doing everything (unfortunately there is no HFS support within the o/s & Im having problems getting mountd to accept connections from clients on a non reserved port)
I did look at FreeBSD 5.3 with HFS+ support but Its early days for the project thus the system panicked everytime I attempt to copy to the NFS share from another host.

1x PC running OpenBSD which is running a tfptd & hacked DHCPD
1x PC running OpenDarwin which has a HFS formatted volume containing the OS X install files shared via NFS
1x Mac (G3 iBook in my case)

Mac gets boot info & kernel image from OpenBSD box & boots, then connects to the OpenDarwin box & starts the GUI/Setup.

I have managed to succesfully install OS X 10.3 & 10.4 with this setup though how the install files where shared on the OpenDarwin box varied between the NetInstall of 10.3 & 10.4.

Lets go through the core part of the setup which needs to be done independent of which version of OS X you are going to be installing.

1. Install OpenDarwin, as OpenDarwin x86 runs off a UFS partition you’ll need a 2nd partition (atleast 2.2gigs if youre installing 10.4) which you’ll format as HFS so remember to partition manually. Note the partition number you’ve installed onto as you’ll need it in the next step!

2. Upon 1st boot you’ll have to manually specify the location of the root partition manually as OpenDarwin doesnt seem to find it & sits there idle.
Press enter at the prompt to specify boot time options & at the prompt enter
rd=disk#s# convention being disk “disknumber” s “partition number”
Once youre logged in edit /Library/Preferences/SystemConfiguration/com.apple.Boot.plist & add rd=disk#s# in the string section under the kernel flags key.

3. Now format the 2nd partition using the newfs_hfs tool
newfs_hfs -v pickaname /dev/disk#s#

4. reboot & log back in, if you look in /Volumes/ you should have a folder called pickaname (or whatever name you picked :P)

5. Using the niutil (netinfo util) you need to create a NFS share
niutil . -create /exports/Volumes/pickaname opts maproot=root:wheel
this will create a share accessible by any host to allow specific hosts use the following command:
niutil . -create /exports/Volumes/pickaname clients 192.168.0.bla
to add aditional IP addresses use the append switch:
niutil . -append /exports/Volumes/pickaname clients 192.168.0.bla

6. To start sharing run:
portmap
nfsd -t -u -n 4
mountd

you may want to add these commands to your /etc/rc to save you having to run it everytime.

7. Run ifconfig -a & note the MAC address of your network card.

1.Install OpenBSD 3.5 (in any configuration you like)
2. Download & extract the sources into /usr/src from the the OpenBSD ftp site
3. Download the patch for dhcpd
& apply to source
patch -p0 < obsd_35patch

4. goto /usr/src/usr.sbin/dhcp/server & run make
5. make a backup copy of your original dhcpd & then overwrite with your new copy
cp /usr/sbin/dhpd /usr/sbin/dhcpd.original
cp dhcpd /usr/sbin/

6. With your dhcpd in place, its onto creating the dhcp lease info. open /etc/dhcpd.conf in your editor & paste the following in & edit to your requirements, you’ll need the MAC addresses of your Mac & PC running OpenDarwin

shared-network LOCAL-NET {
option domain-name "domainname.co.uk";
option domain-name-servers 194.168.4.100, 194.168.8.100;
subnet 192.168.0.0 netmask 255.255.255.0
{option routers 192.168.0.1;
range 192.168.0.2 192.168.0.16;
default-lease-time 600;
max-lease-time 7200;
allow bootp;
not authoritative;
}
host ibook {
hardware ethernet 00:03:66:55:cf:b8;
fixed-address 192.168.0.33;
filename "BootX";
server-name "192.168.0.1";
}
host darwin {
hardware ethernet 00:04:55:66:dd:b5;
fixed-address 192.168.0.10;
}
}

7. Edit /etc/dhcpd.interfaces & enter the name of the interface which dhcpd will run on, run
ifconfig -a if youre unsure of which interface.
8. Edit /etc/bootparams & specify the locations of the root & private folders that the mac will mount on boot
the convention is
hostname root=path private=path eg
ibook root=192.168.0.10:/Volumes/pickaname private=192.168.0.10:/Volumes/pickaname

9.Now onto enabling the services on boot, open /etc/rc.conf.local in your editor & add the following lines:

bootparamd_flags=""
dhcpd_flags="-q"

then open /etc/inetd.conf & uncomment
tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot

10. You’ll need to create a folder on the root of your disc called tftpboot, this folder is going to store the files to boot your mac.
11. Using your Mac or the OpenDarwin box copy the following files from your OS X disks to /tftpboot on your openbsd box:
System/Library/CoreServices/BootX
mach_kernel rename it to: mach.macosx
Extensions.mkext rename it to mach.macosx.mkext

To Install OSX 10.3 (Panther)
As the install is spread over multiple discs & the system reboots after the 1st CD is finished, I didnt bother trying to get a full install going at once, Instead I installed the Core & BSD componenets, then rebooted, mounted the NFS share & installed the other components by hand.
1.Copy the contents of CD1 to your nfs share
pax -r -w -p e /Volumes/Mac OS X Install Disc 1/* /Volumes/pickaname/
2. On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname

If the installer complains that there is 0 space available on your Mac to install onto then make sure you have a folder called .vol on your NFS share.

Theoretically is should be possible to install Tiger this way aswell but the installer complains that the harddisk on the Mac cannot be installed onto as the system cannot be started from that volume!!!

To Install OSX 10.4 (Tiger)
Simply copy the .dmg of the latest Beta Seed to the /Volumes/pickaname
On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname:nameoftigerimage.dmg

It should be possible to install 10.3 this way aswell though I havent tried.
If youre planing on only installing from a disk image then theoretically there is no need to create a HFS partition on the OpenDarwin box & If you can get OpenBSD to accept connections from clients on non reserved ports then the OpenDarwin box can be ditched all together.

My 1st Patch!

Woohoo!
I’ve just created my 1st patch, to add support for Slackware to the iSCSI Enterprise Target software

Read this guide if youre interested in rolling out your patches

--- Makefile.orig 2004-11-22 10:30:57.000000000 +0000
+++ Makefile 2004-11-22 10:35:16.000000000 +0000
@@ -28,6 +28,8 @@
install -v -m 755 scripts/initd.debian /etc/init.d/iscsi-target;
elif [ -f /etc/redhat-release ]; then
install -v -m 755 scripts/initd.redhat /etc/init.d/iscsi-target;
+ elif [ -f /etc/slackware-version ]; then
+ install -v -m 755 scripts/initd /etc/rc.d/iscsi-target;
else
install -v -m 755 scripts/initd /etc/init.d/iscsi-target;

iSCSI On a budget!

Following the Quick Guide to iSCSI on Linux I managed to setup a iSCSI Target host on Slackware 10 running on a virtual machine on VMware then connected to it from the Windows 2000 box which was the VMware host! 🙂

I used the iSCSI Enterprise Target rather then the Ardis Target which the guide covers but as the Enterprise Target is a fork of the Ardis Target there is no variation in steps carried out.

The Windows Initiator can be dowloaded from here

XBench Results

System Spec & benchmark results of my 12″ iBook
You can compare your results online here
Results 28.66
System Info
Xbench Version 1.1.3
System Version 10.3.5 (7M34)
Physical RAM 256 MB
Model PowerBook4,1
Processor PowerPC G3 @ 500 MHz
Version 750CXe v2.4 v2.5
L1 Cache 32K (instruction), 32K (data)
L2 Cache 256K @ 500 MHz
Bus Frequency 67 MHz
Video Card ATY,RageM3
Drive Type TOSHIBA MK1017GAP
CPU Test 21.88
GCD Loop 36.86 1.44 Mops/sec
Floating Point Basic 62.30 225.29 Mflop/sec
vecLib FFT 7.96 123.57 Mflop/sec
Floating Point Library 71.46 2.86 Mops/sec
Thread Test 39.37
Computation 27.76 374.72 Kops/sec, 4 threads
Lock Contention 67.68 849.69 Klocks/sec, 4 threads
Memory Test 15.30
System 15.89
Allocate 344.83 224.93 Kalloc/sec
Fill 12.87 102.42 MB/sec
Copy 9.24 46.21 MB/sec
Stream 14.76
Copy 13.89 101.51 MB/sec
Scale 13.51 99.70 MB/sec
Add 15.74 100.73 MB/sec
Triad 16.29 99.55 MB/sec
Quartz Graphics Test 38.91
Line 36.91 941.80 lines/sec [50% alpha]
Rectangle 42.64 3.00 Krects/sec [50% alpha]
Circle 43.94 1.02 Kcircles/sec [50% alpha]
Bezier 41.58 458.64 beziers/sec [50% alpha]
Text 32.10 523.27 chars/sec
OpenGL Graphics Test 54.63
Spinning Squares 54.63 38.23 frames/sec
User Interface Test 41.95
Elements 41.95 13.49 refresh/sec
Disk Test 25.01
Sequential 24.71
Uncached Write 21.22 8.85 MB/sec [4K blocks]
Uncached Write 21.16 8.67 MB/sec [256K blocks]
Uncached Read 46.04 7.29 MB/sec [4K blocks]
Uncached Read 21.85 8.83 MB/sec [256K blocks]
Random 25.31
Uncached Write 17.32 0.26 MB/sec [4K blocks]
Uncached Write 24.20 5.46 MB/sec [256K blocks]
Uncached Read 39.93 0.26 MB/sec [4K blocks]
Uncached Read 29.43 6.06 MB/sec [256K blocks]

X-Over to the other side

I managed to pick up a broken iBook which needed some TLC.
After 3 hours in the operating theatre everything went A-ok, I managed to replace the broken tft panel & lid. With a fully working laptop I started messing around, then got a bit cocky & managed to nearly rip off the slot which the ribbon for the trackpad slots into, so now I have to sort that out as Im trackpad less.

Being a geek is my own curse sometimes! 🙁

WMI Window Manager

After a serious plugging by some of the peepz @ BSD Nexus (WIntellect!!) I decide to give the new window manager called WMI a try on my laptop running OpenBSD.
WMI is coming from the same angle as flux & black box in that its a totally stripped down window manager with heavy focus on keyboard shortcuts.
For OpenBSD the site links straight to the OpenBSD ports cvsweb page, where you can download the necessary files to build WMI, the build process went totally smoothely & a package was created in /usr/ports/packages/i386/all/ but as there is a error in one of the Make files, the package doesnt complete the install & outputs a error (will investigate this & keep you updated).

I wasnt particularly impressed with the default theme that WMI comes with (called industrial) but there are 2 aditional themes currently available on the WMI site which you can install, which I did (im currently running the DragonflyBSD theme) & judging from the contents of a theme if you dont like the themes available it wouldnt be very difficult to make your own one, a quick edit of my theme file to add some wallpaper & Its all systems go. 🙂

Darwin Streaming Server Port Usage

As Darwin SS uses the RTSP protocol to stream (unless youre streaming via port 80) you must have the following ports open on your firewall 554, 7070, 8000, 8001 then anything starting from 6970 & up depending on how many clients you want to support.
Apple have a basic support article on this here

Running Darwin Streaming Server on OpenBSD 3.5

Today I have mostly been playing with streaming servers, I’ve been meaning to give Apple’s Darwin Streaming server a go for a while now but never got around to trying it, unfortunatly theres no official binaries for OpenBSD but a quick google around & I found this
I download the patch from the url specified in the post & then onto Apples site to download the sources. I was unable to use the patch in its original form as the creator had specified the paths from his computer to the files which ofcourse where invalid on my system. A quick edit of the dif & i was back on track. 🙂

Heres my moded patch with the paths taken out, place it inside the DarwinStreamingSrc5.0.1.1 directory & patch away 🙂
As specified in the Jeff Ross’s post, patch the source with
patch -p0 < DSS_5.diff
then compile & install with
./Buildit
./DSS_MakeRoot -f DarwinStreamingSvr
cd DarwinStreamingSvr
sudo ./Install

once installation is completed run
rmuser qtss then run adduser & create a new user with the username qtss,with the shell /sbin/nologin & no password.
otherwise Darwin fails with the following error
Cannot switch to group qtss

Now run /usr/local/sbin/streamingadminserver.pl then openup your browser & goto http://localhost:1220
You should be presented with a login screen! 😀
enjoy!

D-Link Sux

Grrrrr
Been dealing with a D-link DSL300T ethernet modem today & I now have a even bigger hatred for their kit, the pony piece of kit re-enables the dhcp server & sets the clock back to 1970 after powercycling the unit (even though you’ve saved the changes) resulting in a impressive uptime stat on the modems admin page & a confused firewall (which sits behind the modem) wondering why it has a 192.168.x.x IP address on both the wan & lan port.

The Propper way to fire up MySQL

grrr
been pulling my hair out as cron wasnt firing up, tracked the problem down to rc.local, the command to start mysql was preventing cron from running but everything seemed A-OK on the outside.
heres the correct lines to insert into rc.local on OpenBSD to fireup mysql without causing any knock on effects:
if [ -x /usr/local/bin/mysqld_safe ]; then
/usr/local/bin/mysqld_safe > /dev/null & echo -n 'mysql '
fi

Automated Uploads with FTP using cron

Today I’ve mostly been messing with IRC bots & toys.
setup a bot (eggdrop) & irc stat generator (pisg) on my server here at home. Unfortunately the channels website is hosted elsewhere, using crontab I created a cron job to run pisg at a regular interval, then planned on using ftp in another job to upload the generated stats page. Unfortunately there no way of telling the ftp command to upload files.
To get around this I resorted to setting a cron job on a script which ran ftp & included the necessary ftp commands to upload the file piped to the ftp command.
Heres the script I used (thnx Dan!):

#!/bin/sh
ftp -i -n ftp.hostname.net <<EOF
user myusern mypasswd
cd /whereu/want2upload/
lcd /wherethe/fileis/locatedlocally/
put index.html
quit
EOF

the crontab entry looks like this
0 * * * * /pathto/sh /pathtothe/script >/dev/null 2>&1