[U-Boot] [PATCH 5/7] Make a special uboot used for booting from SDcard or SPI flash
Wolfgang Denk
wd at denx.de
Tue Mar 17 13:30:38 CET 2009
Dear "Hu Mingkai-B21284",
In message <73839B4A0818E747864426270AC332C303E411DE at zmy16exm20.fsl.freescale.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?
> > > @@ -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.
> > > --- 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.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I haven't lost my mind -- it's backed up on tape somewhere.
More information about the U-Boot
mailing list