Nixpanic's Blog

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.

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.

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...

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.

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...

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.



Configuring a Brother MFC-7820N on Fedora 13

I always need to check what driver and RPM is needed to get my the best out of my printer and have it enabled to scan over the network.

This are some notes mainly for myself, but maybe they are helpful for someone else too.

Configure the printer and enable it:

# lpadmin -p sheldon-court -L "Sheldon Court" -E \
    -v ipp://172.31.24.253:631/ipp \
    -P /usr/share/foomatic/db/source/PPD/Brother/BR7225_2_GPL.ppd.gz


Install and configure the scanner add-on:
  • download the brscan2 RPM from the Brother website
  • Install the RPM:
    # rpm -ivh brscan2-0.2.5-1.x86_64.rpm
  • Configure Sane to access the scanner:
    # brsaneconfig2 -a name=sheldon-court model=MFC-7820N ip=172.31.24.253

Now printing and  scanning works!

Creating a bootable USB-stick

This is a short explanation on how to create a bootable USB-stick with GRUB. This stick can be used to boot an installer, rescue-mode or an on-stick installed Linux distribution.

I mainly use my USB-stick to install different versions (and architectures) of RHEL. Booting from this USB-stick and starting and starting a kickstart installation is really convenient.

Detect the USB-stick

This is a very important step and the one where most attention is needed. Detecting the device-node where the USB-stick is connected should not go wrong. Picking the wrong drive will not make your system unbootable (as we're creating a bootable disk), but all data will be lost!

To detect which device-node is used for the USB-stick, I tend to check the output from the command 'dmesg'. This commmand displays the contents of the kernel-log-buffer and the last lines contain the last events. Insert the USB-stick and shortly after that checking 'dmesg', results for me in the following output (truncated here, only the last importan messages are shown):
usb 1-2: new high speed USB device using ehci_hcd and address 5
usb 1-2: New USB device found, idVendor=1e3d, idProduct=2093
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product:
usb 1-2: Manufacturer: USB 2.0
usb 1-2: SerialNumber: 26073604A307E205
usb 1-2: configuration #1 chosen from 1 choice
scsi4 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 4:0:0:0: Direct-Access USB 2.0 5.00 PQ: 0 ANSI: 2
sd 4:0:0:0: Attached scsi generic sg2 type 0
sd 4:0:0:0: [sdc] 4067328 512-byte logical blocks: (2.08 GB/1.93 GiB)
sd 4:0:0:0: [sdc] Write Protect is off
sd 4:0:0:0: [sdc] Mode Sense: 0b 00 00 08
sd 4:0:0:0: [sdc] Assuming drive cache: write through
sd 4:0:0:0: [sdc] Assuming drive cache: write through
sdc: sdc1 sdc2
The USB-stick just connected is called 'sdc' and obviously contiains two partitions: sdc1 and sdc2. The matching device-node for this USB-stick is '/dev/sdc'.

Prtitioning the USB-stick

There exist a lot of tools to perform partitioning of a disk. One of the most common tools is 'fdisk' and that is very esy to use, therefore I mostly use this tool too.

'fdisk' takes the device-node as parameter, starting 'fdisk' looks like this:
# fdisk /dev/sdc

The number of cylinders for this disk is set to 32280.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
In order to make the USB-stick usable on a lot of systems, it seems to be a good idea to create a MSDOS-partitiontable on it.
Command (m for help): o
Building a new DOS disklabel with disk identifier 0x077c807a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

The number of cylinders for this disk is set to 32280.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The only purpose of this stick will be that it is able to boot a range of kernels. Using it to save or transfer files is not important and therefore this stick will contain one VFAT partition. This makes it possible to add files and change the configuration under practically any operating system.

Create one primary partition:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
The partition should be the first partition:
Partition number (1-4): 1
The start of the partition should be the first cylinder on the disk:
First cylinder (1-32280, default 1):
Using default value 1
By default the size of the partition will be the whole disk:
Last cylinder, +cylinders or +size{K,M,G} (1-32280, default 32280):
Using default value 32280
Change the type of the partition:
Command (m for help): t
Selected partition 1
VFAT is most portable, so choose 'c' (the hex-value for VFAT):
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Mark the newly created partition bootable (probably not needed though):
Command (m for help): a
Partition number (1-4): 1
Check if all has been configured correctly, nothing has been saved yet:
Command (m for help): p

Disk /dev/sdc: 2082 MB, 2082471936 bytes
2 heads, 63 sectors/track, 32280 cylinders
Units = cylinders of 126 * 512 = 64512 bytes
Disk identifier: 0x077c807a

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 32280 2033608+ c W95 FAT32 (LBA)
If all looks okay, write the changes to the partitiontable on the disk:
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
After this, the kernel got instructed to read the new partitiontable. The result should be that there is a new /dev/sdc1. Before this new partition can be used, it should be formatted:
# mkfs -t vfat -n ndevos /dev/sdc1
With the new filesystem on the USB-stick, it is now possible to mount the stick:
# mount /dev/sdc1 /mnt
and copy the required files for the bootloader:
# mkdir -p /mnt/boot/grub
# cp /boot/grub/* /mnt/boot/grub/
Before the bootlaoder can get installed in the Master Boot Record (MBR), it needs to get mapped, so that GRUB recognises the USB-stick as first bootable disk. This can be done by changing the device.map file (or creating it if missing):
[root@localhost ~]# cat /mnt/boot/grub/device.map
# this device map was generated by ndevos on eeepc
(hd0) /dev/sdc
This example shows that (hd0) is mapped to /dev/sdc.

Installing GRUB with the updated device.map file is done like this:
# grub --device-map=/mnt/boot/grub/device.map


GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,0)
root (hd0,0)
Filesystem type is fat, partition type 0xc
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (hd0)"... 27 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
grub> quit
quit
The USB-stick does now contain a working GRUB and can be used to bootstrap an installer (or rescue disk) for any Fedora, RHEL and possibly other Linux distributions. The only two things that needs to be done before this works are
  1. copy the vmlinz and initrd.img to the /mnt/boot directory
  2. update the /mnt/boot/grub/grub.conf with lines to boot the new kernel (with any options you like) with the matching initrd

