mirror of
https://github.com/yoboujon/dumber.git
synced 2025-06-09 06:10:49 +02:00
Ajout d'une option en ligne de commande pour compiler uniquement
This commit is contained in:
parent
8eb632cdc2
commit
0d6c5aa5ec
1 changed files with 22 additions and 6 deletions
|
@ -12,6 +12,8 @@ from shutil import rmtree
|
|||
import paramiko
|
||||
from getpass import getpass
|
||||
|
||||
import argparse
|
||||
|
||||
# Parameters to configure
|
||||
TEMPORARY_DIRECTORY = '~/tmp/rpi-kernel'
|
||||
BUILD_DIRECTORY = '/rt-kernel'
|
||||
|
@ -148,7 +150,7 @@ def installXenomai(tmp_dir, build_dir, image_path ):
|
|||
os.system('sudo cp -a dev/* %s/rootfs/dev/'%image_path)
|
||||
os.system('sudo cp -a usr/* %s/rootfs/usr/'%image_path)
|
||||
|
||||
def main():
|
||||
def main(build_only=False):
|
||||
# prepare build environment
|
||||
temp_dir = os.path.expanduser (TEMPORARY_DIRECTORY)
|
||||
build_dir = temp_dir + BUILD_DIRECTORY
|
||||
|
@ -166,6 +168,7 @@ def main():
|
|||
print ("Temp directory : " + temp_dir)
|
||||
print ("Build directory : " + build_dir)
|
||||
print ("Script directory : " + script_dir)
|
||||
print ("Build only: " + str(build_only))
|
||||
print()
|
||||
|
||||
if not os.path.exists(temp_dir):
|
||||
|
@ -197,6 +200,7 @@ def main():
|
|||
print ('\nBuild Xenomai libraries')
|
||||
buildXenomai(temp_dir, build_dir, [])
|
||||
|
||||
if not build_only:
|
||||
print ('\nInstalling kernel')
|
||||
installKernel(temp_dir, build_dir, PATH_TO_IMAGE)
|
||||
|
||||
|
@ -205,8 +209,20 @@ def main():
|
|||
|
||||
os.chdir(currentdir)
|
||||
|
||||
def parseCommandLine() -> str:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--build-only', action='store_true', help='Build only')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args.build_only
|
||||
|
||||
if __name__ == '__main__':
|
||||
val=main()
|
||||
build_only = parseCommandLine()
|
||||
if build_only == None or build_only == False:
|
||||
val=main(False)
|
||||
else:
|
||||
val=main(True)
|
||||
|
||||
if val ==None:
|
||||
val =0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue