blob: cb79069bcfb8485b2a9e7fd619aba9aa8d6bc0a6 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001SUMMARY = "Linux aarch64 boot wrapper with FDT support"
2LICENSE = "BSD-3-Clause"
3
4LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=bb63326febfb5fb909226c8e7ebcef5c"
5
6SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git;branch=master"
Andrew Geissler9347dd42023-03-03 12:38:41 -06007SRCREV = "d3b1a15d18542b2086e72bfdc3fc43f454772a3b"
8
9# boot-wrapper doesn't make releases
10UPSTREAM_CHECK_COMMITS = "1"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040011
12PV = "git${SRCPV}"
13
14S = "${WORKDIR}/git"
15
16inherit autotools deploy
17
18PACKAGE_ARCH = "${MACHINE_ARCH}"
19
20COMPATIBLE_MACHINE ?= "invalid"
21
22# Device tree to put in the image
23# by default use the standard kernel devicetree
24# This should be overwritten if the devicetree is not generated
25# by the kernel.
26# This should point to a file in the deploy image directory
27BOOT_WRAPPER_AARCH64_DEVICETREE ??= "${KERNEL_DEVICETREE}"
28
29# Kernel image to put in the image
30# This should point to a file in the deploy image directory
31BOOT_WRAPPER_AARCH64_KERNEL ??= "Image"
32
33# Kernel command line for the image
34BOOT_WRAPPER_AARCH64_CMDLINE ??= "rw"
35
36# Image generated by boot wrapper
37BOOT_WRAPPER_AARCH64_IMAGE ??= "linux-system.axf"
38
39DEPENDS += "virtual/kernel dtc-native"
40
41EXTRA_OECONF += "--with-kernel-dir=${WORKDIR}/kernel"
42EXTRA_OECONF += "--with-dtb=${WORKDIR}/kernel/dummy.dtb"
43EXTRA_OECONF += "--with-cmdline=\"\""
44EXTRA_OECONF += "--enable-psci --enable-gicv3"
45
46# unset LDFLAGS solves this error when compiling kernel modules:
47# aarch64-poky-linux-ld: unrecognized option '-Wl,-O1'
48EXTRA_OEMAKE += "'LDFLAGS= --gc-sections '"
49
50# Strip prefix if any
51REAL_DTB = "${@os.path.basename(d.getVar('BOOT_WRAPPER_AARCH64_DEVICETREE'))}"
52
53EXTRA_OEMAKE += "'KERNEL_DTB=${DEPLOY_DIR_IMAGE}/${REAL_DTB}'"
54EXTRA_OEMAKE += "'KERNEL_IMAGE=${DEPLOY_DIR_IMAGE}/${BOOT_WRAPPER_AARCH64_KERNEL}'"
55EXTRA_OEMAKE += "'CMDLINE=${BOOT_WRAPPER_AARCH64_CMDLINE}'"
56
57
58do_configure:prepend() {
59 # Create dummy files to make configure happy.
60 # We will pass the generated ones directly to make.
61 mkdir -p ${WORKDIR}/kernel/arch/arm64/boot
62 echo "dummy" > ${WORKDIR}/kernel/arch/arm64/boot/Image
63 echo "dummy" > ${WORKDIR}/kernel/dummy.dtb
64
65 # Generate configure
66 (cd ${S} && autoreconf -i || exit 1)
67}
68
69do_compile[noexec] = "1"
70do_install[noexec] = "1"
71
72# We need the kernel to create an image
73do_deploy[depends] += "virtual/kernel:do_deploy"
74
75do_deploy() {
76 if [ ! -f ${DEPLOY_DIR_IMAGE}/${REAL_DTB} ]; then
77 echo "ERROR: cannot find ${REAL_DTB} in ${DEPLOY_DIR_IMAGE}" >&2
78 echo "Please check your BOOT_WRAPPER_AARCH64_DEVICETREE settings" >&2
79 exit 1
80 fi
81
82 if [ ! -f ${DEPLOY_DIR_IMAGE}/${BOOT_WRAPPER_AARCH64_KERNEL} ]; then
83 echo "ERROR: cannot find ${BOOT_WRAPPER_AARCH64_KERNEL}" \
84 " in ${DEPLOY_DIR_IMAGE}" >&2
85 echo "Please check your BOOT_WRAPPER_AARCH64_KERNEL settings" >&2
86 exit 1
87 fi
88
89 oe_runmake clean
90 oe_runmake all
91
92 install -D -p -m 644 ${BOOT_WRAPPER_AARCH64_IMAGE} \
93 ${DEPLOYDIR}/linux-system.axf
94}
95addtask deploy before do_build after do_compile