Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
migration from grub legacy to grub2 [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Tue Jan 22, 2019 8:58 pm    Post subject: migration from grub legacy to grub2 [solved] Reply with quote

Greetings,

I'm in the process of migrating my system from grub legacy to grub2.
in grub legacy I had a script doing this after the kernel was compiled:

  1. make ${JOBS} modules_install
  2. mount /boot/
  3. cp arch/x86/boot/bzImage /boot/kernel64-${FULL_NEW_KERNEL_VERSION}.img
  4. OLD_KERNEL="$(sed -n "${GRUB_CFG_ENTRY_LINE_START}p" /boot/grub/grub.conf | awk '{print $4}')"
  5. NEW_ENTRY="$(cat /boot/grub/grub.conf | sed -n "${GRUB_CFG_ENTRY_LINE_START},$((${GRUB_CFG_ENTRY_LINE_START}+${GRUB_CFG_ENTRY_LENGTH}))p" | sed ':a;N;$!ba;s/\n/\\n/g' | sed "s/${OLD_KERNEL}/${FULL_NEW_KERNEL_VERSION}/g")"
  6. sed -i \"${GRUB_CFG_ENTRY_LINE_START} i ${NEW_ENTRY}\" /boot/grub/grub.conf
  7. n -sf /boot/kernel64-${FULL_NEW_KERNEL_VERSION}.img /boot/kernel64-rescue.img


this resulted in a bootable image with custom initrd. with grub2 I need to use grub-mkconfig -o /boot/grub/grub.cfg, my problem is getting the above to work.
I assume I cannot use the cp method and I'd should use the make install, if that so, how can I instruct grub2 to use my initrd?

Thanks.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein


Last edited by DaggyStyle on Fri Jan 25, 2019 7:08 am; edited 1 time in total
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Tue Jan 22, 2019 9:56 pm    Post subject: Re: migration from grub legacy to grub2 Reply with quote

DaggyStyle wrote:
I'm in the process of migrating my system from grub legacy to grub2..


Why? Just because it's not in the tree anymore doesn't mean you can't keep it. Your present install is not affected. Unless you really want grub2 features, don't bother.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Jan 23, 2019 8:34 am    Post subject: Re: migration from grub legacy to grub2 Reply with quote

Tony0945 wrote:
DaggyStyle wrote:
I'm in the process of migrating my system from grub legacy to grub2..


Why? Just because it's not in the tree anymore doesn't mean you can't keep it. Your present install is not affected. Unless you really want grub2 features, don't bother.

I transferred my existing installation from one machine to another, in the process I need to reinstall gentoo and I'd like to migrate to efi.
the main problem is that fat32 doesn't supports links, so I cannot create a link with the proper formatting for grub.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Jan 23, 2019 8:37 am    Post subject: Reply with quote

looks like this: https://wiki.gentoo.org/wiki/EFI_stub_kernel#Optional:_Initramfs is my answer, but how does grub2 enters here I'm not sure

EDIT:
this https://wiki.gentoo.org/wiki/Custom_Initramfs#Using_GRUB looks like what actually need, but what should I select? what are the gains in efi stub or grub.
afaicu, efi stub doesn't needs grub as efi bootmgr does all the work.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Phoenix591
Guru
Guru


Joined: 17 Sep 2007
Posts: 487

PostPosted: Thu Jan 24, 2019 10:26 am    Post subject: Reply with quote

Correct, with efistub no boot loader is needed, just the BIOS (efi firmware) executing the kernel. The arguments and initrd set by either compiling in the kernel itself a default command line (under processor type and features->, built in kernel command line, something like root=LABEL=Gentoo dobtrfs initrd=\intel-uc.img initrd=\initrd-current do note efi path notations use \ rather than / ), or when creating the boot entry with efibootmgr (anything in quotes after the -u or --unicode is passed to the kernel), and letting the BIOS (efi firmware) handle displaying any alternative boot options (ie press f12 to display the menu).


https://wiki.gentoo.org/wiki/GRUB2 and https://wiki.gentoo.org/wiki/GRUB2_Migration are the two most relevant grub 2 articles for getting started and migrating to grub 2 if you havn't found it yet (no experience with it personally)

Imo, it comes down to taste, if you need/want many boot choices, and if your efi firmware is quirky or not: Some efi firmware can have strange bugs and other quirks, my own, for instance, ignores the efi system partition on my second hard drive, and can natively read ntfs partitions ( that was handy for creating and using windows 10 installation usb stick), others refuse to acknowledge efi executables other than the default ( efi partition/EFI/BOOT/BOOTX64.EFI ). If you're satisfied with the visual appearance of your efi firmware's boot menu and can work within any quirks of your own board's efi firmware, you can go bare bones with efistub. If not, Grub (2), rEFInd, both provide the traditional boot loader experience with theme-able menus etc ( with systemd-boot providing a more bare bones menu option)
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Jan 25, 2019 7:08 am    Post subject: Reply with quote

thought so, I've went the grub2 path, now I only need to get it to boot.

Thanks.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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