2011-02-09 05:45:23 +00:00
|
|
|
# Support for device tree generation
|
2013-08-09 10:53:39 +00:00
|
|
|
FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
|
2011-02-09 05:45:23 +00:00
|
|
|
|
|
|
|
python __anonymous () {
|
2013-08-13 13:52:35 +00:00
|
|
|
d.appendVar("PACKAGES", " kernel-devicetree")
|
2011-02-09 05:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install_append() {
|
2013-04-03 19:23:59 +00:00
|
|
|
if test -n "${KERNEL_DEVICETREE}"; then
|
2013-08-13 13:52:35 +00:00
|
|
|
for DTB in ${KERNEL_DEVICETREE}; do
|
|
|
|
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'`
|
2013-04-03 19:23:59 +00:00
|
|
|
fi
|
2013-08-13 13:52:35 +00:00
|
|
|
DTB_BASE_NAME=`basename ${DTB} .dtb`
|
|
|
|
DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
|
|
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
2013-08-16 18:34:28 +00:00
|
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
|
2013-08-13 13:52:35 +00:00
|
|
|
oe_runmake ${DTB}
|
2013-08-16 18:34:28 +00:00
|
|
|
if [ ! -e "${DTB_PATH}" ]; then
|
|
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
|
|
|
|
fi
|
|
|
|
install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
|
2013-04-03 19:23:59 +00:00
|
|
|
done
|
|
|
|
fi
|
2011-02-09 05:45:23 +00:00
|
|
|
}
|
|
|
|
|
2012-06-26 03:53:16 +00:00
|
|
|
do_deploy_append() {
|
2013-04-03 19:23:59 +00:00
|
|
|
if test -n "${KERNEL_DEVICETREE}"; then
|
2013-08-13 13:52:35 +00:00
|
|
|
for DTB in ${KERNEL_DEVICETREE}; do
|
|
|
|
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'`
|
2013-04-03 19:23:59 +00:00
|
|
|
fi
|
2013-08-13 13:52:35 +00:00
|
|
|
DTB_BASE_NAME=`basename ${DTB} .dtb`
|
|
|
|
DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
|
|
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
2013-08-16 18:34:28 +00:00
|
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
|
|
|
|
if [ ! -e "${DTB_PATH}" ]; then
|
|
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
|
|
|
|
fi
|
2013-04-03 19:23:59 +00:00
|
|
|
install -d ${DEPLOYDIR}
|
2013-08-16 18:34:28 +00:00
|
|
|
install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
|
2013-04-03 19:23:59 +00:00
|
|
|
cd ${DEPLOYDIR}
|
|
|
|
ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
|
|
|
|
cd -
|
|
|
|
done
|
|
|
|
fi
|
2012-06-26 03:53:16 +00:00
|
|
|
}
|
2013-04-03 19:23:58 +00:00
|
|
|
|
|
|
|
pkg_postinst_kernel-devicetree () {
|
2013-04-03 19:23:59 +00:00
|
|
|
cd /${KERNEL_IMAGEDEST}
|
2013-08-13 13:52:35 +00:00
|
|
|
for DTB_FILE in ${KERNEL_DEVICETREE}
|
2013-04-03 19:23:59 +00:00
|
|
|
do
|
2013-08-13 13:52:35 +00:00
|
|
|
DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
|
|
|
|
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
|
|
update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
|
2013-04-03 19:23:59 +00:00
|
|
|
done
|
2013-04-03 19:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_postrm_kernel-devicetree () {
|
2013-04-03 19:23:59 +00:00
|
|
|
cd /${KERNEL_IMAGEDEST}
|
2013-08-13 13:52:35 +00:00
|
|
|
for DTB_FILE in ${KERNEL_DEVICETREE}
|
2013-04-03 19:23:59 +00:00
|
|
|
do
|
2013-08-13 13:52:35 +00:00
|
|
|
DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
|
|
|
|
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
|
|
update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
|
2013-04-03 19:23:59 +00:00
|
|
|
done
|
2013-04-03 19:23:58 +00:00
|
|
|
}
|