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
|
import paramiko
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
# Parameters to configure
|
# Parameters to configure
|
||||||
TEMPORARY_DIRECTORY = '~/tmp/rpi-kernel'
|
TEMPORARY_DIRECTORY = '~/tmp/rpi-kernel'
|
||||||
BUILD_DIRECTORY = '/rt-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 dev/* %s/rootfs/dev/'%image_path)
|
||||||
os.system('sudo cp -a usr/* %s/rootfs/usr/'%image_path)
|
os.system('sudo cp -a usr/* %s/rootfs/usr/'%image_path)
|
||||||
|
|
||||||
def main():
|
def main(build_only=False):
|
||||||
# prepare build environment
|
# prepare build environment
|
||||||
temp_dir = os.path.expanduser (TEMPORARY_DIRECTORY)
|
temp_dir = os.path.expanduser (TEMPORARY_DIRECTORY)
|
||||||
build_dir = temp_dir + BUILD_DIRECTORY
|
build_dir = temp_dir + BUILD_DIRECTORY
|
||||||
|
@ -166,6 +168,7 @@ def main():
|
||||||
print ("Temp directory : " + temp_dir)
|
print ("Temp directory : " + temp_dir)
|
||||||
print ("Build directory : " + build_dir)
|
print ("Build directory : " + build_dir)
|
||||||
print ("Script directory : " + script_dir)
|
print ("Script directory : " + script_dir)
|
||||||
|
print ("Build only: " + str(build_only))
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if not os.path.exists(temp_dir):
|
if not os.path.exists(temp_dir):
|
||||||
|
@ -197,16 +200,29 @@ def main():
|
||||||
print ('\nBuild Xenomai libraries')
|
print ('\nBuild Xenomai libraries')
|
||||||
buildXenomai(temp_dir, build_dir, [])
|
buildXenomai(temp_dir, build_dir, [])
|
||||||
|
|
||||||
print ('\nInstalling kernel')
|
if not build_only:
|
||||||
installKernel(temp_dir, build_dir, PATH_TO_IMAGE)
|
print ('\nInstalling kernel')
|
||||||
|
installKernel(temp_dir, build_dir, PATH_TO_IMAGE)
|
||||||
|
|
||||||
print ('\nInstall Xenomai libraries')
|
print ('\nInstall Xenomai libraries')
|
||||||
installXenomai(temp_dir, build_dir, PATH_TO_IMAGE)
|
installXenomai(temp_dir, build_dir, PATH_TO_IMAGE)
|
||||||
|
|
||||||
os.chdir(currentdir)
|
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__':
|
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:
|
if val ==None:
|
||||||
val =0
|
val =0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue