diff options
| -rw-r--r-- | meta/classes-recipe/kernel-fitimage.bbclass | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass index 6307e3c50a..7980910aa8 100644 --- a/meta/classes-recipe/kernel-fitimage.bbclass +++ b/meta/classes-recipe/kernel-fitimage.bbclass | |||
| @@ -355,6 +355,27 @@ EOF | |||
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | # | 357 | # |
| 358 | # echoes symlink destination if it points below directory | ||
| 359 | # | ||
| 360 | # $1 ... file that's a potential symlink | ||
| 361 | # $2 ... expected parent directory | ||
| 362 | symlink_points_below() { | ||
| 363 | file="$2/$1" | ||
| 364 | dir=$2 | ||
| 365 | |||
| 366 | if ! [ -L "$file" ]; then | ||
| 367 | return | ||
| 368 | fi | ||
| 369 | |||
| 370 | realpath="$(realpath --relative-to=$dir $file)" | ||
| 371 | if [ -z "${realpath%%../*}" ]; then | ||
| 372 | return | ||
| 373 | fi | ||
| 374 | |||
| 375 | echo "$realpath" | ||
| 376 | } | ||
| 377 | |||
| 378 | # | ||
| 358 | # Emit the fitImage ITS configuration section | 379 | # Emit the fitImage ITS configuration section |
| 359 | # | 380 | # |
| 360 | # $1 ... .its filename | 381 | # $1 ... .its filename |
| @@ -392,7 +413,13 @@ fitimage_emit_section_config() { | |||
| 392 | setup_line="" | 413 | setup_line="" |
| 393 | default_line="" | 414 | default_line="" |
| 394 | 415 | ||
| 416 | dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}") | ||
| 417 | if [ -z "$dtb_image_sect" ]; then | ||
| 418 | dtb_image_sect=$dtb_image | ||
| 419 | fi | ||
| 420 | |||
| 395 | dtb_image=$(echo $dtb_image | tr '/' '_') | 421 | dtb_image=$(echo $dtb_image | tr '/' '_') |
| 422 | dtb_image_sect=$(echo "${dtb_image_sect}" | tr '/' '_') | ||
| 396 | 423 | ||
| 397 | # conf node name is selected based on dtb ID if it is present, | 424 | # conf node name is selected based on dtb ID if it is present, |
| 398 | # otherwise its selected based on kernel ID | 425 | # otherwise its selected based on kernel ID |
| @@ -411,7 +438,7 @@ fitimage_emit_section_config() { | |||
| 411 | if [ -n "$dtb_image" ]; then | 438 | if [ -n "$dtb_image" ]; then |
| 412 | conf_desc="$conf_desc${sep}FDT blob" | 439 | conf_desc="$conf_desc${sep}FDT blob" |
| 413 | sep=", " | 440 | sep=", " |
| 414 | fdt_line="fdt = \"fdt-$dtb_image\";" | 441 | fdt_line="fdt = \"fdt-$dtb_image_sect\";" |
| 415 | fi | 442 | fi |
| 416 | 443 | ||
| 417 | if [ -n "$ramdisk_id" ]; then | 444 | if [ -n "$ramdisk_id" ]; then |
| @@ -568,6 +595,10 @@ fitimage_assemble() { | |||
| 568 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue | 595 | echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue |
| 569 | 596 | ||
| 570 | DTBS="$DTBS $DTB" | 597 | DTBS="$DTBS $DTB" |
| 598 | |||
| 599 | # Also skip if a symlink. We'll later have each config section point at it | ||
| 600 | [ $(symlink_points_below $DTB "${EXTERNAL_KERNEL_DEVICETREE}") ] && continue | ||
| 601 | |||
| 571 | DTB=$(echo $DTB | tr '/' '_') | 602 | DTB=$(echo $DTB | tr '/' '_') |
| 572 | fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB" | 603 | fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB" |
| 573 | done | 604 | done |
