Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit linux-kernel-base kernel-module-split |
| 2 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 3 | KERNEL_PACKAGE_NAME ??= "kernel" |
| 4 | KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else d.getVar("KERNEL_PACKAGE_NAME") }" |
| 5 | |
| 6 | PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else "" }" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 7 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native" |
| 8 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}" |
| 9 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 10 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 12 | do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 13 | do_clean[depends] += "make-mod-scripts:do_clean" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | |
| 15 | CVE_PRODUCT ?= "linux_kernel" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | |
| 17 | S = "${STAGING_KERNEL_DIR}" |
| 18 | B = "${WORKDIR}/build" |
| 19 | KBUILD_OUTPUT = "${B}" |
| 20 | OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT" |
| 21 | |
| 22 | # we include gcc above, we dont need virtual/libc |
| 23 | INHIBIT_DEFAULT_DEPS = "1" |
| 24 | |
| 25 | KERNEL_IMAGETYPE ?= "zImage" |
| 26 | INITRAMFS_IMAGE ?= "" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 27 | INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | INITRAMFS_TASK ?= "" |
| 29 | INITRAMFS_IMAGE_BUNDLE ?= "" |
| 30 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 31 | # KERNEL_VERSION is extracted from source code. It is evaluated as |
| 32 | # None for the first parsing, since the code has not been fetched. |
| 33 | # After the code is fetched, it will be evaluated as real version |
| 34 | # number and cause kernel to be rebuilt. To avoid this, make |
| 35 | # KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on |
| 36 | # LINUX_VERSION which is a constant. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION') or ""}" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 38 | KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 40 | KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" |
| 41 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | python __anonymous () { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 43 | pn = d.getVar("PN") |
| 44 | kpn = d.getVar("KERNEL_PACKAGE_NAME") |
| 45 | |
| 46 | # XXX Remove this after bug 11905 is resolved |
| 47 | # FILES_${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly |
| 48 | if kpn == pn: |
| 49 | bb.warn("Some packages (E.g. *-dev) might be missing due to " |
| 50 | "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)") |
| 51 | |
| 52 | # The default kernel recipe builds in a shared location defined by |
| 53 | # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR. |
| 54 | # Set these variables to directories under ${WORKDIR} in alternate |
| 55 | # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they |
| 56 | # may build in parallel with the default kernel without clobbering. |
| 57 | if kpn != "kernel": |
| 58 | workdir = d.getVar("WORKDIR") |
| 59 | sourceDir = os.path.join(workdir, 'kernel-source') |
| 60 | artifactsDir = os.path.join(workdir, 'kernel-build-artifacts') |
| 61 | d.setVar("STAGING_KERNEL_DIR", sourceDir) |
| 62 | d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 63 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 64 | # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 65 | type = d.getVar('KERNEL_IMAGETYPE') or "" |
| 66 | alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or "" |
| 67 | types = d.getVar('KERNEL_IMAGETYPES') or "" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 68 | if type not in types.split(): |
| 69 | types = (type + ' ' + types).strip() |
| 70 | if alttype not in types.split(): |
| 71 | types = (alttype + ' ' + types).strip() |
| 72 | d.setVar('KERNEL_IMAGETYPES', types) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 73 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 74 | # KERNEL_IMAGETYPES may contain a mixture of image types supported directly |
| 75 | # by the kernel build system and types which are created by post-processing |
| 76 | # the output of the kernel build system (e.g. compressing vmlinux -> |
| 77 | # vmlinux.gz in kernel_do_compile()). |
| 78 | # KERNEL_IMAGETYPE_FOR_MAKE should contain only image types supported |
| 79 | # directly by the kernel build system. |
| 80 | if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'): |
| 81 | typeformake = set() |
| 82 | for type in types.split(): |
| 83 | if type == 'vmlinux.gz': |
| 84 | type = 'vmlinux' |
| 85 | typeformake.add(type) |
| 86 | |
| 87 | d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' '.join(sorted(typeformake))) |
| 88 | |
| 89 | kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel" |
| 90 | imagedest = d.getVar('KERNEL_IMAGEDEST') |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 91 | |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 92 | for type in types.split(): |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 93 | typelower = type.lower() |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 94 | d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower)) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 95 | d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 96 | d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower)) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 97 | d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower)) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 98 | d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1') |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 99 | d.setVar('pkg_postinst_%s-image-%s' % (kname,typelower), """set +e |
| 100 | if [ -n "$D" ]; then |
| 101 | ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 |
| 102 | else |
| 103 | ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 |
| 104 | if [ $? -ne 0 ]; then |
| 105 | echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)." |
| 106 | install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s |
| 107 | fi |
| 108 | fi |
| 109 | set -e |
| 110 | """ % (type, type, type, type, type, type, type)) |
| 111 | d.setVar('pkg_postrm_%s-image-%s' % (kname,typelower), """set +e |
| 112 | if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then |
| 113 | rm -f ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 |
| 114 | fi |
| 115 | set -e |
| 116 | """ % (type, type, type)) |
| 117 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 118 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 119 | image = d.getVar('INITRAMFS_IMAGE') |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 120 | # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0, |
| 121 | # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built |
| 122 | # standalone for use by wic and other tools. |
| 123 | if image: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 124 | d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 125 | |
| 126 | # NOTE: setting INITRAMFS_TASK is for backward compatibility |
| 127 | # The preferred method is to set INITRAMFS_IMAGE, because |
| 128 | # this INITRAMFS_TASK has circular dependency problems |
| 129 | # if the initramfs requires kernel modules |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 130 | image_task = d.getVar('INITRAMFS_TASK') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 131 | if image_task: |
| 132 | d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}') |
| 133 | } |
| 134 | |
| 135 | # Here we pull in all various kernel image types which we support. |
| 136 | # |
| 137 | # In case you're wondering why kernel.bbclass inherits the other image |
| 138 | # types instead of the other way around, the reason for that is to |
| 139 | # maintain compatibility with various currently existing meta-layers. |
| 140 | # By pulling in the various kernel image types here, we retain the |
| 141 | # original behavior of kernel.bbclass, so no meta-layers should get |
| 142 | # broken. |
| 143 | # |
| 144 | # KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this |
| 145 | # used to be the default behavior when only uImage was supported. This |
| 146 | # variable can be appended by users who implement support for new kernel |
| 147 | # image types. |
| 148 | |
| 149 | KERNEL_CLASSES ?= " kernel-uimage " |
| 150 | inherit ${KERNEL_CLASSES} |
| 151 | |
| 152 | # Old style kernels may set ${S} = ${WORKDIR}/git for example |
| 153 | # We need to move these over to STAGING_KERNEL_DIR. We can't just |
| 154 | # create the symlink in advance as the git fetcher can't cope with |
| 155 | # the symlink. |
| 156 | do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" |
| 157 | do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 158 | python do_symlink_kernsrc () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 159 | s = d.getVar("S") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 160 | if s[-1] == '/': |
| 161 | # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail |
| 162 | s=s[:-1] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 163 | kernsrc = d.getVar("STAGING_KERNEL_DIR") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 164 | if s != kernsrc: |
| 165 | bb.utils.mkdirhier(kernsrc) |
| 166 | bb.utils.remove(kernsrc, recurse=True) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 167 | if d.getVar("EXTERNALSRC"): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | # With EXTERNALSRC S will not be wiped so we can symlink to it |
| 169 | os.symlink(s, kernsrc) |
| 170 | else: |
| 171 | import shutil |
| 172 | shutil.move(s, kernsrc) |
| 173 | os.symlink(kernsrc, s) |
| 174 | } |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 175 | # do_patch is normally ordered before do_configure, but |
| 176 | # externalsrc.bbclass deletes do_patch, breaking the dependency of |
| 177 | # do_configure on do_symlink_kernsrc. |
| 178 | addtask symlink_kernsrc before do_patch do_configure after do_unpack |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 179 | |
| 180 | inherit kernel-arch deploy |
| 181 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 182 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*" |
| 183 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*" |
| 184 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 185 | |
| 186 | export OS = "${TARGET_OS}" |
| 187 | export CROSS_COMPILE = "${TARGET_PREFIX}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 188 | export KBUILD_BUILD_VERSION = "1" |
Brad Bishop | 977dc1a | 2019-02-06 16:01:43 -0500 | [diff] [blame] | 189 | export KBUILD_BUILD_USER ?= "oe-user" |
| 190 | export KBUILD_BUILD_HOST ?= "oe-host" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 192 | KERNEL_RELEASE ?= "${KERNEL_VERSION}" |
| 193 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 194 | # The directory where built kernel lies in the kernel tree |
| 195 | KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 196 | KERNEL_IMAGEDEST ?= "boot" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 197 | |
| 198 | # |
| 199 | # configuration |
| 200 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 201 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE") or "ttyS0"}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 202 | |
| 203 | KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" |
| 204 | |
| 205 | KERNEL_LOCALVERSION ?= "" |
| 206 | |
| 207 | # kernels are generally machine specific |
| 208 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 209 | |
| 210 | # U-Boot support |
| 211 | UBOOT_ENTRYPOINT ?= "20008000" |
| 212 | UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" |
| 213 | |
| 214 | # Some Linux kernel configurations need additional parameters on the command line |
| 215 | KERNEL_EXTRA_ARGS ?= "" |
| 216 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 217 | EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 218 | EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}"" |
| 219 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 220 | KERNEL_ALT_IMAGETYPE ??= "" |
| 221 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 222 | copy_initramfs() { |
| 223 | echo "Copying initramfs into ./usr ..." |
| 224 | # In case the directory is not created yet from the first pass compile: |
| 225 | mkdir -p ${B}/usr |
| 226 | # Find and use the first initramfs image archive type we find |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 227 | rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 228 | for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 229 | if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then |
| 230 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 231 | case $img in |
| 232 | *gz) |
| 233 | echo "gzip decompressing image" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 234 | gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 235 | break |
| 236 | ;; |
| 237 | *lz4) |
| 238 | echo "lz4 decompressing image" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 239 | lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 240 | break |
| 241 | ;; |
| 242 | *lzo) |
| 243 | echo "lzo decompressing image" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 244 | lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 245 | break |
| 246 | ;; |
| 247 | *lzma) |
| 248 | echo "lzma decompressing image" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 249 | lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 250 | break |
| 251 | ;; |
| 252 | *xz) |
| 253 | echo "xz decompressing image" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 254 | xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 255 | break |
| 256 | ;; |
| 257 | esac |
Brad Bishop | f8caae3 | 2019-03-25 13:13:56 -0400 | [diff] [blame] | 258 | break |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 259 | fi |
| 260 | done |
Brad Bishop | f8caae3 | 2019-03-25 13:13:56 -0400 | [diff] [blame] | 261 | # Verify that the above loop found a initramfs, fail otherwise |
| 262 | [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz) for bundling; INITRAMFS_IMAGE_NAME might be wrong." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 263 | } |
| 264 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 265 | do_bundle_initramfs () { |
| 266 | if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then |
| 267 | echo "Creating a kernel image with a bundled initramfs..." |
| 268 | copy_initramfs |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 269 | # Backing up kernel image relies on its type(regular file or symbolic link) |
| 270 | tmp_path="" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 271 | for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do |
| 272 | if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then |
| 273 | linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType` |
| 274 | realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType` |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 275 | mv -f $realpath $realpath.bak |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 276 | tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath |
| 277 | elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then |
| 278 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak |
| 279 | tmp_path=$tmp_path" "$imageType"##" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 280 | fi |
| 281 | done |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 282 | use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 283 | kernel_do_compile |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 284 | # Restoring kernel image |
| 285 | for tp in $tmp_path ; do |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 286 | imageType=`echo $tp|cut -d "#" -f 1` |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 287 | linkpath=`echo $tp|cut -d "#" -f 2` |
| 288 | realpath=`echo $tp|cut -d "#" -f 3` |
| 289 | if [ -n "$realpath" ]; then |
| 290 | mv -f $realpath $realpath.initramfs |
| 291 | mv -f $realpath.bak $realpath |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 292 | ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 293 | else |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 294 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs |
| 295 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 296 | fi |
| 297 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 298 | fi |
| 299 | } |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 300 | do_bundle_initramfs[dirs] = "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 301 | |
| 302 | python do_devshell_prepend () { |
| 303 | os.environ["LDFLAGS"] = '' |
| 304 | } |
| 305 | |
| 306 | addtask bundle_initramfs after do_install before do_deploy |
| 307 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 308 | get_cc_option () { |
| 309 | # Check if KERNEL_CC supports the option "file-prefix-map". |
| 310 | # This option allows us to build images with __FILE__ values that do not |
| 311 | # contain the host build path. |
| 312 | if ${KERNEL_CC} -Q --help=joined | grep -q "\-ffile-prefix-map=<old=new>"; then |
| 313 | echo "-ffile-prefix-map=${S}=/kernel-source/" |
| 314 | fi |
| 315 | } |
| 316 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 317 | kernel_do_compile() { |
| 318 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 319 | if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 320 | # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not |
| 321 | # be set.... |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 322 | if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 323 | # The source directory is not necessarily a git repository, so we |
| 324 | # specify the git-dir to ensure that git does not query a |
| 325 | # repository in any parent directory. |
| 326 | SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 327 | fi |
| 328 | |
| 329 | ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` |
| 330 | export KBUILD_BUILD_TIMESTAMP="$ts" |
| 331 | export KCONFIG_NOTIMESTAMP=1 |
| 332 | bbnote "KBUILD_BUILD_TIMESTAMP: $ts" |
| 333 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 334 | # The $use_alternate_initrd is only set from |
| 335 | # do_bundle_initramfs() This variable is specifically for the |
| 336 | # case where we are making a second pass at the kernel |
| 337 | # compilation and we want to force the kernel build to use a |
| 338 | # different initramfs image. The way to do that in the kernel |
| 339 | # is to specify: |
| 340 | # make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio |
| 341 | if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then |
| 342 | # The old style way of copying an prebuilt image and building it |
| 343 | # is turned on via INTIRAMFS_TASK != "" |
| 344 | copy_initramfs |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 345 | use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 346 | fi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 347 | cc_extra=$(get_cc_option) |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 348 | for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 349 | oe_runmake ${typeformake} CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 350 | done |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 351 | # vmlinux.gz is not built by kernel |
| 352 | if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then |
| 353 | mkdir -p "${KERNEL_OUTPUT_DIR}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 354 | gzip -9cn < ${B}/vmlinux > "${KERNEL_OUTPUT_DIR}/vmlinux.gz" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 355 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | do_compile_kernelmodules() { |
| 359 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 360 | if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then |
| 361 | # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not |
| 362 | # be set.... |
| 363 | if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then |
| 364 | # The source directory is not necessarily a git repository, so we |
| 365 | # specify the git-dir to ensure that git does not query a |
| 366 | # repository in any parent directory. |
| 367 | SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` |
| 368 | fi |
| 369 | |
| 370 | ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` |
| 371 | export KBUILD_BUILD_TIMESTAMP="$ts" |
| 372 | export KCONFIG_NOTIMESTAMP=1 |
| 373 | bbnote "KBUILD_BUILD_TIMESTAMP: $ts" |
| 374 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 375 | if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 376 | cc_extra=$(get_cc_option) |
| 377 | oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 378 | |
| 379 | # Module.symvers gets updated during the |
| 380 | # building of the kernel modules. We need to |
| 381 | # update this in the shared workdir since some |
| 382 | # external kernel modules has a dependency on |
| 383 | # other kernel modules and will look at this |
| 384 | # file to do symbol lookups |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 385 | cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame^] | 386 | # 5.10+ kernels have module.lds that we need to copy for external module builds |
| 387 | if [ -e "${B}/scripts/module.lds" ]; then |
| 388 | install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds |
| 389 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 390 | else |
| 391 | bbnote "no modules to compile" |
| 392 | fi |
| 393 | } |
| 394 | addtask compile_kernelmodules after do_compile before do_strip |
| 395 | |
| 396 | kernel_do_install() { |
| 397 | # |
| 398 | # First install the modules |
| 399 | # |
| 400 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE |
| 401 | if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 402 | oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install |
| 403 | rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" |
| 404 | rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 405 | # If the kernel/ directory is empty remove it to prevent QA issues |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 406 | rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 407 | else |
| 408 | bbnote "no modules to install" |
| 409 | fi |
| 410 | |
| 411 | # |
| 412 | # Install various kernel output (zImage, map file, config, module support files) |
| 413 | # |
| 414 | install -d ${D}/${KERNEL_IMAGEDEST} |
| 415 | install -d ${D}/boot |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 416 | for imageType in ${KERNEL_IMAGETYPES} ; do |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 417 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType ${D}/${KERNEL_IMAGEDEST}/$imageType-${KERNEL_VERSION} |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 418 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 419 | install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} |
| 420 | install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} |
| 421 | install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} |
| 422 | [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} |
| 423 | install -d ${D}${sysconfdir}/modules-load.d |
| 424 | install -d ${D}${sysconfdir}/modprobe.d |
| 425 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 426 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 427 | # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile |
| 428 | do_kernel_version_sanity_check() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 429 | if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then |
| 430 | exit 0 |
| 431 | fi |
| 432 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 433 | # The Makefile determines the kernel version shown at runtime |
| 434 | # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile |
| 435 | VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) |
| 436 | PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//) |
| 437 | SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//) |
| 438 | EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//) |
| 439 | |
| 440 | # Build a string for regex and a plain version string |
| 441 | reg="^${VERSION}\.${PATCHLEVEL}" |
| 442 | vers="${VERSION}.${PATCHLEVEL}" |
| 443 | if [ -n "${SUBLEVEL}" ]; then |
| 444 | # Ignoring a SUBLEVEL of zero is fine |
| 445 | if [ "${SUBLEVEL}" = "0" ]; then |
| 446 | reg="${reg}(\.${SUBLEVEL})?" |
| 447 | else |
| 448 | reg="${reg}\.${SUBLEVEL}" |
| 449 | vers="${vers}.${SUBLEVEL}" |
| 450 | fi |
| 451 | fi |
| 452 | vers="${vers}${EXTRAVERSION}" |
| 453 | reg="${reg}${EXTRAVERSION}" |
| 454 | |
| 455 | if [ -z `echo ${PV} | grep -E "${reg}"` ]; then |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 456 | bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe." |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 457 | fi |
| 458 | exit 0 |
| 459 | } |
| 460 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 461 | addtask shared_workdir after do_compile before do_compile_kernelmodules |
| 462 | addtask shared_workdir_setscene |
| 463 | |
| 464 | do_shared_workdir_setscene () { |
| 465 | exit 1 |
| 466 | } |
| 467 | |
| 468 | emit_depmod_pkgdata() { |
| 469 | # Stash data for depmod |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 470 | install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/ |
| 471 | echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion |
| 472 | cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | PACKAGEFUNCS += "emit_depmod_pkgdata" |
| 476 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 477 | do_shared_workdir[cleandirs] += " ${STAGING_KERNEL_BUILDDIR}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 478 | do_shared_workdir () { |
| 479 | cd ${B} |
| 480 | |
| 481 | kerneldir=${STAGING_KERNEL_BUILDDIR} |
| 482 | install -d $kerneldir |
| 483 | |
| 484 | # |
| 485 | # Store the kernel version in sysroots for module-base.bbclass |
| 486 | # |
| 487 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 488 | echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 489 | |
| 490 | # Copy files required for module builds |
| 491 | cp System.map $kerneldir/System.map-${KERNEL_VERSION} |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 492 | [ -e Module.symvers ] && cp Module.symvers $kerneldir/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 493 | cp .config $kerneldir/ |
| 494 | mkdir -p $kerneldir/include/config |
| 495 | cp include/config/kernel.release $kerneldir/include/config/kernel.release |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 496 | if [ -e certs/signing_key.x509 ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 497 | # The signing_key.* files are stored in the certs/ dir in |
| 498 | # newer Linux kernels |
| 499 | mkdir -p $kerneldir/certs |
| 500 | cp certs/signing_key.* $kerneldir/certs/ |
| 501 | elif [ -e signing_key.priv ]; then |
| 502 | cp signing_key.* $kerneldir/ |
| 503 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 504 | |
| 505 | # We can also copy over all the generated files and avoid special cases |
| 506 | # like version.h, but we've opted to keep this small until file creep starts |
| 507 | # to happen |
| 508 | if [ -e include/linux/version.h ]; then |
| 509 | mkdir -p $kerneldir/include/linux |
| 510 | cp include/linux/version.h $kerneldir/include/linux/version.h |
| 511 | fi |
| 512 | |
| 513 | # As of Linux kernel version 3.0.1, the clean target removes |
| 514 | # arch/powerpc/lib/crtsavres.o which is present in |
| 515 | # KBUILD_LDFLAGS_MODULE, making it required to build external modules. |
| 516 | if [ ${ARCH} = "powerpc" ]; then |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 517 | if [ -e arch/powerpc/lib/crtsavres.o ]; then |
| 518 | mkdir -p $kerneldir/arch/powerpc/lib/ |
| 519 | cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o |
| 520 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 521 | fi |
| 522 | |
| 523 | if [ -d include/generated ]; then |
| 524 | mkdir -p $kerneldir/include/generated/ |
| 525 | cp -fR include/generated/* $kerneldir/include/generated/ |
| 526 | fi |
| 527 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 528 | if [ -d arch/${ARCH}/include/generated ]; then |
| 529 | mkdir -p $kerneldir/arch/${ARCH}/include/generated/ |
| 530 | cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 531 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 532 | |
| 533 | if (grep -q -i -e '^CONFIG_UNWINDER_ORC=y$' $kerneldir/.config); then |
| 534 | # With CONFIG_UNWINDER_ORC (the default in 4.14), objtool is required for |
| 535 | # out-of-tree modules to be able to generate object files. |
| 536 | if [ -x tools/objtool/objtool ]; then |
| 537 | mkdir -p ${kerneldir}/tools/objtool |
| 538 | cp tools/objtool/objtool ${kerneldir}/tools/objtool/ |
| 539 | fi |
| 540 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware |
| 544 | sysroot_stage_all () { |
| 545 | : |
| 546 | } |
| 547 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 548 | KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} CC="${KERNEL_CC}" LD="${KERNEL_LD}" O=${B} olddefconfig || oe_runmake -C ${S} O=${B} CC="${KERNEL_CC}" LD="${KERNEL_LD}" oldnoconfig" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 549 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 550 | python check_oldest_kernel() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 551 | oldest_kernel = d.getVar('OLDEST_KERNEL') |
| 552 | kernel_version = d.getVar('KERNEL_VERSION') |
| 553 | tclibc = d.getVar('TCLIBC') |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 554 | if tclibc == 'glibc': |
| 555 | kernel_version = kernel_version.split('-', 1)[0] |
| 556 | if oldest_kernel and kernel_version: |
| 557 | if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 558 | bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN'), oldest_kernel, kernel_version, tclibc)) |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION" |
| 562 | do_configure[prefuncs] += "check_oldest_kernel" |
| 563 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 564 | kernel_do_configure() { |
| 565 | # fixes extra + in /lib/modules/2.6.37+ |
| 566 | # $ scripts/setlocalversion . => + |
| 567 | # $ make kernelversion => 2.6.37 |
| 568 | # $ make kernelrelease => 2.6.37+ |
| 569 | touch ${B}/.scmversion ${S}/.scmversion |
| 570 | |
| 571 | if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then |
| 572 | mv "${S}/.config" "${B}/.config" |
| 573 | fi |
| 574 | |
| 575 | # Copy defconfig to .config if .config does not exist. This allows |
| 576 | # recipes to manage the .config themselves in do_configure_prepend(). |
| 577 | if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then |
| 578 | cp "${WORKDIR}/defconfig" "${B}/.config" |
| 579 | fi |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 580 | |
| 581 | ${KERNEL_CONFIG_COMMAND} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | do_savedefconfig() { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 585 | bbplain "Saving defconfig to:\n${B}/defconfig" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 586 | oe_runmake -C ${B} savedefconfig |
| 587 | } |
| 588 | do_savedefconfig[nostamp] = "1" |
| 589 | addtask savedefconfig after do_configure |
| 590 | |
| 591 | inherit cml1 |
| 592 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame^] | 593 | KCONFIG_CONFIG_COMMAND_append = " LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 594 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 595 | EXPORT_FUNCTIONS do_compile do_install do_configure |
| 596 | |
| 597 | # kernel-base becomes kernel-${KERNEL_VERSION} |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 598 | # kernel-image becomes kernel-image-${KERNEL_VERSION} |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 599 | PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 600 | FILES_${PN} = "" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 601 | FILES_${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 602 | FILES_${KERNEL_PACKAGE_NAME}-image = "" |
| 603 | FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" |
| 604 | FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" |
| 605 | FILES_${KERNEL_PACKAGE_NAME}-modules = "" |
| 606 | RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 607 | # Allow machines to override this dependency if kernel image files are |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 608 | # not wanted in images as standard |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 609 | RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 610 | PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 611 | RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 612 | PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 613 | RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}" |
| 614 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1" |
| 615 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1" |
| 616 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1" |
| 617 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1" |
| 618 | DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 619 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 620 | pkg_postinst_${KERNEL_PACKAGE_NAME}-base () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 621 | if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then |
| 622 | mkdir -p $D/lib/modules/${KERNEL_VERSION} |
| 623 | fi |
| 624 | if [ -n "$D" ]; then |
| 625 | depmodwrapper -a -b $D ${KERNEL_VERSION} |
| 626 | else |
| 627 | depmod -a ${KERNEL_VERSION} |
| 628 | fi |
| 629 | } |
| 630 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 631 | PACKAGESPLITFUNCS_prepend = "split_kernel_packages " |
| 632 | |
| 633 | python split_kernel_packages () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 634 | do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 635 | } |
| 636 | |
| 637 | # Many scripts want to look in arch/$arch/boot for the bootable |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 638 | # image. This poses a problem for vmlinux and vmlinuz based |
| 639 | # booting. This task arranges to have vmlinux and vmlinuz appear |
| 640 | # in the normalized directory location. |
| 641 | do_kernel_link_images() { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 642 | if [ ! -d "${B}/arch/${ARCH}/boot" ]; then |
| 643 | mkdir ${B}/arch/${ARCH}/boot |
| 644 | fi |
| 645 | cd ${B}/arch/${ARCH}/boot |
| 646 | ln -sf ../../../vmlinux |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 647 | if [ -f ../../../vmlinuz ]; then |
| 648 | ln -sf ../../../vmlinuz |
| 649 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 650 | if [ -f ../../../vmlinuz.bin ]; then |
| 651 | ln -sf ../../../vmlinuz.bin |
| 652 | fi |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 653 | if [ -f ../../../vmlinux.64 ]; then |
| 654 | ln -sf ../../../vmlinux.64 |
| 655 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 656 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 657 | addtask kernel_link_images after do_compile before do_strip |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 658 | |
| 659 | do_strip() { |
| 660 | if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 661 | if ! (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux"); then |
| 662 | bbwarn "image type(s) will not be stripped (not supported): ${KERNEL_IMAGETYPES}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 663 | return |
| 664 | fi |
| 665 | |
| 666 | cd ${B} |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 667 | headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT_DIR}/vmlinux | \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 668 | grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \ |
| 669 | sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \ |
| 670 | gawk '{print $1}'` |
| 671 | |
| 672 | for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do { |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 673 | if ! (echo "$headers" | grep -q "^$str$"); then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 674 | bbwarn "Section not found: $str"; |
| 675 | fi |
| 676 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 677 | "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT_DIR}/vmlinux |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 678 | }; done |
| 679 | |
| 680 | bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \ |
| 681 | "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" |
| 682 | fi; |
| 683 | } |
| 684 | do_strip[dirs] = "${B}" |
| 685 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 686 | addtask strip before do_sizecheck after do_kernel_link_images |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 687 | |
| 688 | # Support checking the kernel size since some kernels need to reside in partitions |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 689 | # with a fixed length or there is a limit in transferring the kernel to memory. |
| 690 | # If more than one image type is enabled, warn on any that don't fit but only fail |
| 691 | # if none fit. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 692 | do_sizecheck() { |
| 693 | if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then |
| 694 | invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'` |
| 695 | if [ -n "$invalid" ]; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 696 | die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integer (The unit is Kbytes)" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 697 | fi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 698 | at_least_one_fits= |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 699 | for imageType in ${KERNEL_IMAGETYPES} ; do |
| 700 | size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$imageType | awk '{print $1}'` |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 701 | if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 702 | bbwarn "This kernel $imageType (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device." |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 703 | else |
| 704 | at_least_one_fits=y |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 705 | fi |
| 706 | done |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 707 | if [ -z "$at_least_one_fits" ]; then |
| 708 | die "All kernel images are too big for your device. Please reduce the size of the kernel by making more of it modular." |
| 709 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 710 | fi |
| 711 | } |
| 712 | do_sizecheck[dirs] = "${B}" |
| 713 | |
| 714 | addtask sizecheck before do_install after do_strip |
| 715 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 716 | inherit kernel-artifact-names |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 717 | |
| 718 | kernel_do_deploy() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 719 | deployDir="${DEPLOYDIR}" |
| 720 | if [ -n "${KERNEL_DEPLOYSUBDIR}" ]; then |
| 721 | deployDir="${DEPLOYDIR}/${KERNEL_DEPLOYSUBDIR}" |
| 722 | mkdir "$deployDir" |
| 723 | fi |
| 724 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 725 | for imageType in ${KERNEL_IMAGETYPES} ; do |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 726 | baseName=$imageType-${KERNEL_IMAGE_NAME} |
| 727 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType $deployDir/$baseName.bin |
| 728 | ln -sf $baseName.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}.bin |
| 729 | ln -sf $baseName.bin $deployDir/$imageType |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 730 | done |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 731 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 732 | if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 733 | mkdir -p ${D}${root_prefix}/lib |
Andrew Geissler | c182c62 | 2020-05-15 14:13:32 -0500 | [diff] [blame] | 734 | if [ -n "${SOURCE_DATE_EPOCH}" ]; then |
| 735 | TAR_ARGS="--sort=name --clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}" |
| 736 | else |
| 737 | TAR_ARGS="" |
| 738 | fi |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 739 | TAR_ARGS="$TAR_ARGS --owner=0 --group=0" |
Andrew Geissler | c182c62 | 2020-05-15 14:13:32 -0500 | [diff] [blame] | 740 | tar $TAR_ARGS -cv -C ${D}${root_prefix} lib | gzip -9n > $deployDir/modules-${MODULE_TARBALL_NAME}.tgz |
| 741 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 742 | ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 743 | fi |
| 744 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 745 | if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then |
| 746 | for imageType in ${KERNEL_IMAGETYPES} ; do |
Brad Bishop | 977dc1a | 2019-02-06 16:01:43 -0500 | [diff] [blame] | 747 | if [ "$imageType" = "fitImage" ] ; then |
| 748 | continue |
| 749 | fi |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 750 | initramfsBaseName=$imageType-${INITRAMFS_NAME} |
| 751 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.initramfs $deployDir/$initramfsBaseName.bin |
| 752 | ln -sf $initramfsBaseName.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}.bin |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 753 | done |
| 754 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 755 | } |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 756 | |
| 757 | # We deploy to filenames that include PKGV and PKGR, read the saved data to |
| 758 | # ensure we get the right values for both |
| 759 | do_deploy[prefuncs] += "read_subpackage_metadata" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 760 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 761 | addtask deploy after do_populate_sysroot do_packagedata |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 762 | |
| 763 | EXPORT_FUNCTIONS do_deploy |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 764 | |
| 765 | # Add using Device Tree support |
| 766 | inherit kernel-devicetree |