Monday 27 June 2011

How to install Angstrom Linux on Pandaboard ( no serial cable )

Background
This tutorial assumes that you want to easily install Angstrom on Panda, without using serial cable connection, i.e you want to simply have all of your output to be displayed on your TV/Monitor via HDMI/DVI.

What do you need
- Pandaboard ( obviously working one )
- SD card ( if you want GUI you would want to get at least 512 MB one )
- TV/Monitor ( connected via HDMI/DVI )
- Keyboard
- Mouse
- Recommended powersupply for Panda ( 5V, 3.6 - 4A )
- Host Linux PC with Internet connection
- Internal/External SD drive

Building Angstrom rootfs
Go on to the following site:
http://narcissus.angstrom-distribution.org/
( This is an online tool to create Angstrom filesystem )
Configure your rootfs:

Base settings:
- Machine type = omap4430-panda/pandaboard ( both work, but I have no idea about the difference )
- Image name = anything you want
- Complexity = simple/advanced

Advanced settings: ( if chosen )
- Release = stable ( I recommend to choose stable, as it will at least work. Next-glibc is probably nice, but it is intended more towards developers and I have never tried it. If one is willing to try it, please tell me results. )
- Base system = extended ( more drivers = better, I think )
- /dev manager = udev ( maybe I should try kernel one ? )
- init manager = sysvinit
- type of image = tar.gz ( works fine )
- Software manifest = yes/no
- SDK type = none ( why would we need it ? oh, I guess its just me - my host POWER5+ machine would not do the job anyhow )

User environment selection:
Environment = X11 ( we want GUI )
X11 Desktop Environment = Enlightenment ( this one works for me )
Note: For some reason Narcissus failed to include Gnome in the rootfs. I wonder will it work now. Also XFCE seems to install fine, but it didn't work for me and there was absolutely nothing to suggest the existance of Xorg/X11 in the rootfs. Bug ?

Additional packages:
Choose what you want. ( I suggest to include all kernel modules, Bluez, Alsa utils, Toolchain, SDK, Midori, Git, etc )

Now hit "Build me!" button and wait. Don't press refresh button. The build time depends on the server.
When it has finished building, a link of your new rootfs will appear. Just download it.

SD card setup and installation process
Now go to:
http://www.angstrom-distribution.org/demo/pandaboard/
and download mkcard.txt, MLO, u-boot.bin. Thanks goes to the author for providing these files.
Allow the mkcard.txt script to be executable.
Insert your SD card in your host PC. Find out its name with:
dmesg
Now open Terminal, gain root privileges  and cd into directory with the script. Run:
./mkcard.txt /dev/(your card)
 Caution: Be careful here, so you don't end up wiping out your HDD.
You should get two partitions, one is FAT32, labeled "boot", and the other one is EXT3, labeled "Angstrom".
With root privileges extract your rootfs to the "Angstrom" partition of the SD. This will take a while. Then copy MLO, u-boot.bin to the "boot" partition. Finally go to your "Angstrom" partition and copy the uImage-2.6.XX.... ( this is the kernel ) from the /boot folder to the "boot" partition of your SD. Rename it to uImage. Our SD setup is complete. You can unmount your card.
Note: Ensure that you copy your active kernel, i.e the one to which uImage in the /boot directory of the rootfs is linked to.

Booting up
Insert your SD card into Panda. Connect your TV/Monitor, keyboard, mouse. Now connect you power supply. Turn on your Panda.

You will not see anything on your TV/Monitor during this long ( about 10 - 15 min ) boot up most likely ( but you must get a video signal though ).  Then you should see the Angstrom setup window ( assuming you have GUI of course ). Complete the setup. Your Angstrom is ready to be used :D

Finally my Pandaboard gets a usable OS !

Background
I had to spent a hell a lot of time trying to get my OMAP4430 dev board to boot a usable Linux. By "usable" I mean a Linux which has a practical value to me. Just to say I am neither a developer nor a programmer. I am just a hobbyist :D
I needed to have a Linux which:
a) Works and works well
b) Has a GUI and doesn't need a Serial cable + a PC connected to it
c) Runs fast enough

Ubuntu
Most tutorials assumed that I have a serial cable and know how to use it. But I don't and don't need one, I am not a dev. So initially my idea was to simply install Ubuntu. http://www.omappedia.org/wiki/OMAP_Ubuntu_Main
... Well, I tried both Maverick and Natty ... HDMI video out works, bluetooth & wifi & GPU acceleration work after installing OMAP 4 addons, etc ... But the speed is ... amazingly horrible. I can't believe, but it is even worth than running Linux on PS3 as OtherOS. ( And that thing didn't even had GPU access - unless someone hacked it of course. BTW you can compare PS3 Linux to high end G4 without 3d staff or some old 800 MHz Intel PC. ) I doubt this speed is only due running OS on a SD card. After all some OSs fly on Panda with 4 - 6 Class SDHC. I think it is the system itself. Ubuntu was never a Linux that you should run on embedded or old machines. I didn't expect it to use > 200 MB of RAM ( well, the high-end GUI gets what it deserves ). The CPU usage is strange - about 50 % for both A9 cores when doing anything in GUI without POWERVR drivers. ( My system must be fast enough even when running with bare frame buffer. ) That's a lot of wasted performance for moving windows or opening System Monitor. Sometimes the CPU load on one core goes to 100 %. What about SGX drivers ? Well, I can barely feel a little bit of insignificant acceleration when browsing menus. Everything is still slow, too slow with constant late responses. And how on earth apt-get ended up using 680 MB of RAM ? Is DDR2 that slow ? I guess not, it is just the OS. So in the end, I must say that Ubuntu is certainly not for Panda, unless you have a spare external HDD. But even then the performance wouldn't be that great.

Angstrom
Then, I have installed Angstrom. And it gave to me awesome performance. It is fast even at 300 MHz. The E17 ( or is it E18 ) GUI is incredible, moving/resizing/minimising/etc windows is easy and quick. All I can say is that it is much much faster then Ubuntu. Thanks to Angstrom developers for bringing up such a useful system !

Some Angstrom notes
( I will make a tutorial  sooner or later on installing Angstrom )
- I have used an online builder Narcissus to build rootfs
- Both pandaboard and omap4430-panda configs work
- I have chosen Enlightenment for GUI
- uImage = kernel from rootfs ( rename uImage-X.XX.X... to uImage )
- Both MLO and u-boot.bin were downloaded from here:
http://www.angstrom-distribution.org/demo/pandaboard/
- SD card setup with mkcard script from the above link
- OS works fast and boots fast ( first boot is long )
- I don't have boot.scr ( highmem is enabled )
- SMP is working
- USB devices work ( mouse, keyboard and USB Thumb drive are verified to work )
- USB storage devices are mounted correctly ( had yet to see how external HDD will work )
- Temp indicator seems to work
- Power management is working ( at the first glance )
- You can change frequency of CPU: 300/600/800/1000 MHz
- Default mode: 1GHz
- I am not able to log-out or turn off the system with a GUI method when running as user. "Turn off" in GUI works when logging in as root.
EDIT:
- External HDD works and is mounted correctly ( but, damn, I have a hard time trying to unmount it )
- SD card used: LEXAR 8 GB SDHC 100x Class 6
- I can change power management settings only when running system as root.