How to Install Arch Linux on BeagleBone White | BBW

How to Install Arch Linux on BeagleBone White | BBW

BeagleBone White BBW Arch Linux

The first member of the BeagleBone family is the BeagleBone White
, also referred to as just the BeagleBone. The white portion was added after they came out with a black board with different specs. The BeagleBone White is a small credit card sized board. It is meant to expand physical computing for all with a low entry point and a solid community base for support. It caters to the entry and mid level hardware hacker, but is not limited only to that area. For what the BeagleBone White is, it’s a very powerful device with many expansion options.

When you buy the BeagleBone White it comes with a preloaded SD-Card that has the Angstrom distribution. While Angstrom has it’s place as a Linux embedded OS, I personally have found the build system to be overly complicated and the packages do not stay close enough to upstream for my tastes, some worse than running a LTS distro. Constant breakages in all areas just drove me nuts. I tried to use them many times over the years when I got my first COM device a gumstix overo. But very little overall changes have been done in my opinion since ’09.

As I use most of my embedded toys for Penetration testing, I need the cutting edge or as close to it that I can get to make sure I have the most current tools, working as they should.
In a future post I will be showing how to setup a basic Pentesting Drop Box.

I am doing all this from a Arch Linux box and will work with other Linux Distros.

Install ArchLinuxARM on BeagleBone White

BeagleBone White BBW Arch Linux ArchLinuxARM
Here is what you will need to get going:

  • BeagleBone White
  • A blank SD-Card to use for the OS
  • Working from a Linux distro, this can be a VM

The install process is relatively simple if you’re comfortable working with the Linux CLI. Beginners can easily do this as well if you take your time and not get frustrated if you do not get it the first time. We all had to begin someplace, just understand what you are doing and why. Mostly importantly be careful when working with the file system during the SD-Card setup.

Setup the SD-Card

Go ahead and put the SD-Card into your card slot on your dev box. We now need to find the device name of the card.

ls -lah /dev/ | grep mmc
brw-rw----   1 root disk      179,   0 Jul 31 06:06 mmcblk0
brw-rw----   1 root disk      179,   1 Jul 31 06:06 mmcblk0p1
brw-rw----   1 root disk      179,   2 Jul 31 06:06 mmcblk0p2

What we have done here is list all the possible devices for the SD-Card. You see in this grep of /dev we currently have 3.
The main card itself is

mmcblk0

The existing partitions are

mmcblk0p1
mmcblk0p2

An easy way to verify this is the proper card to work with you could just eject the card, run the above grep command again and they should be gone now. Another method you could use would be to grep the dmesg output.

dmesg | tail
[164300.142568] mmc0: new high speed SDHC card at address 1234
[164300.219888] mmcblk0: mmc0:1234 SA04G 3.63 GiB 
[164300.221627]  mmcblk0: p1 p2

With this being the last entry it is safe to assume this is the card you just inserted.

Now that we know the SD-Card device name we can go ahead and start preparing the card with its partition layout. We will be using fdisk to work with the SD-Card and create our partitions then format to their requirements.

Remember to use your device name if different!!!!!!

If you have never used fdisk before it can look a little intimidating. If you would like to familiarize yourself more with it before you continue run this command

man fdisk

This will open the MAN page for fdisk, if you are not familiar with the MAN pages this is basically your manual for the software you are going to use, pretty much everything on a Linux box has MAN files.

It is of the utmost importance to make sure you use the proper device with the following portion, if you do not use the correct one you WILL BE deleting the contents of whichever device/partition you choose. Please be careful.

OK lets load the SD-Card into fdisk

sudo fdisk /dev/mmcblk0

We want to delete anything that is already on the card.

sudo fdisk /dev/mmcblk0 
[sudo] password for YourUserName: 
Welcome to fdisk (util-linux 2.23.1).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): o
Building a new DOS disklabel with disk identifier 0x6791a9b9.

We have now started fdisk with our card. Pressing o (that is not a zero, but lower case letter o) is going delete the existing partition table, at this point the change has not been written.

Next we are going to want to press p this will list all partition tables. This is to verify the above command has cleared it out for you.

Command (m for help): p

Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes, 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x6791a9b9

        Device Boot      Start         End      Blocks   Id  System

