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.