Porting To A New Platform

From Daya Bay

Jump to: navigation, search

Porting NuWa to a new platform requires introducing it to CMT and correcting any code that will not build/run as-is.

Introducing the Platform to CMT

CMT and the lcgcmt project learn about a platform through a circular configuration. The CMTCONFIG env. var. defines some "host-*" tags which are used to defined "target-*" tags which then must reconstruct CMTCONFIG.

First steps

Just try the usual installation and watch for errors like:

ERROR: CMTCONFIG is not compatible!

If it is not seen, the platform is (likely) already supported.

Determining the Platform tags

CMT must already be installed.

dybinst trunk cmt

will perform just that step.

From a "clean" shell do:

 external/CMT/<cmtversion>/mgr
source setup.sh
cmt show tags
CMTv1 (from CMTVERSION)
CMTr20 (from CMTVERSION)
CMTp20080222 (from CMTVERSION)
Linux (from uname) package CMT implies [Unix]
Linux-x86_64 (from CMTCONFIG)
x86_64 (from package CMT)
debiansqueeze/sid (from package CMT)
gcc445 (from package CMT)
Unix (from package CMT) excludes [WIN32 Win32]

These show the basic tags that CMT auto-detects. They form the basis of more expressive ones.

You may next edit

lcgcmt/LCG_Settings/cmt/requirements

Simpler base tags

Some tags, such as the one specifying GCC version are two specific and need aliases. Towards the top you will see them. For example

tag gcc445 gcc44

defines a tag independent of the .5 minor version.

The host-* tags

Somewhat further down are CMT tag commands that define some "host-*" tags. The host tag needs to be defined based on the basic tags. Make sure your platform has a suitable one. Eg:

tag debiansqueeze/sid   host-debian

is needed for Ubuntu 10.10.

Test:

cd NuWa-trunk/lcgcmt/LCG_Settings/cmt/
cmt show tags 
...
host-x86_64 (from package LCG_Settings)
host-gcc44 (from package LCG_Settings)
host-linux (from package LCG_Settings)
host-unix (from package LCG_Settings)
host-debian (from package LCG_Settings)

Success.


The target tags

Somewhat further down you will see

### Daya Bay CMTCONFIG tags, follows common conventions

Here you must define what target tags should be defined if the tag that looks like a CMTCONFIG is defined. The CMTCONFIG is shaped like

CPU-VENDOR-COMPILER-[opt,dbg]

And defines tags that break up each component and any other things implied.

For example:

tag x86_64-debian-gcc44-dbg target-x86_64 target-debian target-gcc44    target-linux    target-unix target-dbg
tag x86_64-debian-gcc44-opt target-x86_64 target-debian target-gcc44    target-linux    target-unix target-opt 
cd NuWa-trunk/lcgcmt/LCG_Settings/cmt/
CMTCONFIG=x86_64-debian-gcc44-dbg cmt show tags|grep target
target-unix (from package LCG_Settings)
target-linux (from package LCG_Settings) package LCG_Settings implies [target-unix]
target-dbg (from package LCG_Settings) package LCG_Settings implies [target-debug debug]
target-x86_64 (from package LCG_Settings)
target-debian (from package LCG_Settings)
target-gcc44 (from package LCG_Settings) package LCG_Settings implies [target-gcc4]
target-debug (from package LCG_Settings)
target-gcc4 (from package LCG_Settings) package LCG_Settings implies [target-gcc]
target-gcc (from package LCG_Settings)

Success.

Making host-* imply basic tags

In the next section assure that CMTCONFIG can be implied from host-* tags.

cmt show macro_value host-compiler
gcc44
cmt show macro_value host-cpu
x86_64
cmt show macro_value host-os
debian
cmt show macro_value host-optdbg
dbg

Okay.

Base system

Finally, an LCG_basesystem must be defined to look like CMTCONFIG (w/out -dbg/-opt).


macro LCG_basesystem	"uncharacterized-platform" \
  ...
  target-x86_64&target-debian&target-gcc44    "x86_64-debian-gcc44" \

Test

cd NuWa-trunk/lcgcmt/LCG_Settings/cmt/
CMTCONFIG=x86_64-debian-gcc44-dbg cmt show macro_value LCG_basesystem
x86_64-debian-gcc44

Success.

Personal tools