Skip to content

Commit

Permalink
chore(dtb): improve '.dtb' to '.dts' renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoninoScordino committed Nov 2, 2024
1 parent 89b9482 commit 72b21a3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions extract_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,13 @@ if [[ -f "${PWD}/boot.img" ]]; then
extract-dtb "${IMAGE}" -o "${OUTPUT}/dtb" > /dev/null || echo "[INFO] No device-tree blobs found."
rm -rf "${OUTPUT}/dtb/00_kernel"

# Do not run 'dtc' if no DTB was found
# Decompile '.dtb' to '.dts'
if [ "$(find "${OUTPUT}/dtb" -name "*.dtb")" ]; then
echo "[INFO] Decompiling device-tree blobs..."
# Decompile '.dtb' to '.dts'
for dtb in $(find "${PWD}/boot/dtb" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb}" | sed 's/\.dtb/.dts/')" || echo "[ERROR] Failed to decompile."
for dtb in $(find "${OUTPUT}/dtb" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb%.*}".dts)" || \
echo "[ERROR] Failed to decompile."
done
fi
fi
Expand All @@ -418,7 +419,8 @@ if [[ -f "${PWD}/vendor_boot.img" ]]; then
echo "[INFO] Decompiling device-tree blobs..."
# Decompile '.dtb' to '.dts'
for dtb in $(find "${OUTPUT}/dtb" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb}" | sed 's/\.dtb/.dts/')" || echo "[ERROR] Failed to decompile."
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb%.*}".dts)" || \
echo "[ERROR] Failed to decompile."
done
fi

Expand Down Expand Up @@ -479,7 +481,8 @@ if [[ -f "${PWD}/vendor_kernel_boot.img" ]]; then
echo "[INFO] Decompiling device-tree blobs..."
# Decompile '.dtb' to '.dts'
for dtb in $(find "${OUTPUT}/dtb" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb}" | sed 's/\.dtb/.dts/')" || echo "[ERROR] Failed to decompile."
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb%.*}".dts)" || \
echo "[ERROR] Failed to decompile."
done
fi
fi
Expand Down Expand Up @@ -529,9 +532,10 @@ if [[ -f "${PWD}/dtbo.img" ]]; then
rm -rf "${OUTPUT}/00_kernel"

# Decompile '.dtb' to '.dts'
echo "[INFO] dbto.img: Decompiling device-tree blobs..."
for dtb in $(find "${OUTPUT}" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb}" | sed 's/\.dtb/.dts/')" || echo "[ERROR] Failed to decompile."
echo "[INFO] Decompiling device-tree blobs..."
for dtb in $(find "${OUTPUT}/dtb" -type f); do
dtc -q -I dtb -O dts "${dtb}" >> "${OUTPUT}/dts/$(basename "${dtb%.*}".dts)" || \
echo "[ERROR] Failed to decompile."
done
fi

Expand Down

0 comments on commit 72b21a3

Please sign in to comment.