qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* hppa-firmware.img missing build-id
@ 2024-04-23 14:11 Cole Robinson
  2024-04-23 14:58 ` Cole Robinson
  2024-04-23 15:02 ` Richard W.M. Jones
  0 siblings, 2 replies; 6+ messages in thread
From: Cole Robinson @ 2024-04-23 14:11 UTC (permalink / raw)
  To: deller; +Cc: qemu-devel, Richard W.M. Jones, Richard Henderson

Hi,

hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
build-id annotations. rpm builds on Fedora will error if an ELF binary
doesn't have build-id:

RPM build errors:
    Missing build-id in
/tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
    Missing build-id in
/tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
    Generating build-id links failed

I didn't hit this with qemu 8.2.* builds FWIW

Thoughts?

Thanks,
Cole



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hppa-firmware.img missing build-id
  2024-04-23 14:11 hppa-firmware.img missing build-id Cole Robinson
@ 2024-04-23 14:58 ` Cole Robinson
  2024-04-23 15:07   ` Helge Deller
  2024-04-23 15:02 ` Richard W.M. Jones
  1 sibling, 1 reply; 6+ messages in thread
From: Cole Robinson @ 2024-04-23 14:58 UTC (permalink / raw)
  To: deller; +Cc: qemu-devel, Richard W.M. Jones, Richard Henderson

On 4/23/24 10:11 AM, Cole Robinson wrote:
> Hi,
> 
> hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
> build-id annotations. rpm builds on Fedora will error if an ELF binary
> doesn't have build-id:
> 
> RPM build errors:
>     Missing build-id in
> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
>     Missing build-id in
> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
>     Generating build-id links failed
> 
> I didn't hit this with qemu 8.2.* builds FWIW
> 

Though checking older bundled hppa-firmware binaries with `readelf` I
don't see build-id either, so now I'm not sure why those RPM builds were
passing.

FWIW the RPM check is deep in RPM code:
https://github.com/rpm-software-management/rpm/blob/68d0f3119c3d46b6184f4704edb51749ce9f819e/build/files.c#L1976

Maybe something else in hppa-firmware ELF headers caused this check to
be skipped in the past

Thanks,
Cole



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hppa-firmware.img missing build-id
  2024-04-23 14:11 hppa-firmware.img missing build-id Cole Robinson
  2024-04-23 14:58 ` Cole Robinson
@ 2024-04-23 15:02 ` Richard W.M. Jones
  1 sibling, 0 replies; 6+ messages in thread
From: Richard W.M. Jones @ 2024-04-23 15:02 UTC (permalink / raw)
  To: Cole Robinson; +Cc: deller, qemu-devel, Richard Henderson

On Tue, Apr 23, 2024 at 10:11:50AM -0400, Cole Robinson wrote:
> Hi,
> 
> hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
> build-id annotations. rpm builds on Fedora will error if an ELF binary
> doesn't have build-id:
> 
> RPM build errors:
>     Missing build-id in
> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
>     Missing build-id in
> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
>     Generating build-id links failed
> 
> I didn't hit this with qemu 8.2.* builds FWIW

Discussed in chat, and I think the consensus is to rebuild these
downstream, since we have the cross-compilers available.  It requires
adding -Wl,--build-id=sha1 at link time.

FWIW this worked for me on Fedora:

# dnf install /usr/bin/hppa-linux-gnu-gcc
$ pushd roms/seabios-hppa
$ make parisc
$ popd

That didn't actually add the .note.gnu.build-id section though, you
have to add this patch:

diff --git a/Makefile.parisc b/Makefile.parisc
index 36edc0c2..3e0c1812 100644
--- a/Makefile.parisc
+++ b/Makefile.parisc
@@ -168,7 +168,7 @@ $(OUT)hppa-firmware$(BIT_SUFFIX).img: $(OUT)autoconf.h $(OUT)head.o $(OUT)ccode3
        @echo "  Linking $@"
        $(Q)$(CPP) $(CPPFLAGS) -Isrc -D__ASSEMBLY__ -DBITS=$(BITS) src/parisc/pafirmware.lds.S -o $(OUT)pafirmware.lds
        $(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o
-       $(Q)$(LD) -N -T $(OUT)pafirmware.lds $(OUT)head.o $(OUT)version.o -X -o $@ -e startup --as-needed $(OUT)ccode32flat.o $(LIBGCC)
+       $(Q)$(LD) --build-id=sha1 -N -T $(OUT)pafirmware.lds $(OUT)head.o $(OUT)version.o -X -o $@ -e startup --as-needed $(OUT)ccode32flat.o $(LIBGCC)
 
 ################ Kconfig rules
 
... and then:

$ objdump -sj .note.gnu.build-id ./out/hppa-firmware.img 

./out/hppa-firmware.img:     file format elf32-big

Contents of section .note.gnu.build-id:
 f0000000 00000004 00000014 00000003 474e5500  ............GNU.
 f0000010 daabe2dc 4e95a4c2 bad0cc57 e7f63152  ....N......W..1R
 f0000020 46274585                             F'E.         

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: hppa-firmware.img missing build-id
  2024-04-23 14:58 ` Cole Robinson
@ 2024-04-23 15:07   ` Helge Deller
  2024-04-23 15:10     ` Daniel P. Berrangé
  0 siblings, 1 reply; 6+ messages in thread
From: Helge Deller @ 2024-04-23 15:07 UTC (permalink / raw)
  To: Cole Robinson; +Cc: qemu-devel, Richard W.M. Jones, Richard Henderson

On 4/23/24 16:58, Cole Robinson wrote:
> On 4/23/24 10:11 AM, Cole Robinson wrote:
>> Hi,
>>
>> hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
>> build-id annotations. rpm builds on Fedora will error if an ELF binary
>> doesn't have build-id:
>>
>> RPM build errors:
>>      Missing build-id in
>> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
>>      Missing build-id in
>> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
>>      Generating build-id links failed
>>
>> I didn't hit this with qemu 8.2.* builds FWIW
>>
>
> Though checking older bundled hppa-firmware binaries with `readelf` I
> don't see build-id either, so now I'm not sure why those RPM builds were
> passing.
>
> FWIW the RPM check is deep in RPM code:
> https://github.com/rpm-software-management/rpm/blob/68d0f3119c3d46b6184f4704edb51749ce9f819e/build/files.c#L1976
>
> Maybe something else in hppa-firmware ELF headers caused this check to
> be skipped in the past

Maybe Fedora ignores binaries which don't have the executable flag set?
Qemu does not need it.
If so, a "chmod -x pc-bios/hppa-firmware*.img" should be sufficient.


Otherwise, adding "--build-id" to the link line when building the SeaBIOS
hppa-firmware.img does adds a build-id:

diff --git a/Makefile.parisc b/Makefile.parisc
index 5c34eb3d..256142f4 100644
--- a/Makefile.parisc
+++ b/Makefile.parisc
@@ -169,7 +169,7 @@ $(OUT)hppa-firmware$(BIT_SUFFIX).img: $(OUT)autoconf.h $(OUT)head.o $(OUT)ccode3
         @echo "  Linking $@"
         $(Q)$(CPP) $(CPPFLAGS) -Isrc -D__ASSEMBLY__ -DBITS=$(BITS) src/parisc/pafirmware.lds.S -o $(OUT)pafirmware.lds
         $(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o
-       $(Q)$(LD) -N -T $(OUT)pafirmware.lds $(OUT)head.o $(OUT)version.o -X -o $@ -e startup --as-needed $(OUT)ccode32flat.o $(LIBGCC)
+       $(Q)$(LD) -N -T $(OUT)pafirmware.lds $(OUT)head.o $(OUT)version.o -X -o $@ -e startup --as-needed --build-id $(OUT)ccode32flat.o $(LIBGCC)


deller@carbonx1:/home/cvs/LINUX/seabios$ eu-readelf -n out/hppa-firmware.img

Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x100:
   Owner          Data size  Type
   GNU                   20  GNU_BUILD_ID
     Build ID: 61a59ebba32fd40eadda7083983a1e1b04ec4082

Are you using the firmware blobs which come with qemu, or do you build Seabios-hppa yourself?

Helge


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: hppa-firmware.img missing build-id
  2024-04-23 15:07   ` Helge Deller
@ 2024-04-23 15:10     ` Daniel P. Berrangé
  2024-04-23 18:50       ` Helge Deller
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrangé @ 2024-04-23 15:10 UTC (permalink / raw)
  To: Helge Deller
  Cc: Cole Robinson, qemu-devel, Richard W.M. Jones, Richard Henderson

On Tue, Apr 23, 2024 at 05:07:17PM +0200, Helge Deller wrote:
> On 4/23/24 16:58, Cole Robinson wrote:
> > On 4/23/24 10:11 AM, Cole Robinson wrote:
> > > Hi,
> > > 
> > > hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
> > > build-id annotations. rpm builds on Fedora will error if an ELF binary
> > > doesn't have build-id:
> > > 
> > > RPM build errors:
> > >      Missing build-id in
> > > /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
> > >      Missing build-id in
> > > /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
> > >      Generating build-id links failed
> > > 
> > > I didn't hit this with qemu 8.2.* builds FWIW
> > > 
> > 
> > Though checking older bundled hppa-firmware binaries with `readelf` I
> > don't see build-id either, so now I'm not sure why those RPM builds were
> > passing.
> > 
> > FWIW the RPM check is deep in RPM code:
> > https://github.com/rpm-software-management/rpm/blob/68d0f3119c3d46b6184f4704edb51749ce9f819e/build/files.c#L1976
> > 
> > Maybe something else in hppa-firmware ELF headers caused this check to
> > be skipped in the past
> 
> Maybe Fedora ignores binaries which don't have the executable flag set?

Yes, that's probably it. qemu 9.0.0 has +x set on the hppa-firmware
images, while qemu 8.2.0 does not have +x set.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hppa-firmware.img missing build-id
  2024-04-23 15:10     ` Daniel P. Berrangé
@ 2024-04-23 18:50       ` Helge Deller
  0 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2024-04-23 18:50 UTC (permalink / raw)
  To: Daniel P. Berrangé, Cole Robinson
  Cc: qemu-devel, Richard W.M. Jones, Richard Henderson

On 4/23/24 17:10, Daniel P. Berrangé wrote:
> On Tue, Apr 23, 2024 at 05:07:17PM +0200, Helge Deller wrote:
>> On 4/23/24 16:58, Cole Robinson wrote:
>>> On 4/23/24 10:11 AM, Cole Robinson wrote:
>>>> Hi,
>>>>
>>>> hppa-firmware.img and hppa-firmware64.img in qemu.git are missing ELF
>>>> build-id annotations. rpm builds on Fedora will error if an ELF binary
>>>> doesn't have build-id:
>>>>
>>>> RPM build errors:
>>>>       Missing build-id in
>>>> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware.img
>>>>       Missing build-id in
>>>> /tmp/rpmbuild/BUILDROOT/qemu-9.0.0-1.rc2.fc41.x86_64/usr/share/qemu/hppa-firmware64.img
>>>>       Generating build-id links failed
>>>>
>>>> I didn't hit this with qemu 8.2.* builds FWIW
>>>>
>>>
>>> Though checking older bundled hppa-firmware binaries with `readelf` I
>>> don't see build-id either, so now I'm not sure why those RPM builds were
>>> passing.
>>>
>>> FWIW the RPM check is deep in RPM code:
>>> https://github.com/rpm-software-management/rpm/blob/68d0f3119c3d46b6184f4704edb51749ce9f819e/build/files.c#L1976
>>>
>>> Maybe something else in hppa-firmware ELF headers caused this check to
>>> be skipped in the past
>>
>> Maybe Fedora ignores binaries which don't have the executable flag set?
>
> Yes, that's probably it. qemu 9.0.0 has +x set on the hppa-firmware
> images, while qemu 8.2.0 does not have +x set.

I just added a patch to the seabios-hppa Makefile
to drop the +x flag with upcoming hppa-firmware builds.

Helge


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-23 18:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23 14:11 hppa-firmware.img missing build-id Cole Robinson
2024-04-23 14:58 ` Cole Robinson
2024-04-23 15:07   ` Helge Deller
2024-04-23 15:10     ` Daniel P. Berrangé
2024-04-23 18:50       ` Helge Deller
2024-04-23 15:02 ` Richard W.M. Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).