Showing posts with label macosx. Show all posts
Showing posts with label macosx. Show all posts

Tuesday, August 24, 2010

Mac OS X Internet Sharing Problems, resolved

I was having problems with Internet Sharing on Mac OS X Snow Leopard. It was working at one time, and then it stopped. I would see from my Mac that it was getting a DHCP DISCOVER from my other computer, but the Mac would not give out a network address.

At long last, I figured out the problem. If perform this command:

$ sudo launchctl list | grep bootp
1550 - com.apple.bootpd

You will see that bootpd is actually running, but being com.apple.bootpd means it is running as the normal system bootpd server. You don't want that.

First, disable Internet Sharing. Then run this command:

$ sudo launchctl remove com.apple.bootpd

Then, re-enable Internet Sharing. You should now see something like:

$ sudo launchctl list | grep bootp
3423 - 0x100101440.anonymous.bootpd

This is the anonymous Internet Sharing version of bootpd. Now it all works.

Tuesday, August 17, 2010

Booting your iBook G4 from a USB stick

So I spent the better half of the night trying to figure out how to make my iBook G4 boot from a USB stick. I have the Leopard ISO, but none of my DVD drives will burn Dual Layer, so I needed to use the USB route.

However, none of the nonsense I found on the Internet could give me proper instructions. The system itself doesn't directly support it (holding down option during power-on doesn't show it either).

So I had to dig into my OpenFirmware roots and do it the old fashion way. So here's the quick tip for the rest of you out there (hopefully Google will eventually pull this up in page ranks so it gets hit first and saves people time).

  1. Plug in the USB device where you have copied your bootable system to (I do not cover this part since it's well covered already, google is your friend).
  2. Power on your iBook and hold down Command+Option+O+F. This will take you into the OpenFirmware. Scary looking if your not a computer type person.
  3. Once you see the screen go white with some text on it, you can release the keys in the previous step.
  4. Type "boot ud:,\\:tbxi" and if you're lucky, it will start booting from your USB device. If not, continue on.
  5. Type "dev usb0" at the little ">" prompt and hit return.
  6. Type "ls". If you see something like "/disk@1", continue, else go to the previous step and use "usb1" instead.
  7. If you get here and you haven't seen something like "/disk@1", then you're likely screwed, sorry.
  8. Type "dev disk@1" and hit return, and then "pwd" and hit return again. You should see something that looks like "/pci@f2000000/usb1b,1/disk@1". You will use this in the next step.
  9. Type "boot /pci@f2000000/usb1b,1/disk@1:,\\:tbxi". This is the device part you got in the last step after typing "pwd" with ":,\\:tbxi" added to the end.
  10. Moment of truth, hit enter. You should now be booting into your USB drive. IT WILL BE SLOW SO BE PATIENT

This should also work on other PPC Mac's that don't normally boot from USB, such as G3s.

Wednesday, July 14, 2010

Cross compiling the Linux kernel from Mac OS X

So I picked up a 13" MacBook and have been fiddling around with it. I like it, sue me.

One of the first things I did (as any Linux developer would) was to install darwin ports. I noticed some interesting things in there. A few that I needed (git) and a few that completely surprised me (dpkg and apt).

One thing that was missing was a Linux cross-compiler. So I did what any self-respecting Linux developer on a Mac would do: I built one.

Don't get too excited. I've only built one worthy of compiling a kernel (which means no C library, no userspace, etc).

The result of my work is here (built on 10.6.3):


You may notice the extra elf.h file, which is needed in /usr/include/elf.h for some programs in the kernel to compile natively on the host (e.g. modpost). The gcc and binutils will unpack in /opt/local/.

In order to cross-compile, you will need to add a few things to your kernel make command line:

make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- ...

You may notice, like I did, scripts/genksyms/parse.c has a #include for malloc.h which is not on Darwin. You may safely delete that line.

Note that you must already have /opt/local/bin in your PATH. Using ARCH=i386 will also work and compile 32-bit kernels. One last point, the sources for gcc/binutils came from Ubuntu's Jaunty.

Happy hacking...