Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub2 works great, ebuild doesn't [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Thu Nov 20, 2008 8:39 pm    Post subject: grub2 works great, ebuild doesn't [SOLVED] Reply with quote

I have been booting my machines with the latest version of grub2 for several months now, and I have found it to be a much nicer, more capable, and more user-friendly bootloader than grub-legacy ever was.

And since I am a dedicated Gentooer, I did the obvious thing : Write an ebuild for it.
sys-boot/grub-9999.ebuild:
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /usr/local/portage/sys-boot/grub/grub-9999.ebuild cyrillic $

ESVN_REPO_URI="svn://svn.sv.gnu.org/grub/trunk/grub2"
EAPI=2
inherit eutils flag-o-matic subversion
IUSE="custom-cflags lzo static"
RESTRICT="strip"

DESCRIPTION="GNU GRUB 2 boot loader"
HOMEPAGE="http://www.gnu.org/software/grub/"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~sparc ~x86"

DEPEND="sys-libs/ncurses
   lzo? ( dev-libs/lzo )"
PROVIDE="virtual/bootloader"

src_configure() {
   use custom-cflags || unset CFLAGS CXXFLAGS LDFLAGS
   use static && append-ldflags -static
   econf $(use_enable lzo) || die
}

src_install() {
   emake DESTDIR=${D} install || die
}

The problem is, it only appears to work, and the resulting bootloader is not able to boot the machine.
EDIT : Now it works with RESTRICT="strip". Thanks to code_raptor for pointing out that bugreport.

If I go through the steps manually,
Code:
# cd /usr/src
# svn co svn://svn.sv.gnu.org/grub/trunk/grub2
# cd grub2
# ./configure
# make
# make install
# grub-install /dev/sda
# grub-mkconfig > /boot/grub/grub.cfg
# reboot

everything works perfectly, and I am able to boot.

If I go the ebuild route,
Code:
# emerge =grub-9999
# grub-install /dev/sda
# grub-mkconfig > /boot/grub/grub.cfg
# reboot

grub panics, drops to the rescue shell, and cannot access any of the harddrives. :(


So, I am wondering if anybody can offer some insight, ebuild writing tips, sympathy ... (patches are also welcome :) )


Last edited by cyrillic on Mon Nov 24, 2008 10:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
tranquilcool
Veteran
Veteran


Joined: 25 Mar 2005
Posts: 1159

PostPosted: Sun Nov 23, 2008 10:29 am    Post subject: Reply with quote

same here. can't get it to work with all the ebuilds i have tried.
_________________
this is a strange strange world.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Nov 23, 2008 10:42 am    Post subject: Reply with quote

emake is not the same as make - it adds tons of options. Use make in the ebuild, i.e. exactly what you are using manually. That applies, very important, to src_compile() also.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5617
Location: Removed by Neddy

PostPosted: Sun Nov 23, 2008 10:52 am    Post subject: Reply with quote

edit yr make.conf and go VERY CONSERVATIVE!!!! probably a bit flaky code w.r.t. some -f gcc options (even seemingly benign ones )
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
tranquilcool
Veteran
Veteran


Joined: 25 Mar 2005
Posts: 1159

PostPosted: Sun Nov 23, 2008 2:57 pm    Post subject: Reply with quote

i have tried make and conservative flags
but it doesn't work either.
_________________
this is a strange strange world.
Back to top
View user's profile Send private message
nissarin
n00b
n00b


Joined: 16 Nov 2008
Posts: 10

PostPosted: Mon Nov 24, 2008 6:57 pm    Post subject: Reply with quote

Here is my ebuild, it's based few others (including yours). I know it compiles and installs (on amd64), I don't know if it works :D (it's first time I use grub2).
I hope I would be able to boot from LVM2@RAID10 with it :)


Code:

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit mount-boot eutils flag-o-matic toolchain-funcs subversion

ESVN_REPO_URI="svn://svn.sv.gnu.org/grub/trunk/grub2"
EAPI=2
DESCRIPTION="GNU GRUB 2 boot loader"
HOMEPAGE="http://www.gnu.org/software/grub/"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="static custom-cflags"

DEPEND=">=sys-libs/ncurses-5.2-r5
   dev-libs/lzo"
PROVIDE="virtual/bootloader"

STRIP_MASK="/lib*/grub/*/*.mod"

src_compile() {
   use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
   use static && append-ldflags -static

   econf \
      --prefix=/ \
      --datadir=/usr/lib \
      || die "econf failed"
   emake -j1 || die "making regular stuff"
}

src_install() {
   emake DESTDIR="${D}" install || die
   dodoc AUTHORS ChangeLog NEWS README THANKS TODO
}
Back to top
View user's profile Send private message
code_raptor
n00b
n00b


Joined: 24 Jun 2005
Posts: 47

PostPosted: Mon Nov 24, 2008 7:33 pm    Post subject: Reply with quote

Maybe this is related https://bugs.gentoo.org/231935. In few words, portage strip all binaries before the install phrase and leave grub2 broken.

Adding RESTRICT="strip" (or STRIP_MASK="/lib*/grub/*/*.mod" like the above ebuild) should fix it.
_________________
just feel the code...
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Mon Nov 24, 2008 10:11 pm    Post subject: Reply with quote

Thank you code_raptor, RESTRICT="strip" did in fact fix the problem.

I have currently tested grub2 on amd64 and x86 (works great). I also have some ppc hardware that I have not tested it on yet, but somebody else will have to try sparc, and report if it works.
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Mon Nov 24, 2008 10:25 pm    Post subject: Reply with quote

