BeagleBoardBeginners

From eLinux.org
Revision as of 22:29, 12 September 2008 by Dirk (talk | contribs) (Add beginners text)
Jump to: navigation, search

This is the "community" beginners guide for TI's ARM based OMAP3 Beagle Board. For "official" beginners guide see My Beagle Board Out of the box experience. If something doesn't work or isn't covered in these guides, please feel free to ask at IRC or mailing list. But before you ask there, make sure you read the FAQs.

So I got this little board, what do I do now?

Checking everything is working

First of all you might want to check it for possible defects. To do so, connect a mini-usb cable to the board and to a computer in the other end. If everything's alright you should see one led lighting and, after a short while, two more leds coming up too. Also, if you connect some speakers or headphones to the audio output you should hear a burst noise when starting the board.

Serial connection

Connect a serial (COM port) cable to the port in the board, it's the 10 pin one next to the power input. Actually the pin number 10 is not gonna be used, so if you got one of those connectors with only 9 holes you can just drill one. I used a hot needle for this purpose and it worked.

Now you need a male-male serial cable, it took me a while to find one, finally I used the ones that come with some switches.

First interaction with the board

Connect the serial cable to the COM port in the beagleboard, and connect the other end to the COM port in the computer. Run minicom setup as root:

#minicom -s

You'll get a screen as follows:

           +-----[configuration]------+                                        
           | Filenames and paths      |                                        
           | File transfer protocols  |                                        
           | Serial port setup        |                                        
           | Modem and dialing        |                                        
           | Screen and keyboard      |                                        
           | Save setup as dfl        |                                        
           | Save setup as..          |                                        
           | Exit                     |                                        
           | Exit from Minicom        |                                        
           +--------------------------+                                        

Select Serial port setup:

   +-----------------------------------------------------------------------+   
   | A -    Serial Device      : /dev/ttyS1                                |   
   | B - Lockfile Location     : /var/lock                                 |   
   | C -   Callin Program      :                                           |   
   | D -  Callout Program      :                                           |   
   | E -    Bps/Par/Bits       : 9600 8N1                                  |   
   | F - Hardware Flow Control : Yes                                       |   
   | G - Software Flow Control : No                                        |   
   |                                                                       |   
   |    Change which setting?                                              |   
   +-----------------------------------------------------------------------+   
           | Screen and keyboard      |                                        
           | Save setup as dfl        |                                        
           | Save setup as..          |                                        
           | Exit                     |                                        
           | Exit from Minicom        |                                        
           +--------------------------+                                        

Now press E to change those settings:

                   +-----------[Comm Parameters]------------+                  
   +---------------|                                        |--------------+   
   | A -    Serial | Current: 115200 8N1                    |              |   
   | B - Lockfile L|                                        |              |   
   | C -   Callin P|   Speed          Parity          Data  |              |   
   | D -  Callout P|                                        |              |   
   | E -    Bps/Par| A: 300           L: None         S: 5  |              |   
   | F - Hardware F| B: 1200          M: Even         T: 6  |              |   
   | G - Software F| C: 2400          N: Odd          U: 7  |              |   
   |               | D: 4800          O: Mark         V: 8  |              |   
   |    Change whic| E: 9600          P: Space              |              |   
   +---------------| F: 19200                      Stopbits |--------------+   
           | Screen| G: 38400                         W: 1  |                  
           | Save s| H: 57600                         X: 2  |                  
           | Save s| I: 115200        Q: 8-N-1              |                  
           | Exit  | J: 230400        R: 7-E-1              |                  
           | Exit f|                                        |                  
           +-------|                                        |                  
                   | Choice, or <Enter> to exit?            |                  
                   +----------------------------------------+                  

You should get 115200 8N1, press keys I, L, V and W. When you're done, press Enter.

