Tuesday, May 18, 2010

Ångström running on the Beagle

Once I got my Beagle communicating, it was time to get the penguins in (although later I found out that carrying out the actual verification process might have been a good idea - check here for the latest version of the official verification process).

Following the instructions on the beginners page on eLinux wiki, I decided to use XorA's script to make formatting the SD card easier. On my Ubuntu 10.04 machine, the 2GB Kingston card I used showed up as /dev/mmcblk0 and it was a simple matter of sudo-calling the script on it afterwards. I plugged out the card and put it back again, verifying that both partitions (boot and rootfs) were in place when Ubuntu displayed them on the desktop.

Next, I downloaded the latest Beagle demo image files from here, which were as follows:

  • the latest rootfs archive, Angstrom-Beagleboard-demo-image-glibc-ipk-2010.3-beagleboard.rootfs.tar.bz2 
  • the MLO file, MLO
  • the modules archive, modules.tgz
  • the u-boot image, u-boot.bin
  • the kernel image, uImage
Then I followed the copy order present in the wiki (MLO, u-boot and uImage to the boot partition, copy and untar the rootfs into the rootfs partition, followed by copying and untar'ing the modules archive in the same place). My hands were getting sweaty as the big moment approached. Would I see the ASCII Ångström logo? Would I get kernel panics, or everything just freezing at some point while booting?

There was only one way to find out. I sudo'd up minicom, put in the SD card into the Beagle card reader, held down the USER button on my Beagle, and connected the Y USB cable...

And there it was! All to swiftly, the kernel uncompressed itself, set up, and a couple of ten seconds later I was greeted by the ASCII Ångström logo, prompting me for the username. I typed in "root" and got to the shell. After playing around for a little while with some commands and verifying that everything was working, I decided to try out setting up USB networking and then VNC'ing into the Beagle to see some GUI action. I set up an IP address on the Beagle side for the usb0 using ifconfig as described, then enabled the interface.

But something was wrong: my Ubuntu host didn't detect the Beagle at all! I looked at the dmesg kernel logs, the lsusb device listing, the network manager interfaces list...it simply wasn't there. I tried loading the usbnet and cdc_ether kernel modules manually on the host side, re-loading them on the Beagle side and many combinations of these actions in different orderings - none of which helped.

I was feeling quite depressed when Koen mentioned in #beagle that the problem might be a bad USB cable :)

Rummaging around the house, I found another USB A to mini B cable, and tried with that instead. Instantly, before the kernel had even booted up, it showed up as an USB gadget in the Ubuntu networking manager! I had just sighed with relief, but was just about to find out it's too soon...

It was time for...Kernel Panic!

[   17.127868] Unable to handle kernel NULL pointer dereference at virtual address 00000014
[   17.135986] pgd = c0004000
[   17.138732] [00000014] *pgd=00000000
[   17.142333] Internal error: Oops: 5 [#1] PREEMPT
[   17.146972] last sysfs file:
[   17.149963] Modules linked in:
[   17.153045] CPU: 0    Tainted: G        W   (2.6.32 #1)
[   17.158325] PC is at musb_interrupt+0x9f8/0xbb8
[   17.162902] LR is at musb_interrupt+0x9e4/0xbb8
[   17.167449] pc : []    lr : []    psr: 60000193
[   17.167449] sp : c0625ee0  ip : c0625f18  fp : 000000f0
[   17.178985] r10: 00000000  r9 : 00000099  r8 : 00000009
[   17.184234] r7 : 00000000  r6 : cf82f108  r5 : 00000001  r4 : 00000000
[   17.190795] r3 : 00000000  r2 : 00000000  r1 : fa0ab000  r0 : cf82f108
[   17.197357] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[   17.204803] Control: 10c5387d  Table: 80004019  DAC: 00000017
[   17.210571] Process swapper (pid: 0, stack limit = 0xc06242f0)
[   17.216430] Stack: (0xc0625ee0 to 0xc0626000)
[   17.220825] 5ee0: 00000000 ffff6b60 00000000 c0684a28 c0624000 cf82f108 60000113 cf8a0a00
[   17.229064] 5f00: c0624000 0000005c 00000000 00000000 c066cfc0 c034101c 060db884 cf8a0a00
[   17.237274] 5f20: c063a5d8 c00a4e90 00000000 cf8a0a00 c063a5d8 0000005c 00000002 00000001
[   17.245513] 5f40: c0624000 0000001f 00000000 c00a7058 0000005c 00000000 c0627e84 c003c074
[   17.253723] 5f60: 00000001 ffffffff fa200000 c003cb44 00000000 80000013 80000013 00000000
[   17.261962] 5f80: c0624000 c0627fe0 c0627e84 c0670fcc 8002f790 411fc083 0000001f 00000000
[   17.270172] 5fa0: c06385c8 c0625fbc c004ca8c c004d2e4 60000013 ffffffff 00000000 c003dfc4
[   17.278411] 5fc0: 00000000 c06b80a0 c0670f90 c0032010 c0627e78 c0008984 c0008498 00000000
[   17.286621] 5fe0: 00000000 c0032010 10c53c7d c0671020 c0032414 80008034 00000000 00000000
[   17.294891] [] (musb_interrupt+0x9f8/0xbb8) from [] (generic_interrupt+0x64/0xa8)
[   17.304168] [] (generic_interrupt+0x64/0xa8) from [] (handle_IRQ_event+0xac/0x1ec)
[   17.313537] [] (handle_IRQ_event+0xac/0x1ec) from [] (handle_level_irq+0xbc/0x148)
[   17.322906] [] (handle_level_irq+0xbc/0x148) from [] (asm_do_IRQ+0x74/0x98)
[   17.331665] [] (asm_do_IRQ+0x74/0x98) from [] (__irq_svc+0x44/0xa8)
[   17.339721] Exception stack(0xc0625f70 to 0xc0625fb8)
[   17.344787] 5f60:                                     00000000 80000013 80000013 00000000
[   17.353027] 5f80: c0624000 c0627fe0 c0627e84 c0670fcc 8002f790 411fc083 0000001f 00000000
[   17.361236] 5fa0: c06385c8 c0625fbc c004ca8c c004d2e4 60000013 ffffffff
[   17.367919] [] (__irq_svc+0x44/0xa8) from [] (omap3_pm_idle+0x4c/0x50)
[   17.376220] [] (omap3_pm_idle+0x4c/0x50) from [<00000000>] (0x0)
[   17.383148] Code: e3530003 13a02000 05963078 05933018 (05d33014)
[   17.389343] ---[ end trace 650abcc06c2958fc ]---
[   17.394012] Kernel panic - not syncing: Fatal exception in interrupt

I'll admit that it wasn't very pleasant, and the fact that I could boot the kernel just fine with the "bad" USB cable was also a bit curious. I still don't know for sure why this particular kernel panic occurs, but it seems to be related with the USB gadget drivers (I don't think it's host-computer related, since I got exactly the same results using a Windows XP host as well. How I hate HyperTerminal).

Guessing that it's probably a kernel issue, I decided to go for the other closest kernel image I could get my hands on, which was really close indeed. In the rootfs, under the /boot directory was another uImage-2.6.32 so I just copied it to my computer, did a comparison with cmp against the uImage I had downloaded to make sure it wasn't the same (it wasn't), and finally replaced the uImage with the one from /boot. This did solve the kernel panic issue, and I was once again able to get to the shell. And this time, the USB networking was all functional! I first ssh'd into the Beagle to make sure everything was working, then I used Ubuntu's VNC viewer (called "Remote Desktop Viewer") to take a small tour of the Ångström Enlightenment GUI. All was fine and mellow :)

Coming Up Next: Setting up OpenEmbedded in Ubuntu 10.04

1 comment:

  1. Thank you! I was struggling with the kernel panic myself, ubuntu kernel worked just fine so I was pulling my hair out on this one :)

    ReplyDelete