EmbeddedRelated.com
Blogs

How to install Ubuntu 12.04 Precise, Xubuntu-desktop and Open JDK-7 on Beagleboard Rev. C2

Tayyar GUZELJuly 25, 20124 comments

My aim was to install Ubuntu 12.04, Xubuntu-desktop graphical user interface and Java virtual machine (Open JDK-7) on my beagleboard so that I could run my java application on the monitor connected to the BB. I encountered several problems and solved them one by one. Following is how I've done it..

I had all the accesorries for the beagleboard (usb hub, dvi-to-hdmi cable, usb-ethernet converter, usb keyboard, usb mouse and a hdmi enabled monitor).

My host PC also has a Ubuntu 12.04 installed and it was connected to the internet through my smart phone's wireless access point during the installation..

You need a 4GB or 8GB blank SD card to install the three. I do not recommend 2GB SD card since there will be almost no place in the SD card after installing the three. 

1) Connect your Beagleboard to your PC via a serial cable

2) Run a terminal and start minicom to access your Beagleboard

root@tayyar:~# minicom -s

Make sure you set the serial communication parameters correctly as 115200, 8N1, No HW Flow Control.

3) Open another terminal to configure your host PC during the installation

4) Get all the required packages for Step 6 & Step 7. If you already have all of these installed you can skip this.

root@tayyar:~# sudo apt-get install wget xz-utils uboot-mkimage pv dosfstools btrfs-tools parted git

5) Instert the SD card in your computer.

6) Get the processor flashing script.

root@tayyar:~# git clone git://github.com/RobertCNelson/flash-omap.git
root@tayyar:~# cd flash-omap

7) Get the location of your sd card.

root@tayyar:flash-omap# sudo ./mk_mmc.sh --probe-mmc

You will see something like:

    Are you sure? I Don't see [/dev/idontknow], here is what I do see...
    fdisk -l:
    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    Disk /dev/sdb: 3957 MB, 3957325824 bytes
    mount:
    /dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)

/dev/sdb is my SD card. Your’s might have a different name and size. Notice that /dev/sda is 160.0GB, that’s my hardrive, do not accidentally format yours!


8) Download Ubuntu 12.04 and unpack it,

a) download  

wget http://rcn-ee.net/deb/rootfs/precise/ubuntu-12.04-r3-minimal-armhf.tar.xz
mirrors (will take some time to update):

wget http://ynezz.ibawizard.net/beagleboard/precise/ubuntu-12.04-r3-minimal-armhf.tar.xz

  b) verify the package

root@tayyar:~# md5sum ubuntu-12.04-r3-minimal-armhf.tar.xz
ecda26197d3f5279b8db0a74a486008c  ubuntu-12.04-r3-minimal-armhf.tar.xz

  c) unpack the prebuilt image,

root@tayyar:~# tar xJf ubuntu-12.04-r3-minimal-armhf.tar.xz
root@tayyar:~# cd ubuntu-12.04-r3-minimal-armhf

9) Create the SD card content

root@tayyar:ubuntu-12.04-r3-minimal-armhf# sudo ./setup_sdcard.sh --mmc /dev/sdb --uboot "beagle_cx"

Notice that my SD card is /dev/sdb.. yours could be different.. You should know this from Step 7.

10) Remove the SD card from your PC and insert it into Beagleboard.
11) Pushing on the "User" button, reset the beagleboard.
12) As the u-boot console is counting down from a number "10..9..8..7.. ...".. press "Enter"..

You should see the Beagleboard u-boot console,

OMAP3 beagleboard.org #

13) Check the content of the SD card by using "fatls" command

OMAP3 beagleboard.org # mmc rescan
OMAP3 beagleboard.org # fatls mmc 0:1
    45876   mlo                                                                
   337932   u-boot.img                                                         
  3000856   zimage                                                             
  3061227   initrd.img                                                         
      919   uenv.txt                                                           
            tools/                                                             
        0   uenv.txt~                                                          
                                                                               
6 file(s), 1 dir(s)         

14) Once you see the files listed above in the SD card, you could now write the image files into the flash memory (NAND). Type the following commands to do so.

    mmc rescan         
        fatload mmc 0:1 0x80200000 mlo
        nand erase 0 80000
        nand write 0x80200000 0 20000
        nand write 0x80200000 20000 20000
        nand write 0x80200000 40000 20000
        nand write 0x80200000 60000 20000
                  
        fatload mmc 0:1 0x80300000 u-boot.img
        nand erase 80000 160000
        nand write 0x80300000 80000 160000
        nand erase 260000 20000

15) Reboot the Beagleboard and wait until it the login screen comes. Use the following username and password to login,

Ubuntu 12.04 LTS omap ttyO2                                                                                           
                                                                                                                      
omap login: ubuntu
Password: temppwd

Last login: Wed Dec 31 18:04:25 CST 1969 on tty02                                                                                              
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.19-x13 armv7l)
                                                                                                                                                                                                                                    
 * Documentation:  https://help.ubuntu.com/                                                                           
ubuntu@omap:~$

I recommend you to become "root" to proceed so that you don't encounter permission problems during the installations..

ubuntu@omap:~$ sudo -s

enter "temppwd" as your password.. now you should see the root console..

root@omap:~#

It is time to configure our network and access internet to proceed the installation of XFCE4 and Open JDK.

In my case, my internet source was my wireless AP in my room and I connected my ethernet cable to a hub to communicate with Beagleboard via network. Finally, my Beagleboard will acces the internet through my wired ethernet. Since there is no physical connection between my beagleboard and wireless adapter on my host PC, I needed to share my ethernet with both wireless and beagleboard ethernet interfaces. Following describes how you can do it.

16) On your host Linux (Ubuntu 12.04 Precise), set your wired eth0 IP address as the following

-> go to System Settings->Network->Wired->Options->IPV4 Settings->set the Method to "Shared to other computers"

17) Check your wired IP address using "ifconfig" on your host PC

18) set the target IP on the Beagleboard accordingly,

root@omap:~# ifconfig eth0 10.42.0.2 netmask 255.255.255.0 up

you should set this IP according to your host IP address so that they exist in the same network.

19) set the Gateway IP on Beagleboard

root@omap:~# route add default gw 10.42.0.1 eth0

Notice that you set the host Linux eth0 IP address as the gateway on your beagleboard.

20) Configure your nameserver (DNS) by editing resolv.conf

root@omap:~# vi /etc/resolv.conf
 
add the following lines anywhere in the file,

nameserver 208.67.220.220
nameserver 8.8.8.8

21) you should be able to ping to any IP on the internet

root@omap:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=43 time=493 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=42 time=1293 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=42 time=868 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=42 time=688 ms
^C
--- 8.8.8.8 ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4006ms
rtt min/avg/max/mdev = 493.835/836.044/1293.606/295.547 ms, pipe 2
root@omap:~#

22) Now it is time to install Xubuntu-desktop on the Beagleboard.

root@omap:~# sudo apt-get update
root@omap:~# sudo apt-get install gdm xubuntu-desktop
root@omap:~# sudo apt-get install xfce4 xserver-xorg-video-omap3 network-manager

Once the Xubuntu installation is done, reboot your Beagleboard..

Bad news is, Xubuntu won't successfully start.. 

Now it is time to fix the problem..

a) Remove the SD card from your Beagleboard and insert it into your host PC. 
b) Edit "uEnv.txt"
c) Add the line "console=tty0" under the line where it is written "optargs=console=tty0"
d) Change the "dvimode=1280x720MR-16@60" to "dvimode=1024x768MR-16@60"

Once you're done editing uEnv.txt, remove the SD card from the host PC and insert it into the BB again and reboot the beagleboard.

Another problem is, XFCE4 won't allow you to login due to permission and ownership problems of the default user account..

23)  You need to add a new user and give it the root rights and change the ownership..