Now in the previous screen, press F to set Hardware Flow Control to Off. You should have this now:

   +-----------------------------------------------------------------------+   
   | A -    Serial Device      : /dev/ttyS1                                |   
   | B - Lockfile Location     : /var/lock                                 |   
   | C -   Callin Program      :                                           |   
   | D -  Callout Program      :                                           |   
   | E -    Bps/Par/Bits       : 115200 8N1                                |   
   | F - Hardware Flow Control : No                                        |   
   | G - Software Flow Control : No                                        |   
   |                                                                       |   
   |    Change which setting?                                              |   
   +-----------------------------------------------------------------------+   
           | Screen and keyboard      |                                        
           | Save setup as dfl        |                                        
           | Save setup as..          |                                        
           | Exit                     |                                        
           | Exit from Minicom        |                                        
           +--------------------------+                                        
                                                                               

Press Enter to leave this screen and select Exit from Minicom next.

Now run minicom as root:

#minicom

You should get the following screen:

Welcome to minicom 2.2

OPTIONS:                                                                     
Compiled on Sep  8 2008, 17:03:34.                                           
Port /dev/ttyS0                                                              
                                                                            
              Press CTRL-A Z for help on special keys                       
                                                                            
                                                                            
                                                                            
Texas Instruments X-Loader 1.41                                              
Starting OS Bootloader...                                                    
                                        
U-Boot 1.3.3 (Jul 10 2008 - 16:33:09)   
                                        
OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz   
OMAP3 Beagle Board + LPDDR/NAND         
DRAM:  128 MB                           
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Audio Tone on Speakers  ... complete
OMAP3 beagleboard.org # 

If you don't, check the serial port. You'll have to go back to the config (minicom -s) and get to this screen:

   +-----------------------------------------------------------------------+   
   | A -    Serial Device      : /dev/ttyS1                                |   
   | B - Lockfile Location     : /var/lock                                 |   
   | C -   Callin Program      :                                           |   
   | D -  Callout Program      :                                           |   
   | E -    Bps/Par/Bits       : 9600 8N1                                  |   
   | F - Hardware Flow Control : Yes                                       |   
   | G - Software Flow Control : No                                        |   
   |                                                                       |   
   |    Change which setting?                                              |   
   +-----------------------------------------------------------------------+   
           | Screen and keyboard      |                                        
           | Save setup as dfl        |                                        
           | Save setup as..          |                                        
           | Exit                     |                                        
           | Exit from Minicom        |                                        
           +--------------------------+     

Now press A and change /dev/ttyS1 for /dev/ttyS0, or 2 or 3, depending on which port you have it connected. In my case it was 0.

Now we got the beagleboard shell! Congratulations!

First command we wanna try is "help":

OMAP3 beagleboard.org # help

If you get some output, you're happy!

SD card setup

Now we wanna use an SD card to install some Gnu/Linux distro in it and get more space for our stuff. You should know that you are not dealing with an x86 processor, this is a completely different architecture called ARM, so don't even try to install a normal distro here.

Since the steps for getting this to work are already written down in the wikis, I'll copy the information, pointing out some extra things you should take care of.

First of all, we wanna set up the SD card to be used as a boot disk, let's plug it to our PC card reader and see what the wiki page says:

[1]

In order to create a bootable SD/MMC card under Linux compatible with OMAP3 boot ROM, you'd have to set a special geometry in the partition table, which is done through the fdisk "Expert mode".

First, lets clear the partition table:

================================================================================
# fdisk /dev/sdb

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 
================================================================================

Print card info:

================================================================================
Command (m for help): p

Disk /dev/sdb: 128 MB, 128450560 bytes
....
================================================================================

Note card size in bytes. Needed later below.

Then go into "Expert mode":

================================================================================
Command (m for help): x
================================================================================

Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD/MMC card:

================================================================================
Expert command (m for help): h
Number of heads (1-256, default 4): 255

Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
================================================================================

NOTE: Be especially careful in the next step. First calculate the number of cylinders as follows:

  • B = Card size in bytes (you got it before, in the second step when you printed the info out)
  • C = Number of cylinders
C=B/255/63/512

When you get the number, you round it DOWN. Thus, if you got 108.8 you'll be using 108 cylinders.

