Bug 2375150
| Summary: | u-boot tools build broken after recent termios changes | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Dan Horák <dan> |
| Component: | uboot-tools | Assignee: | Peter Robinson <pbrobinson> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | arjun, codonell, dan, dennis, dj, fberat, fmartine, fweimer, javierm, jean, jlaw, jordan, josmyers, mcermak, mcoufal, mfabian, nrevo, pbrobinson, pfrankli, pwhalen, sipoyare, skolosov, suraj.ghimire7 |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | ppc64le | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | --- | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2025-07-24 11:56:28 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1071880 | ||
|
Description
Dan Horák
2025-06-27 09:25:24 UTC
This looks like an attempt in uboot-tools to use the termios2 kernel interfaces with the old glibc headers. Quoting the uboot-tools header: /* * We need to use raw TCGETS2/TCSETS2 or TCGETS/TCSETS ioctls with the BOTHER * flag in struct termios2/termios, defined in Linux headers <asm/ioctls.h> * (included by <sys/ioctl.h>) and <asm/termbits.h>. Since these headers * conflict with glibc's header file <termios.h>, it is not possible to use * libc's termios functions and we need to reimplement them via ioctl() calls. * * An arbitrary baudrate is supported when the macro BOTHER is defined. The * baudrate value itself is then stored into the c_ospeed and c_ispeed members. * If ioctls TCGETS2/TCSETS2 are defined and supported then these fields are * present in struct termios2, otherwise these fields are present in struct * termios. * * Note that the Bnnn constants from <termios.h> need not be compatible with Bnnn * constants from <asm/termbits.h>. */ If the uboot-tools developers have suggestions how we can make the porting easier for them, maybe they can suggest that on libc-alpha? I'll reach out to upstream I've posted an RFC patch for u-boot: https://lists.denx.de/pipermail/u-boot/2025-June/593131.html The problem as I understand it is that the PowerPC architecture does not define a struct termios2 as is the case for other architectures. In https://elixir.bootlin.com/linux/v6.16-rc3/source/arch/powerpc/include/uapi/asm/termbits.h it says: #define NCCS 19 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ cc_t c_line; /* line discipline (== c_cc[19]) */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* For PowerPC the termios and ktermios are the same */ struct ktermios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ cc_t c_line; /* line discipline (== c_cc[19]) */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; while all other architectures have a legacy struct termios and a struct termios2 that is the same than struct ktermios: https://elixir.bootlin.com/linux/v6.16-rc3/source/include/uapi/asm-generic/termbits.h #define NCCS 19 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ }; struct termios2 { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; struct ktermios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; Given that the u-boot header that Florian mentioned, includes the kernel headers, then of course there's no struct termios2 for PowerPC. Dan also mentioned this glibc https://sourceware.org/git/?p=glibc.git;a=commit;h=5f54d8bc48983bed844c02e1fe614ad223e78838 But AFAICT that change is not completely correct because is defining the TCGETS2/TCSETS*2 ioctls but using a struct termios2 that is not defined for PowerPC. Unless the #include <asm/ioctls.h> somehow includes the asm-generic headers that define the struct termios2 ? (In reply to Javier Martinez Canillas from comment #4) > Dan also mentioned this glibc > https://sourceware.org/git/?p=glibc.git;a=commit; > h=5f54d8bc48983bed844c02e1fe614ad223e78838 > > But AFAICT that change is not completely correct because is defining the > TCGETS2/TCSETS*2 ioctls but using a struct termios2 > that is not defined for PowerPC. Unless the #include <asm/ioctls.h> somehow > includes the asm-generic headers that define the > struct termios2 ? None of this should be necessary with current glibc (at least I hope so) because it's now termios2-based on all architectures. We could define _LIBC_LINUX_TERMIOS2 in <features.h> to help u-boot to help to disable the compatibility hacks. (In reply to Florian Weimer from comment #5) > (In reply to Javier Martinez Canillas from comment #4) > > Dan also mentioned this glibc > > https://sourceware.org/git/?p=glibc.git;a=commit; > > h=5f54d8bc48983bed844c02e1fe614ad223e78838 > > > > But AFAICT that change is not completely correct because is defining the > > TCGETS2/TCSETS*2 ioctls but using a struct termios2 > > that is not defined for PowerPC. Unless the #include <asm/ioctls.h> somehow > > includes the asm-generic headers that define the > > struct termios2 ? > > None of this should be necessary with current glibc (at least I hope so) > because it's now termios2-based on all architectures. We could define > _LIBC_LINUX_TERMIOS2 in <features.h> to help u-boot to help to disable the > compatibility hacks. I'm confused, but who defines the struct termios2 for the PowerPC architecture? You said that current glibc it is now termios2-based on all architectures, but I couldn't find where is defined for PowerPC. Hmm. I missed the incorrect definition problem. I raised it on libc-alpha. Hopefully it's just a typo, and the constant should use struct termios. (In reply to Florian Weimer from comment #7) > Hmm. I missed the incorrect definition problem. I raised it on libc-alpha. > Hopefully it's just a typo, and the constant should use struct termios. Yes, that should work too. What is mentioned in https://sourceware.org/pipermail/libc-alpha/2025-July/168339.html is not accurate AFAICT: "<linux/termios.h> defines it, but that header conflicts with <termios.h>." but what I see in the Linux kernel source repo is the following: $ make x86_64_defconfig prepare modules_prepare $ cat ./arch/x86/include/generated/uapi/asm/termbits.h #include <asm-generic/termbits.h> $ grep "struct termios2" include/uapi/asm-generic/termbits.h 19:struct termios2 { $ head -n 40 arch/powerpc/include/uapi/asm/termbits.h /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _ASM_POWERPC_TERMBITS_H #define _ASM_POWERPC_TERMBITS_H /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <asm-generic/termbits-common.h> typedef unsigned int tcflag_t; /* * termios type and macro definitions. Be careful about adding stuff * to this file since it's used in GNU libc and there are strict rules * concerning namespace pollution. */ #define NCCS 19 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ cc_t c_line; /* line discipline (== c_cc[19]) */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* For PowerPC the termios and ktermios are the same */ struct ktermios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ In other words, struct termios and struct termios2 (if defined for the arch) are defined in <asm/termbits.h>, which for x86 is just <asm-generic/termbits.h> and powerpc has its own that does not define a struct termios2. |