Commit 53fc4818 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

optimized device trees generation for various sensors and 10393 revisions

parent a9b5e6c7
......@@ -6,11 +6,21 @@ MACHINE_DEVICETREE ?= "elphel393.dts"
COMPATIBLE_MACHINE_elphel393 = ".*"
# include all
# MACHINE_DEVICETREE - in case something new is added
SRC_URI += "file://${MACHINE_DEVICETREE} \
file://elphel393_4_mt9p006.dts \
file://elphel393_4_mt9f002.dts \
file://elphel393_4_lepton35.dts \
file://elphel393_eyesis.dts \
file://elphel393_eyesis_bottom2.dts \
file://elphel393-zynq-base.dtsi \
file://elphel393-common.dtsi \
file://elphel393-bootargs-mmc.dtsi \
file://elphel393-bootargs-nand.dtsi \
file://elphel393-bootargs-ram.dtsi \
file://elphel393-revision-rev0-B.dtsi \
file://elphel393-revision-revC.dtsi \
"
do_deploy(){
......@@ -38,41 +48,80 @@ do_deploy(){
done
}
# full sub
do_compile() {
if test -n "${MACHINE_DEVICETREE}"; then
mkdir -p ${WORKDIR}/devicetree
for i in ${MACHINE_DEVICETREE}; do
if test -e ${WORKDIR}/$i; then
echo cp ${WORKDIR}/$i ${WORKDIR}/devicetree
cp ${WORKDIR}/$i ${WORKDIR}/devicetree
cp ${WORKDIR}/*.dtsi ${WORKDIR}/devicetree
fi
done
fi
for DTS_FILE in ${S}/devicetree/*.dts; do
DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
for RLOC in ${PRODUCTION_ROOT_LOCATION}; do
ln -sf ${WORKDIR}/devicetree/elphel393-bootargs-${RLOC}.dtsi ${WORKDIR}/devicetree/elphel393-bootargs.dtsi
dtc -I dts -O dtb ${DEVICETREE_FLAGS} -o ${DTS_NAME}_${RLOC}.dtb ${DTS_FILE}
done
done
python do_deploy(){
import shutil
B = d.getVar('B', True)
DEPLOY_DIR_IMAGE = d.getVar('DEPLOY_DIR_IMAGE', True)
MACHINE_DEVICETREE = d.getVar('MACHINE_DEVICETREE', True)
PRODUCTION_DEVICETREE = d.getVar('PRODUCTION_DEVICETREE', True)
PRODUCTION_ROOT_LOCATION = d.getVar('PRODUCTION_ROOT_LOCATION', True)
DTS_NAME = os.path.splitext(MACHINE_DEVICETREE)[0]
for RLOC in PRODUCTION_ROOT_LOCATION.split():
dtb_name = DTS_NAME+"_"+RLOC+".dtb"
dtb_path = os.path.join(B,dtb_name)
dtb_build_path = os.path.join(DEPLOY_DIR_IMAGE,dtb_name)
rloc_path = os.path.join(DEPLOY_DIR_IMAGE,RLOC)
dtb_deploy_path = os.path.join(rloc_path,PRODUCTION_DEVICETREE)
if not os.path.exists(dtb_path):
print("Warning: "+dtb_path+" is not available")
os.system("install -d "+DEPLOY_DIR_IMAGE)
os.system("install -m 0644 "+dtb_path+" "+dtb_build_path)
os.makedirs(rloc_path,exist_ok=True);
shutil.copyfile(dtb_build_path,dtb_deploy_path)
print("Deployed "+dtb_deploy_path)
}
# full sub
do_install() {
for DTS_FILE in ${S}/devicetree/*.dts; do
DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
for RLOC in ${PRODUCTION_ROOT_LOCATION}; do
if [ ! -f ${B}/${DTS_NAME}_${RLOC}.dtb ]; then
echo "Warning: ${DTS_NAME}_${RLOC}.dtb is not available!"
continue
fi
install -d ${D}/boot/devicetree
install -m 0644 ${B}/${DTS_NAME}_${RLOC}.dtb ${D}/boot/devicetree/${DTS_NAME}_${RLOC}.dtb
done
done
python do_compile(){
WORKDIR = d.getVar('WORKDIR', True)
PRODUCTION_ROOT_LOCATION = d.getVar('PRODUCTION_ROOT_LOCATION', True)
DEVICETREE_FLAGS = d.getVar('DEVICETREE_FLAGS', True)
for f in os.listdir(WORKDIR):
if f.endswith(".dts"):
DTS_NAME = os.path.splitext(f)[0]
eyesis = False
print("Found dts file: "+f)
if f.startswith("elphel393_eyesis"):
print("Device tree type: Eyesis4Pi 393 (panoramic camera)")
eyesis = True
else:
print("Device tree type: 10393 (regular)")
if not eyesis:
for RLOC in PRODUCTION_ROOT_LOCATION.split():
os.system("ln -sf "+WORKDIR+"/elphel393-bootargs-"+RLOC+".dtsi "+WORKDIR+"/elphel393-bootargs.dtsi")
for REV in ["rev0-B","revC"]:
os.system("ln -sf "+WORKDIR+"/elphel393-revision-"+REV+".dtsi "+WORKDIR+"/elphel393-revision.dtsi")
os.system("dtc -I dts -O dtb "+DEVICETREE_FLAGS+" -o "+DTS_NAME+"_"+REV+"_"+RLOC+".dtb "+f)
else:
for RLOC in PRODUCTION_ROOT_LOCATION.split():
os.system("dtc -I dts -O dtb "+DEVICETREE_FLAGS+" -o "+DTS_NAME+"_"+RLOC+".dtb "+f)
}
python do_install(){
B = d.getVar('B', True)
D = d.getVar('D', True)
os.system("install -d "+D+"/boot/devicetree")
for f in os.listdir(B):
if not f.startswith("elphel393_eyesis"):
src = B+"/"+f
dst = D+"/boot/devicetree/"+f
os.system("install -m 0644 "+src+" "+dst)
}
REMOTE_USER ??= "root"
......
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