Wednesday, February 23, 2011

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.
Post a Comment