Well, that was easy.
I remember that Broadcom publically offered their bootloader source online for download. I downloaded version 1.4.2 and extracted this. Broadcom offers a bunch of crosscompiler toolchains for download, but only for the sb1, mips and mips64 architectures. Not for the PowerPC architecture that the MPC8245 is using.
So I downloaded the ELDK toolchain, ppc-2008-04-01.iso, mounted the ISO and installed this (./install -d /opt/eldk ppc_6xx).
The README states that you have to enter the directory of the respecture architecture and just run make. So that’s what I did:
~/dev/cfe-1.4.2/build/broadcom/bcm98245cpci$ make ppc-elf-gcc -DCFG_PCI=1 -DCFG_LDT=0 -g -c -ffreestanding -O2 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -fomit-frame-pointer -meabi -mrelocatable -DCFG_RELOC=1 -DCFG_RELOC=1 -DCFG_UNCACHED=0 -DCFE_ROM_START=0xFFF00000 -DCFE_TEXT_START=0xFFF00000 -DCFE_DATA_START=0x00010000 -I. -I../../../cfe/arch/ppc/board/bcm98245cpci/include -I../../../cfe/arch/ppc/chipset/mpc824x/include -I../../../cfe/arch/ppc/cpu/mpc8245/include -I../../../cfe/arch/ppc/common/include -I../../../cfe/include -I../../../cfe/net -I../../../cfe/dev -I../../../cfe/pci -D_CFE_ -DCFE_VER_MAJ=1 -DCFE_VER_MIN=4 -DCFE_VER_ECO=2 -DCFG_BOARDNAME=\""BCM98245CPCI"\" -D_MPC8245_ -DINCLUDE_FLASH_DRIVERS -D_BCM98245CPCI_ -o init_ppc.o ../../../cfe/arch/ppc/common/src/init_ppc.S /bin/sh: ppc-elf-gcc: command not found make: *** [init_ppc.o] Error 127 ~/dev/cfe-1.4.2/build/broadcom/bcm98245cpci$
It uses a different PREFIX than ELDK. No hassle, just change it:
../../../cfe/arch/ppc/common/src/tools.mk:TOOLPREFIX ?= ppc_82xx-
On to the into the next issue:
ppc_82xx-gcc -DCFG_PCI=1 -DCFG_LDT=0 -g -c -ffreestanding -O2 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -fomit-frame-pointer -meabi -mrelocatable -DCFG_RELOC=1 -DCFG_RELOC=1 -DCFG_UNCACHED=0 -DCFE_ROM_START=0xFFF00000 -DCFE_TEXT_START=0xFFF00000 -DCFE_DATA_START=0x00010000 -I. -I../../../cfe/arch/ppc/board/bcm98245cpci/include -I../../../cfe/arch/ppc/chipset/mpc824x/include -I../../../cfe/arch/ppc/cpu/mpc8245/include -I../../../cfe/arch/ppc/common/include -I../../../cfe/include -I../../../cfe/net -I../../../cfe/dev -I../../../cfe/pci -D_CFE_ -DCFE_VER_MAJ=1 -DCFE_VER_MIN=4 -DCFE_VER_ECO=2 -DCFG_BOARDNAME=\""BCM98245CPCI"\" -D_MPC8245_ -DINCLUDE_FLASH_DRIVERS -D_BCM98245CPCI_ -o pci_subr.o ../../../cfe/pci/pci_subr.c /tmp/cc85MlSl.s: Assembler messages: /tmp/cc85MlSl.s:3148: Warning: ignoring changed section attributes for .text /tmp/cc85MlSl.s:8597: Error: unaligned opcodes detected in executable segment make: *** [pci_subr.o] Error 1
I don’t need PCI at first, so I disable this:
Makefile:CFG_PCI = 0
And run make clean, make again. Next issue:
ppc_82xx-gcc -g -c -ffreestanding -O2 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -fomit-frame-pointer -meabi -mrelocatable -DCFG_RELOC=1 -DCFG_RELOC=1 -DCFG_UNCACHED=0 -DCFE_ROM_START=0xFFF00000 -DCFE_TEXT_START=0xFFF00000 -DCFE_DATA_START=0x00010000 -I. -I../../../cfe/arch/ppc/board/bcm98245cpci/include -I../../../cfe/arch/ppc/chipset/mpc824x/include -I../../../cfe/arch/ppc/cpu/mpc8245/include -I../../../cfe/arch/ppc/common/include -I../../../cfe/include -I../../../cfe/net -I../../../cfe/dev -I../../../cfe/pci -D_CFE_ -DCFE_VER_MAJ=1 -DCFE_VER_MIN=4 -DCFE_VER_ECO=2 -DCFG_BOARDNAME=\""BCM98245CPCI"\" -D_MPC8245_ -DINCLUDE_FLASH_DRIVERS -D_BCM98245CPCI_ -o dev_ide_frodo.o ../../../cfe/dev/dev_ide_frodo.c ../../../cfe/dev/dev_ide_frodo.c:92:20: error: sbmips.h: No such file or directory make: *** [dev_ide_frodo.o] Error 1
There’s no IDE, so I don’t need this (which appears to be mips-specific anyhow) either:
../../../cfe/dev/Makefile: dev_bcm5780_ht1000.o #dev_ide_frodo.o
And on with a make clean, make and on to the next issue:
ppc_82xx-objcopy --output-target=binary cfe cfe.bin ppc_82xx-objcopy --input-target=binary --output-target=srec cfe.bin cfe.srec gcc -g -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -o mkflashimage -I../../../cfe/include ../../../cfe/hosttools/mkflashimage.c cc1: warnings being treated as errors ../../../cfe/hosttools/mkflashimage.c: In function 'main': ../../../cfe/hosttools/mkflashimage.c:324: error: pointer targets in passing argument 1 of 'strcpy' differ in signedness make: *** [mkflashimage] Error 1
Their mkflashimage tool doesn’t build. But no worries, it seems to have build the cfe.bin anyhow, so that’s no issue. We’ll just flash cfe.bin.
So using the JTAG tool from earlier, I make a backup of the original bootloader and then I flash this cfe.bin on offset 0×700000 (ROMBASE is 0xff800000, system reset vector is 0xfff00100) and reboot the switch:
CFE version 1.4.2 for BCM98245CPCI (32bit,SP,BE,PPC) Build Date: Sat May 8 19:55:01 CEST 2010 (dev@box) Copyright (C) 2000,2001,2002,2003,2004,2005 Broadcom Corporation. Initializing Arena. Initializing Devices. CPU Multiplier: 2.0 Mem Multiplier: 3.0 Sys logic clock: 99MHz CPU type 0x80811014: 198MHz Total memory: 0x4000000 bytes (64MB) Total memory used by CFE: 0x03F574E0 - 0x03FFFFF0 (690960) Initialized Data: 0x03F7F11C - 0x03F7F830 (1812) BSS Area: 0x03F7F830 - 0x03F7FBF0 (960) Local Heap: 0x03F7FBF0 - 0x03FFFBF0 (524288) Stack Area: 0x03FFFBF0 - 0x03FFFFF0 (1024) Text (code) segment: 0x03F574E0 - 0x03F7E3C4 (159460) Boot area (physical): 0x00000000 - 0x00000000 Relocation Factor: I:040574E0 - D:040574E0 CFE>
Success! It seems to misdetect the memory (which is hardcoded due to lack of SPD), doesn’t detect the flash:
CFE> show flash show flash [-sectors] -sectors Display sector information *** command status = -2 CFE>
And probably loads more issues, but at least it’s running selfcompiled code!
May 14, 2010 at 08:44 |
[...] I grab the latest U-Boot (u-boot-2010.03.tar.bz2) and using the same ELDK toolchain as earlier I [...]