1

for a few days, I googled everywhere to see if someone ever had the same issues as I do. here is my linux kernel on my Lenovo Z50-70 ( maybe it's important)

 $ uname -a
Linux Z50-Debian 4.7.0-1-amd64 #1 SMP Debian 4.7.8-1 (2016-10-19) x86_64 GNU/Linux

 $ lvdisplay  |grep -i path
  LV Path                /dev/Debian/Home
  LV Path                /dev/Debian/Root
  LV Path                /dev/Debian/Swap

# gdisk /dev/sda -l |grep 0
GPT fdisk (gdisk) version 1.0.1
Disk identifier (GUID): 4A75B640-D8A2-03A2-906D-9D9228B6E800
Partitions will be aligned on 2048-sector boundaries
Total free space is 3707 sectors (1.8 MiB)
   1            2048         3653631   1.7 GiB     2700  Basic data partition
   2         3653632         4601855   463.0 MiB   EF00  EFI system partition
   3         4601856         6752255   1.0 GiB     EF00  Basic data partition
   4         6752256         7014399   128.0 MiB   0C01  Microsoft reserved ...
   5         7014400       907063665   429.2 GiB   0700  Basic data partition
   6       907065344       908787711   841.0 MiB   2700  
   7       908787712       910155775   668.0 MiB   EF00  
   8       910155776       953745407   20.8 GiB    8E00  Linux
   9       953745408       976773119   11.0 GiB    2700  Basic data partition

I've followed two guides to use efi-stub (the kernel UEFI self-bootlaoder)

official debian wiki on efistub and bitbinary guide on debian and efistub

but none of them worked.

issue 1: My firmware doesn't find the EFI/Debian/vmlinuz.efi ( but it did find rEFInd efi app, as well as grub when I first installed Debian)

issue 2: when starting the vmlinuz.efi through rEFInd, It stop the boot process with a initramfs prompt and errors telling me it couldn't mount/find root.

also

cat /proc/cmdline 

does not echo my /proc/cmdline, but a generic one without any specified option for root mounting

issue 3: as on the guide i've used efibootmgr, but as each reboot my new entry is deleted.

I'm fairly new to the (U)EFI world, but I really wish I could make this work. As I'm pretty much out of ideas for now, if you know anything that could help me, please shout it out !

Thank you.

2
  • Why do you do that in the first place, did the conventional installer procedure fail? You seem to go in the direction that's hard to be done "distribution way" (I've implemented UEFI support in ALT Linux), but if you insist on that, Rod Smith's rodsbooks.com/efi-bootloaders is a gem to study first. Oct 29, 2016 at 14:31
  • I'm just trying to learn how to use the kernel UEFI capabilities (I really wanna master UEFI), debian uses grubx64.efi by default , and I find adding another layer of software just to change the OS (when I can do it with my UEFI firmware) is kind of useless, and will slow down a PC that isn't really fast in the first place. I already saw Rod's guie, but I hoped that there was another way than rebuilding my kernel ( especially since I will mostly have to do this often, just to have an up-to-date kernel
    – MacCrow
    Oct 31, 2016 at 12:04

2 Answers 2

0

This question is old but since it has no answer and I have recently booted by system with the mentioned configuration ,let me write how I did it. My spec : OS: arch Linux (mainline kernel, Linux -zen , linux-clear). System : HP laptop with UEFI 2.

Apart from that I we as also trying to set up secure boot with my own keys (which further complicated set up ). But i won't be touching that part here.

First thing you need to do is configure your initramfs/initrd/ ramdisk to have the proper hooks. That's the gist of the whole problem you are having (probably, and I did too). I am only experienced with how arch Linux builds its ramdisk/initramfs. You may have to convert the process for debian (or any other distribution that you may be using ).

I started with three hooks available in the makinitcpio initramfs building process: base hook ( this is the main and necessary hook ) udev hook ( it does the detection of the necessary parts of the system including the hard disk and root filesystem ). LVM hook ( since you have LVM, this hooks would include the device mapper and set up the LVM volumes ).

Building the EFISTUB.

Use the objcopy tool from the binutils package.

objcopy
--add-section .osrel="/etc/os-release" --change-section-vma .osrel=0x20000
--add-section .cmdline=<(echo -n "${cmdline}") --change-section-vma .cmdline=0x30000
--add-section .splash="${SPLASH}" --change-section-vma .splash=0x40000
--add-section .linux="${linux}" --change-section-vma .linux=0x2000000
--add-section .initrd=<(cat "${INITRD_PREPEND[@]}" "${initrd}") --change-section-vma .initrd=0x3000000
"${EFISTUB}" "${output}" wait $!

The above command basically takes your kernel , iniramfs and the kernel parameters and converts them to a single EFISTUB which you can directly boot from the firmware (UEFI firmware).

Here: $cmdline is basically your kernel parameters and it must at least contain the root path e.g in your case root=/dev/Debian/root $SPLASH should be an image that you want to display as the splash screen on boot up.

$EFISTUB is the generic linuxx64.efi.stub that comes with systemd. On Arch Linux , it is generally placed under /use/lib/systemd/efi/ directory.

$output is the location where you want to output the file which should obviously be in the ESP (EFI System partition) so the firmware can detect it.

Then with the help of efibootmgr, you can make a boot entry of the newly created EFISTUB:

efibootmgr -c -d /dev/sda -p 2 -L "Debian EFISTUB" -l /efi/EFI/debian/linux-efi.efi

In the above example: -c stands for create (to create a new boot entry ) -d is for pointing to the disk where the ESP is. -p points to the partition number of that disk. -L is for giving a suitable Label for the boot entry. -l points to the loader (basically the efistub). I assumed that is placed under EFI/debian directory in the ESP and which is mounted under /efi.

Tips: while wokring on booting efistub, i found it very handy to have the UEFI shell. You can try many things from that shell including booting a kernel efi stub with custom kernel parameters etc.

The guide above here is booting EFISTUB WITHOUT THE HELP OF ANY BOOT LOADER. If you are booting multiple OSes then you may add a boot loader to manage the different efistubs or OSes.

1
  • I wrote It from a handset , with format it when I get to my PC. Jun 1, 2021 at 15:38
-2

I think, you can do so that find debian installiation disk and plug to PC. Then boot from disk and pass troubleshooting menu and recovery vmlinuz files and other boot files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.