diff options
-rw-r--r-- | meta/classes-recipe/kernel-fitimage.bbclass | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass index b77747404f..6684478c33 100644 --- a/meta/classes-recipe/kernel-fitimage.bbclass +++ b/meta/classes-recipe/kernel-fitimage.bbclass | |||
@@ -388,6 +388,7 @@ symlink_points_below() { | |||
388 | # $5 ... u-boot script ID | 388 | # $5 ... u-boot script ID |
389 | # $6 ... config ID | 389 | # $6 ... config ID |
390 | # $7 ... default flag | 390 | # $7 ... default flag |
391 | # $8 ... default DTB image name | ||
391 | fitimage_emit_section_config() { | 392 | fitimage_emit_section_config() { |
392 | 393 | ||
393 | conf_csum="${FIT_HASH_ALG}" | 394 | conf_csum="${FIT_HASH_ALG}" |
@@ -404,6 +405,7 @@ fitimage_emit_section_config() { | |||
404 | bootscr_id="$5" | 405 | bootscr_id="$5" |
405 | config_id="$6" | 406 | config_id="$6" |
406 | default_flag="$7" | 407 | default_flag="$7" |
408 | default_dtb_image="$8" | ||
407 | 409 | ||
408 | # Test if we have any DTBs at all | 410 | # Test if we have any DTBs at all |
409 | sep="" | 411 | sep="" |
@@ -415,7 +417,6 @@ fitimage_emit_section_config() { | |||
415 | bootscr_line="" | 417 | bootscr_line="" |
416 | setup_line="" | 418 | setup_line="" |
417 | default_line="" | 419 | default_line="" |
418 | default_dtb_image="${FIT_CONF_DEFAULT_DTB}" | ||
419 | 420 | ||
420 | dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}") | 421 | dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}") |
421 | if [ -z "$dtb_image_sect" ]; then | 422 | if [ -z "$dtb_image_sect" ]; then |
@@ -469,11 +470,7 @@ fitimage_emit_section_config() { | |||
469 | # Select default node as user specified dtb when | 470 | # Select default node as user specified dtb when |
470 | # multiple dtb exists. | 471 | # multiple dtb exists. |
471 | if [ -n "$default_dtb_image" ]; then | 472 | if [ -n "$default_dtb_image" ]; then |
472 | if [ -s "${EXTERNAL_KERNEL_DEVICETREE}/$default_dtb_image" ]; then | 473 | default_line="default = \"${FIT_CONF_PREFIX}$default_dtb_image\";" |
473 | default_line="default = \"${FIT_CONF_PREFIX}$default_dtb_image\";" | ||
474 | else | ||
475 | bbwarn "Couldn't find a valid user specified dtb in ${EXTERNAL_KERNEL_DEVICETREE}/$default_dtb_image" | ||
476 | fi | ||
477 | else | 474 | else |
478 | default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";" | 475 | default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";" |
479 | fi | 476 | fi |
@@ -555,7 +552,8 @@ fitimage_assemble() { | |||
555 | ramdiskcount=$3 | 552 | ramdiskcount=$3 |
556 | setupcount="" | 553 | setupcount="" |
557 | bootscr_id="" | 554 | bootscr_id="" |
558 | rm -f $1 ${KERNEL_OUTPUT_DIR}/$2 | 555 | default_dtb_image="" |
556 | rm -f $1 arch/${ARCH}/boot/$2 | ||
559 | 557 | ||
560 | if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then | 558 | if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then |
561 | bbfatal "Keys used to sign images and configuration nodes must be different." | 559 | bbfatal "Keys used to sign images and configuration nodes must be different." |
@@ -593,6 +591,13 @@ fitimage_assemble() { | |||
593 | DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB" | 591 | DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB" |
594 | fi | 592 | fi |
595 | 593 | ||
594 | # Set the default dtb image if it exists in the devicetree. | ||
595 | if [ ${FIT_CONF_DEFAULT_DTB} = $DTB ];then | ||
596 | default_dtb_image=$(echo "$DTB" | tr '/' '_') | ||
597 | fi | ||
598 | |||
599 | DTB=$(echo "$DTB" | tr '/' '_') | ||
600 | |||
596 | # Skip DTB if we've picked it up previously | 601 | # Skip DTB if we've picked it up previously |
597 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue | 602 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue |
598 | 603 | ||
@@ -606,6 +611,13 @@ fitimage_assemble() { | |||
606 | dtbcount=1 | 611 | dtbcount=1 |
607 | for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtb' -printf '%P\n' | sort) \ | 612 | for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtb' -printf '%P\n' | sort) \ |
608 | $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtbo' -printf '%P\n' | sort); do | 613 | $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtbo' -printf '%P\n' | sort); do |
614 | # Set the default dtb image if it exists in the devicetree. | ||
615 | if [ ${FIT_CONF_DEFAULT_DTB} = $DTB ];then | ||
616 | default_dtb_image=$(echo "$DTB" | tr '/' '_') | ||
617 | fi | ||
618 | |||
619 | DTB=$(echo "$DTB" | tr '/' '_') | ||
620 | |||
609 | # Skip DTB/DTBO if we've picked it up previously | 621 | # Skip DTB/DTBO if we've picked it up previously |
610 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue | 622 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue |
611 | 623 | ||
@@ -619,6 +631,10 @@ fitimage_assemble() { | |||
619 | done | 631 | done |
620 | fi | 632 | fi |
621 | 633 | ||
634 | if [ -n "${FIT_CONF_DEFAULT_DTB}" ] && [ -z $default_dtb_image ]; then | ||
635 | bbwarn "${FIT_CONF_DEFAULT_DTB} is not available in the list of device trees." | ||
636 | fi | ||
637 | |||
622 | # | 638 | # |
623 | # Step 3: Prepare a u-boot script section | 639 | # Step 3: Prepare a u-boot script section |
624 | # | 640 | # |
@@ -691,15 +707,15 @@ fitimage_assemble() { | |||
691 | for DTB in ${DTBS}; do | 707 | for DTB in ${DTBS}; do |
692 | dtb_ext=${DTB##*.} | 708 | dtb_ext=${DTB##*.} |
693 | if [ "$dtb_ext" = "dtbo" ]; then | 709 | if [ "$dtb_ext" = "dtbo" ]; then |
694 | fitimage_emit_section_config $1 "" "$DTB" "" "$bootscr_id" "" "`expr $i = $dtbcount`" | 710 | fitimage_emit_section_config $1 "" "$DTB" "" "$bootscr_id" "" "`expr $i = $dtbcount`" "$default_dtb_image" |
695 | else | 711 | else |
696 | fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`" | 712 | fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`" "$default_dtb_image" |
697 | fi | 713 | fi |
698 | i=`expr $i + 1` | 714 | i=`expr $i + 1` |
699 | done | 715 | done |
700 | else | 716 | else |
701 | defaultconfigcount=1 | 717 | defaultconfigcount=1 |
702 | fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount | 718 | fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount "$default_dtb_image" |
703 | fi | 719 | fi |
704 | 720 | ||
705 | fitimage_emit_section_maint $1 sectend | 721 | fitimage_emit_section_maint $1 sectend |