Sunday, April 17, 2011

Booting a Pogoplug with Fedora ARM

So, this week I received my Pogoplug, and it is currently running Fedora 13 for ARM (Beta-2). The Pogoplug has an ARM/Kirkwood board inside, just like a Sheevaplug and other Plug* computers. Below are some notes on how to get Fedora installed on an external USB-drive (and keeping most of the original Pogoplug software on it, but disabled).

The Fedora ARM Project provides a Beta root-disk for Fedora 13. Downloading the .tar.bz2 and extracting it to the first partition (formatted as ext3) of an USB-disk should make a good start for any Pogoplug related development.

The bootloader (u-boot) has been updated according to the well written instructions (includes a script for automation) from Jeff Doozan. The instructions are mainly targeted for Debian, but are a very useful source of information. Using the script, the bootloader gets replaced and it is possible to boot from an external USB-disk when placing the kernel (uImage) and initrd.img (uInitrd) under /boot on the USB-disk.

There is a kernel with initrd.img and modules available for ARM/Kirkwood boards. Unfortunately this kernel does not seem to fully boot on the Pogoplug. As there is no monitor or serial port connector on the outside of the pink box (who knows whats hidden inside), troubleshooting a boot issue is quite challenging. The updated u-boot supports netconsole. The output over netconsole shows that the kernel and initrd.img are loaded correctly and can be started. After which the kernel is supposed to take over the communication with any human being (or machine for that matters). Unfortunately the installation does not seem to get to a point where logs are written (checking the removable USB-storage after trying to boot). There is also no networking happening, eventhough the rootfs has been configured for DHCP.

Luckily there is an other kernel available for a GuruPlug (which is also a similar ARM board) which should function on any ARM/Kirkwoood. This specific kernel does not use an initrd/initramfs, so when trying to boot it, make sure to have only a /boot/uImage and no /boot/uInitrd. Booting a Pogoplug with the GuruPlug kernel-2.6.36.1 seems to work well:
Linux version 2.6.36.1 (root@Xion) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #1 PREEMPT Mon Nov 29 06:21:49 EST 2010
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell SheevaPlug Reference Board
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat c058a5f4, node_mem_map c065e000
  Normal zone: 512 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 65024 pages, LIFO batch:15
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyS0,115200 root=/dev/sda1 rootwait rootfstype=ext2 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 253380k/253380k available, 8764k reserved, 0K highmem
...

Monday, March 28, 2011

Configuring the BeagleBoard to have network over usb0

After some experimenting, I have a kernel .config based on the kernel from the Angstrom BeagleBoard Demo. The original provided kernel with gether did not boot on my (loaned) BeagleBoard Rev B5. Only after disabling USB completely (kernel parameter nousb). As gether is the part I am most interested in, booting without USB is pretty pointless. Fortunately the kernel provides /proc/config.gz. Using this configuration, some little tuning (i.e. turning off the staging-modules because they do not compile), a kernel and suitable modules could be built.

Fedora almost expects using a initramfs for booting, and well, it surely makes troubleshooting easier! Getting dracut to run on a system where no network is available takes quite a lot of reboots (the BeagleBoard has one SD-slot for the filesystem, one mini-USB for power, a serial port for the console and nothing else that makes transport of files easy). Installing all the dependencies and disabling some dracut-modules /etc/dracut.conf (crypt dmraid mdraid multipath plymouth) in /etc/dracut.conf allows creating an initramfs.img. Before u-boot can use the initramfs.img, it needs to be converted with a command like:
# mkimage -A arm -O linux -T ramdisk -C none -e 0 -a 0 -n initramfs-2.6.38 -d /boot/initramfs-2.6.38.img /boot/uinitramfs-2.6.38.img

Currently, the generated files are on a VFAT-partition on an SD-card. This BeagleBoard boots from this card and uses the following settings to start the Fedora 13 ARM system:
OMAP3 beagleboard.org # printenv bootargs
bootargs=console=ttyO2,115200n8 root=/dev/mmcblk0p2 ro

