Bob Hartwig's thoughts on Raspberry Pi, microcontrollers, etc.
BeagleBone Black – preparing to run Debian
or Ubuntu from the microSD card
In one of my first posts to this blog, I described how I
prepare an SD card for running Raspbian
on a Raspberry Pi
. The scripts that I described in that post go well beyond simply copying the
Raspbian image to the SD card – they also mount the newly imaged partitions, update the
firmware, configure the hostname, static IP address, and other things, getting the card most of
the way set up before the card is ever booted in the target Raspberry Pi.
Because I’ve been doing more and more with my
BeagleBone Black, I decided to adopt those
Raspbian scripts to similarly prepare a fresh microSD card for use in a BBB. These scripts
prepare the microSD card for running the OS directly from the card, not for flashing the onboard
eMMC memory. I’ll describe my scripts for that in a future post. I run the
preparecard
script described below from my main Raspberry Pi, but you can run it from a BeagleBone Black,
or any other Linux system.
On the main Linux system
This screenshot shows the directory from where I prepare my BBB cards for Debian:
BeagleBone Black – preparing to run Debian or Ubuntu from the microSD card | Ti... Seite 1 von 5
Sie müssen registriert sein, um Links zu sehen.
... 30.09.13
The
debian-user-scripts and bbb-user-scripts directories get copied onto the target card, and each
contains a script to be used upon first booting into the new system as the
debian user, and then
as the new
bbb user. More on those below.
The
preparecard script is the business end of all of this. It does the following:
• It downloads the latest Debian demo image from Circuitco, as described
on this page
• It verifies the SHA1 hash of the newly downloaded compressed image file.
• It uncompresses and copies the image file onto the microSD card in the card reader. Please
note that the script assumes that your card reader shows up as
/dev/sda . That should hold
true for a Raspberry Pi or BBB, but if your Linux system is different, be sure to edit the
script before running it.
• It creates a temporary mount point for the new card’s root partition.
• It temporarily mounts the card’s root partition, and then tweaks some settings and installs
some scripts onto the card. These tweaks include setting the hostname, and setting a static
IP address.
• It unmounts the card, and removes the temporary mount point.
• It displays some final instructions on how to use
fdisk to expand the root partition to fill all
free space on the card.
You can download this script from a link at the bottom of this post. Please note that you will
almost certainly want to edit the variables at the top of the script to match your preferred
hostname and IP address. Once you insert your new micro SD card’s USB card reader, and verify
that it shows up at
/dev/sda, go ahead and run the script:
./preparecard
BeagleBone Black – preparing to run Debian or Ubuntu from the microSD card | Ti...
Seite 2 von 5
Sie müssen registriert sein, um Links zu sehen.
... 30.09.13
…
your new card will have a fresh install of Debian, with the above-mentioned customizations.
The USB-attached SD card will be unmounted, so you can simply remove it and plug it into the
micro SD card slot of your target BeagleBone Black.
On the target BeagleBone Black
Now insert your newly prepared card into the micro SD card slot, and power it up. Because our
script configured a static IP address, you should be able to immediately SSH into the new system
as user
debian, password debian. Your home directory should have a firstrun script. Execute this
script
…
./firstrun
…
and the following should happen:
• A new
bbb user is created, and you are prompted to set the user’s password.
• The home directory for the new
bbb user is prepared.
Once this finishes, log out, and then log back in as the new
bbb user, and run the firstrun script in
the bbb user’s home directory:
./firstrun
This script does the following:
• It updates the packages on the system.
• It configures the timezone.
• It prompts for a new root password
• It installs the
screen package. Screen is a utility that I cannot live without when working with
any headless Linux system.
Once you follow these simple steps, you should be good to go – your system should be up to
date, and you can log in as the
bbb user, or as root.
What about Ubuntu?
BeagleBone Black – preparing to run Debian or Ubuntu from the microSD card | Ti... Seite 3 von 5
Sie müssen registriert sein, um Links zu sehen.
...
30.09.13
The procedure for imaging and preparing Ubuntu are so similar to imaging and preparing
Debian, the scripts are almost identical. Ubuntu uses a different technique for specifying a DNS
name server, so that portion of the script is slightly different, and of course the URL for
downloading the Ubuntu image is different (see
this page for details). And instead of a debian
user with a password of
debian , the initial user is named ubuntu, with password ubuntu.
Downloads
• If you wish to use Debian:
• Here is the
preparecard script: preparecard
• Here is the debian user’s
firstrun script: firstrun – place this into the debian-userscripts
subdirectory.
• Here is the bbb user’s
firstrun script: firstrun – place this into the bbb-user-scripts
subdirectory.
• If you wish to use Ubuntu:
BeagleBone Black – preparing to run Debian or Ubuntu from the microSD card | Ti...
Seite 4 von 5
Sie müssen registriert sein, um Links zu sehen.
... 30.09.13
• Here is the
preparecard script: preparecard
• Here is the ubuntu user’s
firstrun script: firstrun – place this into the ubuntu-userscripts
subdirectory.
• Here is the bbb user’s
firstrun script: firstrun – place this into the bbb-user-scripts
subdirectory.
This entry was posted in BeagleBone Black on September 29, 2013
[
Sie müssen registriert sein, um Links zu sehen.
from-the-microsd-card/] by Bob Hartwig.
BeagleBone Black – preparing to run Debian or Ubuntu from the microSD card | Ti... Seite 5 von 5
http://