LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-27-2018, 03:32 PM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Rep: Reputation: 28
14.2/x86_64: UEFI/elilo migration


I have older hardware not before assembled into a working desktop but now it is and I want to learn how to use the UEFI/elilo capabilities it provides.

The motherboard is an Asus Sabertooth FX-990 and it supports UEFI. I have three portables running Slackware-14.2/x86_64, but they run with the older BIOS and lilo.

I've read a couple of blog posts and an undated slackbook page on 14.2 and elilo but am not yet sufficiently educated to install the OS and get it properly configured. I would like pointers to current docs that will teach me the new systems so I can migrate my knowledge of lilo (and mkinitrd) to the new procedures.
 
Old 08-27-2018, 04:38 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
First make sure your firmware is set to boot in EFI mode (not legacy).

Then insert the Slackware64-14.2 DVD or USB stick.

Before running setup use cfdisk to partition the hard drive. You will need a partition of 100M of type EFI: in the drop down list of partition types, choose "ef EFI (FAT-12/16/32)". Alternatively you can use cgdisk then choose the partition type ef00 (for EFI System). Both utilities work.

The EFI partition should be equipped with a FAT file system. Let's say it's /dev/sda1, then just type:
Code:
mkfs.fat /dev/sda1
Alternatively, the installer can do it for you later.

Then run setup. After having set the Linux partitions, the installer will make an entry in /etc/fstab for the EFI partition, and if not yet done, will put a FAT system in it.

At the CONFIGURE step you will choose to install elilo and accept when asked to make an entry for Slackware in the firmware's menu. You can install lilo too, there will be no conflict as elilo installs its files in the EFI partition (mounted as /boot/efi) but lilo writes its boot sector elsewhere: this way you will be able to boot in EFI mode as well as in Legacy (aka BIOS) mode.

To elaborate a bit, the installer will put in the EFI partition, in /efi/boot/EFI/Slackware these files:
  • elilo.conf (similar to /etc/lilo.conf)
  • elilo.efi (the boot loader). elilo.efi reads the file elilo.conf every time it runs, so you don't have to reinstall it when e.g. you change the kernel and or the initrd, just put the new kernel and initrd in the EFI partition (eliloconfig can do it for you) and edit elilo.conf if need be.
  • vmlinuz (the kernel, copied from /boot and renamed)
  • initrd.gz (the initrd, copied from /boot case occurring)
Once installed, read the docs in /usr/doc/elilo-3.16/ and have a look at the script /usr/sbin/eliloconfig.

If you want more in depth knowledge or suffer of insomnia, read the UEFI specification. The current version is 2.7 (Errata A), get it from http://uefi.org/specifications. Also, elilo.efi is an executable file compliant to the Microsoft Portable Executable and Common Object File Format Specification usually abbreviated as PE/COFF, available here[1]. It's in the docx format, so you can read it with LibreOffice.

[1] I case someone wonders, Linux can convert the elf-like shared objects to the PE/COFF format using the objcopy program shipped in binutils. That's what is used to make the elilo's .efi binary for each architecture, as per the file Makefile.rules in the source tree:
Code:
%.efi: %.so 
	$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
		   -j .rela -j .reloc --target=$(FORMAT) $*.so $@

Last edited by Didier Spaier; 08-29-2018 at 03:34 AM. Reason: [1] added.
 
4 members found this post helpful.
Old 08-27-2018, 05:04 PM   #3
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
It's not complicated, in particular if Slackware is going to be the only OS on given machine. You should just use gdisk instead of fdisk to create partitions, and remember to create a small partition (100MB may be enough) along with your swap and other partitions. In gdisk, assign EF00 as type of this partition, then format it as FAT32, and in Slackware installer, select to have it mounted under /boot/efi. When Slackware installation comes to selecting boot loader, you should choose ELILO from the list, and you should be pretty much good to go.

After the system booted for the first time, you can go into /boot/efi/EFI/Slackware and adjust ELILO config file elilo.conf for your needs. Its format is rather simple, and well documented, so that should not be hard.

The idea with EFI loading is that BIOS (now called EFI firmware) knows to read partition table, and FAT32 file system, so boot loaders are practically plain executable files on such file system, i.e. no more messing with MBR etc. So your ELILO boot loader is actually a file elilo.efi, also under /boot/efi/EFI/Slackware directory. The third file there is kernel.

Whenever you install new kernel, or when you are switching to generic kernel for the first time, you have to remember to create initrd.gz and copy it from /boot to /boot/efi/EFI/Slackware, and also to copy /boot/vmlinuz-generic-x.y.z into /boot/efi/EFI/Slackware/vmlinuz. That's all, and you don't have to run anything further, like lilo command in LILO case. However, when switching to generic kernels for the first time, remember to change elilo.conf, so that initrd.gz is mentioned there.

Edit: Haven't seen previous post until I hit send button, sorry for duplicated info.

Last edited by cgorac; 08-27-2018 at 05:09 PM.
 
2 members found this post helpful.
Old 08-27-2018, 05:29 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
In recent versions, as the ones shipped in the installer for Slackware 14.2, fdisk and cfdisk can handle EFI partition tables so can be used to set EFI partitions as gdisk and cgdisk.
 
1 members found this post helpful.
Old 08-28-2018, 09:39 AM   #5
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Didier/cgorac:

Thank you both for clear, helpful explanations. I have two remaining questions for which I've still not found answers.

1.) The sequence and formats of partitions on the boot disk. Am I correct in assuming that sda1 is type EF00 formatted as FAT32 (100M or more in size), sda2 is type linux swap (82) and formatted ext4, and sda3 is type linux (83) and formatted ext4? The secondary disk will be formatted with three GPT partitions formatted ext4 and mounted with: sdb1 as /home, sdb2 as /opt, and adb3 as /data.

2.) What is the specific syntax for mkinitrd? Is it the same 'mkinitrd -c -k <kernel_number> -m ext4, -f ext4, -r /dev/sda1' or something different?

Regards,

Rich
 
Old 08-28-2018, 11:46 AM   #6
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
Quote:
Originally Posted by rshepard View Post
1.) The sequence and formats of partitions on the boot disk. Am I correct in assuming that sda1 is type EF00 formatted as FAT32 (100M or more in size), sda2 is type linux swap (82) and formatted ext4, and sda3 is type linux (83) and formatted ext4?
I can confirm that this order will work, as it's one that I'm using (and most natural, as for EFI and swap one has to specify size, and then leave the rest for ext4). But I guess other orders will work too, i.e. I think that EFI partition doesn't have to be first. (Also, note that you don't have to format swap partition, and that root ext4 partition could be formatted by Slackware installer).

Quote:
Originally Posted by rshepard View Post
What is the specific syntax for mkinitrd? Is it the same 'mkinitrd -c -k <kernel_number> -m ext4, -f ext4, -r /dev/sda1' or something different?
Here, I'm using /usr/share/mkinitrd/mkinitrd_command_generator.sh helper script to determine correct mkinitrd arguments. So say, kernel gets updated, and there is new /boot/vmlinuz-generic-4.14.67 kernel. I would run:

Code:
/usr/share/mkinitrd/mkinitrd_command_generator.sh /boot/vmlinuz-generic-4.14.67
and then in the printout there is "A suitable 'mkinitrd' command will be:" followed by mkinitrd command listed with needed arguments, that I would just copy and run to get initrd.gz created.
 
Old 08-28-2018, 12:08 PM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
Quote:
Originally Posted by rshepard View Post
1.) The sequence and formats of partitions on the boot disk. Am I correct in assuming that sda1 is type EF00 formatted as FAT32 (100M or more in size), sda2 is type linux swap (82) and formatted ext4, and sda3 is type linux (83) and formatted ext4? The secondary disk will be formatted with three GPT partitions formatted ext4 and mounted with: sdb1 as /home, sdb2 as /opt, and adb3 as /data.
It doesn't matter much in which order you put the partitions, as far as I know. I would suggest to use a GPT partition label on the both drives. This has no inconvenience as far as I know and you will have more flexibility.

The swap should not have a file system, the installer will propose to use it as as swap, then include it in /etc/fstab and run swapon on it.

