Bug 4073 - Add method to configure preferred ABI when using RPM
Summary: Add method to configure preferred ABI when using RPM
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Low enhancement
Target Milestone: 1.7 M3
Assignee: Robert Yang
QA Contact:
URL:
Whiteboard: IMAGEGEN
Depends on:
Blocks: 4106 4685
  Show dependency tree
 
Reported: 2013-03-21 14:58 UTC by Mark Hatle
Modified: 2014-08-14 15:54 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hatle 2013-03-21 14:58:38 UTC
When using the RPM packaging backend to generate a rootfs there needs to be a way to configure the preferred ABI to resolve ELF file conflicts.

Currently RPM resolves ELF file conflicts with the last-installed wins.  Using SMART it's difficult to know what the last installed will be.

There are configuration settings in the RPM 'macros' file that allow you to select a specific policy for that rootfs.

There are three specific policies that can be selected:

* Last installed wins
* ELF32 wins
* ELF64 wins

A mechanism should be added to give the user the ability to select this behavior.
Comment 1 Jeff Johnson 2013-04-24 16:20:59 UTC
This functionality is already implemented, though not used since FC3.

The values involved are carried in the transaction (lib/rpmts.c:1502)

    ts->color = rpmExpandNumeric("%{?_transaction_color}");
    ts->prefcolor = rpmExpandNumeric("%{?_prefer_color}");
    if (!ts->prefcolor) ts->prefcolor = 0x2;

Your "last installed" policy MUST take color into account
because it makes little sense to arbitrarily replace ELF32
with ELF64
Comment 2 Mark Hatle 2013-04-24 16:24:01 UTC
The functionality is already in RPM5.  There just is no way to control the settings from within the OE build environment.

The defect is asking for an RPM specific configuration setting to be added to OE.
Comment 3 Jeff Johnson 2013-04-24 16:29:24 UTC
Tracked at https://bugs.launchpad.net/rpm/+bug/1172334
Comment 4 Jeff Johnson 2013-04-24 16:30:53 UTC
OK. Note that prefcolor used for file conflict resolution
is an installation, not a build, configuration.
Comment 5 Mark Hatle 2013-07-16 17:32:57 UTC
Image generation enhancement specific to RPM.
Comment 6 Alexandru Georgescu 2013-11-12 10:57:15 UTC
Hi,
Any updates on this? I see it still marked as 1.5.

Thanks!
Comment 7 Mark Hatle 2013-11-12 14:55:37 UTC
No update, this got pushed back due to lack of time on my part to implement it.

So far nobody has complained about the wrong system behavior in these cases, I suspect due to a small population using both RPM and multilib packages.
Comment 9 Jeff Johnson 2014-08-14 15:05:37 UTC
I'd suggest using a different OE config name than
    RPM_PREFER_COLOR
just because of the obscurity of the functionality in RPM.

Perhaps
    RPM_PREFER_ELF_ARCH
is more informative about the specific configuration need.

See the EM_??? e_machine defines in /usr/include/elf.h
for the fundamental constants in the files that are
mapped into "color" bits that RPM uses to decide
what ELF file to install.
Comment 10 Jeff Johnson 2014-08-14 15:54:38 UTC
Please also note that RPM color is a bit mask, not
an enumeration.

Specifically that means these bits are in use:

    0 == uncolored (i.e. a non-elf file)
    1 == 32 bit ELF
    2 == 64 bit ELF
    4 == MIPS "other endian" (and likely x32abi soon)

The comments in this patch
    http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=a9c8767a1707fa6ea40cbba99d4e12160fd91d11

seem to indicate that the 0x4 bit (or enumeration value 3)
is ambiguous wrto 32 or 64 bit: I would have expected these
color bit assignments on MIPS
    1 == 32 bit mipsel (little endian)
    2 == 64 bit mipsel (little endian)
    4 == mipseb (big endian, no. of bits unspecified)
The 0x8 bit could/should be used for 64 bit mipseb if
the distinction is really important: rpm hasn't been
tested or used on a mips architecture by me this century.

The distinction is important (to rpm) when dealing with
*.a archives, which can contain multiple ELF architectures.

You can of course use an enum in OE configuration that maps
to an rpm color bit setting.

But note that setting multiple RPM color bits (like 0x3 or
0x5 or 0x7) may have some surprising behaviors.