On 27.01.25 20:06, Khem Raj wrote:
> On Mon, Jan 27, 2025 at 7:40 AM Enrico Jörns via
> lists.openembedded.org <[email protected]>
> wrote:
>>
>> Changes:
>>
>> * Added LLVM/Clang support for the sandbox architecture.
>> * Enabled command execution from the sandbox command line.
>> * Improved TFTP with dentry caching and default-disabled window size.
>> * Introduced hardening features: register zeroing, stack variable
>>   initialization, and malloc buffer zeroing.
>> * Enhanced AM625 support with network support, watchdog driver, and
>>   bootsource detection.
>>
>> Changelog: 
>> https://lore.barebox.org/barebox/[email protected]/T/#u
>>
>> Also adds a new patch created for fixing barebox-tools build with musl.
>>
>> Signed-off-by: Enrico Jörns <[email protected]>
>> ---
>> v1 -> v2:
>>   * added barebox patch file to fix musl build (by Ahmad Fatoum)
>>   * minor wording change in 'Changes'
>>   [* added patch to remove old barebox .patch file]
>>
>>  meta/recipes-bsp/barebox/barebox-common.inc   |  6 +-
>>  ...linux-types.h-define-loff_t-for-musl.patch | 57 +++++++++++++++++++
>>  2 files changed, 61 insertions(+), 2 deletions(-)
>>  create mode 100644 
>> meta/recipes-bsp/barebox/files/0001-scripts-include-linux-types.h-define-loff_t-for-musl.patch
>>
>> diff --git a/meta/recipes-bsp/barebox/barebox-common.inc 
>> b/meta/recipes-bsp/barebox/barebox-common.inc
>> index fce3b825ae..13f1d81289 100644
>> --- a/meta/recipes-bsp/barebox/barebox-common.inc
>> +++ b/meta/recipes-bsp/barebox/barebox-common.inc
>> @@ -3,6 +3,8 @@ SECTION = "bootloaders"
>>
>>  LIC_FILES_CHKSUM = "file://COPYING;md5=f5125d13e000b9ca1f0d3364286c4192"
>>
>> -PV = "2024.12.0"
>> +PV = "2025.01.0"
>>  SRC_URI = "https://barebox.org/download/barebox-${PV}.tar.bz2";
>> -SRC_URI[sha256sum] = 
>> "717a2416b37942f584b0bb2eb61ccbf85dc0f1a5c841318f47cd6967b9c4dcab"
>> +SRC_URI[sha256sum] = 
>> "288a838e6fe8897ea46dabd112e42287177353c88a7d442cefc8be8d1a85f5b5"
>> +
>> +SRC_URI += 
>> "file://0001-scripts-include-linux-types.h-define-loff_t-for-musl.patch"
>> diff --git 
>> a/meta/recipes-bsp/barebox/files/0001-scripts-include-linux-types.h-define-loff_t-for-musl.patch
>>  
>> b/meta/recipes-bsp/barebox/files/0001-scripts-include-linux-types.h-define-loff_t-for-musl.patch
>> new file mode 100644
>> index 0000000000..bce9d2ebf5
>> --- /dev/null
>> +++ 
>> b/meta/recipes-bsp/barebox/files/0001-scripts-include-linux-types.h-define-loff_t-for-musl.patch
>> @@ -0,0 +1,57 @@
>> +From e46f4add079bbae4ac0926ed113e393786e89bef Mon Sep 17 00:00:00 2001
>> +From: Ahmad Fatoum <[email protected]>
>> +Date: Mon, 27 Jan 2025 15:31:46 +0100
>> +Subject: [PATCH] scripts: include/linux/types.h: define loff_t for musl
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +musl doesn't define loff_t, but glibc does and both of them define
>> +__linux__. This leads to build errors with musl when code makes it into
>> +scripts/ that uses loff_t. This was already fixed once e.g. in commit
>> +c0d065fb0aa0 ("scripts: bareboximd: remove usage of loff_t").
>> +
>> +Instead of playing whack-a-mole in future, let's just define loff_t
>> +for non-glibc builds of scripts/.
>> +
> 
> loff_t is not posix defined but it is available in musl.
> you need to add -D_GNU_SOURCE to the compiler cmdline.

I somehow thought _GNU_SOURCE was already being set globally, but you're
right: Not all files were setting it.

I just Cc'd you on a patch[1] to define it on the compiler command line instead.

[1]: 
https://lore.kernel.org/barebox/[email protected]/T/#u

Thanks,
Ahmad

> 
>> +Also, make sure <linux/types.h> is always included for scripts/common.h,
>> +which is the only header currently making use of loff_t.
>> +
>> +Fixes: 5171f4d0696f ("scripts: implement read_fd and pread_full for tools")
>> +Upstream-Status: Submitted 
>> [https://lore.barebox.org/barebox/[email protected]/T/#u]
>> +Reported-by: Enrico Jörns <[email protected]>
>> +Signed-off-by: Ahmad Fatoum <[email protected]>
>> +---
>> + scripts/common.h              | 2 ++
>> + scripts/include/linux/types.h | 2 +-
>> + 2 files changed, 3 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/scripts/common.h b/scripts/common.h
>> +index a0d16606b5..21ec576a5b 100644
>> +--- a/scripts/common.h
>> ++++ b/scripts/common.h
>> +@@ -1,6 +1,8 @@
>> + #ifndef __COMMON_H
>> + #define __COMMON_H
>> +
>> ++#include <linux/types.h>
>> ++
>> + int read_file_2(const char *filename, size_t *size, void **outbuf, size_t 
>> max_size);
>> + void *read_file(const char *filename, size_t *size);
>> + void *read_fd(int fd, size_t *out_size);
>> +diff --git a/scripts/include/linux/types.h b/scripts/include/linux/types.h
>> +index e81d7e8101..02a330cd4e 100644
>> +--- a/scripts/include/linux/types.h
>> ++++ b/scripts/include/linux/types.h
>> +@@ -14,7 +14,7 @@ typedef int16_t __s16;
>> + typedef uint8_t __u8;
>> + typedef int8_t __s8;
>> +
>> +-#ifndef __linux__
>> ++#ifndef __GLIBC__
>> + typedef long long loff_t;
>> + #endif
>> +
>> +--
>> +2.39.5
>> +
>> --
>> 2.39.5
>>
>>
>> 
>>
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210308): 
https://lists.openembedded.org/g/openembedded-core/message/210308
Mute This Topic: https://lists.openembedded.org/mt/110840770/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to