aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel')
-rw-r--r--recipes-kernel/linux/linux-linaro-qcom.inc10
-rw-r--r--recipes-kernel/linux/linux-linaro-qcomlt_5.10.bb2
-rw-r--r--recipes-kernel/linux/linux-linaro-qcomlt_5.7.bb2
-rw-r--r--recipes-kernel/linux/linux-linaro-qcomlt_5.9.bb2
-rw-r--r--recipes-kernel/linux/linux-qcom-bootimg.inc139
5 files changed, 100 insertions, 55 deletions
diff --git a/recipes-kernel/linux/linux-linaro-qcom.inc b/recipes-kernel/linux/linux-linaro-qcom.inc
index 21f0ae6..b9e2714 100644
--- a/recipes-kernel/linux/linux-linaro-qcom.inc
+++ b/recipes-kernel/linux/linux-linaro-qcom.inc
@@ -80,13 +80,3 @@ do_configure_prepend() {
yes '' | oe_runmake -C ${S} O=${B} oldconfig
oe_runmake -C ${S} O=${B} savedefconfig && cp ${B}/defconfig ${WORKDIR}/defconfig.saved
}
-
-# append DTB
-do_compile_append() {
- if ! [ -e ${B}/arch/${ARCH}/boot/dts/${KERNEL_DEVICETREE} ] ; then
- oe_runmake ${KERNEL_DEVICETREE}
- fi
- cp arch/${ARCH}/boot/${KERNEL_IMAGETYPE} arch/${ARCH}/boot/${KERNEL_IMAGETYPE}.backup
- cat arch/${ARCH}/boot/${KERNEL_IMAGETYPE}.backup arch/${ARCH}/boot/dts/${KERNEL_DEVICETREE} > arch/${ARCH}/boot/${KERNEL_IMAGETYPE}
- rm -f arch/${ARCH}/boot/${KERNEL_IMAGETYPE}.backup
-}
diff --git a/recipes-kernel/linux/linux-linaro-qcomlt_5.10.bb b/recipes-kernel/linux/linux-linaro-qcomlt_5.10.bb
index 0320f89..57ae852 100644
--- a/recipes-kernel/linux/linux-linaro-qcomlt_5.10.bb
+++ b/recipes-kernel/linux/linux-linaro-qcomlt_5.10.bb
@@ -12,4 +12,4 @@ LOCALVERSION ?= "-linaro-lt-qcom"
SRCBRANCH = "release/qcomlt-5.10"
SRCREV = "6afb1155f01df9871e14e4189d83d31000b308ee"
-COMPATIBLE_MACHINE = "(apq8016|apq8096|sdm845|sm8250)"
+COMPATIBLE_MACHINE = "(qcom)"
diff --git a/recipes-kernel/linux/linux-linaro-qcomlt_5.7.bb b/recipes-kernel/linux/linux-linaro-qcomlt_5.7.bb
index d59db58..88b33be 100644
--- a/recipes-kernel/linux/linux-linaro-qcomlt_5.7.bb
+++ b/recipes-kernel/linux/linux-linaro-qcomlt_5.7.bb
@@ -23,7 +23,7 @@ LOCALVERSION ?= "-linaro-lt-qcom"
SRCBRANCH ?= "release/qcomlt-5.7"
SRCREV ?= "4af49ea41ecf17e5e6243f3ac81dfc2f84d8a3a1"
-COMPATIBLE_MACHINE = "(apq8016|apq8096|sdm845|sm8250)"
+COMPATIBLE_MACHINE = "(qcom)"
# Wifi firmware has a recognizable arch :(
ERROR_QA_remove = "arch"
diff --git a/recipes-kernel/linux/linux-linaro-qcomlt_5.9.bb b/recipes-kernel/linux/linux-linaro-qcomlt_5.9.bb
index a1af3c0..118ff78 100644
--- a/recipes-kernel/linux/linux-linaro-qcomlt_5.9.bb
+++ b/recipes-kernel/linux/linux-linaro-qcomlt_5.9.bb
@@ -15,4 +15,4 @@ SRCREV ?= "b5ff44498a19a685aa10a07ec67e3d12bc95a33a"
SRCBRANCH_sm8250 = "release/rb5/qcomlt-5.9"
SRCREV_sm8250 = "6d5a9a5da79684f69e4c66a7cf9108ab4e77025f"
-COMPATIBLE_MACHINE = "(apq8016|apq8096|sdm845|sm8250)"
+COMPATIBLE_MACHINE = "(qcom)"
diff --git a/recipes-kernel/linux/linux-qcom-bootimg.inc b/recipes-kernel/linux/linux-qcom-bootimg.inc
index 8a8a407..15b3397 100644
--- a/recipes-kernel/linux/linux-qcom-bootimg.inc
+++ b/recipes-kernel/linux/linux-qcom-bootimg.inc
@@ -1,49 +1,104 @@
-DEPENDS += "skales-native"
-
-QCOM_BOOTIMG_ROOTFS ?= "undefined"
-SD_QCOM_BOOTIMG_ROOTFS ?= "undefined"
-
-# set output file names
-BOOT_IMAGE_BASE_NAME = "boot-${KERNEL_IMAGE_NAME}"
-BOOT_IMAGE_SYMLINK_NAME = "boot-${KERNEL_IMAGE_LINK_NAME}"
-SD_BOOT_IMAGE_BASE_NAME = "boot-sd${KERNEL_IMAGE_NAME}"
-SD_BOOT_IMAGE_SYMLINK_NAME = "boot-sd-${KERNEL_IMAGE_LINK_NAME}"
-KERNEL_CMDLINE = "root=${1} rw rootwait console=${ttydev},${baudrate}n8"
-KERNEL_CMDLINE_append_dragonboard-845c = " clk_ignore_unused pd_ignore_unused"
-KERNEL_CMDLINE_append_qrb5165-rb5 = " pcie_pme=nomsi"
-
-# param ${1} partition where rootfs is located
-# param ${2} output boot image file name
-priv_make_image() {
- ${STAGING_BINDIR_NATIVE}/skales/mkbootimg --kernel ${B}/arch/${ARCH}/boot/${KERNEL_IMAGETYPE} \
- --ramdisk ${B}/initrd.img \
- --output ${DEPLOYDIR}/${2}.img \
- --pagesize ${QCOM_BOOTIMG_PAGE_SIZE} \
- --base ${QCOM_BOOTIMG_KERNEL_BASE} \
- --cmdline "${KERNEL_CMDLINE}"
-}
+QIMG_DEPLOYDIR = "${WORKDIR}/qcom_deploy-${PN}"
+
+python do_qcom_img_deploy() {
+ import shutil
+ import subprocess
+
+ subdir = d.getVar("KERNEL_DEPLOYSUBDIR")
+ if subdir is not None:
+ qcom_deploy_dir = os.path.join(d.getVar("QIMG_DEPLOYDIR"), subdir)
+ image_dir = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), subdir)
+ else:
+ qcom_deploy_dir = d.getVar("QIMG_DEPLOYDIR")
+ image_dir = d.getVar("DEPLOY_DIR_IMAGE")
+
+ B = d.getVar("B")
+ D = d.getVar("D")
+ kernel_output_dir = d.getVar("KERNEL_OUTPUT_DIR")
+ kernel_imagedest = d.getVar("KERNEL_IMAGEDEST")
+ kernel = os.path.join(B, "kernel-dtb")
+ definitrd = os.path.join(B, "initrd.img")
+ mkbootimg = os.path.join(d.getVar("STAGING_BINDIR_NATIVE"), "skales", "mkbootimg")
+ kernel_image_name = d.getVar("KERNEL_IMAGE_NAME")
+ kernel_link_name = d.getVar("KERNEL_IMAGE_LINK_NAME")
+ output_img = os.path.join(qcom_deploy_dir, "boot-%s.img" % (kernel_link_name))
+ output_sd_img = os.path.join(qcom_deploy_dir, "boot-sd-%s.img" % (kernel_link_name))
+
+ arch = d.getVar("ARCH")
+ if arch is "arm":
+ kernel_name = "zImage"
+ elif arch is "arm64":
+ kernel_name = "Image.gz"
+ else:
+ bb.fatal("Unuspported ARCH %s" % arch)
+
+ if os.path.exists(output_img):
+ os.unlink(output_img)
+ if os.path.exists(output_sd_img):
+ os.unlink(output_sd_img)
+
+ with open(definitrd, "w") as f:
+ f.write("This is not an initrd\n")
-do_deploy_append() {
+ for dtbf in d.getVar("KERNEL_DEVICETREE").split():
+ dtb = os.path.basename(dtbf)
+ dtb_name = dtb.rsplit('.', 1)[0]
- tmp="${SERIAL_CONSOLES}"
- baudrate=`echo $tmp | sed 's/\;.*//'`
- ttydev=`echo $tmp | sed -e 's/^[0-9]*\;//' -e 's/\s.*//' -e 's/\;.*//'`
+ def getVarDTB(name):
+ return d.getVarFlag(name, dtb_name) or d.getVar(name)
+
+ def make_image(template, rootfs):
+ output = os.path.join(qcom_deploy_dir, template % (dtb_name, kernel_image_name))
+ output_link = os.path.join(qcom_deploy_dir, template % (dtb_name, kernel_link_name))
+ subprocess.check_call([mkbootimg,
+ "--kernel", kernel,
+ "--ramdisk", definitrd,
+ "--output", output,
+ "--pagesize", getVarDTB("QCOM_BOOTIMG_PAGE_SIZE"),
+ "--base", getVarDTB("QCOM_BOOTIMG_KERNEL_BASE"),
+ "--cmdline", "root=%s rw rootwait %s %s" % (rootfs, consoles, getVarDTB("KERNEL_CMDLINE_EXTRA") or "")])
+ if os.path.exists(output_link):
+ os.unlink(output_link)
+ os.symlink(os.path.basename(output), output_link)
+ return output
+
+ consoles = ' '.join(map(lambda c: "console=%(tty)s,%(rate)sn8" % dict(zip(("rate", "tty"), c.split(';'))), getVarDTB("SERIAL_CONSOLES").split()))
+
+ # prepare kernel image with appended dtb
+ with open(kernel, 'wb') as wfd:
+ with open(os.path.join(kernel_output_dir, kernel_name), 'rb') as rfd:
+ shutil.copyfileobj(rfd, wfd)
+ with open(os.path.join(D, kernel_imagedest, dtb), 'rb') as rfd:
+ shutil.copyfileobj(rfd, wfd)
+
+ rootfs = getVarDTB("QCOM_BOOTIMG_ROOTFS")
+ if not rootfs or rootfs is "":
+ bb.fatal("QCOM_BOOTIMG_ROOTFS is undefined")
+
+ output = make_image("boot-%s-%s.img", rootfs)
+ if not os.path.exists(output_img):
+ os.symlink(os.path.basename(output), output_img)
+
+ sd_rootfs = getVarDTB("SD_QCOM_BOOTIMG_ROOTFS")
+ if sd_rootfs:
+ output = make_image("boot-sd-%s-%s.img", sd_rootfs)
+ if not os.path.exists(output_sd_img):
+ os.symlink(os.path.basename(output), output_sd_img)
+}
- # mkbootimg requires an initrd file, make fake one that will be ignored
- # during boot
- echo "This is not an initrd" > ${B}/initrd.img
+do_qcom_img_deploy[depends] += "skales-native:do_populate_sysroot"
- # don't build bootimg if rootfs partition is not defined
- if [ "${QCOM_BOOTIMG_ROOTFS}" = "undefined" ]; then
- bbfatal "Rootfs partition must be defined"
- fi
+addtask qcom_img_deploy after do_populate_sysroot do_packagedata bundle_initramfs before do_deploy
- priv_make_image ${QCOM_BOOTIMG_ROOTFS} ${BOOT_IMAGE_BASE_NAME}
- ln -sf ${BOOT_IMAGE_BASE_NAME}.img ${DEPLOYDIR}/${BOOT_IMAGE_SYMLINK_NAME}.img
+# Setup sstate, see deploy.bbclass
+SSTATETASKS += "do_qcom_img_deploy"
+do_qcom_img_deploy[sstate-inputdirs] = "${QIMG_DEPLOYDIR}"
+do_qcom_img_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
- # build sd boot image only for machines supporting it.
- if [ "${SD_QCOM_BOOTIMG_ROOTFS}" != "undefined" ]; then
- priv_make_image ${SD_QCOM_BOOTIMG_ROOTFS} ${SD_BOOT_IMAGE_BASE_NAME}
- ln -sf ${SD_BOOT_IMAGE_BASE_NAME}.img ${DEPLOYDIR}/${SD_BOOT_IMAGE_SYMLINK_NAME}.img
- fi
+python do_qcom_img_deploy_setscene () {
+ sstate_setscene(d)
}
+addtask do_qcom_img_deploy_setscene
+do_qcom_img_deploy[dirs] = "${QIMG_DEPLOYDIR} ${B}"
+do_qcom_img_deploy[cleandirs] = "${QIMG_DEPLOYDIR}"
+do_qcom_img_deploy[stamp-extra-info] = "${MACHINE_ARCH}"