Could you post your final, working ebuild here?
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Mon Nov 24, 2008 10:36 pm    Post subject: Reply with quote

I edited the ebuild in my first post, and that is the current working version.
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Tue Nov 25, 2008 3:54 am    Post subject: Reply with quote

Guys, kudos to fallenwizard who made a grub2-graphical ebuild with the bzr eclass

Get his overlay from: git://repo.or.cz/fwz-overlay.git (git clone <repo>)
The guide for grub2-graphical: http://bbs.archlinux.org/viewtopic.php?id=56576
Gentoo 1024x768 grub2 theme: http://omploader.org/veWtn (gentoo.tar.bz2)

The gentoo grub2 theme there is the one posted on the last page on that forum, except it has changed logos for gentoo (gentoodark and gentoocenter instead of arch*)

just thought if anyone was interested, it's working perfect here.
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
tranquilcool
Veteran
Veteran


Joined: 25 Mar 2005
Posts: 1159

PostPosted: Tue Nov 25, 2008 9:51 am    Post subject: Reply with quote

confirm RESTRICT="strip" fixed it.
thanks!
_________________
this is a strange strange world.
Back to top
View user's profile Send private message
jordanwb
l33t
l33t


Joined: 10 Jul 2008
Posts: 642
Location: Ottawa, Canada

PostPosted: Fri Feb 06, 2009 5:35 pm    Post subject: Reply with quote

Are there any non-git overlays?

I'd like to try grub2 but I'd like to use layman in place of git.
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Fri Feb 06, 2009 9:17 pm    Post subject: Reply with quote

jordanwb wrote:
Are there any non-git overlays?

The vast majority of them are

Quote:
I'd like to try grub2 but I'd like to use layman in place of git.

I don't see why you can't use these git repositories in layman?
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6928
Location: Austria

PostPosted: Fri Feb 06, 2009 9:19 pm    Post subject: Reply with quote

You don't actually need to 'use' git in order to get those overlays, layman does it all for you.
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
jordanwb
l33t
l33t


Joined: 10 Jul 2008
Posts: 642
Location: Ottawa, Canada

PostPosted: Fri Feb 06, 2009 9:23 pm    Post subject: Reply with quote

So

Code:
layman -o git://repo.or.cz/fwz-overlay.git -a grub2_overlay


?
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Fri Feb 06, 2009 9:28 pm    Post subject: Reply with quote

jordanwb wrote:
So

Code:
layman -o git://repo.or.cz/fwz-overlay.git -a grub2_overlay


?


I dont know anything about using layman, but i'd assume you can edit the layman configuration.

it's fallenwizards overlay too, not just grub2 goes in there.
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
jordanwb
l33t
l33t


Joined: 10 Jul 2008
Posts: 642
Location: Ottawa, Canada

PostPosted: Fri Feb 06, 2009 9:33 pm    Post subject: Reply with quote

I went to http://repo.or.cz/fwz-overlay.git for the fun of it and I get an HTTP 404 error.
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Fri Feb 06, 2009 9:43 pm    Post subject: Reply with quote

because your clone url is:
git://repo.or.cz/fwz-overlay.git

If i could maintain the gentoo overlays i'd put grub2 in THE since that is in layman (someone step up and maintain them for us)
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
jordanwb
l33t
l33t


Joined: 10 Jul 2008
Posts: 642
Location: Ottawa, Canada

PostPosted: Fri Feb 06, 2009 9:54 pm    Post subject: Reply with quote

cheater1034 wrote:
If i could maintain the gentoo overlays i'd put grub2 in THE since that is in layman


Um okay. :?
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Sat Feb 07, 2009 12:32 am    Post subject: Reply with quote

jordanwb wrote:
cheater1034 wrote:
If i could maintain the gentoo overlays i'd put grub2 in THE since that is in layman


Um okay. :?


What i was saying is that i can't maintain gentoo overlays properly since i'm not on gentoo and have no ebuild commands, using fallenwizard's overlay should be perfectly find though.
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Sat Feb 07, 2009 2:16 am    Post subject: Reply with quote

I wouldn't bother with the overlay, it hasn't been updated since the ebuild above was finished.

Just copy and past the one above into your /usr/local/portage (or equivalent) and you're gold.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
jordanwb
l33t
l33t


Joined: 10 Jul 2008
Posts: 642
Location: Ottawa, Canada

PostPosted: Sat Feb 07, 2009 2:22 am    Post subject: Reply with quote

I think I'll wait till its stable, or at least has keywords. Even then I'll try it on VBox.
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Sat Feb 07, 2009 4:16 am    Post subject: Reply with quote

It's not about that, the whole point of the ebuild in fallenwizard's overlay is for the graphical menu, which isn't standard in grub2 (yet)
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
aiezue
n00b
n00b


Joined: 29 Dec 2008
Posts: 8

PostPosted: Sat Mar 07, 2009 4:57 am    Post subject: Reply with quote

cheater1034 wrote:
Guys, kudos to fallenwizard who made a grub2-graphical ebuild with the bzr eclass

Get his overlay from: git://repo.or.cz/fwz-overlay.git (git clone <repo>)
The guide for grub2-graphical: http://bbs.archlinux.org/viewtopic.php?id=56576
Gentoo 1024x768 grub2 theme: http://omploader.org/veWtn (gentoo.tar.bz2)

The gentoo grub2 theme there is the one posted on the last page on that forum, except it has changed logos for gentoo (gentoodark and gentoocenter instead of arch*)

just thought if anyone was interested, it's working perfect here.


this is nice .thx...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum