Running U-Boot on the Dell Powerconnect 3324

CFE is a nice bootloader, but it’s only focussed on booting VxWorks images.

The current preferred opensource embedded bootloader appears to be Das U-Boot. And U-Boot conveniently supports the ‘BMW’ platform.

So I grab the latest U-Boot (u-boot-2010.03.tar.bz2) and using the same ELDK toolchain as earlier I do:

$ CROSS_COMPILE=ppc_82xx- make BMW_config
Configuring for BMW board...
$ CROSS_COMPILE=ppc_82xx- make
... lots of output ...
ppc_82xx-gcc -E -g  -Os   -mrelocatable -fPIC -meabi -D__KERNEL__ -DTEXT_BASE=0xFFF00000 -I/home/zoiah/dev/u-boot-2010.03.work/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/eldk/usr/bin/../lib/gcc/powerpc-linux/4.2.2/include -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC824X -ffixed-r2 -mstring -mcpu=603e -msoft-float -DEMBEDDED -DBIG_ENDIAN_HOST -DINCLUDE_5701_AX_FIX=1 -DDBG=0 -DT3_JUMBO_RCV_RCB_ENTRY_COUNT=256 -DTEXT_BASE=0xFFF00000 -include /home/zoiah/dev/u-boot-2010.03.work/include/u-boot/u-boot.lds.h -DLD_MAJOR=2 -DLD_MINOR=17 -ansi -D__ASSEMBLY__ -P - </home/zoiah/dev/u-boot-2010.03.work/cpu/mpc824x/u-boot.lds >u-boot.lds
UNDEF_SYM=`ppc_82xx-objdump -x board/bmw/libbmw.a lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/mpc824x/libmpc824x.a lib_ppc/libppc.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a | sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`; cd /home/zoiah/dev/u-boot-2010.03.work && ppc_82xx-ld -Bstatic -T u-boot.lds  -n -Ttext 0xFFF00000 $UNDEF_SYM cpu/mpc824x/start.o --start-group lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/mpc824x/libmpc824x.a lib_ppc/libppc.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a board/bmw/libbmw.a --end-group -L /opt/eldk/usr/bin/../lib/gcc/powerpc-linux/4.2.2/pic -lgcc -Map u-boot.map -o u-boot
ppc_82xx-objcopy -O srec u-boot u-boot.srec
ppc_82xx-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
$

u-boot.bin is the file I need to flash. So I use the same JTAG tools as before and I flash it on 0x00700000. And let’s take a look:

U-Boot 2010.03 (May 13 2010 - 13:02:20)

CPU:   MPC8245 Revision 1.4 at 247.500 MHz: 16 kB I-Cache 16 kB D-Cache
Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)
Built: May 13 2010 at 13:02:20
Local Bus at 99 MHz
DRAM:  64 MB
FLASH: *** failed ***
### ERROR ### Please RESET the board ###

Ha! Output! Ok, let’s see if we can get it to boot further. After outputting the failed flash detection, it hangs. This appears to be outputted around line 730 in lib_ppc/board.c:

if ((flash_size = flash_init ()) > 0) {
# ifdef CONFIG_SYS_FLASH_CHECKSUM
 print_size (flash_size, "");
 /*
 * Compute and print flash CRC if flashchecksum is set to 'y'
 *
 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
 */
 s = getenv ("flashchecksum");
 if (s && (*s == 'y')) {
 printf ("  CRC: %08X",
 crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
 );
 }
 putc ('\n');
# else  /* !CONFIG_SYS_FLASH_CHECKSUM */
 print_size (flash_size, "\n");
# endif /* CONFIG_SYS_FLASH_CHECKSUM */
 } else {
 puts (failed);
 hang ();
 }

That ‘hang ()’ is probably there for a reason, but I comment it anyhow and retry:

U-Boot 2010.03 (May 13 2010 - 13:19:22)

CPU:   MPC8245 Revision 1.4 at 247.500 MHz: 16 kB I-Cache 16 kB D-Cache
Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)
Built: May 13 2010 at 13:19:22
Local Bus at 99 MHz
DRAM:  64 MB
FLASH: *** failed ***
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
Wrong Image Format for bootm command
ERROR: can't get kernel image!
=>

Ha, guess it wasn’t there for a reason. Later I noticed the following  around it:

#if !defined(CONFIG_SYS_NO_FLASH)
 puts ("FLASH: ");

So instead of hacking the code, I could just set this define in include/configs/BMW_config.h. Which I promptly did.

Now, we have a functional u-boot. But no functional flash. I spoke with Wolfgang Denk on IRC (#mklinux on Freenode) and it appears that the ‘bmw’ board is unmaintained in U-Boot. Since the porting of the board 8 years ago there have been large steps in moving functionality like flash initialization, memory initialization, etc. into generic components with variables defined in include/configs/boardname_config.h.

I also noticed a lot of code in board/bmw/early_init.S which appears to initialize the memory. In other maintained boards this have been replaced with defines in the boardconfig. The init_dram from bmw.c is a bit minimalistic:

phys_size_t initdram(int board_type)
{
 return 64*1024*1024;
}

So I can try to get the current board-specific flash code (board/bmw/flash.c) to support my flash ROM, or I can try to port the board to the newer code. Or repurpose an existing board to support my board.

Next post I’ll continue with this.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: