[U-Boot-Users] Custom Board configuration

Andrew Wozniak awozniak at mc.com
Wed Jun 8 16:29:44 CEST 2005

Wolfgang Denk wrote:
> In message <000101c56c28$4af32eb0$f201a8c0 at SN7606> you wrote:
>>need a minimal configuration for booting with u-boot. Is there anywhere a
>>guide or some information what i have to do?!
> I recommend you start with the README, probably section "Porting
> Guide" or so...

cute porting guide - read it anyway.

Here's how I approached our port of a custom PPC440gx board.

- first of all, try to understand the general initialization of U-Boot
- get and install PPC4xx compiler and tools
- setup/use ctags or cscope with a compatible editor
- find and choose an existing U-Boot port that resembles your target
- if target has a JTAG interface, acquire a JTAG debugger
- modify the memory settings of the baseline port you've chosen - I 
used OCOTEA port
- edit the config file for your target (OCOTEA.h). see the README for 
additional entries
- adjust Makefile to pickup your compiler properly
- build it:
make mrproper
make OCOTEA_config
make dep
- if build works, verify the .map output fits your target memory layout
- install u-boot.bin and single step via JTAG, see how far you get
- get GDB/DDD hooked up to your BDM JTAG pod
- convert/copy the OCOTEA build target to your own; create a 
board/your_target directory and include/configs/YOUR_TARGET.h
- rebuild as before but with YOUR_TARGET_config
- replace/remove any OCOTEA specific (FPGA) init functions
- get the console I/O, RTC... working
- turn on DEBUG statements to see what is running
- get the rest of the U-Boot commands working thru a combination of JTAG 
and printfs
- document the initialization that you see happening - see my attached 
logfile. it has lot of extra info that may not apply to your target. I'm 
not responsible for any inaccuracies ;)
- don't forget to dig thru the READMEs and source code. It is helpful to 
some degree.

> Best regards,
> Wolfgang Denk

# logfile	general boot sequence for PPC440GX target
# 2005-03-28	Andrew Wozniak, initial draft

_start_440()                             cpu/ppc4xx/start.S
   ...Initialize debug registers
   ...CCR0 init
   ...Setup interrupt vectors at 0x0000_0000
   ...config cache regions
   ...clear and setup TLBs
   ...SDRAM fast refresh
   ...jump to _start
   ...setup ISRAM
   ...setup stack within ISRAM
   ...ready to run "C" level init code
   ...jump to board_init_f		jump to "C" level code

   board_init_f()			lib_ppc/board.c

       board_early_init_f()              board/ocotea/ocotea.c
         ...init OCOTEA FPGA network ops
         ...setup CSO for Flash		setup Flash chip select
         ...setup UIC 			setup interrupt controller
       get_clocks,			get CPU clock info from GD
       env_init,				validate CRC, point to env space or hard coded dflt
       display_options,			display U-Boot name and version info
       checkcpu,				update CPU rev info
       checkboard,			display CPU clock details

           fixed_sdram()			ocotea.c - memory controller setup/timimg
     end of init[]

     ...init gd (global data) values
     ...allocate stack memory
     ...reserve memory for data, BSS
     ...reserve memory for malloc
     ...allocate/copy global data structure
     ...setup stack
     ...save board info structure
     ...run optional post

     relocate_code()                     cpu/ppc4xx/start.S
       ...copy self to RAM

   board_init_r()                        lib_ppc/board.c
     trap_init()				setup trap handlers	cpu/ppc4xx/start.S
     flash_init()			setup structures, protect monitor & envars
     cpu_init_r()			initialize high-level parts of CPU; time base and timers
     s = get_env("ethaddr")		MAC address	( lib_ppc/board.c)
     getenv_IPaddr ("ipaddr")
     misc_init_r()                    	platform specific
     reset_phy ()
     interrupt_init()			Enable Interrupts	lib_ppc/interrupts.c
       interrupt_init_cpu()		cpu/ppc4xx/interrupts.c

     eth_initialize()                 	net/eth.c
       ppc_440x_eth_initialize()      	cpu/ppc4xx/440gx_enet.c
         ppc_440x_eth_init()		also read SROM for MAC values

       compare SROM and envar MAC values
	print if diff

     for (;;)
       main_loop()                      	u-boot monitor	common/main.c
       getenv ("bootdelay")
       run_command(getenv ("bootcmd"))

More information about the U-Boot mailing list