Debugging USB with VMware

This looks really cool! It includes logging the traffic, and even a graphical analyser is available:

Virtual USB Analyzer - Tutorial

Enabling access over a serial console

To enable access to a (virtual) system over a serial console I'm doing following steps:

1) add a login-prompt on the serial console

echo 'S0:2345:respawn:/sbin/agetty ttyS0 115200 vt100' >> /etc/inittab


2) allow root to login over serial console

echo ttyS0 >> /etc/securetty


3) let /sbin/init reload the inittab to make the login prompt active

/sbin/telinit q


Now you can connect to the serial console and after pressing 'return' you should see a login prompt.

Optionally put the output of the kernel and boot process over the console
4) add parameters console=tty0 console=ttyS0,115200 to the kernel line in /boot/grub/grub.conf

title Red Hat Enterprise Linux AS (2.6.9-78.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-78.EL ro root=/dev/VolGroup00/LogVol00 console=tty0 console=ttyS0,115200
initrd /initrd-2.6.9-78.EL.img


By adding both parameters console=tty0 and console=ttyS0,115200, the output of the kernel is sent to both consoles. For the boot messages the last console is used. This is useful if your main console is a serial one, but you also have a real (or virtual) monitor connected.

This is what I see when booting one of my virtual systems on Fedora 11:

# virsh start --console rhel4
Domain rhel4 started
Connected to domain rhel4
Escape character is ^]
Linux version 2.6.9-78.EL (brewbuilder@hs20-bc2-3.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)) #1 Wed Jul 9 15:27:01 EDT 2008
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e8000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000001fff0000 (usable)
BIOS-e820: 000000001fff0000 - 0000000020000000 (ACPI data)
BIOS-e820: 00000000fffbc000 - 0000000100000000 (reserved)
0MB HIGHMEM available.
511MB LOWMEM available.
found SMP MP-table at 000fbd10
Using x86 segment limits to approximate NX protection
zapping low mappings.
DMI 2.4 present.
ACPI: PM-Timer IO Port: 0xb008
ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
Processor #0 6:3 APIC version 20
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] disabled)
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] disabled)
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x03] disabled)
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x04] disabled)
ACPI: LAPIC (acpi_id[0x05] lapic_id[0x05] disabled)
ACPI: LAPIC (acpi_id[0x06] lapic_id[0x06] disabled)
ACPI: LAPIC (acpi_id[0x07] lapic_id[0x07] disabled)
ACPI: LAPIC (acpi_id[0x08] lapic_id[0x08] disabled)
ACPI: LAPIC (acpi_id[0x09] lapic_id[0x09] disabled)
ACPI: LAPIC (acpi_id[0x0a] lapic_id[0x0a] disabled)
ACPI: LAPIC (acpi_id[0x0b] lapic_id[0x0b] disabled)
ACPI: LAPIC (acpi_id[0x0c] lapic_id[0x0c] disabled)
ACPI: LAPIC (acpi_id[0x0d] lapic_id[0x0d] disabled)
ACPI: LAPIC (acpi_id[0x0e] lapic_id[0x0e] disabled)
ACPI: LAPIC (acpi_id[0x0f] lapic_id[0x0f] disabled)
Enabling APIC mode: Flat. Using 0 I/O APICs
ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
Using ACPI (MADT) for SMP configuration information
Allocating PCI resources starting at 30000000 (gap: 20000000:dffbc000)
Built 1 zonelists
Kernel command line: ro root=/dev/VolGroup00/LogVol00 console=tty0 console=ttyS0,115200 elevator=noop
Initializing CPU#0
CPU 0 irqstacks, hard=c0418000 soft=c0417000
PID hash table entries: 2048 (order: 11, 32768 bytes)
Detected 2394.771 MHz processor.
Using pmtmr for high-res timesource
Console: colour VGA+ 80x25
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 513840k/524224k available (2209k kernel code, 9752k reserved, 745k data, 172k init, 0k highmem)
Calibrating delay using timer specific routine.. 4560.74 BogoMIPS (lpj=2280372)
Security Scaffold v1.0.0 initialized
SELinux: Initializing.
selinux_register_security: Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: Intel Pentium II (Klamath) stepping 03
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Checking 'hlt' instruction... OK.
ENABLING IO-APIC IRQs
..TIMER: vector=0x31 pin1=0 pin2=-1
checking if image is initramfs... it is
Freeing initrd memory: 1175k freed
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xfb510, last bus=0
PCI: Using configuration type 1
mtrr: v2.0 (20020519)
ACPI: Subsystem revision 20040816
ACPI: Interpreter enabled
ACPI: Using IOAPIC for interrupt routing
ACPI: PCI Root Bridge [PCI0] (00:00)
PCI: Probing PCI hardware (bus 00)
ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
Linux Plug and Play Support v0.97 (c) Adam Belay
xen_mem: Initialising balloon driver.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: Using ACPI for IRQ routing
ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
ACPI: PCI Interrupt 0000:00:01.2[D] -> GSI 11 (level, high) -> IRQ 11
ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
ACPI: PCI Interrupt 0000:00:01.3[A] -> GSI 10 (level, high) -> IRQ 10
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
ACPI: PCI Interrupt 0000:00:03.0[A] -> GSI 11 (level, high) -> IRQ 11
ACPI: PCI Interrupt 0000:00:04.0[A] -> GSI 11 (level, high) -> IRQ 11
ACPI: PCI Interrupt 0000:00:05.0[A] -> GSI 10 (level, high) -> IRQ 10
apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac)
apm: overridden by ACPI.
audit: initializing netlink socket (disabled)
audit(1247389170.873:1): initialized
Total HugeTLB memory allocated, 0
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Initializing Cryptographic API
ksign: Installing public key data
Loading keyring
- Added public key 9ADA2B4B1EC241DE
- User ID: Red Hat, Inc. (Kernel Module GPG key)
PCI: PIIX3: Enabling Passive Release on 0000:00:01.0
Limiting direct PCI/PCI transfers.
Activating ISA DMA hang workarounds.
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
ACPI: Processor [CPU0] (supports C1)
Real Time Clock Driver v1.12
Linux agpgart interface v0.100 (c) Dave Jones
serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 68 ports, IRQ sharing enabled
�ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
PIIX3: IDE controller at PCI slot 0000:00:01.1
PIIX3: chipset revision 0
PIIX3: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0xc000-0xc007, BIOS settings: hda:pio, hdb:pio
ide1: BM-DMA at 0xc008-0xc00f, BIOS settings: hdc:pio, hdd:pio
hda: QEMU HARDDISK, ATA DISK drive
Using noop io scheduler
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
hdc: QEMU DVD-ROM, ATAPI CD/DVD-ROM drive
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 1024KiB
hda: 16777216 sectors (8589 MB) w/256KiB Cache, CHS=16383/255/63, (U)DMA
hda: hda1 hda2
hdc: ATAPI 4X CD-ROM drive, 512kB Cache, (U)DMA
Uniform CD-ROM driver Revision: 3.20
ide-floppy driver 0.99.newide
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.0:USB HID core driver
mice: PS/2 mouse device common for all mice
input: AT Translated Set 2 keyboard on isa0060/serio0
input: ImExPS/2 Generic Explorer Mouse on isa0060/serio1
md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27
NET: Registered protocol family 2
IP route cache hash table entries: 8192 (order: 3, 32768 bytes)
TCP established hash table entries: 32768 (order: 6, 262144 bytes)
TCP bind hash table entries: 32768 (order: 7, 917504 bytes)
TCP: Hash tables configured (established 32768 bind 32768)
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
ACPI wakeup devices:

