I've been running some experiments on building platforms in parallel and I was 
wondering if folks are interested in supporting this? It is currently possible 
to multi-thread a platform build by passing in `-n THREADNUMBER`, but if you 
want to do something like have a top level makefile that builds all the 
platforms you have to add .NOTPARALLEL: to the GNU makefile and build each 
platform one after the other. Thus all the data base construction, and FD 
creation happen serially. 

The 1st thing you have to do to make this all work is pass --conf=${CONF_DIR} 
to the build commands. The CONF_DIR can just be a copy of the Current Conf/ dir 
that is placed in the build output directory. Basically this gives each 
platform a separate Conf/.cache/. 

But you start running into a few issues. 
1) BaseTools/BuildEnv blows up if you run it in parallel. 
I worked around this by commenting out RestorePreviousConfiguration, and 
StoreCurrentConfiguration calls.

2) BaseTools/Source/C/GNUmakefile and Source/C/VfrCompile/GNUmakefile do not 
support parallel build.  
Adding .NOTPARALLEL: to these makefiles fixes this. 

My top level makefile will build the BaseTools, if needed, and all the Platform 
targets depend on that. This way the BaseTools only get built once. The 
platform targets called out by the top level makefile had to be update to pass 
--conf=${CONF_DIR} to the build command, and to create the directory in the 1st 
place if need in the build output. 

#1 maybe it would be best to cleanup BaseTools/BuildEnv to never use a temp 
file? I also wonder if we still need support for the BaseTools and edk2 being 
in separate locations, since the BaseTools are now maintained in the same repo? 
For me I've been burned by this behavior, and never used it for development. So 
it is kind of an enhancement. The burn was having a couple of different trees 
on my system and setting up environment variables that point the tools at the 
wrong tree.

#2 Adding the  .NOTPARALLEL: to the BaseTools GNUmakefiles is a backwards 
compatible work around. At  some point we could restructure the makefiles to 
support parallel build, but that may only save a few seconds. 

#3 Someone could look a nmake as I've only looked at GNU make. 

Thanks,

Andrew Fish
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to