a) create the user,
root@omap:~# adduser genius

b) set a password for the user,
root@omap:~# passwd genius

c) Edit the /etc/passwd file using "vi" to make the user root.

change the line from

genius:x:1001:1004:Genius User,207,,:/home/genius:/bin/bash

to

genius:x:0:0:Genius User,207,,:/home/genius:/bin/bash

d) Reboot the beagleboard and login with your new username ("genius" in my case)

add the following line to your .bashrc

root@omap:~# chown genius:genius .ICEauthority
root@omap:~# chmod 644 /home/genius .ICEauthority

reboot the beagleboard.. Once the login screen comes, you should now be able to login with the new user..

24) A known problem of Beagleboard is that once the Ubuntu is installed on the BB, the sound does not properly work.. To try this out, do the following..

a) record your voice

root@omap:~# arecord -t wav -c 2 -r 44100 -f S16_LE deneme.wav

b) listen the same file "deneme.wav"

root@omap:~# aplay -t wav -c 2 -r 44100 -f S16_LE deneme.wav

It won't give any errors but you won't be hearing any sound.. To fix this, type the following to get into ALSA Mixer configuration software..

root@omap:~# alsamixer

unmute 'HeadsetL Mixer AudioL2', and 'HeadsetR Mixer AudioR2'then volume can be controlled through 'DAC2 Analog' and 'Headset' volume controls.

Now you should be able hear the record..


25) Now we are ready to install the Open JDK-7. This is fairly easy compared to Ubuntu and X-ubuntu Desktop installation..

Do the following,

26) apt-get install openjdk-7-jre
27) apt-get install librxtx-java
28) cp /usr/lib/jni/librxtx* to /usr/lib/jvm/java-7-openjdk-armhf/jre/lib/arm to make the libraries work at all. This is not done by the install rxtx above.

Reboot your beagleboard..

29) Create a file on your host PC using Gedit or any other text editor, type in the following lines and save the file as "HelloWorld.java"

public class HelloWorld {
   public static void main(String[] args) {
        System.out.println("Hello, World");
   }
}

or

Find the "HelloWorld.class" from internet and download it to your host PC..

You could send one of these files to your beagleboard to test your Java installation..


30) Copy the HelloWorld.class or HelloWorld.java to beagleboard over the network as the following

root@tayyar:~# scp HelloWorld.class genius@10.42.0.2:/home/genius

31) test the Java VM..

root@omap:~# java HelloWorld
Hello, World
root@omap:~#

I was also able to run my Java application on the monitor and control my IP camera using the beagleboard.



[ - ]
Comment by taherOctober 3, 2012
hi.
very nice tutorial for me. i am using BB-XM rev C. same steps can help me? as i am new to this area please guide me
[ - ]
Comment by tayyarguzelOctober 3, 2012
the way you need to follow will be very similar.. anyhow, each board has its own hardware configuration.. therefore, you need to install suitable packages (Ubuntu, Xubuntu-desktop, Open JDK etc.) to BB-XM rather than BB-Rev C2.
[ - ]
Comment by adityardesaiJanuary 22, 2013
hello

I have used all these steps given in above. I dont want to have Open JDK . Still I am not getting sound correctly. I am unable to hear/record any song...I have tried using different speakers, different files formats of .mp3,.wav also
So please can you tell me whats wrong I am doing and how can I fix the sound problem.

Thanks in advance
[ - ]
Comment by VANGALA PRAVEENKUMARMay 26, 2013
Hello

I am following the same steps. But at the 6th step , when I am trying get the processor flashing script using the command "git clone git://github.com/RobertCNelson/flash-omap.git" . Then I a error as follows:
--------------------------------------------------
Cloning into flash-omap...
fatal: remote error:
Repository not found.
---------------------------------------

Please help me out.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Please login (on the right) if you already have an account on this platform.

Otherwise, please use this form to register (free) an join one of the largest online community for Electrical/Embedded/DSP/FPGA/ML engineers: