Skip to content

Commit

Permalink
meta-xilinx-standalone: Rework embeddedsw integration
Browse files Browse the repository at this point in the history
Introduce a new embeddedsw-source recipe that is a single point for unpack,
and patch of the sources.  This will allow someone to universally patch
(via a bbappend or similar) the esw sources.

As part of this work, we transfered the various patches for fsbl, pmu, plm,
and psm to the universe source recipe.

Most of this is transparent to any recipe using xlnx-embeddedsw.  The class
automaticaly detects if the recipe is a user our the special embeddedsw-source
recipe and enables the correct behavior.

Since the esw sources expect the S and B to be the same, the cmake objects
get written into S, we are not able to follow the gcc-source example.
Instead recipes that use the xlnx-embeddedsw class will hard link or copy
the source files to their working directory.  This avoid the penalty for
fetch, unpack and patch.  Note these recipes may also add their own
SRC_URI which WILL be processed as normal.  This is often used to
introduce special tcl scripts.  See the do_copy_shared_src task injected
by the xlnx-embeddedsw.bbclass for technical details.

Additionally, correct some of the existing patch Upstream-Status entries
to conform to current YP guidelines.

For 2024.2 introduce a special Xil_Assert fix for the current toolchain
which is more strict on type conversion..  See the patch itself for
more details.

Signed-off-by: Mark Hatle <[email protected]>
  • Loading branch information
mhatle committed Nov 24, 2024
1 parent fc65196 commit 1d98f89
Show file tree
Hide file tree
Showing 48 changed files with 169 additions and 158 deletions.
2 changes: 0 additions & 2 deletions meta-xilinx-standalone-sdt/classes-recipe/esw.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ OECMAKE_ARGS:remove = "-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON"

SRCREV_FORMAT = "src_decouple"

S = "${UNPACKDIR}/git"
B = "${WORKDIR}/build"
OECMAKE_SOURCEPATH = "${S}/${ESW_COMPONENT_SRC}"
LICFILENAME = "license.txt"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Can't depend on esw since this is needed for setup!
inherit xlnx-embeddedsw

S = "${UNPACKDIR}/git"
B = "${WORKDIR}/build"

INHIBIT_DEFAULT_DEPS = "1"

# Installing this recipe should install the lopper tools and such
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Can't depend on esw since this is needed for setup!
inherit xlnx-embeddedsw

S = "${UNPACKDIR}/git"
B = "${WORKDIR}/build"

INHIBIT_DEFAULT_DEPS = "1"

# Installing this recipe should install the lopper tools and such
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ ESW_COMPONENT_NAME = "libxilstandalone.a"

DEPENDS += "libgloss"

S = "${B}"

do_configure:prepend() {
# This script should also not rely on relative paths and such
(
cd ${S}
lopper ${DTS_FILE} -- baremetal_bspconfig_xlnx ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC}
install -m 0755 MemConfig.cmake ${S}/${ESW_COMPONENT_SRC}/
install -m 0755 *.c ${S}/${ESW_COMPONENT_SRC}
lopper ${DTS_FILE} -- bmcmake_metadata_xlnx ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S}
install -m 0755 StandaloneExample.cmake ${S}/${ESW_COMPONENT_SRC}/common/
LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetal_xparameters_xlnx.py ${ESW_MACHINE} ${S}
install -m 0755 xparameters.h ${S}/${ESW_COMPONENT_SRC}/common/
)
lopper ${DTS_FILE} -- baremetal_bspconfig_xlnx ${ESW_MACHINE} ${B}/${ESW_COMPONENT_SRC}
install -m 0755 MemConfig.cmake ${B}/${ESW_COMPONENT_SRC}/
install -m 0755 *.c ${B}/${ESW_COMPONENT_SRC}
lopper ${DTS_FILE} -- bmcmake_metadata_xlnx ${ESW_MACHINE} ${B}/${ESW_COMPONENT_SRC} hwcmake_metadata ${B}
install -m 0755 StandaloneExample.cmake ${B}/${ESW_COMPONENT_SRC}/common/
LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetal_xparameters_xlnx.py ${ESW_MACHINE} ${B}
install -m 0755 xparameters.h ${B}/${ESW_COMPONENT_SRC}/common/

}
22 changes: 21 additions & 1 deletion meta-xilinx-standalone/classes/xlnx-embeddedsw.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ LIC_FILES_CHKSUM[xlnx_rel_v2024.1] = '0dcabd3719e5ac33f7c03f0d77d473f2'
LIC_FILES_CHKSUM[xlnx_rel_v2024.2] = '689662801a76c14d0cb57ae169cbec7c'
LIC_FILES_CHKSUM ??= "file://license.txt;md5=${@d.getVarFlag('LIC_FILES_CHKSUM', d.getVar('BRANCH')) or '0'}"

SRC_URI = "${EMBEDDEDSW_SRCURI}"
PV .= "+git"

python() {
Expand All @@ -47,3 +46,24 @@ python() {
except:
raise bb.parse.SkipRecipe('BB_NO_NETWORK is enabled, can not fetch SRCREV (%s)' % d.getVar('SRCREV'))
}

SHARED_S = "${TMPDIR}/work-shared/embeddedsw-${PV}-${PR}/source/git"
S = "${WORKDIR}/source"
B = "${WORKDIR}/build"

ERROR_QA:remove = "buildpaths"

# The following is for recipes that use the common sources
python do_copy_shared_src() {
src = d.getVar('SHARED_S')
dest = d.getVar('S')
if src != dest:
oe.path.copyhardlinktree(src, dest)
}

python() {
if d.getVar('BPN') != "embeddedsw-source":
bb.build.addtask('do_copy_shared_src', 'do_configure do_populate_lic do_deploy_source_date_epoch', 'do_patch', d)

d.appendVarFlag('do_copy_shared_src', 'depends', ' embeddedsw-source-${PV}:do_patch')
}
1 change: 0 additions & 1 deletion meta-xilinx-standalone/conf/distro/xilinx-standalone.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ DISTRO_VERSION = "1.0"
TARGET_VENDOR = "-xilinx"

TCLIBC = "newlib"
TCLIBCAPPEND =""

# Change SDK name
SDK_VERSION = "xilinx-standalone"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
deltask do_configure
deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
RM_WORK_EXCLUDE += "${PN}"

inherit xlnx-embeddedsw nopackages

COMPATIBLE_HOST = ".*"
COMPATIBLE_MACHINE = ".*"

PN = "embeddedsw-source-${PV}"
WORKDIR = "${TMPDIR}/work-shared/embeddedsw-${PV}-${PR}"
SSTATE_SWSPEC = "sstate:embeddedsw::${PV}:${PR}::${SSTATE_VERSION}:"

STAMP = "${STAMPS_DIR}/work-shared/embeddedsw-${PV}-${PR}"
STAMPCLEAN = "${STAMPS_DIR}/work-shared/embeddedsw-${PV}-*"

INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = ""
PACKAGES = ""
TARGET_ARCH = "allarch"
TARGET_AS_ARCH = "none"
TARGET_CC_ARCH = "none"
TARGET_LD_ARCH = "none"
TARGET_OS = "linux"
baselib = "lib"
PACKAGE_ARCH = "all"

UNPACKDIR = "${WORKDIR}/source"
S = "${SHARED_S}"
B = "${WORKDIR}/build"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require recipes-bsp/embeddedsw/embeddedsw-source.inc


BPN = "embeddedsw-source"
EXCLUDE_FROM_WORLD = "1"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI = " \
${EMBEDDEDSW_SRCURI} \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"

# file://fix-xil-assert-filename.patch \
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require recipes-bsp/embeddedsw/embeddedsw-source.inc


BPN = "embeddedsw-source"
EXCLUDE_FROM_WORLD = "1"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI = " \
${EMBEDDEDSW_SRCURI} \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"

# file://fix-xil-assert-filename.patch \
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require recipes-bsp/embeddedsw/embeddedsw-source.inc


BPN = "embeddedsw-source"
EXCLUDE_FROM_WORLD = "1"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI = " \
${EMBEDDEDSW_SRCURI} \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"

# file://fix-xil-assert-filename.patch \
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require recipes-bsp/embeddedsw/embeddedsw-source.inc


BPN = "embeddedsw-source"
EXCLUDE_FROM_WORLD = "1"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI = " \
${EMBEDDEDSW_SRCURI} \
file://fix-xil-assert-filename.patch \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ additional variables that may not be appropriate to do on the regular
command line build version. This patch preserves the default while
allowing it to be overriden as necessary.

Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
lib/sw_apps/versal_plm/misc/versal/Makefile | 6 ++++--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent makefile from calling copy_bsp.sh
If we call copy_bsp.sh we will undo any manual compliation steps we
have already done. Avoid this.

YP integration specific
Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ additional variables that may not be appropriate to do on the regular
command line build version. This patch preserves the default while
allowing it to be overriden as necessary.

Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
lib/sw_apps/versal_plm/misc/versal/Makefile | 6 ++++--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent makefile from calling copy_bsp.sh
If we call copy_bsp.sh we will undo any manual compliation steps we
have already done. Avoid this.

YP integration specific
Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ additional variables that may not be appropriate to do on the regular
command line build version. This patch preserves the default while
allowing it to be overriden as necessary.

Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
lib/sw_apps/versal_plm/misc/versal/Makefile | 6 ++++--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent makefile from calling copy_bsp.sh
If we call copy_bsp.sh we will undo any manual compliation steps we
have already done. Avoid this.

YP integration specific
Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ additional variables that may not be appropriate to do on the regular
command line build version. This patch preserves the default while
allowing it to be overriden as necessary.

Upstream-Status: Pending

Signed-off-by: Mark Hatle <[email protected]>
---
lib/sw_apps/versal_plm/misc/versal/Makefile | 6 ++++--
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Fix __FILENAME__ definition

This fixes the error:

| <command-line>: error: passing argument 1 of 'Xil_Assert' makes pointer from integer without a cast [-Wint-conversion]
| .../work-shared/embeddedsw-2024.2+git-r0/source/git/lib/bsp/standalone/src/common/xil_assert.h:123:20: note: in expansion of macro '__FILENAME__'
| 123 | Xil_Assert(__FILENAME__, __LINE__); \
| | ^~~~~~~~~~~~

Upstream-Status: Pending

Signed-off-by: Mark Hatle <[email protected]>

diff --git a/cmake/Findcommon.cmake b/cmake/Findcommon.cmake
index c856d408fb..acac2e8fcc 100644
--- a/cmake/Findcommon.cmake
+++ b/cmake/Findcommon.cmake
@@ -11,7 +11,7 @@ endif()
if("${CMAKE_HOST_NAME}" STREQUAL "Linux")
add_compile_options("-D__FILENAME__=\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"")
else()
- add_compile_options("-D__FILENAME__='__FILE__'")
+ add_compile_options("-D__FILENAME__=__FILE__")
endif()
set (CMAKE_INSTALL_LIBDIR "lib")
function (collector_create name base)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent makefile from calling copy_bsp.sh
If we call copy_bsp.sh we will undo any manual compliation steps we
have already done. Avoid this.

YP integration specific
Upstream-Status: Inappropriate [YP integration specific]

Signed-off-by: Mark Hatle <[email protected]>
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Upstream-Status: Pending

Index: git/lib/sw_apps/zynqmp_fsbl/misc/makefile
===================================================================
--- git.orig/lib/sw_apps/zynqmp_fsbl/misc/makefile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ COMPATIBLE_MACHINE:zynqmp = ".*"

PACKAGE_ARCH = "${MACHINE_ARCH}"

S = "${UNPACKDIR}/git"

# This is the default in most BSPs. A MACHINE.conf can override this!
FSBL_IMAGE_NAME ??= "fsbl-${MACHINE}"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
SKIP_MSG = ""
SKIP_MSG:zynq = "Generic support for zynq is not available"
SKIP_RECIPE[fsbl-firmware] = "${SKIP_MSG}"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
"
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
SKIP_MSG = ""
SKIP_MSG:zynq = "Generic support for zynq is not available"
SKIP_RECIPE[fsbl-firmware] = "${SKIP_MSG}"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
"
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
SKIP_MSG = ""
SKIP_MSG:zynq = "Generic support for zynq is not available"
SKIP_RECIPE[fsbl-firmware] = "${SKIP_MSG}"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
"
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
SKIP_MSG = ""
SKIP_MSG:zynq = "Generic support for zynq is not available"
SKIP_RECIPE[fsbl-firmware] = "${SKIP_MSG}"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://fsbl-fixups.patch \
"
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ COMPATIBLE_MACHINE:versal-net = ".*"

PACKAGE_ARCH = "${MACHINE_ARCH}"

S = "${UNPACKDIR}/git"

# This is the default in most BSPs. A MACHINE.conf can override this!
PLM_IMAGE_NAME ??= "plm-${MACHINE}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ B = "${S}/lib/sw_apps/versal_plm/src/${SOC_DIR}"

BSP_DIR ?= "${B}/../../misc/versal_plm_bsp"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"

EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects"

do_configure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ B = "${S}/lib/sw_apps/versal_plm/src/${SOC_DIR}"

BSP_DIR ?= "${B}/../../misc/versal_plm_bsp"

FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/${PV}:${FILE_DIRNAME}/embeddedsw"

SRC_URI += " \
file://makefile-skip-copy_bsp.sh.patch \
file://0001-versal_fw-Fixup-core-makefiles.patch \
"

EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects"

do_configure() {
Expand Down
Loading

0 comments on commit 1d98f89

Please sign in to comment.