Quote:
2.) What is the specific syntax for mkinitrd? Is it the same 'mkinitrd -c -k <kernel_number> -m ext4, -f ext4, -r /dev/sda1' or something different?
Nothing specific for UEFI. To ease installation I suggest that you first install using the huge kernel, then after installation make your initrd. Don't forget to copy the generic kernel and the initrd in /boot/efi/EFI/Slackware. You can choose to make a stanza for it in elilo.conf: then rename the generic kernel in /boot/efi/EFI/Slackware kernel-generic and edit elilo.conf accordingly (don't forget: initrd=initrd.gz). Or be sure that /boot/vmlinuz be a symlink to the generic kernel and run eliloconfig as root after having built the initrd if you want a boot entry for the generic kernel only.

PS cgorac was faster this time!
Let's say that our answers complete each other

Last edited by Didier Spaier; 08-28-2018 at 12:10 PM.
 
Old 08-29-2018, 10:40 AM   #8
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by cgorac View Post
I can confirm that this order will work, as it's one that I'm using (and most natural, as for EFI and swap one has to specify size, and then leave the rest for ext4). But I guess other orders will work too, i.e. I think that EFI partition doesn't have to be first. (Also, note that you don't have to format swap partition, and that root ext4 partition could be formatted by Slackware installer).

You're correct that swap is not formatted by me.

With the older system the first partition is the first one on the drive and it will be easier for me to continue that practice. Then swap, followed by /. I'll keep /home, /opt, and a new /data partition on the second (hard) drive

Here, I'm using /usr/share/mkinitrd/mkinitrd_command_generator.sh helper script to determine correct mkinitrd arguments. So say, kernel gets updated, and there is new /boot/vmlinuz-generic-4.14.67 kernel. I would run:

Code:
/usr/share/mkinitrd/mkinitrd_command_generator.sh /boot/vmlinuz-generic-4.14.67
and then in the printout there is "A suitable 'mkinitrd' command will be:" followed by mkinitrd command listed with needed arguments, that I would just copy and run to get initrd.gz created.
Okay. I used the shell script once but then returned to the command line directly. I'll use the shell script this time.

Many thanks.

Rich
 
Old 08-29-2018, 10:47 AM   #9
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by Didier Spaier View Post
It doesn't matter much in which order you put the partitions, as far as I know. I would suggest to use a GPT partition label on the both drives. This has no inconvenience as far as I know and you will have more flexibility.

Dedier,

I will use GPT partitions on both drives (and on the four external hard drives in a multibay case.) Reading about the advantages over DOS was quite eye-opening. I'll continue to use the same partition order as I have for a couple of decades because there's no reason to change ... as far as I now know.

The swap should not have a file system, the installer will propose to use it as as swap, then include it in /etc/fstab and run swapon on it.

You are, of course, correct and my fingers got ahead of my brain when I typed that. Thanks for pointing it out.

Nothing specific for UEFI. To ease installation I suggest that you first install using the huge kernel, then after installation make your initrd. Don't forget to copy the generic kernel and the initrd in /boot/efi/EFI/Slackware. You can choose to make a stanza for it in elilo.conf: then rename the generic kernel in /boot/efi/EFI/Slackware kernel-generic and edit elilo.conf accordingly (don't forget: initrd=initrd.gz). Or be sure that /boot/vmlinuz be a symlink to the generic kernel and run eliloconfig as root after having built the initrd if you want a boot entry for the generic kernel only.

Yes, the huge kernel has always been the installation default, but I then change to make the generic kernel the default (with an initrd) with the huge kernel as a backup. The UEFI process looks similar to that of lilo, but I'm making a list of what you and cgorac wrote to keep as a guide.

PS cgorac was faster this time!
Let's say that our answers complete each other
Yes, they do. And I really appreciate the education you both provided.

Best regards,

Rich
 
  


Reply

Tags
14-2, elilo, uefi booting



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 14.2 setup encrypted UEFI elilo LUKS & LVM crash GrumpyGnome Slackware - Installation 3 04-15-2017 06:25 PM
Anyone else on UEFI ditched ELILO for GRUB2 + GPT? WLD Slackware 11 12-01-2015 04:50 AM
Problem with elilo and uefi on Asus rampage 4 damgar Slackware 3 10-20-2012 08:47 PM
lilo x elilo x grup2 x UEFI afreitascs Slackware 5 09-09-2012 10:55 AM
UEFI PXE server elilo.conf configuration miszum Linux - Networking 2 08-05-2011 11:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration