This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CDL template example?


Jonathan Larmour <jlarmour@redhat.com> writes:

> Gary Thomas wrote:
> > 
> > On Tue, 2001-12-11 at 15:34, Grant Edwards wrote:
> > >
> > > What I'd like is a way to pre-define a configuration that would
> > > be the same as the result of doing something like:
> > >
> > >    ecosconfig new foobar
> > >    ecosconfig remove this-package
> > >    ecosconfig add that-package theother-package
> > >    [edit ecos.ecc to set user-values for a handfull of package options]
> > 
> > Use 'ecosconfig import <file>'.  While we generally use this to define
> > a complete configuration, the file can actually be any CDL .ecm
> > fragment.  For example, I use this fragment to force ROM startup mode:
> > 
> > ------- startup.ROM -----------
> >     cdl_component CYG_HAL_STARTUP {
> >         user_value ROM
> >     };
> > 
> 
> Although as was only recently discussed here, imported files can't _remove_
> packages. For that, you need to have a new template with that package not
> included, or use the "next smallest" template and add the missing packages.
> (this is now bug 57324)

By adding instructions to the heading comment in the ecm files like:

# Networking application modifications for the "toto" system
#
# Our custom eCos build process looks for these lines to determine the
# eCos template and the packages to remove from the configuration.
#
# Template: default
# Remove packages: CYGPKG_DEVS_FLASH_PLC2
#

and using some make rules to update your eCos configuration (not all variables
have a definition in this fragment, but you get the idea):

eCos_configurations := redboot-rom redboot-ram appdbg appprod
# This will build 4 different eCos configurations based on the target/template
# and modified by redboot-rom.ecm, redboot-ram.ecm, appdbg.ecm, appprod.ecm

ecos_src_dir := $(eCos_root)/ecos-$(eCos_version)
ecos_work_pfx = $(eCos_root)/ecos-work-$(eCos_version)-$(eCos_target_alias)-
ecos_config_pat = $(eCos_cfg_root)/%.ecm

export ECOS_REPOSITORY = $(ecos_src_dir)/packages

.PRECIOUS: $(ecos_work_pfx)%/ecos.ecc
$(ecos_work_pfx)%/ecos.ecc: $(ecos_config_pat) Makefile \
                            $(ecos_src_dir)/packages/ecos.db
    $(make-target-directory)
    cd $(@D) && $(run-ecosconfig)

ecos_template = $(shell                                                   \
  sed -ne '/\# Template:/s,[^:]*: *\([^ ]*\).*,\1,p' $<)
ecos_removed_packages = $(shell                                           \
  sed -ne '/\# Remove packages:/s,[^:]*:\(.*\)$$,\1,p' $<)

define run-ecosconfig
$(ecos_tools_dir)/bin/ecosconfig new $(eCos_target) $(ecos_template) &&   \
for pkg in $(ecos_removed_packages) ""; do                                \
  test -z "$$pkg" || $(ecos_tools_dir)/bin/ecosconfig remove $$pkg;       \
done &&                                                                   \
$(ecos_tools_dir)/bin/ecosconfig import $<
endef

$(ecos_work_pfx)%/ecos-tree.stamp: $(ecos_work_pfx)%/ecos.ecc
    cd $(@D) &&                                                           \
      $(ecos_tools_dir)/bin/ecosconfig check &&                           \
      $(ecos_tools_dir)/bin/ecosconfig tree &&                            \
      echo "" > $@

.PHONY: $(eCos_configurations)
build: $(eCos_configurations)
$(eCos_configurations): %: $(ecos_work_pfx)%/ecos-tree.stamp
    cd $(dir $<) && make


Then you can modify the config options, include packages or exclude packages by
editing the corresponding ecm file and running make. Easy, no?

Robin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]