Wednesday 29 May 2013

Minix on the BeagleBone Black Part 2 - Software

This is the second post in a 3 part mini-series on getting Minix up and running on the new BeagleBone Black. It's intended to help those interested in following my work over the summer. I'll be looking for people interested in helping test out my code as the summer goes along. The previous post listed some suggested hardware. This post will detail how to cross compile Minix and get it on a MicroSD card. The third and final post will go over terminal setup, booting, and logging into Minix.

You'll need some sort of Linux or Unix-like system to build Minix. The system should have at least the following tools installed: git, bash, sfdisk, mcopy, dd, wget, mkfs.vfat, make, and a C compiler. Once you've got the tools installed, the next step is to get the source code from my minix-i2c repository on github and checkout the i2c branch.

git clone git://github.com/tcort/minix-i2c.git
cd minix-i2c
git checkout i2c

The next steps of building a cross compiler, cross compiling Minix, and creating an SD card image have been automated. You just need to set a few environment variables and run a script.

echo "BASE_URL=http://www.minix3.org/arm/beaglebone" > .settings
echo "FLAG=-DAM335X" >> .settings
echo "CONSOLE=tty00" >> .settings
./releasetools/arm_sdimage.sh

After a lot of compiling, you'll be left with an image file in the current working directory named minix_arm_sd.img

Insert your SD card into your SD card reader/writer. Check the output of `dmesg` to see which device file it was mapped to. If you aren't paying attention here, you could write the SD card image to your hard drive by accident, destroying your partition table and boot sector in the process. If your card had file systems on it previously and your computer auto-mounted them, you should unmount them all. Then, write the image to the SD card with dd.

dd if=minix_arm_sd.img of=/dev/sdX bs=1M oflag=direct

After several minutes or more, dd will finish and you can remove the card. I'm not sure if it makes a difference or not, but I usually issue the sync command before removing the card just to make sure that all of the data was actually flushed to the card.

That's all for now. In my next post I'll go over how to set up the hardware, how to set up your terminal program, booting, and logging in.

No comments:

Post a Comment