Commit a1fea3d4 authored by Andrey Filippov's avatar Andrey Filippov

Merge branch 'master' of git.elphel.com:Elphel/elphel393

parents 2b80829b 0e8f58ea
Note for developers: **To have SSH access to all Elphel's repositories clone this project using SSH**
Note for users: **Some already built firmware images are available [here](http://community.elphel.com/files/393/). Also check [User Manual](https://wiki.elphel.com/wiki/Tmp_manual).**
# elphel393 # elphel393
Installation script for fetching and setting up building environment for elphel393 camera images, The project contains scripts for fetching and setting up build environment that will generate firmware images for Elphel393 camera systems.
it clones and configures several individual repositories, such as
It clones and configures several individual repositories, such as
* https://git.elphel.com/Elphel/linux-elphel * https://git.elphel.com/Elphel/linux-elphel
* https://git.elphel.com/Elphel/x393 * https://git.elphel.com/Elphel/x393
* http://git.yoctoproject.org * http://git.yoctoproject.org
* http://git.openembedded.org * http://git.openembedded.org
* https://github.com/Xilinx/meta-xilinx * https://github.com/Xilinx/meta-xilinx
* https://git.elphel.com/Elphel/meta-elphel393 * https://git.elphel.com/Elphel/meta-elphel393
The same script pulls updates from these repositories The same script (*setup.py*) pulls updates from these repositories
### Get environment ### Get environment
#### Dependencies #### Dependencies
* poky might require installing some packages, please check with the [Yocto Poky Manual][1] * poky might require installing some packages, please check with the [Yocto Poky Manual](http://www.yoctoproject.org/docs/2.0/mega-manual/mega-manual.html)
* extra requirement * extra requirement
```sh ```sh
$ sudo apt install python-numpy $ sudo apt install python-numpy
``` ```
#### Get sources #### Get sources
...@@ -32,10 +37,9 @@ $ bitbake u-boot device-tree linux-xlnx core-image-elphel393 ...@@ -32,10 +37,9 @@ $ bitbake u-boot device-tree linux-xlnx core-image-elphel393
``` ```
* the results are in *poky/build/tmp/deploy/images/elphel393/* * the results are in *poky/build/tmp/deploy/images/elphel393/*
* for more details, read [**this guide**][2] at [https://wiki.elphel.com][2] * for more details, read [**this guide**][1] at [https://wiki.elphel.com][1]
[1]: http://www.yoctoproject.org/docs/2.0/mega-manual/mega-manual.html [1]: http://wiki.elphel.com/index.php?title=Poky_2.0_manual
[2]: http://wiki.elphel.com/index.php?title=Poky_2.0_manual
### Update and refresh environment ### Update and refresh environment
```sh ```sh
...@@ -49,3 +53,23 @@ $ (if changes in the kernel) bitbake linux-xlnx -c link -f ...@@ -49,3 +53,23 @@ $ (if changes in the kernel) bitbake linux-xlnx -c link -f
$ (if changes in the rootfs and the kernel) bitbake core-image-elphel393 $ (if changes in the rootfs and the kernel) bitbake core-image-elphel393
``` ```
### More info
[**Development for 10393**](https://wiki.elphel.com/wiki/Development_for_10393)
### Support
support-list@support
### Note 1: Switching between GIT protocols (SSH or HTTPS)
To have access to related Elphel's projects over **SSH** clone this project using **SSH**.
For **HTTPS** clone with **HTTPS**.
To change git protocol for all Elphel's projects - change the *remote* of this project accordingly, then run *setup.py*:
```sh
$ git remote -v
$ git remote set-url ...
$ ./setup.py
```
\ No newline at end of file
...@@ -55,7 +55,7 @@ def cloneandcheckout(name,item): ...@@ -55,7 +55,7 @@ def cloneandcheckout(name,item):
os.chdir(cwd) os.chdir(cwd)
else: else:
#check for https or git #check for https or git
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(cwd+"/"+name) os.chdir(cwd+"/"+name)
read_remote = subprocess.check_output("git remote -v",shell=True) read_remote = subprocess.check_output("git remote -v",shell=True)
...@@ -63,7 +63,7 @@ def cloneandcheckout(name,item): ...@@ -63,7 +63,7 @@ def cloneandcheckout(name,item):
print(bcolors.WARNING+"Changing git remote to "+item[0]+bcolors.ENDC) print(bcolors.WARNING+"Changing git remote to "+item[0]+bcolors.ENDC)
shout("git remote set-url origin "+item[0]) shout("git remote set-url origin "+item[0])
os.chdir(cwd) os.chdir(cwd)
if item[2]!="": if item[2]!="":
print(" Already cloned - checked out at "+item[1]+" "+item[2]) print(" Already cloned - checked out at "+item[1]+" "+item[2])
else: else:
...@@ -81,12 +81,12 @@ def copy_eclipse_settings(name): ...@@ -81,12 +81,12 @@ def copy_eclipse_settings(name):
print(" Copying up files for Eclipse project") print(" Copying up files for Eclipse project")
print(bcolors.WARNING+" Copying "+name+"/"+EPS+" to "+name+"/"+bcolors.ENDC) print(bcolors.WARNING+" Copying "+name+"/"+EPS+" to "+name+"/"+bcolors.ENDC)
shout("rsync -av "+name+"/"+EPS+"/ "+name+"/") shout("rsync -av "+name+"/"+EPS+"/ "+name+"/")
if not os.path.isdir(name+"/"+EPS): if not os.path.isdir(name+"/"+EPS):
print("Not copying up files for Eclipse project: not an Eclipse project") print("Not copying up files for Eclipse project: not an Eclipse project")
elif os.path.isfile(name+"/.project"): elif os.path.isfile(name+"/.project"):
print("Not copying up files for Eclipse project: .project is already there") print("Not copying up files for Eclipse project: .project is already there")
def read_local_conf(conf_file,pattern): def read_local_conf(conf_file,pattern):
ret = [] ret = []
...@@ -117,9 +117,31 @@ def read_local_conf_dev(conf_file,pattern): ...@@ -117,9 +117,31 @@ def read_local_conf_dev(conf_file,pattern):
ret = line.split("=")[1].strip().strip("\"") ret = line.split("=")[1].strip().strip("\"")
return ret return ret
# reads protocol from the current repository and converts all other projects to this protocol
# https - user/password access
# git - key-based access
def read_git_proto(conf_file,pattern):
ret = "0"
if os.path.isfile(conf_file):
with open(conf_file,"r") as f:
lines = f.readlines()
for line in lines:
if len(line)!=0:
if line.strip()[0]!="#":
pars = line.strip().split("=")
if (len(pars)>1):
# simple test
if pars[0].strip()=='url':
test = pars[1].find(pattern)
if test!=-1:
ret = "1"
print("ogogo! "+pars[1].strip())
return ret
def update_branch(names_from_conf,name_from_list,pars,git_proto): def update_branch(names_from_conf,name_from_list,pars,git_proto):
# GIT host is defined in projects.json, # GIT host is defined in projects.json,
# https or git is defined in local.conf # https or git is defined in local.conf
# get host # get host
s0 = re.search("^(https:\/\/|git@)(.+)(\/|:)Elphel.*",pars[0]) s0 = re.search("^(https:\/\/|git@)(.+)(\/|:)Elphel.*",pars[0])
...@@ -134,7 +156,7 @@ def update_branch(names_from_conf,name_from_list,pars,git_proto): ...@@ -134,7 +156,7 @@ def update_branch(names_from_conf,name_from_list,pars,git_proto):
tmp = "git@"+host+":Elphel" tmp = "git@"+host+":Elphel"
if pars[0].find(tmp)!=-1: if pars[0].find(tmp)!=-1:
pars[0] = "https://"+host+"/Elphel"+pars[0][len(tmp):] pars[0] = "https://"+host+"/Elphel"+pars[0][len(tmp):]
for p in names_from_conf: for p in names_from_conf:
if name_from_list in p: if name_from_list in p:
pars[1] = p[1] pars[1] = p[1]
...@@ -155,12 +177,15 @@ else: ...@@ -155,12 +177,15 @@ else:
print("ok") print("ok")
project_branches = read_local_conf("poky/build/conf/local.conf","ELPHEL393_branches") project_branches = read_local_conf("poky/build/conf/local.conf","ELPHEL393_branches")
git_proto = read_local_conf_dev("poky/build/conf/local.conf","ELPHEL393_DEV")
#git_proto = read_local_conf_dev("poky/build/conf/local.conf","ELPHEL393_DEV")
git_proto = read_git_proto(".git/config","git@")
i=0 i=0
for p,v in Projects.items(): for p,v in Projects.items():
i = i + 1 i = i + 1
print bcolors.BOLDWHITE+"Step "+str(i)+": "+p+bcolors.ENDC print bcolors.BOLDWHITE+"Step "+str(i)+": "+p+bcolors.ENDC
if isinstance(v,dict): if isinstance(v,dict):
#create dir #create dir
if not os.path.isdir(p): if not os.path.isdir(p):
...@@ -168,15 +193,15 @@ for p,v in Projects.items(): ...@@ -168,15 +193,15 @@ for p,v in Projects.items():
os.mkdir(p) os.mkdir(p)
else: else:
print(" "+p+" exists") print(" "+p+" exists")
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(cwd+"/"+p) os.chdir(cwd+"/"+p)
for k,l in v.items(): for k,l in v.items():
print("\n"+bcolors.BOLDWHITE+"*"+bcolors.ENDC+" "+k) print("\n"+bcolors.BOLDWHITE+"*"+bcolors.ENDC+" "+k)
cloneandcheckout(k,update_branch(project_branches,k,l,git_proto)) cloneandcheckout(k,update_branch(project_branches,k,l,git_proto))
copy_eclipse_settings(k) copy_eclipse_settings(k)
#special case for x393 fpga project #special case for x393 fpga project
if k=="x393": if k=="x393":
if os.path.isfile(k+"/py393/generate_c.sh"): if os.path.isfile(k+"/py393/generate_c.sh"):
...@@ -188,11 +213,11 @@ for p,v in Projects.items(): ...@@ -188,11 +213,11 @@ for p,v in Projects.items():
if os.path.isdir(cwd+"/linux-elphel/src/drivers/elphel"): if os.path.isdir(cwd+"/linux-elphel/src/drivers/elphel"):
shout("rsync -a "+k+"/py393/generated/ "+cwd+"/linux-elphel/src/drivers/elphel") shout("rsync -a "+k+"/py393/generated/ "+cwd+"/linux-elphel/src/drivers/elphel")
os.chdir(cwd) os.chdir(cwd)
elif isinstance(v,list): elif isinstance(v,list):
cloneandcheckout(p,update_branch(project_branches,p,v,git_proto)) cloneandcheckout(p,update_branch(project_branches,p,v,git_proto))
copy_eclipse_settings(p) copy_eclipse_settings(p)
else: else:
print("Error?") print("Error?")
...@@ -256,7 +281,7 @@ BBLAYERS = " \\ ...@@ -256,7 +281,7 @@ BBLAYERS = " \\
{0}/meta/meta-openembedded/meta-webserver \\ {0}/meta/meta-openembedded/meta-webserver \\
" "
""".format(path)) """.format(path))
with open(local_conf,"a") as f: with open(local_conf,"a") as f:
f.write("""\ f.write("""\
...@@ -264,8 +289,8 @@ MACHINE ?= "elphel393" ...@@ -264,8 +289,8 @@ MACHINE ?= "elphel393"
MIRRORS =+ "http://.*/.* http://mirror.elphel.com/elphel393_mirror/ \\n " MIRRORS =+ "http://.*/.* http://mirror.elphel.com/elphel393_mirror/ \\n "
# Elphel's default git server. # Elphel's default git server.
# Affected recipes: # Affected recipes:
# * u-boot-ezynq.inc, # * u-boot-ezynq.inc,
# * elphel-python-extensions_*.bb # * elphel-python-extensions_*.bb
# * linux-xlnx_4.0.bbappend # * linux-xlnx_4.0.bbappend
ELPHELGITHOST = "git.elphel.com" ELPHELGITHOST = "git.elphel.com"
...@@ -277,15 +302,8 @@ ELPHELGITHOST = "git.elphel.com" ...@@ -277,15 +302,8 @@ ELPHELGITHOST = "git.elphel.com"
# ELPHEL393_branches += "elphel-apps-camogm:framepars" # ELPHEL393_branches += "elphel-apps-camogm:framepars"
# ELPHEL393_branches += "linux-elphel:framepars" # ELPHEL393_branches += "linux-elphel:framepars"
# By default the projects' remotes are set to https.
# To switch to git:// (commit changes to github w/o a password)
# uncomment the following line
# 1 - for git:// - access using a key
# 0 (or commented) - for https:// - access using a password
# ELPHEL393_DEV = "1"
# To change git host edit: projects.json (a copy of projects-default.json) # To change git host edit: projects.json (a copy of projects-default.json)
# New git host must match "^(https:\/\/|git@)(.+)(\/|:)Elphel.*", e.g.: # New git host must match "^(https:\/\/|git@)(.+)(\/|:)Elphel.*", e.g.:
# "https://something.com/Elphel/someproject" or # "https://something.com/Elphel/someproject" or
# "git@something.com:Elphel/someproject" # "git@something.com:Elphel/someproject"
...@@ -313,7 +331,7 @@ if missing_bblayers_conf==0: ...@@ -313,7 +331,7 @@ if missing_bblayers_conf==0:
shout("cp "+bblayers_conf+" "+bblayers_conf+"_default") shout("cp "+bblayers_conf+" "+bblayers_conf+"_default")
shout("cp "+bblayers_conf+"_bkp "+bblayers_conf) shout("cp "+bblayers_conf+"_bkp "+bblayers_conf)
print("NOTE: If anything breaks after running setup.py, compare your bblayers.conf and bblayers.conf_default") print("NOTE: If anything breaks after running setup.py, compare your bblayers.conf and bblayers.conf_default")
if missing_local_conf==0: if missing_local_conf==0:
print("restoring "+local_conf) print("restoring "+local_conf)
shout("cp "+local_conf+" "+local_conf+"_default") shout("cp "+local_conf+" "+local_conf+"_default")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment