diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/ptxd_lib_template.sh | 1 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_dts_dtc.sh | 87 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_dtb.sh | 97 | ||||
-rwxr-xr-x | scripts/migrate/migrate_platform | 10 |
4 files changed, 108 insertions, 87 deletions
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh index a75c775a5..ecc2d9a19 100644 --- a/scripts/lib/ptxd_lib_template.sh +++ b/scripts/lib/ptxd_lib_template.sh @@ -512,6 +512,7 @@ ptxd_template_new_kernel() { export class="kernel-" ptxd_template_read_basic && ptxd_template_read "enter kernel image" image "zImage" + ptxd_template_read "enter device-tree files" dts "yourboard.dts" ptxd_template_read_author && ptxd_template_write_platform_rules } diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh deleted file mode 100644 index 0eb7f9881..000000000 --- a/scripts/lib/ptxd_make_dts_dtc.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2014 by Michael Olbrich <m.olbrich@pengutronix.de> -# -# For further information about the PTXdist project and license conditions -# see the README file. -# - -ptxd_make_dts_dtb() { - local dts tmp_dts deb_dts deps tmp_deps dtc_include no_linemarker - - case "${dts_dts}" in - /*) - if [ ! -e "${dts_dts}" ]; then - ptxd_bailout "Device-tree '${dts_dts}' not found." - fi - dts="${dts_dts}" - deb_dts=( "${dts_dts}" ) - ;; - *) - if ! ptxd_in_path dts_path "${dts_dts}"; then - ptxd_bailout "Device-tree '${dts_dts}' not found in '${dts_path}'." - fi - dts="${ptxd_reply}" - # create a list of all posible matches - ptxd_in_path dts_path - deb_dts=( "${ptxd_reply[@]/%/\/${dts_dts}}" ) - ;; - esac - deb_dts=( "${deb_dts[@]/#/\$(wildcard }" ) - deb_dts=( "${deb_dts[@]/%/)}" ) - - if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then - dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts" - tmp_dts="${ptx_state_dir}/$(basename "${dts}").tmp" - no_linemarker="" - else - # the support for "#line ..." was added in the same relase when -i - # was added. So we add -P only if -i is not supported. - tmp_dts="${dts}.tmp" - no_linemarker="-P" - fi && - - deps="${ptx_state_dir}/dtc.$(basename "${dts}").deps" - tmp_deps="${PTXDIST_TEMPDIR}/dtc.$(basename "${dts}").deps" - - exec 2>&${PTXDIST_FD_LOGERR} - - echo "${dts_dtb}: \$(firstword ${deb_dts[*]})" > "${deps}" && - - echo "CPP $(ptxd_print_path "${tmp_dts}")" && - cpp \ - -Wp,-MD,${tmp_deps} \ - -Wp,-MT,${tmp_dts} \ - -nostdinc \ - ${no_linemarker} \ - -I$(dirname "${dts}") \ - -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts \ - -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts/include \ - -I${dts_kernel_dir}/drivers/of/testcase-data \ - -I${dts_kernel_dir}/include \ - -undef -D__DTS__ -x assembler-with-cpp \ - -o ${tmp_dts} \ - ${dts} && - - sed -e "s;^${tmp_dts}:;${dts_dtb}:;" \ - -e 's;^ \([^ ]*\); $(wildcard \1);' "${tmp_deps}" >> "${deps}" && - - echo "DTC $(ptxd_print_path "${dts_dtb}")" && - dtc \ - $(ptxd_get_ptxconf PTXCONF_DTC_EXTRA_ARGS) \ - ${dtc_include} \ - -d "${tmp_deps}" \ - -I dts -O dtb -b 0 \ - -o "${dts_dtb}" "${tmp_dts}" && - - awk '{ \ - printf "%s", $1 ; \ - for (i = 2; i <= NF; i++) { \ - printf " $(wildcard %s)", $i; \ - }; \ - print "" \ - }' "${tmp_deps}" >> "${deps}" || - - ptxd_bailout "Unable to generate dtb file." -} -export -f ptxd_make_dts_dtb diff --git a/scripts/lib/ptxd_make_world_dtb.sh b/scripts/lib/ptxd_make_world_dtb.sh new file mode 100644 index 000000000..20aaba9e9 --- /dev/null +++ b/scripts/lib/ptxd_make_world_dtb.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# Copyright (C) 2020 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +ptxd_make_dtb() { + local dtc dts tmp_dts dtb deps tmp_deps + + if [ "$(basename "${dts_dts}")" != "${dts_dts}" ]; then + ptxd_bailout "'${dts_dts}' must not include directories!" \ + "Use <PKG>_DTS_PATH to specify the search path." + fi + + if ! ptxd_in_path pkg_dts_path "${dts_dts}"; then + ptxd_bailout "Device-tree '${dts_dts}' not found in '${pkg_dts_path}'." + fi + dts="${ptxd_reply}" + dtb="${dtb_dir}/${dts_dts/%.dts/.dtb}" + + dtc="${pkg_build_dir}/scripts/dtc/dtc" + if [ ! -x "${dtc}" ]; then + dtc=dtc + fi + + tmp_dts="${ptx_state_dir}/${pkg_label}.$(basename "${dts}").tmp" + + deps="${ptx_state_dir}/${pkg_label}.$(basename "${dts}").deps" + tmp_deps="${PTXDIST_TEMPDIR}/${pkg_label}.$(basename "${dts}").deps" + + exec 2>&${PTXDIST_FD_LOGERR} + + echo "CPP $(ptxd_print_path "${dts}")" && + ptxd_eval \ + cpp \ + -Wp,-MMD,${tmp_deps} \ + -Wp,-MT,${dtb_deps_target} \ + -nostdinc \ + -I"$(dirname "${dts}")" \ + -I${pkg_dir}/arch/${pkg_arch}/boot/dts \ + -I${pkg_dir}/arch/${pkg_arch}/boot/dts/include \ + -I${pkg_dir}/drivers/of/testcase-data \ + -I${pkg_dir}/include \ + -undef -D__DTS__ -x assembler-with-cpp \ + -o ${tmp_dts} \ + ${dts} && + + sed -e "\;^ ${pkg_dir}[^ ]*;d" \ + -e 's;^ \([^ \]*\); $(wildcard \1);' "${tmp_deps}" > "${deps}" && + # empty line in case all dependencies were removed + echo >> "${deps}" && + + mkdir -p "$(dirname "${dtb}")" && + echo "DTC $(ptxd_print_path "${dtb}")" && + ptxd_eval \ + "${dtc}" \ + $(ptxd_get_ptxconf PTXCONF_DTC_EXTRA_ARGS) \ + -i "$(dirname "${dts}")" \ + -i "${pkg_dir}/arch/${pkg_arch}/boot/dts" \ + -d "${tmp_deps}" \ + -I dts -O dtb -b 0 \ + -o "${dtb}" "${tmp_dts}" && + + awk "{ \ + s = \"\"; \ + for (i = 2; i <= NF; i++) { \ + if (\$i != \"${tmp_dts}\") + s = s \" \$(wildcard \" \$i \")\"; \ + }; \ + if (s != \""\"") { + printf \"${dtb_deps_target}:\" s; \ + print \"\"; \ + } \ + }" "${tmp_deps}" >> "${deps}" || + + ptxd_bailout "Unable to generate dtb file." +} +export -f ptxd_make_dtb + + +ptxd_make_world_dtb() { + local dtb_deps_target dtb_dir + + ptxd_make_world_init || break + + dtb_deps_target="${ptx_state_dir}/${pkg_stamp}" + dtb_dir="${pkg_pkg_dir}/boot" + + echo -e "\nBuilding Device trees..." + + for dts_dts in ${pkg_dts}; do + ptxd_make_dtb || break + done +} +export -f ptxd_make_world_dtb diff --git a/scripts/migrate/migrate_platform b/scripts/migrate/migrate_platform index 6790975d3..e9b4854d5 100755 --- a/scripts/migrate/migrate_platform +++ b/scripts/migrate/migrate_platform @@ -41,3 +41,13 @@ s/^\(\(# \)\?PTXCONF\)_IMAGE_IPKG_EXTRA_ARGS\(.*$\)/\1_IMAGE_XPKG_EXTRA_ARGS\3/ # reason : tf-a can be built for multiple platforms now # s/^\(\(# \)\?PTXCONF_TF_A_PLATFORM\>\)\(.*$\)/\1S\3/ + +# +# from : ptxdist-2020.07.0 +# to : ptxdist-2020.08.0 +# symbol : PTXCONF_DTC -> PTXCONF_KERNEL_DTB +# symbol : PTXCONF_DTC_OFTREE_DTS{,_PATH} -> PTXCONF_KERNEL__DTS{,_PATH} +# reason : dtc package removed. Devicetrees are built and installed with the kernel +# +s/^\(\(# \)\?PTXCONF\)_DTC\>\(.*$\)/\1_KERNEL_DTB\3/ +s/^\(\(# \)\?PTXCONF\)_DTC_OFTREE\(_DTS\(\|_PATH\)\)\(.*$\)/\1_KERNEL\3\5/ |