Added compile script for Yosys in docker (for Debian 10).

This commit is contained in:
Jean-Paul Chaput 2020-03-20 15:07:41 +01:00
parent 2af531991e
commit 654ae5b8a4
5 changed files with 147 additions and 94 deletions

View File

@ -6,5 +6,5 @@ RUN mkdir -p coriolis-2.x/src \
&& git clone https://github.com/m-labs/nmigen.git \ && git clone https://github.com/m-labs/nmigen.git \
&& cd nmigen \ && cd nmigen \
&& python3 setup.py develop \ && python3 setup.py develop \
&& /root/socInstaller.py --docker --profile=Debian10 --do-alliance --do-coriolis --benchs && /root/socInstaller.py --docker --profile=Debian10 --do-yosys --do-alliance --do-coriolis --benchs

View File

@ -14,7 +14,7 @@ RUN apt-get update \
autotools-dev automake \ autotools-dev automake \
libxt-dev libxpm-dev libmotif-dev \ libxt-dev libxpm-dev libmotif-dev \
\ \
yosys \ tcl tcl-dev libffi6 libffi-dev libreadline7 \
\ \
vim \ vim \
&& apt-get clean && apt-get clean
@ -24,3 +24,6 @@ RUN apt-get update \
# transfig texlive texlive-latex-extra # transfig texlive texlive-latex-extra
# texlive-plain-generic texlive-pictures # texlive-plain-generic texlive-pictures
# imagemagick # imagemagick
#
# The packaged yosys 0.8 is too old to work with nMigen, must be 0.9.
# yosys

View File

@ -203,6 +203,13 @@ class CommandArg ( object ):
return return
class YosysCommand ( CommandArg ):
def __init__ ( self, yosysBin, fdLog=None ):
CommandArg.__init__ ( self, [ yosysBin ], fdLog=fdLog )
return
class AllianceCommand ( CommandArg ): class AllianceCommand ( CommandArg ):
def __init__ ( self, alcBin, fdLog=None ): def __init__ ( self, alcBin, fdLog=None ):
@ -286,7 +293,7 @@ class Configuration ( object ):
, 'success' , 'rcode' , 'success' , 'rcode'
] ]
SecondaryNames = \ SecondaryNames = \
[ 'rootDir', 'srcDir', 'logDir', 'logs', 'fds', 'alcBin', 'ccbBin', 'benchsDir' [ 'rootDir', 'srcDir', 'logDir', 'logs', 'fds', 'yosysBin', 'alcBin', 'ccbBin', 'benchsDir'
] ]
def __init__ ( self ): def __init__ ( self ):
@ -301,8 +308,9 @@ class Configuration ( object ):
self._rmSource = False self._rmSource = False
self._rmBuild = False self._rmBuild = False
self._doGit = True self._doGit = True
self._doCoriolis = False self._doYosys = False
self._doAlliance = False self._doAlliance = False
self._doCoriolis = False
self._doBenchs = False self._doBenchs = False
self._doSendReport = False self._doSendReport = False
self._nightlyMode = False self._nightlyMode = False
@ -355,6 +363,7 @@ class Configuration ( object ):
self._rootDir = self._homeDir + '/coriolis-2.x' self._rootDir = self._homeDir + '/coriolis-2.x'
self._srcDir = self._rootDir + '/src' self._srcDir = self._rootDir + '/src'
self._logDir = self._srcDir + '/logs' self._logDir = self._srcDir + '/logs'
self._yosysBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/yosysInstaller.sh'
self._alcBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/allianceInstaller.sh' self._alcBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/allianceInstaller.sh'
self._ccbBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/ccb.py' self._ccbBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/ccb.py'
self._benchsDir = self._srcDir + '/' + GitRepository.getLocalRepository(self._benchsRepo ) + '/benchs' self._benchsDir = self._srcDir + '/' + GitRepository.getLocalRepository(self._benchsRepo ) + '/benchs'
@ -415,6 +424,13 @@ class Configuration ( object ):
def getCommands ( self, target ): def getCommands ( self, target ):
commands = [] commands = []
if self.doYosys:
if not os.path.isfile( self.yosysBin ):
raise ErrorMessage( 1, [ 'Cannot find <yosysInstaller.sh>, should be here:'
, ' <%s>' % self.yosysBin
] )
commands.append( YosysCommand( self.yosysBin, fdLog=self.fds['yosys'] ) )
if self.doAlliance: if self.doAlliance:
if not os.path.isfile( self.alcBin ): if not os.path.isfile( self.alcBin ):
raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:' raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:'
@ -524,6 +540,7 @@ class Report ( object ):
parser = optparse.OptionParser () parser = optparse.OptionParser ()
parser.add_option ( "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." ) parser.add_option ( "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." )
parser.add_option ( "--no-git" , action="store_true" , dest="noGit" , help="Do not pull/update Git repositories before building." ) parser.add_option ( "--no-git" , action="store_true" , dest="noGit" , help="Do not pull/update Git repositories before building." )
parser.add_option ( "--do-yosys" , action="store_true" , dest="doYosys" , help="Rebuild Yosys." )
parser.add_option ( "--do-alliance" , action="store_true" , dest="doAlliance" , help="Rebuild the Alliance tools." ) parser.add_option ( "--do-alliance" , action="store_true" , dest="doAlliance" , help="Rebuild the Alliance tools." )
parser.add_option ( "--do-coriolis" , action="store_true" , dest="doCoriolis" , help="Rebuild the Coriolis tools." ) parser.add_option ( "--do-coriolis" , action="store_true" , dest="doCoriolis" , help="Rebuild the Coriolis tools." )
parser.add_option ( "--do-report" , action="store_true" , dest="doReport" , help="Send a final report." ) parser.add_option ( "--do-report" , action="store_true" , dest="doReport" , help="Send a final report." )
@ -547,14 +564,16 @@ try:
if options.docker: conf.dockerMode = True if options.docker: conf.dockerMode = True
if options.chroot: conf.chrootMode = True if options.chroot: conf.chrootMode = True
if options.noGit: conf.doGit = False if options.noGit: conf.doGit = False
if options.doCoriolis: conf.doCoriolis = True if options.doYosys: conf.doYosys = True
if options.doAlliance: conf.doAlliance = True if options.doAlliance: conf.doAlliance = True
if options.doCoriolis: conf.doCoriolis = True
if options.benchs: conf.doBenchs = True if options.benchs: conf.doBenchs = True
if options.doReport: conf.doSendReport = True if options.doReport: conf.doSendReport = True
if options.rmSource or options.rmAll: conf.rmSource = True if options.rmSource or options.rmAll: conf.rmSource = True
if options.rmBuild or options.rmAll: conf.rmBuild = True if options.rmBuild or options.rmAll: conf.rmBuild = True
if conf.doYosys: conf.openLog( 'yosys' )
if conf.doAlliance: conf.openLog( 'alliance' ) if conf.doAlliance: conf.openLog( 'alliance' )
if conf.doCoriolis: conf.openLog( 'coriolis' ) if conf.doCoriolis: conf.openLog( 'coriolis' )
if conf.doBenchs: conf.openLog( 'benchs' ) if conf.doBenchs: conf.openLog( 'benchs' )
@ -577,16 +596,16 @@ try:
#if gitSupport.url.endswith('rapidjson'): #if gitSupport.url.endswith('rapidjson'):
# gitSupport.checkout( 'a1c4f32' ) # gitSupport.checkout( 'a1c4f32' )
if conf.doCoriolis:
if conf.rmSource: gitCoriolis.removeLocalRepo()
gitCoriolis.clone ()
gitCoriolis.checkout( 'devel' )
if conf.doAlliance: if conf.doAlliance:
if conf.rmSource: gitAlliance.removeLocalRepo() if conf.rmSource: gitAlliance.removeLocalRepo()
gitAlliance.clone () gitAlliance.clone ()
#gitAlliance.checkout( 'devel' ) #gitAlliance.checkout( 'devel' )
if conf.doCoriolis:
if conf.rmSource: gitCoriolis.removeLocalRepo()
gitCoriolis.clone ()
gitCoriolis.checkout( 'devel' )
if conf.rmSource: gitBenchs.removeLocalRepo() if conf.rmSource: gitBenchs.removeLocalRepo()
gitBenchs.clone() gitBenchs.clone()

View File

@ -203,6 +203,13 @@ class CommandArg ( object ):
return return
class YosysCommand ( CommandArg ):
def __init__ ( self, yosysBin, fdLog=None ):
CommandArg.__init__ ( self, [ yosysBin ], fdLog=fdLog )
return
class AllianceCommand ( CommandArg ): class AllianceCommand ( CommandArg ):
def __init__ ( self, alcBin, fdLog=None ): def __init__ ( self, alcBin, fdLog=None ):
@ -286,7 +293,7 @@ class Configuration ( object ):
, 'success' , 'rcode' , 'success' , 'rcode'
] ]
SecondaryNames = \ SecondaryNames = \
[ 'rootDir', 'srcDir', 'logDir', 'logs', 'fds', 'alcBin', 'ccbBin', 'benchsDir' [ 'rootDir', 'srcDir', 'logDir', 'logs', 'fds', 'yosysBin', 'alcBin', 'ccbBin', 'benchsDir'
] ]
def __init__ ( self ): def __init__ ( self ):
@ -301,8 +308,9 @@ class Configuration ( object ):
self._rmSource = False self._rmSource = False
self._rmBuild = False self._rmBuild = False
self._doGit = True self._doGit = True
self._doCoriolis = False self._doYosys = False
self._doAlliance = False self._doAlliance = False
self._doCoriolis = False
self._doBenchs = False self._doBenchs = False
self._doSendReport = False self._doSendReport = False
self._nightlyMode = False self._nightlyMode = False
@ -355,6 +363,7 @@ class Configuration ( object ):
self._rootDir = self._homeDir + '/coriolis-2.x' self._rootDir = self._homeDir + '/coriolis-2.x'
self._srcDir = self._rootDir + '/src' self._srcDir = self._rootDir + '/src'
self._logDir = self._srcDir + '/logs' self._logDir = self._srcDir + '/logs'
self._yosysBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/yosysInstaller.sh'
self._alcBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/allianceInstaller.sh' self._alcBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/allianceInstaller.sh'
self._ccbBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/ccb.py' self._ccbBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/ccb.py'
self._benchsDir = self._srcDir + '/' + GitRepository.getLocalRepository(self._benchsRepo ) + '/benchs' self._benchsDir = self._srcDir + '/' + GitRepository.getLocalRepository(self._benchsRepo ) + '/benchs'
@ -415,6 +424,13 @@ class Configuration ( object ):
def getCommands ( self, target ): def getCommands ( self, target ):
commands = [] commands = []
if self.doYosys:
if not os.path.isfile( self.yosysBin ):
raise ErrorMessage( 1, [ 'Cannot find <yosysInstaller.sh>, should be here:'
, ' <%s>' % self.yosysBin
] )
commands.append( YosysCommand( self.yosysBin, fdLog=self.fds['yosys'] ) )
if self.doAlliance: if self.doAlliance:
if not os.path.isfile( self.alcBin ): if not os.path.isfile( self.alcBin ):
raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:' raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:'
@ -524,6 +540,7 @@ class Report ( object ):
parser = optparse.OptionParser () parser = optparse.OptionParser ()
parser.add_option ( "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." ) parser.add_option ( "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." )
parser.add_option ( "--no-git" , action="store_true" , dest="noGit" , help="Do not pull/update Git repositories before building." ) parser.add_option ( "--no-git" , action="store_true" , dest="noGit" , help="Do not pull/update Git repositories before building." )
parser.add_option ( "--do-yosys" , action="store_true" , dest="doYosys" , help="Rebuild Yosys." )
parser.add_option ( "--do-alliance" , action="store_true" , dest="doAlliance" , help="Rebuild the Alliance tools." ) parser.add_option ( "--do-alliance" , action="store_true" , dest="doAlliance" , help="Rebuild the Alliance tools." )
parser.add_option ( "--do-coriolis" , action="store_true" , dest="doCoriolis" , help="Rebuild the Coriolis tools." ) parser.add_option ( "--do-coriolis" , action="store_true" , dest="doCoriolis" , help="Rebuild the Coriolis tools." )
parser.add_option ( "--do-report" , action="store_true" , dest="doReport" , help="Send a final report." ) parser.add_option ( "--do-report" , action="store_true" , dest="doReport" , help="Send a final report." )
@ -547,14 +564,16 @@ try:
if options.docker: conf.dockerMode = True if options.docker: conf.dockerMode = True
if options.chroot: conf.chrootMode = True if options.chroot: conf.chrootMode = True
if options.noGit: conf.doGit = False if options.noGit: conf.doGit = False
if options.doCoriolis: conf.doCoriolis = True if options.doYosys: conf.doYosys = True
if options.doAlliance: conf.doAlliance = True if options.doAlliance: conf.doAlliance = True
if options.doCoriolis: conf.doCoriolis = True
if options.benchs: conf.doBenchs = True if options.benchs: conf.doBenchs = True
if options.doReport: conf.doSendReport = True if options.doReport: conf.doSendReport = True
if options.rmSource or options.rmAll: conf.rmSource = True if options.rmSource or options.rmAll: conf.rmSource = True
if options.rmBuild or options.rmAll: conf.rmBuild = True if options.rmBuild or options.rmAll: conf.rmBuild = True
if conf.doYosys: conf.openLog( 'yosys' )
if conf.doAlliance: conf.openLog( 'alliance' ) if conf.doAlliance: conf.openLog( 'alliance' )
if conf.doCoriolis: conf.openLog( 'coriolis' ) if conf.doCoriolis: conf.openLog( 'coriolis' )
if conf.doBenchs: conf.openLog( 'benchs' ) if conf.doBenchs: conf.openLog( 'benchs' )
@ -577,16 +596,16 @@ try:
#if gitSupport.url.endswith('rapidjson'): #if gitSupport.url.endswith('rapidjson'):
# gitSupport.checkout( 'a1c4f32' ) # gitSupport.checkout( 'a1c4f32' )
if conf.doCoriolis:
if conf.rmSource: gitCoriolis.removeLocalRepo()
gitCoriolis.clone ()
gitCoriolis.checkout( 'devel' )
if conf.doAlliance: if conf.doAlliance:
if conf.rmSource: gitAlliance.removeLocalRepo() if conf.rmSource: gitAlliance.removeLocalRepo()
gitAlliance.clone () gitAlliance.clone ()
#gitAlliance.checkout( 'devel' ) #gitAlliance.checkout( 'devel' )
if conf.doCoriolis:
if conf.rmSource: gitCoriolis.removeLocalRepo()
gitCoriolis.clone ()
gitCoriolis.checkout( 'devel' )
if conf.rmSource: gitBenchs.removeLocalRepo() if conf.rmSource: gitBenchs.removeLocalRepo()
gitBenchs.clone() gitBenchs.clone()

12
bootstrap/yosysInstaller.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
srcDir=${HOME}
gitHash="6edca05"
cd ${srcDir}
git clone https://github.com/cliffordwolf/yosys.git
cd yosys
git checkout ${gitHash}
make config-gcc
make GIT_REV=${gitHash} -j4
make GIT_REV=${gitHash} install