Skip to content

Commit

Permalink
Merge pull request #1685 from thochstein/dtb-move
Browse files Browse the repository at this point in the history
linux: Add compatibility logic for 32-bit dtb move
  • Loading branch information
otavio authored Nov 2, 2023
2 parents ee4dc92 + f06c737 commit 6d2c944
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recipes-kernel/linux/linux-fslc-imx_6.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Latest stable Kernel patchlevel is applied and maintained by Community."

require linux-imx.inc

KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE = "1"

KBRANCH = "6.1-2.1.x-imx"
SRC_URI = "git://github.com/Freescale/linux-fslc.git;branch=${KBRANCH};protocol=https"
SRCREV = "3f41fbe42851375d3d5996e4bf9e9809e6c79517"
Expand Down
2 changes: 2 additions & 0 deletions recipes-kernel/linux/linux-fslc-lts_6.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ upstreaming in any form."

require linux-imx.inc

KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE = "1"

SRC_URI = "git://github.com/Freescale/linux-fslc.git;branch=${KBRANCH};protocol=https"

# PV is defined in the base in linux-imx.inc file and uses the LINUX_VERSION definition
Expand Down
26 changes: 26 additions & 0 deletions recipes-kernel/linux/linux-imx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,29 @@ KCONFIG_MODE="--alldefconfig"
# We need to pass it as param since kernel might support more then one
# machine, with different entry points
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"

# A function to strip the new 32-bit dtb sub-folders in KERNEL_DEVICETREE
# for older kernel builds.
# Set KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE = "1" to enable.
KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE ?= "0"
python kernel_devicetree_32bit_compatibility_update() {
import os.path
import re
if d.getVar('KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE') != "1" or d.getVar('TUNE_ARCH') != "arm":
return
input = d.getVar('KERNEL_DEVICETREE').split()
output = ""
stripped = ""
for original in input:
if re.match("^.*/", original):
stripped = os.path.basename(original)
output += stripped + " "
bb.debug(1, "Devicetrees are moved to sub-folder, stripping the sub-folder for older kernel: %s -> %s" % (original, stripped))
else:
output += original + " "
if stripped:
bb.warn("Updating KERNEL_DEVICETREE, removing sub-folders for older kernel. Use -D for more details. Set KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE = \"0\" to disable.")
d.setVar('KERNEL_DEVICETREE', output)
}
addhandler kernel_devicetree_32bit_compatibility_update
kernel_devicetree_32bit_compatibility_update[eventmask] = "bb.event.RecipeParsed"
2 changes: 2 additions & 0 deletions recipes-kernel/linux/linux-imx_6.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ i.MX Family Reference Boards. It includes support for many IPs such as GPU, VPU

require recipes-kernel/linux/linux-imx.inc

KERNEL_DEVICETREE_32BIT_COMPATIBILITY_UPDATE = "1"

SRCBRANCH = "lf-6.1.y"
LOCALVERSION = "-6.1.36-2.1.0"
SRCREV = "04b05c5527e9af8d81254638c307df07dc9a5dd3"
Expand Down

0 comments on commit 6d2c944

Please sign in to comment.