Rebuilding grub package

Issues related to software problems.
gosselin_andre
Posts: 7
Joined: 2008/02/02 23:09:26

Rebuilding grub package

Post by gosselin_andre » 2008/02/02 23:26:01

I would like to rebuild the grub package to check the effects of a patch supposed to solve a bizarre Xen-related problem on an AMI bios.

My machine is an X86_64 AMD. I first tried to rebuild the rpm from the src.rpm with rpmbuild, to make sure I can at least recreate the rpm package provided by Centos 5.1. I cannot get past that point. Those commands failed to produce a working grub executable similar to the official one that gets installed in /sbin/grub :
# rpmbuild -ba path/to/spec/file
# rpmbuild -ba --target i386 path/to/spec

Is there a place I could get the build log for the grub package (x86_64.rpm) as distributed ? Or could someone explain to me how to do it ?

Thanks in advance

Andre Gosselin

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Rebuilding grub package

Post by AlanBartlett » 2008/02/03 12:06:05

It would be helpful to see the actual errors that resulted from executing either of the two [b]rpmbuild[/b] commands that you quoted.

I also note

[quote]# rpmbuild -ba --target i386 path/to/spec[/quote]

The correct format should be [b]rpmbuild -ba --target=i386 spec-file[/b] (note the [b]=[/b] sign).

Alan.

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Rebuilding grub package

Post by toracat » 2008/02/03 12:26:41

[quote]
AlanJBartlett wrote:

The correct format should be [b]rpmbuild -ba --target=i386 spec-file[/b] (note the [b]=[/b] sign).
[/quote]
Actually, either format should work.

Akemi

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Rebuilding grub package

Post by AlanBartlett » 2008/02/03 13:13:49

Apologies for my error, as pointed out by [b]toracat[/b].

Alan.

gosselin_andre
Posts: 7
Joined: 2008/02/02 23:09:26

Re: Rebuilding grub package

Post by gosselin_andre » 2008/02/03 13:47:26

Here is a more precise statement of the problem. Remember that my machine is 64-bit AMD .

1- I uninstall the grub package, to start from a clean state.
2- I install the official grub-0.97-13.x86_64.rpm package. Then perform the following checks :
=======
[root@lauimldsoes04 orig]# ls -l /sbin/grub
-rwxr-xr-x 1 root root 579932 Oct 1 2006 /sbin/grub
[root@lauimldsoes04 orig]# file /sbin/grub
/sbin/grub: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, statically linked, for GNU/Linux 2.6.9, stripped
[root@lauimldsoes04 orig]# /sbin/grub
Probing devices to guess BIOS drives. This may take a long time.


GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> quit
====

3- I rebuild the package from the grub-0.97-13.src.rpm source :
# rpmbuild --rebuild grub-0.97-13.src.rpm

This produces two binary packages : grub-0.97-13.i386.rpm and grub-0.97-13.x86_64.rpm

I omitted this time the --target=i86 argument in order to produce both 32 and 64 bit versions of the binary package. I also went straight to the --rebuild option, since it
is cleaner and simpler than specifying the spec path. I do not think it makes a difference with "--ba path/to/spec ".

4- I uninstall grub to make sure, then install the newly generated grub-0.97-13.x86_64.rpm package.
5- I reexecute the previous checks, and here is what I get :
===
[root@lauimldsoes04 redhat]# ls -l /sbin/grub
-rwxr-xr-x 1 root root 287488 Feb 3 08:13 /sbin/grub
[root@lauimldsoes04 redhat]# file /sbin/grub
/sbin/grub: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[root@lauimldsoes04 redhat]# /sbin/grub
-bash: /sbin/grub: No such file or directory
===

Note the differences. The new /sbin/grub is not statically linked, and worst, it does not even want to execute.

6- If I uninstall grub and then install the newly generated 32bit package, I get the same picture as above.
The /sbin/grub executable is dynamically linked, but at least it executes correctly.

This is all done on the same machine and te same 64 bit RHE5.1 (Centos 5.1 if you like).

So I am surely missing something in the way I regenerate the 64bit vesion of the package. (extra options, etc)
This is why it would be interesting to see the build log of this package.

Regards,
A. Gosselin

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Rebuilding grub package

Post by toracat » 2008/02/03 14:24:45

I think I can confirm what you described. The grub executable compiled from srpm on x86_64 is not statically linked. This used to be a known problem and I thought the bug was fixed long time ago:

https://bugzilla.redhat.com/show_bug.cgi?id=121095

So, I don't know what is going on here. If you like, I can share my log file.

Akemi

gosselin_andre
Posts: 7
Joined: 2008/02/02 23:09:26

Re: Rebuilding grub package

Post by gosselin_andre » 2008/02/03 14:58:27

Thanks for your help. Sure, I would be happy to see your logs. Does that mean that you succeeded in generating a new grub executable for 64bit OS ?

Since the 32bit executes correctly, do you think it would be safe for me to "grub" my 64-bit boot disk with this version, or would this be asking for trouble ?

Remember that the reason I am into all this is to simply try a patch to the grub code in order to see if this could help me overcome a problem with Xen kernel not
seeing all my memory. The patch is described here :
https://bugzilla.redhat.com/show_bug.cgi?id=250299

I know how to regenerate a new ".src.rpm" with this patch applied, but sadly enough I do not know how to regenerate the binary package (except the 32bit one).
Perhaps I could achieve the same result in a simpler way, but I am lost here. If you could help me, I would really appreciate it.

Regards

A. Gosselin

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Rebuilding grub package

Post by toracat » 2008/02/03 15:33:22

I have only built it on a x86_64 system but did not test it or anything. It did build the 64-bit /sbin/grub but it was not statically linked.

Could you perhaps file a bug at bugs.centos.org ? This way, it will be seen by CentOS devs as well. Make sure you include all the details you described here. In the meantime, here is my log file:

http://toracat.freeshell.org/centos/logfile.txt

gosselin_andre
Posts: 7
Joined: 2008/02/02 23:09:26

Re: Rebuilding grub package

Post by gosselin_andre » 2008/02/03 15:42:53

Thanks,

A last detail : what was the exact command line you used ? Was it :
# rpmbuild --rebuild --target=x86_64 grub-0.97-13.src.rpm

I deeply than you for your help,

Regards,

AG

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Rebuilding grub package

Post by toracat » 2008/02/03 15:50:12

I first tried that command using mock. However it did not finish for an unknown reason. So, I installed the srpm file to see what is going on and built it by:

rpmbuild -bb --target `uname -m` grub.spec

on an x86_64 machine. The log file is from this process.

Post Reply