Beaglebone Black and Ubuntu – Copying the OS Image to the SD Card from Linux


beagleAbout a month ago (maybe longer), I started my Beaglebone Black saga and in one of my first posts, I recall mentioning that I was unable to copy the OS image to the SD Card in Linux.  My process was to format the card, then boot into Windows and use ImageWriter for Windows to copy the image to the card.  Then move back over to Linux to carry on.  Yesterday, while I was waiting for FFMPEG to compile (foreshadowing), I was be-bopping around on adafruit.com’s web site and read a paragraph about the Mac process for copying the image to the sdcard.  I had previously skipped that since I wasn’t using a Mac.

So, after some careful experimentation, I was able to get the copy to work on Ubuntu.  Here’s how I did it:

First, check to see what the device designation is:

sudo fdisk -l

for me it was /dev/mmcblk0

Next, for convenience, I changed directories to my Downloads folder where I unpacked the gzip’d version of my OS image.

Finally, I entered in the following command:

Before doing this, be aware that this command, if not carefully used, could quickly and easily destroy your host system.  Just pretend that you are on the ledge of a very, very tall building without a railing.  Scary?  You bit it is!

sudo dd if=ubuntu-raring-13.04-armhf-3.8.13-bone20.img of=/dev/mmcblk0

The article included an additional parameter, “bs=1m” but Ubuntu did not like it so I took it out.  I can only assume it is a Mac-related thing.

Anyway, after entering this command, I waited about 20-30 minutes.  When the prompt came back, I pulled out the card, slipped it into my BBB and viola… A new, sexy install of Ubuntu was on my card, waiting for glorious projects.

Here’s the original article (the code is near the bottom):

http://learn.adafruit.com/beaglebone-black-installing-operating-systems/mac-os-x

PS.  Yes, Be-bopping is an industry term.  Don’t believe me?  Look it up…

Advertisements

Linux Noob: Linux and Windows Living Together: A World Gone Mad!


So, I have recently had the experience of puzzling out how to dual boot Linux (FC14) and Windows 7.  Now, if you know what you’re doing this is cake.

IMPORTANT SAFETY TIP: INSTALL WINDOWS FIRST!

However, easy isn’t exactly fun or educational.   I initially re-imaged my laptop with 3 partitions:

  • 500MB /boot
  • 4GB /swap
  • the rest-of 500GB-ext4

Whoops!  As you can see, I forgot to account for a Windows partition.   Cue circus music.

So, after I spent considerable time setting up my Linux environment, I realized my mistake.  Not wanting to repeat a week’s worth of work, I started looking for a magically solution.  I will say that you can do incredibly crazy-and dangerous- things in Linux that you would never think of in Windows.  Here is how I was able to researve a 130GB partition and get Windows 7 dual booting.

First, I fired up GParted.  This is the Gnome Partition app.  There are several way to run this.  I chose to use a USB boot device (http://gparted.sourceforge.net/liveusb.php#linux-method-b).  There are several methods to create a bootable USB stick.  I elected to got the manual route.  It is the most straight-forward process and doesn’t have any extraneousness nonsense in the mix.  Once the stick was prepped, I rebooted the laptop and repartitioned the main partition giving me ~130GB (detailed instructions are found at http://gparted.sourceforge.net/).

Next, I tested my work and Linux booted up without issue.  Now for Windows.

I crammed the Windows 7 64bit install DVD in the drive and installed it on the newly created partition.  Once completed.  I had the hotness of Windows 7 running but no Linux.  <sigh>  So, this is where it gets a bit scary for me but it’s really not bad being on the other side of it.

I found an app called SuperGrubDisk to fix the problem.  As you are probably aware, when Windows was installed, it assumed control of the Master Boot Record, disregarding the Grub bootloader.  SGD will allow you to recover your Grub fully intact.  Just download the .iso at http://www.supergrubdisk.org/super-grub-disk/.  They have several products for fixing MBRs but I really only needed SuperGrubDisk1.  Once the disk was burned, I rebooted the machine that loads up SGD and I was greeted with a text menu system (details on this app on on the site).  I followed the instructions, completed my very, scary activities, and then rebooted.  WOOHOO!  Linux is back.

Windows is gone.  Damn.  Well, gone… kind of.  At this point we are just talking about the MBR.  Both OSs are installed and work fine, it’s just a matter of getting access to both of them easily.

So, the next step was to edit the Grub.conf file.  This is found in the /etc directory.

IMPORTANT SAFETY TIP: BACK UP YOUR FILE BEFORE MODIFYING

[muppet@computer ~]  cp /etc/grub.conf /etc/grub.conf_orig

Here’s what I did:

Since I have one drive with 4 partitions (3 for Linux and 1 for Windows with Windows being the last one), you refer to the target partition as hd(0,3).

[muppet@computer ~]  sudo gedit /etc/grub.conf

I only had to change 2 things:

  • Timeout setting from 0 to 15
  • Add the windows loader entry at the bottom (after the Linux entries) like this:
title Microsoft Windows 7 Ultimate
rootnoverify (hd0,3)
chainloader +1

Finally I saved the file and rebooted the laptop.

Now for the moment of truth.  By now, you would be really miffed if I ended this by saying I roached my box and had to start all over.  I would have been upset too.  The end result was that I got a grub loader message displaying my default OS (FC14) with a 15 sec countdown.  If you hit the ESC key, it will stop the timer and give you all the options.

So, this was an exciting adventure in Linux, being something that I have never done before.  The scary parts were actually repartitioning the drive, reloading the the Grub bootloader, and finally editing the grub.conf file (I once brought a Linux box down to it knees by fooling with the MBR).

FINAL SAFETY TIP: BACK UP YOUR LINUX OS PRIOR TO ATTEMPTING ANY OF THIS.

So there you have it.  A very scary and exciting fix to what could have been a night of reloading.  I hope you found this helpful.  If you would like more details about the partitioning and MBR process, just let me know.