================================================================================
Expert command (m for help): c
Number of cylinders (1-1048576, default 1011): 15
================================================================================

In this case 128MB card is used (reported as 128450560 bytes by fdisk above), thus 128450560 / 255 / 63 / 512 = 15.6 rounded down to 15 cylinders. Numbers there are 255 heads, 63 sectors, 512 bytes per sector.

So far so good, now we wanna create two partitions. One for the boot image, one for our distro. Let's check what another wiki page has to say about it:

[2]

Create the FAT32 partition for booting and transferring files from Windows. Mark it as bootable.

================================================================================
Command (m for help): [n]
Command action
  e   extended
  p   primary partition (1-4)
[p]
Partition number (1-4): [1]
First cylinder (1-245, default 1): [(press Enter)]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): [+50]

Command (m for help): [t]
Selected partition 1
Hex code (type L to list codes): [c]
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): [a]
Partition number (1-4): [1]
================================================================================

Create the Linux partition for the root file system.

================================================================================
Command (m for help): [n]
Command action
  e   extended
  p   primary partition (1-4)
[p]
Partition number (1-4): [2]
First cylinder (52-245, default 52): [(press Enter)]
Using default value 52
Last cylinder or +size or +sizeM or +sizeK (52-245, default 245):[(press Enter)]
Using default value 245
================================================================================

Print and save the new partition records.

================================================================================
Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          51      409626    c  W95 FAT32 (LBA)
/dev/sdc2              52         245     1558305   83  Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information.
Syncing disks.
================================================================================

Now we got both partitions, next step is formatting them.

================================================================================
# mkfs.msdos -F 32 /dev/sdc1 -n LABEL
mkfs.msdos 2.11 (12 Mar 2005)

# mkfs.ext3 /dev/sdc2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
195072 inodes, 389576 blocks
19478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks: 
       32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: 
================================================================================

All done!

Writing the angstrom image into the SDcard and finally booting GNU/Linux

Now we got this two partitions, in the first one we're gonna write the boot image and other stuff, while in the other one we're gonna write our Angstrom root filesystem.

First of all, let's download the files we're gonna need from:

[3]

Get the latest Angstom demo image (Angstrom-Beagleboard-demo-image......), MLO, u-boot and uImage.

Now you've gotta copy MLO, u-boot and uImage into the first partition (the FAT32 one) of your SD card. Do it in this strict order, since MLO's gotta be in the first sectors of the card.

Mount both partitions somewhere, I'll assume they're mounted in /mnt/sda1 and /mnt/sda2 respectively.

#cp MLO /mnt/sda1
#cp u-boot /mnt/sda1
#cp uImage /mnt/sda1

Now let's copy the root filesystem into the other partition (the ext3 one):

#cp Angstrom-Beagleboard-demo-image..... /mnt/sda2

And untar it:

#cd /mnt/sda2
#tar -jxvf Angstrom-Beagleboard-demo-image....

Once it's done, delete the tarball:

#rm Angstrom-Beagleboard-demo-image....

And unmount both partitions.

#umount /mnt/sda1
#umount /mnt/sda2

Ok, we're almost done. Now we've gotta tell our BeagleBoard that we want it to boot from the SD card. Let's go back to our almost forgotten minicom shell:

OMAP3 beagleboard.org #

The commands to set it up for booting from SD are:

# setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1'
# setenv bootcmd 'mmcinit;fatload mmc 0 80300000 uImage;bootm 80300000'

Now we wanna save this variables into the NAND:

# saveenv

And, YES, we're done.

Connect the BeagleBoard to a screen using a DVI cable and press the reset button. Now you've gotta be PATIENT, first boot takes a looooong time.

Important

If you're using a USB hub, be sure it's a self-powered one. That means, it should have a power input which you can connect to a power socket, otherwise the BeagleBoard won't be able to bear with too many devices and it will power-cycle itself all the time.

Thanks to

_vlad jkridner ds2

And the rest of the people in the #beagle IRC channel, if you cannot go through some of the steps, don't hesitate to ask there, there's always somebody willing to help you!