aboutsummaryrefslogtreecommitdiff
path: root/scripts/common
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/common')
-rw-r--r--scripts/common77
1 files changed, 59 insertions, 18 deletions
diff --git a/scripts/common b/scripts/common
index ccad03d..2dd98fb 100644
--- a/scripts/common
+++ b/scripts/common
@@ -9,6 +9,9 @@
# - NUM_DOMUS
# - DOMU_PASSTHROUGH_PATHS
# - DOMU_PASSTHROUGH_DTB
+# - LOPPER_PATH
+# - LOPPER_CMD
+# - DEVICE_TREE
tmp_files=()
tmp_dirs=()
@@ -99,31 +102,41 @@ function compile_merge_partial_dts()
local tmp
local tmpdts
local file
+ local node
local i
local j
- if [[ "$repo" =~ .*@.*:.* ]]
+ if test "$repo"
then
- tmp=`mktemp -d`
- tmp_dirs+=($tmp)
-
- echo "Cloning git repo \"$git_repo\""
- git clone "$repo" $tmp
- if test $? -ne 0
+ # Partial dts will be obtained from PASSTHROUGH_DTS_REPO
+ if [[ "$repo" =~ .*@.*:.* ]]
then
- echo "Error occurred while cloning \"$git_repo\""
- return 1
- fi
+ tmp=`mktemp -d`
+ tmp_dirs+=($tmp)
- repo=$tmp
- fi
+ echo "Cloning git repo \"$git_repo\""
+ git clone "$repo" $tmp
+ if test $? -ne 0
+ then
+ echo "Error occurred while cloning \"$git_repo\""
+ return 1
+ fi
- if test -z "$dir"
- then
- dir="."
+ repo=$tmp
+ fi
+
+ if test -z "$dir"
+ then
+ dir="."
+ fi
+ partial_dts_dir="$repo"/"$dir"
+ else
+ # Partial dts will be generated by the lopper
+ tmp=`mktemp -d`
+ tmp_dirs+=($tmp)
+ partial_dts_dir="$tmp"
fi
- partial_dts_dir="$repo"/"$dir"
i=0
while test $i -lt $NUM_DOMUS
do
@@ -133,6 +146,34 @@ function compile_merge_partial_dts()
return 1
fi
+ if test -z "$repo"
+ then
+ # Generate partial dts using lopper
+ for devpath in ${DOMU_PASSTHROUGH_PATHS[$i]}
+ do
+ node=${devpath##*/}
+ file="$partial_dts_dir"/"$node".dts
+
+ # Execute lopper with the following assists:
+ # - extract: used to take the target node, extract it from the
+ # system device tree, chase the phandle references and place
+ # it in a new extracted tree structure,
+ # - extract-xen: used to perform Xen specific modifications
+ # on the extracted tree structure e.g. adding "xen,path",
+ # "xen,reg", interrupt-parent properties.
+ # For additional information, please see the lopper's README
+ # file as well as usage of the mentioned assists.
+ $LOPPER_PATH --permissive -f $DEVICE_TREE \
+ -- extract -t $devpath $LOPPER_CMD \
+ -- extract-xen -t $node -o $file
+
+ if test $? -ne 0
+ then
+ return 1
+ fi
+ done
+ fi
+
sanity_check_partial_dts "${DOMU_PASSTHROUGH_PATHS[$i]}" "$partial_dts_dir"
if test $? -ne 0
then
@@ -146,8 +187,8 @@ function compile_merge_partial_dts()
for devpath in ${DOMU_PASSTHROUGH_PATHS[$i]}
do
- file=${devpath##*/}
- file="$partial_dts_dir"/"$file".dts
+ node=${devpath##*/}
+ file="$partial_dts_dir"/"$node".dts
# All the subsequent dts files should not have dts version mentioned
if test $j -gt 1