Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ziegler <br015@umbiko.net>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	Pierre Floury <pierre.floury@gmail.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	buildroot <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH v4 3/4] package/linux-tools: add rtla
Date: Tue, 24 Oct 2023 06:27:00 +0000	[thread overview]
Message-ID: <79d4b2171690584e6cf0358b8a05ab51@umbiko.net> (raw)
In-Reply-To: <f22e9a6b-0229-4919-ad70-8eb60ab1fe65@benettiengineering.com>

Hi Giulio, *

[remove everything not related to linux-tool-rtla.mk.in]

On 2023-10-19 13:16, Giulio Benetti wrote:
> Hi Andreas,
> 
> thank you for reviewing,
> 
> On 19/10/23 14:32, Andreas Ziegler wrote:
>> Hi Giulio, *
>> 
>> On 2023-10-14 23:57, Giulio Benetti wrote:

[cut]

>>> diff --git a/package/linux-tools/linux-tool-rtla.mk.in 
>>> b/package/linux-tools/linux-tool-rtla.mk.in
>>> new file mode 100644
>>> index 0000000000..04b98f443d
>>> --- /dev/null
>>> +++ b/package/linux-tools/linux-tool-rtla.mk.in
>>> @@ -0,0 +1,40 @@
>>> +################################################################################
>>> +#
>>> +# rtla
>>> +#
>>> +################################################################################
>>> +
>>> +LINUX_TOOLS += rtla
>>> +
>> 
>> Linux kernel needs FTRACE, TIMERLAT_TRACER, HIST_TRIGGERS for RTLA to 
>> work:
>> 
>> ifeq ($(BR2_PACKAGE_LINUX_TOOLS_RTLA),y)
>> define RTLA_LINUX_CONFIG_FIXUPS
>>      $(call KCONFIG_ENABLE_OPT,CONFIG_FTRACE)
>>      $(call KCONFIG_ENABLE_OPT,CONFIG_TIMERLAT_TRACER)
>>      $(call KCONFIG_ENABLE_OPT,CONFIG_HIST_TRIGGERS)
>> endef
>> endif
> 
> Nice catch! I didn't think about it
> 
>>> +RTLA_DEPENDENCIES = host-pkgconf libtracefs
>>> +RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
>>> +    CC=$(TARGET_CC) \
>> 
>> libtrace{event,fs} are compiled with _GNU_SOURCE enabled; in the rtla 
>> build the symbol may be missing, depending on the C library used. 
>> Define _GNU_SOURCE unconditionally to prevent build failures with 
>> musl:
>> 
>>      EXTRA_CFLAGS="-D_GNU_SOURCE" \
> 
> I haven't found such build failure with musl, do you have a Buildroot 
> defconfig that exhibits this bug?
> 

I put together a defconfig, based on configs/raspberrypi4_64_defconfig; 
changes are, roughly:

   C-library musl
   binutils 2.41
   gcc 13

   PIC/PIE not set
   SSP none
   RELRO none

   kernel version 6.6-rc6
   kernel patch 
https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.6/patch-6.6-rc6-rt9.patch.xz
   no overlay support
   linux kernel tools -> rtla

You will run into another error first, because libtracefs is missing 
host dependencies.

 From src/meson.build:
   flex = find_program('flex', required: true)
   bison = find_program('bison', required: true)

Modified package/libtracefs/libtracefs.mk:
   LIBTRACEFS_DEPENDENCIES = host-bison host-flex host-pkgconf 
libtraceevent

BR2_aarch64=y
BR2_cortex_a72=y
BR2_ARM_FPU_VFPV4=y
BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_BINUTILS_VERSION_2_41_X=y
BR2_GCC_VERSION_13_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
# BR2_PIC_PIE is not set
BR2_SSP_NONE=y
BR2_RELRO_NONE=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6-rc6"
BR2_LINUX_KERNEL_PATCH="https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.6/patch-6.6-rc6-rt9.patch.xz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_LINUX_TOOLS_RTLA=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4-64/config_4_64bit.txt"
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

>>> +    LDFLAGS="$(TARGET_LDFLAGS)" \
>>> +    PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
>>> +
>> 
>> Build fails if BR2_TOOLCHAIN_BUILDROOT_USE_SSP is set to 'n', so 
>> introduce a workaround, similar to linux-tool-tmon.mk.in:
>> 
>> ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
>> define RTLA_DISABLE_STACK_PROTECTOR
>>      $(SED) 's/-fstack-protector.* //' 
>> $(LINUX_DIR)/tools/tracing/rtla/Makefile
>> endef
>> endif
> 
> Thank you, I will
> 
>>> +define RTLA_BUILD_CMDS
>>> +    $(Q)if ! grep install $(LINUX_DIR)/tools/tracing/rtla/Makefile 
>>> >/dev/null 2>&1 ; then \
>>> +        echo "Your kernel version is too old and does not implement 
>>> the rtla tool." ; \
>>> +        echo "At least kernel 5.19 must be used." ; \
>>> +        exit 1 ; \
>>> +    fi
>>> +
>> 
>>      $(RTLA_DISABLE_STACK_PROTECTOR)
> 
> Ok
> 
>>> +    $(TARGET_MAKE_ENV) \
>>> +    $(MAKE) $(RTLA_MAKE_OPTS) \
>>> +    -C $(LINUX_DIR)/tools/tracing rtla
>>> +endef
>>> +
>>> +# make rtla_install build and install by default documentation using 
>>> rst2man
>>> +# but it's not available in Buildroot and we don't want manual files 
>>> in target
>>> +# folder so let's simply install the resulting rtla binary and 
>>> create symlinks
>>> +# like Linux does in its tools/tracing/rtla/Makefile
>>> +define RTLA_INSTALL_TARGET_CMDS
>>> +    $(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla 
>>> $(TARGET_DIR)/usr/bin
>>> +    ln -sf rtla $(TARGET_DIR)/usr/bin/osnoise
>>> +    ln -sf rtla $(TARGET_DIR)/usr/bin/timerlat
>>> +
>>> +    # Check if hwnoise is provided or not
>>> +    if grep -q hwnoise $(LINUX_DIR)/tools/tracing/rtla/Makefile; 
>>> then \
>>> +        ln -sf rtla $(TARGET_DIR)/usr/bin/hwnoise ; \
>>> +    fi
>>> +endef
>>> -- 2.34.1
> 
> Thanks a lot for the accurate review!
> 
> Best regards
> --
> Giulio Benetti
> CEO&CTO@Benetti Engineering sas

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2023-10-24  6:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.9571.1697362018.35217.buildroot@buildroot.org>
2023-10-19 12:32 ` [Buildroot] [PATCH v4 3/4] package/linux-tools: add rtla Andreas Ziegler
2023-10-19 13:16   ` Giulio Benetti
2023-10-19 13:48     ` Andreas Ziegler
2023-10-24  6:27     ` Andreas Ziegler [this message]
2023-10-24 13:49       ` Giulio Benetti
2023-10-24 14:37         ` Andreas Ziegler
2023-10-14 21:57 [Buildroot] [PATCH v4 1/4] package/libtraceevent: new package Giulio Benetti
2023-10-14 21:57 ` [Buildroot] [PATCH v4 3/4] package/linux-tools: add rtla Giulio Benetti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79d4b2171690584e6cf0358b8a05ab51@umbiko.net \
    --to=br015@umbiko.net \
    --cc=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=pierre.floury@gmail.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox