BBB Angstrom image

From Crashcourse Wiki

Jump to: navigation, search

Contents

Overview

Once you download (and uncompress) an eMMC Flasher image such as this one (363M), it's fun to poke around to see the internal structure.

Top-level structure

First, you can see that if you want to copy the (uncompressed) image file to a micro SD card to boot from it, you'll need a 4G card:

$ ls -l BBB-eMMC-flasher-2013.05.03.img 
-rw-rw-r-- 1 rpjday rpjday 3657433088 May  6 10:05 BBB-eMMC-flasher-2013.05.03.img
$

Use file to see the image file type:

$ file BBB-eMMC-flasher-2013.05.03.img 
BBB-eMMC-flasher-2013.05.03.img: x86 boot sector; partition 1: ID=0xc, active, starthead 1, startsector 63, 144522 sectors; partition 2: ID=0x83, starthead 0, startsector 144585, 6988275 sectors, code offset 0x0
$

Use fdisk to see the internal partitioning:

$ fdisk -l BBB-eMMC-flasher-2013.05.03.img 

Disk BBB-eMMC-flasher-2013.05.03.img: 3657 MB, 3657433088 bytes
255 heads, 63 sectors/track, 444 cylinders, total 7143424 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 identifier: 0x00000000

                          Device Boot      Start         End      Blocks   Id  System
BBB-eMMC-flasher-2013.05.03.img1   *          63      144584       72261    c  W95 FAT32 (LBA)
BBB-eMMC-flasher-2013.05.03.img2          144585     7132859     3494137+  83  Linux
$

Mounting the internal partitions with kpartx

If you're unfamiliar with kpartx for mounting partitions within an image file, there are various tutorials like this one. So first, on this 64-bit Ubuntu system, examine the initial contents of the /dev/mapper directory -- nothing special:

$ ls -l /dev/mapper
total 0
crw------- 1 root root 10, 236 Apr 30 16:26 control
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-home -> ../dm-4
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-root -> ../dm-0
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-srv -> ../dm-5
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-tmp -> ../dm-1
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-usr -> ../dm-3
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-var -> ../dm-2
$

Now use kpartx to create new device files associated with the partitions in the image file and check the result:

$ sudo kpartx -a -v BBB-eMMC-flasher-2013.05.03.img 
add map loop0p1 (253:6): 0 144522 linear /dev/loop0 63
add map loop0p2 (253:7): 0 6988275 linear /dev/loop0 144585
$ sudo kpartx -l BBB-eMMC-flasher-2013.05.03.img 
loop0p1 : 0 144522 /dev/loop0 63
loop0p2 : 0 6988275 /dev/loop0 144585
$

where the new devices files show up under /dev/mapper:

$ ls -l /dev/mapper
total 0
crw------- 1 root root 10, 236 Apr 30 16:26 control
lrwxrwxrwx 1 root root       7 May  6 08:25 loop0p1 -> ../dm-6   <-- there ...
lrwxrwxrwx 1 root root       7 May  6 08:25 loop0p2 -> ../dm-7   <-- ... and there
lrwxrwxrwx 1 root root       7 Apr 30 16:26 vg1-home -> ../dm-4
... snip ...
$

at which point we can move on to mounting and examining them as you would with any other filesystems. And when you're done, unmount the filesystems and remove those device files with:

$ sudo kpartx -d BBB-eMMC-flasher-2013.05.03.img

Contents of image partitions

Using the standard mount command, you can then mount those internal partitions to regular directories to see the following.

FAT partition

$ ls -l
total 474
-rwxr-xr-x 1 root root     41 May  3 16:42 ID.txt
-rwxr-xr-x 1 root root  99904 May  3 17:13 MLO
-rwxr-xr-x 1 root root 378948 May  3 17:13 u-boot.img
-rwxr-xr-x 1 root root     14 Mar 18 11:01 uEnv.txt
$
$ cat ID.txt 
BeagleBone Black eMMC flasher 2013.05.03
$
$ cat uEnv.txt 
optargs=quiet
$

Linux partition

Just the top level for now -- maybe more later:

$ ls -l
total 84
drwxr-xr-x.  2 root root  4096 Mar 18 06:45 bin
drwxr-xr-x.  2 root root  4096 Mar 18 06:45 boot
drwxr-xr-x.  2 root root  4096 May  3 10:43 build
drwxr-xr-x.  3 root root  4096 Mar  5 04:06 dev
-rw-r--r--.  1 root root    12 Mar 13 08:17 eeprom.dump
drwxr-xr-x. 35 root root  4096 Mar 27 08:03 etc
drwxr-sr-x.  4 root root  4096 Mar 12 06:12 home
drwxr-xr-x.  9 root root  4096 Mar 16 04:37 lib
drwx------   2 root root 16384 Mar 12 07:39 lost+found
drwxr-xr-x. 10 root root  4096 Mar 12 06:12 media
drwxr-xr-x.  2 root root  4096 Mar 12 06:12 mnt
drwxr-xr-x.  2 root root  4096 Mar  5 04:06 proc
drwxr-xr-x.  2 root root  4096 Mar  5 04:06 run
drwxr-xr-x.  2 root root  4096 Mar 27 08:03 sbin
drwxr-xr-x.  2 root root  4096 Mar  5 04:06 sys
drwxrwxrwt.  2 root root  4096 Mar  5 04:06 tmp
drwxr-xr-x.  9 root root  4096 Mar 20 06:40 usr
drwxr-xr-x. 12 root root  4096 Oct 19  2012 var
$


(Back to BeagleBone Black page.)

Personal tools