[U-Boot] [PATCH 5/7] Make a special uboot used for booting from SDcard or SPI flash

Hu Mingkai-B21284 Mingkai.Hu at freescale.com
Thu Aug 27 04:43:58 CEST 2009


Hi Wolfgang,

First truly sorry for the long time delay. I'm not on purpose.

I reworked this patch and unified the implementation of booting from
NAND/SDCard/SPI flash
for MPC85xx platform, and sent to the U-Boot list on August:
http://lists.denx.de/pipermail/u-boot/2009-August/058803.html

Also we tried a method that not to swamp the top level Makefile with
different configuration
options. Hope you can find some time to give some comments.

Please find comments inline about this patch.

> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de] 
> Sent: Tuesday, March 17, 2009 8:31 PM
> To: Hu Mingkai-B21284
> Cc: Fleming Andy-AFLEMING; u-boot at lists.denx.de; 
> Subject: Re: [U-Boot] [PATCH 5/7] Make a special uboot used 
> for booting from SDcard or SPI flash
> 
> Dear "Hu Mingkai-B21284",
> 
> In message 
> <73839B4A0818E747864426270AC332C303E411DE at zmy16exm20.fsl.frees
> cale.net> you wrote:
> >
> > > Cannot this be done with U-Boot, or with Linux running on 
> any other 
> > > system that das a SDCard reader/writer attached to it?
> >
> > It's hard to do that, in order to support booting from the 
> SDCard, we 
> > place the data structure onto the unused space on the MBR on the 
> > SDCard.
> 
> What exactly is the difficault part there?
> 
> Reading and modifying the MBR is just like reading or writing 
> any other block on the device. Where is the problem?
> 

Yes, you're right. We just need to put the specific info to the assigned
address.

> > > > @@ -2360,6 +2360,18 @@ ATUM8548_config:	unconfig
> > > >  MPC8536DS_config:       unconfig
> > > >  	@$(MKCONFIG) $(@:_config=) ppc mpc85xx 
> mpc8536ds freescale
> > > >  
> > > > +MPC8536DS_SPIFLASH_config \
> > > > +MPC8536DS_SDCARD_config:	unconfig
> > > > +	@echo "" >$(obj)include/config.h;
> > > > +	@if [ "$(findstring _SPIFLASH_,$@)" ] ; then \
> > > > +		echo "#define CONFIG_SPIFLASH_U_BOOT" >>
> > > $(obj)include/config.h ; \
> > > > +	fi ;
> > > > +	@echo "#define CONFIG_SDCARD_U_BOOT" >> 
> $(obj)include/config.h ;
> > > > +	@$(MKCONFIG) -a MPC8536DS ppc mpc85xx mpc8536ds 
> freescale ; \
> > > > +		echo "TEXT_BASE = 0x11001000" >
> > > $(obj)board/freescale/mpc8536ds/config.tmp ; \
> > > > +		echo "#define CONFIG_SDCARD_U_BOOT" >>
> > > $(obj)include/config.h ;  \
> > > > +		echo "CONFIG_SDCARD_U_BOOT = y" >>
> > > $(obj)include/config.mk ;
> > > > +
> > > 
> > > Please do noty swamp the top level Makefile with configuration 
> > > options for one board.
> > > 
> >
> > Could you give me some suggestion? ;-) Where is the proper 
> position to 
> > handle this?
> 
> Options if a board has (or uses) SPI flash and/or a SDCard 
> and/or other things belong into the board config file. It 
> makes no sense to provide long lists of make targets and then 
> again long code to analyze these options in the top level 
> Makefile. For example, above code would not allow for the 
> case that a customer wants to use a board with SPI flash 
> *and* SDCard - it covers only the *or* case. And no, please 
> do not attempt to add even more such targets. This is not the 
> way to go. It doesn't scale.
> 
> Assume each of the hundrets of boards would add code like this.
> 

So we add another option (-t) on the mkconfig file to parse the target
to individual targets,
and put them to config.h and config.mk, then leave the board config file
and board makefile
to handle the different options.
http://lists.denx.de/pipermail/u-boot/2009-August/058804.html

Really need your suggestions.

> > > > --- a/config.mk
> > > > +++ b/config.mk
> > > > @@ -112,8 +112,8 @@ DBGFLAGS= -g # -DDEBUG  OPTFLAGS= -Os 
> > > > #-fomit-frame-pointer  ifndef LDSCRIPT  #LDSCRIPT := 
> > > > $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
> > > > -ifeq ($(CONFIG_NAND_U_BOOT),y)
> > > > -LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
> > > > +ifeq ($(CONFIG_SDCARD_U_BOOT),y)
> > > > +LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-sdboot.lds
> > > >  else
> > > >  LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
> > > >  endif
> > > 
> > > Is it absolutely necessary to set this in the top level config.mk 
> > > file?
> > > 
> > Maybe combined with u-boot.lds.
> 
> Or moved to a processor or board specific config.mk.
> 
> 

Reused the u-boot.lds for booting from SDCard/SPI flash.

> Best regards,
> 
> Wolfgang Denk
> 

Sorry again for the delayed response.

Many thanks,
Mingkai


More information about the U-Boot mailing list