ACPI: (supports S3 S4 S5)
Freeing unused kernel memory: 172k freed
Red Hat nash version 4.2.1.13 starting
Mounted /proc filesystem
Mounting sysfs
Creating /dev
Starting udev
Loading dm-mod.ko module
device-mapper: 4.5.5-ioctl (2006-12-01) initialised: dm-devel@redhat.com
Loading jbd.ko module
Loading ext3.ko module
Loading dm-mirror.ko module
Loading dm-zero.ko module
Loading dm-snapshot.ko module
Making device-mapper control node
Scanning logical volumes
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
2 logical volume(s) in volume group "VolGroup00" now active
Creating root device
Mounting root filesystem
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Switching to new root
INIT: version 2.85 booting
Setting default font (latarcyrheb-sun16): [ OK ]

Welcome to Red Hat Enterprise Linux AS
Press 'I' to enter interactive startup.
Setting clock (utc): Sun Jul 12 09:59:43 BST 2009 [ OK ]
Starting udev: [ OK ]
Initializing hardware... storage network audio done[ OK ]
Configuring kernel parameters: [ OK ]
Loading default keymap (de-latin1): [ OK ]
Setting hostname localhost.localdomain: [ OK ]
Checking root filesystem
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/VolGroup00/LogVol00
/dev/VolGroup00/LogVol00: clean, 64778/897600 files, 397753/1794048 blocks
[ OK ]
Remounting root filesystem in read-write mode: [ OK ]
No RAID disks
Setting up Logical Volume Management: [ OK ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/hda1
/boot: clean, 35/26104 files, 12799/104388 blocks
[ OK ]
Mounting local filesystems: [ OK ]
Enabling local filesystem quotas: [ OK ]
Enabling swap space: [ OK ]
INIT: Entering runlevel: 3
Entering non-interactive startup
Applying Intel Microcode update: [ OK ]
Starting monitoring for VG VolGroup00: [ OK ]
Checking for new hardware [ OK ]
Starting pcmcia: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1:
Determining IP information for eth1... failed.
[FAILED]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
Starting portmap: [ OK ]
Starting NFS statd: [ OK ]
Starting RPC idmapd: [ OK ]
Mounting other filesystems: [ OK ]
Starting lm_sensors: [ OK ]
Starting automount: No Mountpoints Defined[ OK ]
Starting smartd: [FAILED]
Starting acpi daemon: [ OK ]
Starting cups: [ OK ]
Starting sshd:[ OK ]
Starting xinetd: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
Starting console mouse services: [ OK ]
Starting crond: [ OK ]
Starting xfs: [ OK ]
Starting anacron: [ OK ]
[ OK ] atd: [ OK ]
Starting system message bus: [ OK ]
Starting Red Hat Network Daemon: [ OK ]
Starting HAL daemon: [ OK ]

Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
Kernel 2.6.9-78.EL on an i686

localhost.localdomain login: