Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

classes/kernel: add useflag kernel_dts_vendor #193

Merged
merged 1 commit into from
Dec 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions classes/kernel.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
## @var KERNEL_IMAGE_DEPLOY_LINK The link name of the symlink to
## KERNEL_IMAGE_DEPLOY_FILE.
## @var KERNEL_DTB_DIR Location of the compiled devicetree.
## @var KERNEL_DTB_VENDOR Vendor subdir of the compiled devicetree.
## @var KERNEL_DTB_FILE Name of the compiled devicetree
## @var KERNEL_DTB_DEPLOY_NAME name of the deployed devicetree. Used in
## KERNEL_DTB_DEPLOY_FILE and in
Expand Down Expand Up @@ -248,18 +249,20 @@ UIMAGE_KERNEL_OUTPUT = ""
UIMAGE_KERNEL_OUTPUT:USE_kernel_uimage = "arch/${KERNEL_ARCH}/boot/uImage"
KERNEL_OUTPUT += "${UIMAGE_KERNEL_OUTPUT}"

CLASS_FLAGS += "kernel_external_dtb kernel_dtc kernel_dtc_flags kernel_dts"
CLASS_FLAGS += "kernel_external_dtb kernel_dtc kernel_dtc_flags kernel_dts_vendor kernel_dts"
DEFAULT_USE_kernel_dtc_flags = "-R 8 -p 0x3000"

KERNEL_DTS_DIR = "arch/${KERNEL_ARCH}/boot/dts/"
KERNEL_DTS_DIR:USE_kernel_dts_dir = "${USE_kernel_dts_dir}"
KERNEL_DTS_FILE = "${MACHINE}.dts"
KERNEL_DTS_NAME = "${MACHINE}"
KERNEL_DTB_VENDOR = ""
KERNEL_DTB_FILE = ""

addhook kernel_devicetree_init to post_recipe_parse after set_useflags
def kernel_devicetree_init(d):
kernel_dtb = d.get('USE_kernel_external_dtb')
kernel_dts_vendor = d.get('USE_kernel_dts_vendor')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without any setting of USE_kernel_dts_vendor, will we end up with None? And how is that handled later on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the @mnhu comments answer this question?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That depends on how d.set('KERNEL_DTB_VENDOR', kernel_dts_vendor) is handled by oe-lite...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will re-formulate. Have you tested this change with USE_kernel_dts set, but without USE_kernel_dts_vendor set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and it fails 👎
CRITICAL: bake failed: Exception: Cannot expand variable ${KERNEL_DTB_VENDOR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now have tested this with and without USE_kernel_dts_vendor set...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better do kernel_dts_vendor = d.get('USE_kernel_dts_vendor') or '' instead of the conditional below.

kernel_dts = d.get('USE_kernel_dts')
if (kernel_dts and kernel_dts != "1"):
if(kernel_dtb):
Expand All @@ -268,6 +271,8 @@ def kernel_devicetree_init(d):
" and USE_kernel_dts makes no sense")
dts_name,ext = os.path.splitext(kernel_dts)
d.set('KERNEL_DTS_FILE', kernel_dts)
if (kernel_dts_vendor and kernel_dts_vendor != "1"):
d.set('KERNEL_DTB_VENDOR', kernel_dts_vendor)
d.set('KERNEL_DTB_FILE',dts_name+'.dtb')
d.set('KERNEL_DTS_NAME',dts_name)
d.set('KERNEL_DTB_TARGET',dts_name)
Expand All @@ -287,12 +292,12 @@ do_compile_kernel_dtc() {

KERNEL_COMPILE_POSTFUNCS:>USE_kernel_dts += " do_compile_kernel_dts"
do_compile_kernel_dts() {
oe_runmake "${KERNEL_DTB_FILE}"
oe_runmake "${KERNEL_DTB_VENDOR}/${KERNEL_DTB_FILE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was afraid the this would break if ${KERNEL_DTB_VENDOR} is empty, but my test shows otherwise:

% make ARCH=arm CROSS_COMPILE=arm-cortexa9neon-linux-gnueabi- /imx6dl-wandboard.dtb
  DTC     arch/arm/boot/dts//imx6dl-wandboard.dtb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right its not very pretty there... I'll look into it
The other places you only end up with arch/arm/boot/dts//imx6dl-wandboard.dtb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really mind the heading slash...

}

KERNEL_COMPILE_POSTFUNCS:>USE_kernel_external_dtb += " do_compile_kernel_external_dtb"
do_compile_kernel_external_dtb() {
cp ${SRCDIR}/${KERNEL_DTB_FILE} ${S}/${KERNEL_DTS_DIR}/${KERNEL_DTB_FILE}
cp ${SRCDIR}/${KERNEL_DTB_FILE} ${S}/${KERNEL_DTS_DIR}/${KERNEL_DTB_VENDOR}/${KERNEL_DTB_FILE}
}

CLASS_FLAGS += "kernel_perf"
Expand Down Expand Up @@ -325,7 +330,7 @@ do_install_kernel () {
install -m 0644 ${KERNEL_IMAGE} ${D}${bootdir}/${KERNEL_IMAGE_FILENAME}

if [ -n "${KERNEL_DTB_FILE}" ] ; then
install -m 0644 ${KERNEL_DTS_DIR}/${KERNEL_DTB_FILE} ${D}${bootdir}/${KERNEL_DTB_FILENAME}
install -m 0644 ${KERNEL_DTS_DIR}/${KERNEL_DTB_VENDOR}/${KERNEL_DTB_FILE} ${D}${bootdir}/${KERNEL_DTB_FILENAME}
fi

if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
Expand Down Expand Up @@ -407,9 +412,9 @@ do_deploy() {
>${IMAGE_DEPLOY_DIR}/${KERNEL_IMAGE_DEPLOY_FILE}.md5

if [ -n "${KERNEL_DTB_FILE}" ] ; then
install -m 0644 "${KERNEL_DTS_DIR}/${KERNEL_DTB_FILE}" \
install -m 0644 "${KERNEL_DTS_DIR}/${KERNEL_DTB_VENDOR}/${KERNEL_DTB_FILE}" \
${IMAGE_DEPLOY_DIR}/${KERNEL_DTB_DEPLOY_FILE}
md5sum <"${KERNEL_DTS_DIR}/${KERNEL_DTB_FILE}" \
md5sum <"${KERNEL_DTS_DIR}/${KERNEL_DTB_VENDOR}/${KERNEL_DTB_FILE}" \
>${IMAGE_DEPLOY_DIR}/${KERNEL_DTB_DEPLOY_FILE}.md5
fi

Expand Down