Now we need to start creating the new partitions. You will want to press n to create the new partition, p will set the new partition as the primary one, 1 sets this to be the first partition. When it gets the to first sector section you can select the default by just pressing enter. Now we are going to set the size to 64MB.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-1983999, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1983999, default 1983999): +64M
Partition 1 of type Linux and of size 64 MiB is set

From here we need to set the partition type for our newly created partition.

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): e

WARNING: If you have created or modified any DOS 6.xpartitions, please see the fdisk manual page for additional information.

Changed type of partition 'Linux' to 'W95 FAT16 (LBA)'

Pressing t selects type, then e will select FAT16.

Now lets set it with a bootable flag

Command (m for help): a
Selected partition 1

Command (m for help): p

Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes, 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xae5de511

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      133119       65536    e  W95 FAT16 (LBA)

Pressing a sets it bootable, since there is only one partition at this point it is automatically going to select the one we just created.

Lets create the second partition, this is the one where the actual OS is going to be stored. It is very similar to the above process.

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (133120-1983999, default 133120): 
Using default value 133120
Last sector, +sectors or +size{K,M,G} (133120-1983999, default 1983999): 
Using default value 1983999
Partition 2 of type Linux and of size 903.8 MiB is set

Command (m for help): p

Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes, 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xae5de511

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      133119       65536    e  W95 FAT16 (LBA)
/dev/mmcblk0p2          133120     1983999      925440   83  Linux

Press n to create a new partition, p to set it primary, 2 to make it the second one. Pressing p again will list all the partitions you now have.

Here is where everything gets written to the card, this is your last chance to get out before making permanent changes to the card

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Everything is now saved to the SD-Card, we are almost done creating the card to install the OS. We have to format the partitions now so they can be used.
Remember to make sure you select the correct partitions in the step below this can be a dangerous step.
Partition 1

sudo mkfs.vfat -F 16 /dev/mmcblk0p1 

Partition 2

mkfs.ext4 /dev/mmcblk0p2

Notice that I selected the first and second partitions, not the main partition of the device. Now the SD-Card is complete and ready for you to install an OS on. At this point you can install any OS that is compatible with the BeagleBone White.

Install the ArchLinuxARM OS on BeagleBone White

We are going to need to download some files to get everthing setup. To make it easy lets go ahead and create a new folder and then move into it

cd $HOME && mkdir BeagleBoneWhite && cd BeagleBoneWhite

Lets download the bootloader and the OS tarball we are going to need

wget http://archlinuxarm.org/os/omap/BeagleBone-bootloader.tar.gz
wget http://archlinuxarm.org/os/ArchLinuxARM-am33x-latest.tar.gz

We need to create a folder and mount our first partition on it. This is going to be so we can setup the bootloader on the SD-Card. If you have ejected your card for any reason put it back in and verify it still has the same device name.

mkdir boot 
sudo mount /dev/mmcblk0p1 boot 
tar -xvf BeagleBone-bootloader.tar.gz -C boot 
sudo umount boot

What we have done is make the directory, mount the first partition to the directory we just made, untar’d the bootloader, then unmounted the partition
If you happen to get the following error

tar: Cannot change ownership to uid 1001, gid 1001: Operation not permitted

This is do to tar and older FAT file systems and the default action for the root user (or if using sudo) it attempts to keep the ownership of the files originally stored in tar. To keep this from happening when using tar just add the following flag

--no-same-owner

We are going to need to do the same now for the second partition for the actual OS.

mkdir root 
sudo mount /dev/mmcblk0p2 root 
tar -xf ArchLinuxARM-am33x-latest.tar.gz -C root 
sudo umount root

Basically performing the same steps above but for the OS. If you are not that familiar with tar the -C flag lets you tell it where to put the files its extracting.

You now have a complete ArchLinuxARM SD-Card that is ready to use in your BeagleBone White. Just remove the card from your system, place it in your board, power it with your method of choice and you are off. On the first boot of the OS it can take some time as it sets everything up and gets going. The subsequent boots will not take as long.

From here you can ssh in or setup a terminal connection. For some basics with ArchLinuxARM on a BeagleBone device you can check out this tutorial. root root is your default username and password. Be sure to change your default password ASAP, with something secure and strong.

What are you doing with your Beagle’s? Feel free to share what you are working on.

Follow Me on twittergoogle_plustwittergoogle_plus
Share This on twittergoogle_plustwittergoogle_plus

Last updated by on .


Leave a Reply