Uncategorized

You are currently browsing the archive for the Uncategorized category.

So, I have this old iBook, it has been doing nothing for a couple of years, so I decided to do something with it. not having any machine in the house with a BSD on it, I thought I would install NetBSD on it.

The iBook is old. The CD drive doesn’t work, the airport card doesn’t work, but it does have a largish HD and 640MB RAM. Because of the broken CD drive, I figured that I’d net install whatever I was going to install on it. Yes, I know there are other options, I could have put an install image on a firewire disk, booted into target disk mode, and installed something that way, etc. I guess I really just wanted to try net installing something :)

Reading the NetBSD docs that I could find made me think that I would need a TFTP server, NFS server, and to mess with my DHCP settings. So I installed TFTP on my Fedora 13 system, and went to my OpenWRT router and looked at changing the config for dnsmasq.

So I added to my /etc/config/dhcp:

config boot linux
option filename 'ofwboot.xcf'
option serveraddress '10.0.0.11'
option servername 'tw'

(tw is the hostname of my Fedora system).

Getting the DHCP options was harder, the openwrt docs suggested ‘list dhcp_option ‘, but that didn’t work, nor did any of the other things I tried until, after reading the shell scripts in /etc/init.d, I added
option 'dhcp_option' '17,/export/client/root 42,10.0.0.4 66,tw 67,ofwboot.xcf 128,10.0.0.11'
This seemed to work, with each space separated option being added to the dnsmasq command line (I was happy for /proc/[pid]/cmdline here – it made checking very easy).

Booted the iBook to openfirmware and tried to get it to boot the NetBSD installer kernel like this:
boot enet:0,\ofwboot.xcf

But that did not work, although the ofwboot.xcf boot loader loaded from TFTP, the netbsd kernel did not load from either TFTP or NFS. Eventually, after much messing about, I discovered that:
boot enet:0,\ofwboot.xcf enet:0,\/netbsd
caused the ofwboot.xcf boot loader to load from TFTP and the netbsd kernel to load from NFS (server 10.0.0.11, path /export/client/root, as specified with DHCP).

WooHoo, so I ran the installer, said it should take the whole disk, etc. And installed everything.

It did not boot.

I was sad, and then went to read the INSTALL docs from the NetBSD macppc page. Indeed, it was quite clearly noted that with open firmware version 3.0 or later NetBSD would install an unbootable system if you just chose the installer defaults. The docs that I found on how to do it properly involved using your Mac OS system to partition the disk and so on prior to installing NetBSD. Of course, I had just overwritten the Mac OS system with a non bootable NetBSD. I was now mad. Mad enough to install Linux on what was supposed to be my BSD system.

I first went to install Fedora (because I am used to it), but discovered that Red Hat and powerpc are no longer friends, not that I can blame them for not supporting the architecture, but it meant I had to keep looking. The ubuntu netinstall kernel etc from http://ports.ubuntu.com/ubuntu-ports/dists/maverick/main/installer-powerpc/current/images/powerpc/netboot/ did not boot (yaboot loaded, the kernel loaded, but did not run). So I tried debian. It booted (with the boot loader, kernel and other files all loading from TFTP, no need for an NFS server, or another argument for the boot loader. All that was required was
boot enet:0,yaboot

The installer did not ask me to set up the network (unlike the NetBSD installer), it got all the settings from DHCP. It seemed strange that both Open Firmware and the Debian installer was capable of getting my network settings from DHCP, but the NetBSD installer was not able to do so.

The Debian installer allowed me to partition my disk, and the resulting install booted. All in all it took me less than an hour to install a working debian system, where it had taken me significantly longer to install a non booting NetBSD. Still I did not give up. When installing debian I added a 2GB HFS+ partition, and left a large amount of free space. And I went to install NetBSD again.

This time, while carefully reading the INSTALL document, I was able to netboot the installer, mount an NFS directory with a pdisk binary, format the partitions I wanted, and eventually install NetBSD and have it boot.

Of course, X11 did not work. Why would it? “Working” and “NetBSD installation” don’t seem to be terms that go together. Yes, I was getting madder. However, rebooting the system into debian, installing kde, and running it, showed that X11 wasn’t all that happy on Linux either. Ok, so maybe that wasn’t NetBSD’s fault :) . A little google and a little guessing, led me to the following changes to my NetBSD 5.0.2 xorg.conf:

To the “Monitor” section, I added:

HorizSync 25-51
VertRefresh 43-60

To the “Device” section, I added:

Option "UseFBDev" "False"

and to the “Screen” section, I removed everything but:

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
EndSubSection
EndSection

And viola, working NetBSD install with working X11. Finally, happy, I wondered what on earth I was going to use it for. I still don’t know, but I’m sure I will think of something. Like maybe letting it sit idle for another couple of years.

For nearly 9 years this site has been hosted at pair.com, and I have had no problems there. Any time I have contacted pair support, I have had excellent response, they host everything on FreeBSD, and have, in the past, made monetary contributions to the FreeBSD project. They seem to be very professional, and uptime has been fantastic.

I have become more and more unhappy with their pricing though. I have been using pairs Advanced account, which provides 1.5GB of disk space and 80GB/month bandwidth, and paying $20/month for it. A few years ago pair introduced a pairlite service which would have suited my needs better, but I had already been a customer for years, and moving was harder than doing nothing, so I did nothing :)

I kept an eye on webhost pricing though, and finally my stinginess exceeded my laziness, and I decided to move. I looked at dreamhost, tried a trial, liked it, but wanted more control, so I began to look for a VPS. Eventually I stumbled on Prgmr.com. I don’t care if uptime is a little lower than it has been, it’s only a blog, a collection of random crap, and email. Prgmr is cheap, dirt cheap. For my same $20, I get a VPS with 22GB of disk space, 1024MB of memory, and 160GB/month bandwidth. Of course, it is no longer managed hosting, it is entirely DIY hosting. And that’s just fine :)

Not everything is moved to prgmr yet, web site is moved, so is DNS, email not yet. Will move that in a few days, and then finally cancel my account with pair.

Due to some recent bus errors, I have been thinking a bit about alignment lately.

When the compiler lays out a struct it will generally ensure that the members of the struct are aligned on the required boundaries for the target architecture. For example, given:

struct foo {
int32_t a;
int16_t b;
};

A compiler may lay it out something like this:

0x??????04 a
0x??????05
0x??????06
0x??????07
0x??????08 b
0x??????09
0x??????0A pad
0x??????0B

The entire struct will likely be placed at an address aligned on a 4 byte boundary because the largest struct member is 4 bytes long, and the int16 type will be followed by a 2 byte pad. Why? So that an array of structs will have the ‘a’ member for all array elements aligned on a 4 byte boundary. All is good, right?

If we add a char to the struct:

struct foo {
int32_t a;
char c;
int16_t b;
};

0x??????04 a
0x??????05
0x??????06
0x??????07
0x??????08 c
0x??????09 pad
0x??????0A b
0x??????0B

Changing our char type to a 64 bit type may result in something like this:

struct foo {
int32_t a;
int64_t c;
int16_t b;
};

0x??????00 a
0x??????01
0x??????02
0x??????03
0x??????04 pad
0x??????05
0x??????06
0x??????07
0x??????08 c
0x??????09
0x??????0A
0x??????0B
0x??????0C
0x??????0D
0x??????0E
0x??????0F
0x??????10 b
0x??????11
0x??????12 pad
0x??????13
0x??????14
0x??????15
0x??????16
0x??????17

In this case (for this imaginary compiler) the entire struct is aligned on an 8 byte boundary, with the 8 byte member also aligned on an 8 byte boundary. So we can still create an array of struct foo, and things will be properly aligned. Of course, even though the individual members of the structure are 4, 8 and 2 bytes long, the entire structure with padding is 24 bytes long, so 10 bytes are “wasted”, it is best to design structs with this in mind, so that my imaginary compiler does not waste space. In the above case, changing the order of the elements is helpful:

struct foo {
int32_t a;
int16_t b;
int64_t c;
};

0x??????00 a
0x??????01
0x??????02
0x??????03
0x??????04 b
0x??????05
0x??????06 pad
0x??????07
0x??????08 c
0x??????09
0x??????0A
0x??????0B
0x??????0C
0x??????0D
0x??????0E
0x??????0F

Now, on some systems a program will run faster if types are aligned “properly”, on others a bus error will occur for misaligned access. Misaligned access will often occur in cases like this:
char array[1024];
...
struct foo * bar = (struct foo *)array;
bar->c = 1;

In the above case, although the array certainly is large enough to hold a foo structure, there is no guarantee that a char will be aligned on an 8 byte boundary, it is a 1 byte type, so there is no need for the compiler to align it. Because of this bar->c = 1; could cause a bus error. OtherĀ  bus errors can occur casting structs of the same size, but with different alignment requirements, etc.

At least firefox works for us on HP-UX now :)

Shantonu noted that for gcc, using -Wcast-align will at least warn about this issue.

Well, at the end of a week in Disney we got tired of hearing “Have a magical day”, had very sore feet and legs, and were sunburned. We did have fun though, despite the heat and all the happy helpful people that we encountered.

When we lived in Japan we went to Tokyo Disney once, and to Universal Studios Japan several times. At Tokyo Disney, even though we went in the off-season on a school day, the wait times for most rides were over 60 minutes. At Universal Studios Japan (unless you purchase their “Express Pass Booklet” which allows you to go into a faster queue) we have seen wait times of 180 minutes for popular rides. We also went to Disney Paris a couple of times in January, snow and freezing rain tend to keep the visitor numbers down, so we did not have to wait at all for most rides. My expectations for Florida’s Disney world were wait times similar to Japan. I was very pleasantly surprised. The longest wait times we saw were 60 minutes, and for those rides that did have longer wait times, we got the “Fast Pass” and went back to them. Jessica at a slide in

The flights were fine and we were able to get to the “All Star Music Resort” on the Disney coach fairly easily. Little did we realize that escape from Disney would be impossible for the next 7 days. This had us paying $14 for a six-pack of beer, and $2 for a bottle of water for the week. The $10 a day extra for a fridge in the room and $9.95 a day for internet access also made me feel that we were being gouged.

The food was better than I had expected. I had thought that we would be eating burgers and fries for a week, but there were delicious alternatives – the kids meals all came with a choice of 2 sides, Jessica usually chose carrot sticks to go along with her fries, and there were delicious salads available too.

Jessica loved the rides, especially the scarier, faster ones. Space Mountain 5 times, Thunder Mountain 4 times, Splash Mountain 3 times, Everest adventure 3 times, Tower of Terror 4 times, Fast Track twice and Mission: Space. Unfortunately she did not quite make the 48 inch height requirement for some of the water slides at Typhoon Lagoon.

I am glad to be back at work – now I do not have to walk miles every day in 90+ F temperatures :-) Hopefully we can avoid theme parks for a couple of years.

My niece asked for an update. This is an update.

Really though, some things have happened, I got work building pacakges
for The Written Word on a part
time basis. It’s fairly interesting.

My daughter is growing up, see some pictures at pic.pogma.com(slow!)

Oh, yeah, almost 2 years without smoking, not too bad. Now if only I
could stop gaining weight. :(

Well, that’s it for another year!

« Older entries