OMAP3 beagleboard.org # printenv bootcmd
bootcmd=mmcinit ; fatload mmc 0:1 0x80000000 uimage-2.6.38 ; fatload mmc 0:1 0x81600000 uinitramfs-2.6.38.img ; bootm 0x80000000 0x81600000

OMAP3 beagleboard.org # boot

During boot, there are some messages that indicate that Ethernet-over-USB will be available:
[    0.334960] musb-hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=0
[    0.335571] musb-hdrc musb-hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ 92
...
[    4.824340] g_ether gadget: using random self ethernet address
[    4.830505] g_ether gadget: using random host ethernet address
[    4.837341] usb0: MAC ba:98:d2:e3:60:36
[    4.841430] usb0: HOST MAC 4a:49:17:92:63:df
[    4.846008] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    4.853027] g_ether gadget: g_ether ready
[    4.857269] musb-hdrc musb-hdrc: MUSB HDRC host driver
[    4.863220] musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 2
[    4.885742] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    4.892913] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.900543] usb usb2: Product: MUSB HDRC host driver
[    4.905792] usb usb2: Manufacturer: Linux 2.6.38 musb-hcd
[    4.911499] usb usb2: SerialNumber: musb-hdrc
...
[    5.383911] g_ether gadget: full speed config #1: CDC Ethernet (ECM)

The musb-hdrc is the controller-chip and the g_ether is the implementation of the USB-client side of the USB-over-Ethernet gadget. On my laptop the BeagleBoard gets detected as a "RNDIS/Ethernet Gadget" product from vendor "Linux 2.6.38 with musb-hdrc":
usb 1-1: new high speed USB device using ehci_hcd and address 66
usb 3-1: new full speed USB device using uhci_hcd and address 45
usb 3-1: not running at top speed; connect to a high speed hub
usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-1: Product: RNDIS/Ethernet Gadget
usb 3-1: Manufacturer: Linux 2.6.38 with musb-hdrc
cdc_ether 3-1:1.0: usb0: register 'cdc_ether' at usb-0000:00:1a.0-1, CDC Ethernet Device, 4a:49:17:92:63:df
usb0: no IPv6 routers present
device usb0 entered promiscuous mode
virbr0: topology change detected, propagating
virbr0: port 1(usb0) entering forwarding state

The last lines are automatically triggered by my ifplugd-configuration which checks for usb0 devices and on a link, the usb0 is added to the virbr0 from libvirt so that BeagleBoard immediately gets access to the network.

On the side of the BeagleBoard, /etc/sysconfig/network-scripts/ifcfg-usb0 is configured to request an IP-address over DHCP:
DEVICE="usb0"
BOOTPROTO="dhcp"
ONBOOT="yes"
MACADDR="ba:98:d2:e3:60:36"

I prefer to give the BeagleBoard the same MAC-address on every boot, by default it is a random one. Setting MACADDR in ifcfg-usb0 makes this happen. The g_ether kernel-module accepts a MAC-address as parameter, but as the module is builtin, this is not convenient (pass g_ether.dev_addr as kernel parameter, or echo it to /sys/module/g_ether/parameters/dev_addr).

Enabling the network on boot and activating usb0 was the only thing left todo:
# chkconfig network on
# ifup usb0

The compiled kernel, initramfs and modules are available for download and re-use. Please report any issues or success if you try them out.

Now this is all written down, it seems really easy and quick. Keep in mind that compiling a very minimal kernel takes at least 120 minutes on the BeagleBoard, the kernel and modules from the Angstom distribution took much more... The BeagleBoard has since gained the elevated status of a mock-builder and rebuild java-1.5.0-gcj-1.5.0.0-32.fc13.bootstrap.src.rpm in "138 minutes 22 seconds", yay!

Wednesday, February 23, 2011

Archivemount is now in EPEL6

The only (for now) package I maintain, archivemount is now available in EPEL6 too. It has been in Fedora 14 for a while now, EPEL5 is following when libarchive is ready.

For those who have no idea what archivemount is:
Archivemount is a piece of glue code between libarchive and FUSE. It can be used to mount a (possibly compressed) archive (as in .tar.gz or .tar.bz2) and use it like an ordinary filesystem.

Serial ports with a BeagleBoard and a (newer) Linux 2.6.36 kernel

Today a Fedora 13 ARM Beta was released. This makes it obviously time for me to blog about my Fedora adventures from last weekend on my loaned BeagleBoard.

I managed to get kernel 2.6.38-rc3 compiled on a virtualized Qemu ARM system. Compiling the kernel really takes some time. A stripped down version, without compiling loadable modules took just over 880 minutes. An other test with make omap2plus_defconfig uImage took around 1400 minutes. I now believe the people that mentioned that the performance of a virtual system (on x86_64) is not very spectacular.

Booting the kernel, made my serial console unusable. A bug and patch has been filed for initscripts in Fedora 14 and below. Fedora 15 uses systemd and is likely not affected with the same. This kernel (well, actually from 2.6.36 an onwards) have a optimized serial-port implementation for OMAP-boards. This unfortunately does not use ttyS* for serial-ports, but ttyO*. Any application (including initscripts) expecting that serial-ports are starting with ttyS or other familiar identifiers, will need an update for the OMAP serial-port driver.

With the new beta release, I would need to rebuild initscripts with the patch that makes ttyO work as main console (giving console=ttyO2,115200n8 on the kernel command line). When all works fine, the boot process will be displayed on the serial-console and logging in works again.

Furthermore I found out how to boot the board in a more useful state than before. Passing the initramfs via u-boot does not seem to be very common, most sites advise to compile the initramfs into the kernel. I'd prefer to keep the standard Fedora way, and that means keeping kernel and initramfs seperate. It seems that u-boot needs a special kind of initramfs/initrd (possibly just a header added). This format can be created like the following:
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initramfs -d initramfs-2.6.38-rc3.img uinitramfs-2.6.38-rc3.img

With this image, my Fedora 12 boots perfectly when setting the bootcmd to load both kernle + initramfs and passing both addresses via bootm
OMAP3 beagleboard.org # printenv 
stdin=serial
stdout=serial
stderr=serial
serial=3a5c00020000000004013ef109010017
bootargs=console=ttyO2,115200n8 root=/dev/mmcblk0p2 ro
bootcmd=mmcinit ; fatload mmc 0:1 0x80000000 uimage-2.6.38-rc3.beagleboard_201102131201 ; fatload mmc 0:1 0x81600000 uinitramfs-2.6.38-rc3.img ; bootm 0x80000000 0x81600000

Environment size: 309/131068 bytes

Some of these steps took quite a bit to figure out, but it looks like it's going to work a little bit more everytime.

Tuesday, February 15, 2011

More details on Fedora on a Beagleboard

It seems to be advised to build your own kernel for an ARM board. I have no idea yet if some kind of default kernel would (suboptimal) work, so I built a more fine-tuned kernel for the beagleboard. Luckily there was a default configuration for a beagleboard (make beagleboard_defconfig), sadly that default is not available in current kernels anymore. taking an old config and updating it a little, got me a recent kernel (2.6.38-rc3) that seems to work on the beagleboard.

After some more research through the kernel logs, it seems that the beagleboard_defconfig was renamed several times, currently it is available as omap2plus_defconfig. I probably need to build a new kernel now... Unfortunately it takes quite a while to build a new kernel on an emulated ARM board (I'm not into crosscompiling with a recent gcc version yet). The SD card I have is a little small, putting both the root filesystem and the kernel-sources on it seems difficult, an exercise I'll experiment with later.

The beagleboard uses u-boot as bootlader, and I have not found out how to use a initial RAM disk. This has not been an issue yet, as I did not feel like creating an initial RAM disk by hand. Fedora comes with dracut that can generate one for me, so why bother?

The current kernel has all requirements built-in. There is no need for an initial RAM disk. Well, actually there is... init seems to require the /proc fileystem mounted, if it is not mounted, init decides to reboot the system as there are some process-communication issues. Starting with an emergency shell (pass init=/bin/dash on the commandline) allows me to manually mount /proc (even if it claims to be mounted already).

Compared to an older version of the kernel, this kernel offers options to enable optimized OMAP-serial ports:
CONFIG_SERIAL_OMAP=y
CONFIG_SERIAL_OMAP_CONSOLE=y
With these options enabled, the standard /dev/ttyS2 does not seem to provide any output. Instead it seems to be required to use the OMAP-specific /dev/ttyO2 (that's an 'O' for Oscar, not a '0' as zero).

My final u-boot defaults (saved with saveenv) looks like this:
OMAP3 beagleboard.org # printenv
stdin=serial
stdout=serial
stderr=serial
serial=3a5c00020000000004013ef109010017
bootargs=console=ttyO2,115200n8 root=/dev/mmcblk0p2 ro rootwait init=/bin/dash
bootcmd=mmcinit ; fatload mmc 0:1 0x80000000 uimage-2.6.38-rc3.beagleboard_201102131201 ; bootm 0x80000000

Environment size: 267/131068 bytes

Booting the system and starting dash as directed by the init parameter can be done as follows:
OMAP3 beagleboard.org # boot
## Booting kernel from Legacy Image at 80000000 ...
   Image Name:   Linux-2.6.38-rc3.beagleboard
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1751256 Bytes =  1.7 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.38-rc3.beagleboard (root@fedora-arm) (gcc version 4.4.2 20091019 (Red Hat 4.4.2-5) (GCC) ) #2 Sun Feb 13 22:26:07 EST 2011
CPU: ARMv7 Processor [411fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES2.1 (l2cache iva sgx neon isp )
SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x10000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyO2,115200n8 root=/dev/mmcblk0p2 ro rootwait init=/bin/dash
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 126296k/126296k available, 4776k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
    vmalloc : 0xc8800000 - 0xf8000000   ( 760 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc002b000   ( 140 kB)
      .text : 0xc002b000 - 0xc033d000   (3144 kB)
      .data : 0xc033e000 - 0xc0369480   ( 174 kB)
NR_IRQS:402
Clocking rate (Crystal/Core/MPU): 26.0/332/500 MHz
Reprogramming SDRC clock to 332000000 Hz
GPMC revision 5.0
IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
Total of 96 interrupts on 1 active controller
OMAP clockevent source: GPTIMER12 at 32768 Hz
sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
Console: colour dummy device 80x30
Calibrating delay loop... 471.61 BogoMIPS (lpj=1843200)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
print_constraints: dummy: 
NET: Registered protocol family 16
omap_device: omap_gpio.0: new worst case activate latency 0: 30517
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
omap_mux_init: Add partition: #1: core, flags: 0
OMAP3 Beagle Rev: unknown 3
omap_device: omap_uart.0: new worst case activate latency 0: 30517
omap_device: omap_uart.0: new worst case deactivate latency 0: 30517
Found NAND on CS0
Registering NAND on CS0
Unable to get DVI reset GPIO
OMAP DMA hardware revision 4.0
bio: create slab  at 0
SCSI subsystem initialized
omap_device: omap_i2c.1: new worst case activate latency 0: 30517
omap_i2c omap_i2c.1: bus 1 rev3.12 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
print_constraints: VUSB1V5: 1500 mV normal standby
print_constraints: VUSB1V8: 1800 mV normal standby
print_constraints: VUSB3V1: 3100 mV normal standby
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
print_constraints: VMMC1: 1850 <--> 3150 mV at 3000 mV normal standby
print_constraints: VDAC: 1800 mV normal standby
print_constraints: VDVI: 1800 mV normal standby
print_constraints: VSIM: 1800 <--> 3000 mV at 1800 mV normal standby
omap_i2c omap_i2c.3: bus 3 rev3.12 at 100 kHz
Switching to clocksource 32k_counter
Switched to NOHz mode on CPU #0
musb-hdrc: version 6.0, tusb-omap-dma, peripheral, debug=0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 246
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a OMAP UART0
omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a OMAP UART1
omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a OMAP UART2
console [ttyO2] enabled
brd: module loaded
loop: module loaded
twl_rtc twl_rtc: rtc core: registered twl_rtc as rtc0
omap_device: omap_i2c.1: new worst case deactivate latency 0: 30517
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
omap_voltage_late_init: Unable to create voltage debugfs main dir
vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
vdd_debugfs_init: Unable to create debugfs directory for vdd_core
Power Management for TI OMAP3.
regulator_init_complete: VDVI: incomplete constraints, leaving on
regulator_init_complete: VDAC: incomplete constraints, leaving on
twl_rtc twl_rtc: setting system clock to 2000-01-01 00:03:14 UTC (946684994)
Waiting for root device /dev/mmcblk0p2...
mmc0: new SD card at address 9ced
mmcblk0: mmc0:9ced SD02G 1.89 GiB 
 mmcblk0: p1 p2
EXT3-fs: barriers not enabled
kjournald starting.  Commit interval 5 seconds
EXT3-fs (mmcblk0p2): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) readonly on device 179:2.
Freeing init memory: 140K
/bin/dash: can't access tty; job control turned off
# 

The way to boot into a multi-user system (or change the runlevel so something else) was the following:
# mount /proc
# mount /sys
# exec init
Unfortunately it looks as if upstart or udev from Fedora 12 does not recognise the /dev/ttyO* as serial console. Of course I do not have the possibility (hte beagleboard has, just I do not) to connect a monitor over HDMI or S-video and serial-console is the only working output available. Yet another thing to look into some other day.

Monday, February 7, 2011

My first experiences with Fedora on a BeagleBoard

Last week I spent some time making libvirt able to start emulated (through QEMU) ARM systems. Today I was looking into starting Fedora on a BeagleBoard. A colleague of mine loaned me the BeagleBoard, for me a nice opportunity to check out the current status of Fedora ARM. There is some documentation on the Fedora ARM Wiki pages. Unfortunately the available downloads do not include a kernel that runs on the BeagleBoard.

Compiling a kernel for the BeagleBoard

The Fedora ARM Project provides a repository for Fedora 12 that contains cross-compilers. This allows one to compile a kernel on x86_64, and saves the need for a ARM CPU. As the packages were created with/for Fedora 12, the tools are not up to date. The available GNU Compiler Collection has version 4.1.2. And unfortunately there seems to be a known issue with kernels newer than 2.4.34. Of course, you only look for this when you run into the error:
linux-2.6/arch/arm/include/asm/atomic.h:42: error: impossible constraint in 'asm'
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2

Switching to linux-2.6.34 was likely the easiest way to workaround this issue. Note to self: look into the option of updating the cross compiler toolchain?

Booting the BeagleBoard

Equipment used:
  • USB-to-serial converter
  • null-modem cable
  • BeagleBoard serial port connector cable
  • USB-Mini plug
  • SD-card

In order to see what the BeagleBoard is doing, I used minicom over the USB-serial converter to receive the output from the serial console. After transferring the root-filesystem to the SD-card, it is possible to send a u-boot image to the BeagleBoard over the serial-connection. Inside u-boot the command loady starts a filetransfer over the ymodem protocol. minicom can send a file after pressing "CTRL+A s". And while doing so, abrt created this bug.

The procedure to boot Linux on Beagle Board is straight forwards and with some tuning the kernel can get started:
Texas Instruments X-Loader 1.4.2 (Feb 19 2009 - 12:01:24)
Reading boot sector
Error: reading boot sector
Loading u-boot.bin from nand



U-Boot 2009.01-dirty (Feb 19 2009 - 12:22:31)

I2C:   ready
OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
DRAM:  128 MB
NAND:  256 MiB
MUSB: using high speed
In:    serial
Out:   serial
Err:   serial
Board revision Ax/Bx
Serial #3a5c00020000000004013ef109010017
OMAP3 beagleboard.org # mmcinit
OMAP3 beagleboard.org # fatload mmc 0:1 0x80000000 uimage-2.6.34_201102061623
OMAP3 beagleboard.org # setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait nohz=off
OMAP3 beagleboard.org # bootm 0x80000000
## Booting kernel from Legacy Image at 80000000 ...
   Image Name:   Linux-2.6.34beagleboard
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1678404 Bytes =  1.6 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.34beagleboard (nixpanic@fedora12.builder.nixpanic.net) (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33.fa1)) #3 Sun Feb 6 16:18:40 GMT 2011
CPU: ARMv7 Processor [411fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board

Some Issues

For some reason init seems to be of the opinion that booting is not successful and a reboot is needed. Adding the 'kernel parameter' --verbose that does not get handled by the kernel, but by init, the following messages were written:
Waiting for root device /dev/mmcblk0p2...
mmc0: new SD card at address 9ced
mmcblk0: mmc0:9ced SD02G 1.89 GiB
 mmcblk0: p1 p2
kjournald starting.  Commit interval 5 seconds
EXT3-fs (mmcblk0p2): using internal journal
EXT3-fs (mmcblk0p2): recovery complete
EXT3-fs (mmcblk0p2): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) on device 179:2.
Freeing init memory: 136K
init: Control request to emit fedora.serial-console-available event
init: Handling fedora.serial-console-available event
init: serial goal changed from stop to start
init: serial state changed from waiting to starting
init: Handling starting event
init: serial state changed from starting to pre-start
init: Active serial pre-start process (453)
init: Control request for status of rcS
init: Control request for status of rcS
init: Control request for status of rcS
init: Control request for status of rcS
init: Control request for status of rcS
init: Control request for status of rcS
init: Event queue paused
init: Control request for status of rcS
init: Control request for status of rcS
Restarting system.

Booting with init=/bin/dash seems to work and one can do some diagnosis. However when doing an exec init --verbose a reboot get initiated again :-/

Next Steps

Whenever I have another day for playing, I will look into the booting issue. Until than, I'm very grateful for any pointers!

From what I understand, the USB-port on the BeagleBoard can be configured to provide a networking-device. It would be very useful if the BeagleBord can communicate over a network-card called usb0. Everything indicates that this is possible, as a test-kernel I tried to start, resulted in these messages on my laptop:
usb 1-1: New USB device found, idVendor=0525, idProduct=a4a2 
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 
usb 1-1: Product: RNDIS/Ethernet Gadget
usb 1-1: Manufacturer: Linux 2.6.28-omap1 with musb_hdrc 
cdc_ether 1-1:1.0: usb0: register 'cdc_ether' at usb-0000:00:1a.7-1, CDC Ethernet Device, 8a:18:75:d3:a6:10
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver cdc_subset
usb0: no IPv6 routers present
usb 1-1: USB disconnect, address 43
cdc_ether 1-1:1.0: usb0: unregister 'cdc_ether' usb-0000:00:1a.7-1, CDC Ethernet Device
But of course, this test-kernel is affected by same reboot-problem.


And the Future?

It looks like there is quite something going on on the BeagleBoard. Futhermore there is the new DreamPlug (oder here)coming. Alternatively I might look into a Pandaboard. These are all nice and low-energy solutions for a little home server...

Sunday, February 6, 2011

Playing with The GIMP and Gravatar

Some blogs, archives for mailing lists, other site and even some application seem to be able to find a matching icon/avatar for the user that posts a message. Blogger, WordPress.com, but also for example Gmane use Gravatar (Gravatar is one of the avatar-services used by Gmane, not the only one.).

Personally I always like to know how the others I am working with look like. This makes is also easier in case one actually meets one other.

Gravatar is actually pretty easy to use, you only need to calculate the MD5-hash from an emailaddress and append that to a URL:

$ echo -n nobody@example.com | md5sum
9f9a7a129db9c1065c011dba45c3cee9
The emailaddress is a fake one, the md5sum is real though.

Now the URL http://www.gravatar.com/avatar/9f9a7a129db9c1065c011dba45c3cee9 (optionally append .gif, .jpg, ...) can be used to retrieve the avatar:
nobody@example.com

Of course this only makes sense if you have an icon of yourself. I created my current one, using The GIMP with some help from the following sites:
There are surely other tutorials that explain the same, but Google put these high in the results and they worked for me.

Saturday, January 29, 2011

Connect automatically (and immediately) to a hidden WiFi

A minor annoyance on with wireless networking at home seems to easily resolved. I'm very happy that NetworkManager offers a CLI that works together with the GNOME-NetworkManager-applet. cnetworkmanager does, or at least did not work for me.

The WiFi at home uses a hidden ESSID and it looks like NetworkManager does not connect to this automatically. Well, that's not completely correct, it just takes a lot of time for NetworkManager to attempt to connect. It's unclear to me why NetworkManager sometimes connect me automatically, and sometimes it seems to take ages and manually connecting to the hidden wireless network is quicker.

This little script ~/bin/nm-connect-me.sh forces NetworkManager to connect to the hidden WiFi when wireless is enabled and there is no connection yet:
#!/bin/sh
#
# Automatically try to connect to 'MyWiFi' when WiFi is enabled
#

# the output of nmcli should be in English
LC_ALL=C

# loop for a while until NetworkManager is accepting commands
while [ "$(nmcli -t -f WIFI,STATE nm)" = 'enabled:disconnected' ]
do
 nmcli con up id MyWiFi
 sleep 5
done

exit 0

After making the script executable and adding it as a startup application over xfce4-session-settings, the network connection is established immediately when I login. It really bids me a little more comfort when turning on my laptop.

The changelog from the NetworkManager package shows that nmcli was added about one year ago! Such a shame that I only found out about it recently...

Friday, January 28, 2011

Running qemu-system-arm through libvirt

Being ill a couple of days and have the need to do something (more or less) productive, I thought of giving Fedora-ARM a go. As I use libvirt and virt-manager for work, running an ARM-emulation this way is my preferred setup.

The Fedora Wiki provides with a nice HowTo a good start. Unfortunately there is already a mentioning that qemu-system-arm gets wrong arguments and a script that functions as a (temporary) workaround should be used. This was a note for Fedora 13, I'm running Fedora 14. So, of course I tried to start my VM without the script first:

qemu-system-arm: -device lsi,id=scsi0,bus=pci.0,addr=0x5: Bus 'pci.0' not found

Ups. This really does not seem to work out of the box :-( Reading the script reveals that bus=pci.0 gets replaced by bus=pci. Manually starting qemu-system-arm with some adjusted bus= parameters seems to start the VM.

Obviously there are loads of others hitting similar issues. For Fedora 14 bug 667345 was filed against libvirt for PPC emulation.

With help from gdb and manually executing qemu-system-arm and comparing it with qemu-kvm, it seems that the virtual hardware is configured differently. Most noticible (for me) seems to be the name of the PCI-bus, on qemu-system-arm it is pci and on qemu-kvm it is pci.0. The function qbus_find_recursive() can be used to breakpoint and to check the names of the available busses (bus->name).

I would assume that at least the busses have the same names for emulated hardware, so either bus=pci or bus=pci.0 should work with any qemu-* command. Unfortunately it is unclear to me how qemu-kvm constructs the virtual hardware, the qemu-system-* are more transparent. Depending on the machine that is being emulated the hardware is 'connected' when the machine is created. The virtual hardware is constructed by qemu-kvm/hw/*.c and depends on the type of machine that is created.

Under qemu-kvm/hw/*.c there are some uses of pci_register_bus() where pci as name for the PCI-bus is passed. It seems easy to rename the PCI-busses to pci.0. This change will break any existing scripts/tools that pass bus=pci on the command line, so the solution is not the best. However, packages are temporary available in case someone wants to try this solution.
A post to the qemu-devel list will show if a patch for qemu, or rather libvirt is preferred.

Fixing the name of the PCI-bus is not the only thing I had to do before I could start my Fedora-ARM VM, though.

The emulated hardware versatileab does not have an ISA-bus, therefore -device isa-serial can not work. The Serial device in the Virtual Machine needs to be removed. An alternative would be a usb-serial, but at the moment, virt-manager does not offer this option (you can probably configure it with virsh edit or virsh define though).


There are more limitations with the emulated versatileab machine. It can obviously not cope with the 512MB of RAM I gave it. The result was shown by virt-manager
libvirtError: operation failed: could not query memory balloon allocation
and in my /var/log/libvirt/fedora.arm.log
qemu: hardware error: pl011_read: Bad offset 101f1018
Giving the machine only 256MB RAM instead of 512MB RAM seems to make this issue go away too.