mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 11:28:58 +00:00
kernel-devicetree.bbclass: Use lowercase names for shell variables
* just to make it more clear what is local shell variable and what is replaced by bitbake from the metadata and also to prevent the variable to be incorrectly expanded by bitbake if someone happens to define e.g. DTB_BASE_NAME (From OE-Core rev: 98b0f13f0650d970aac7441e7fcfc1089570785f) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ea676cbdb8
commit
85d1f532f3
@@ -10,21 +10,21 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-
|
||||
KERNEL_DEVICETREE_BUNDLE ?= "0"
|
||||
|
||||
normalize_dtb () {
|
||||
DTB="$1"
|
||||
if echo ${DTB} | grep -q '/dts/'; then
|
||||
bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
|
||||
DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
|
||||
dtb="$1"
|
||||
if echo $dtb | grep -q '/dts/'; then
|
||||
bbwarn "$dtb contains the full path to the the dts file, but only the dtb name should be used."
|
||||
dtb=`basename $dtb | sed 's,\.dts$,.dtb,g'`
|
||||
fi
|
||||
echo "${DTB}"
|
||||
echo "$dtb"
|
||||
}
|
||||
|
||||
get_real_dtb_path_in_kernel () {
|
||||
DTB="$1"
|
||||
DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
|
||||
if [ ! -e "${DTB_PATH}" ]; then
|
||||
DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
|
||||
dtb="$1"
|
||||
dtb_path="${B}/arch/${ARCH}/boot/dts/$dtb"
|
||||
if [ ! -e "$dtb_path" ]; then
|
||||
dtb_path="${B}/arch/${ARCH}/boot/$dtb"
|
||||
fi
|
||||
echo "${DTB_PATH}"
|
||||
echo "$dtb_path"
|
||||
}
|
||||
|
||||
do_configure_append() {
|
||||
@@ -50,61 +50,61 @@ do_configure_append() {
|
||||
}
|
||||
|
||||
do_compile_append() {
|
||||
for DTB in ${KERNEL_DEVICETREE}; do
|
||||
DTB=`normalize_dtb "${DTB}"`
|
||||
oe_runmake ${DTB}
|
||||
for dtbf in ${KERNEL_DEVICETREE}; do
|
||||
dtb=`normalize_dtb "$dtbf"`
|
||||
oe_runmake $dtb
|
||||
done
|
||||
}
|
||||
|
||||
do_install_append() {
|
||||
for DTB in ${KERNEL_DEVICETREE}; do
|
||||
DTB=`normalize_dtb "${DTB}"`
|
||||
DTB_EXT=${DTB##*.}
|
||||
DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
|
||||
DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
|
||||
install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
|
||||
for dtbf in ${KERNEL_DEVICETREE}; do
|
||||
dtb=`normalize_dtb "$dtbf"`
|
||||
dtb_ext=${dtb##*.}
|
||||
dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
|
||||
dtb_base_name=`basename $dtb ."$dtb_ext"`
|
||||
install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
|
||||
for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
|
||||
symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
|
||||
DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
||||
ln -sf ${DTB_BASE_NAME}.${DTB_EXT} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
|
||||
dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
|
||||
ln -sf $dtb_base_name.$dtb_ext ${D}/${KERNEL_IMAGEDEST}/devicetree-$dtb_symlink_name.$dtb_ext
|
||||
|
||||
if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
|
||||
cat ${D}/${KERNEL_IMAGEDEST}/$type \
|
||||
${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} \
|
||||
> ${D}/${KERNEL_IMAGEDEST}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
||||
${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext \
|
||||
> ${D}/${KERNEL_IMAGEDEST}/$type-$dtb_base_name.$dtb_ext.bin
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
do_deploy_append() {
|
||||
for DTB in ${KERNEL_DEVICETREE}; do
|
||||
DTB=`normalize_dtb "${DTB}"`
|
||||
DTB_EXT=${DTB##*.}
|
||||
DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
|
||||
for dtbf in ${KERNEL_DEVICETREE}; do
|
||||
dtb=`normalize_dtb "$dtbf"`
|
||||
dtb_ext=${dtb##*.}
|
||||
dtb_base_name=`basename $dtb ."$dtb_ext"`
|
||||
for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
|
||||
base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
|
||||
symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
|
||||
DTB_NAME=`echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
||||
DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
||||
DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
|
||||
dtb_name=`echo ${base_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
|
||||
dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
|
||||
dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
|
||||
install -d ${DEPLOYDIR}
|
||||
install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
|
||||
ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
|
||||
ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_BASE_NAME}.${DTB_EXT}
|
||||
install -m 0644 $dtb_path ${DEPLOYDIR}/$dtb_name.$dtb_ext
|
||||
ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_symlink_name.$dtb_ext
|
||||
ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext
|
||||
|
||||
if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
|
||||
cat ${DEPLOYDIR}/$type \
|
||||
${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
|
||||
> ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}.bin
|
||||
ln -sf ${DTB_NAME}.${DTB_EXT}.bin ${DEPLOYDIR}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
||||
${DEPLOYDIR}/$dtb_name.$dtb_ext \
|
||||
> ${DEPLOYDIR}/$dtb_name.$dtb_ext.bin
|
||||
ln -sf $dtb_name.$dtb_ext.bin ${DEPLOYDIR}/$type-$dtb_base_name.$dtb_ext.bin
|
||||
|
||||
if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
|
||||
cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
|
||||
${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
|
||||
> ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
||||
ln -sf ${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin \
|
||||
${DEPLOYDIR}/${type}-initramfs-${DTB_BASE_NAME}.${DTB_EXT}-${MACHINE}.bin
|
||||
${DEPLOYDIR}/$dtb_name.$dtb_ext \
|
||||
> ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin
|
||||
ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin \
|
||||
${DEPLOYDIR}/${type}-initramfs-$dtb_base_name.$dtb_ext-${MACHINE}.bin
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user