schierlm / usb-modboot

Boot multiple systems from a single GRUB2-powered USB drive (just drop ISO or other modules to integrate into menu)
GNU General Public License v3.0
42 stars 4 forks source link

Using usb-modboot as rescue-system on existing UEFI systems (usb-modboot v0.9) #4

Closed de-ramon closed 6 years ago

de-ramon commented 6 years ago

Hi,

in order to boot grml or other live-systems supported by usb-modboot directly from harddisk based UEFI-installations I tried to install usb-modboot into the ESP.

Win10 Installation

sda      8:0    0   100G  0 disk 
├─sda1   8:1    0   9.8G  0 part /boot/efi        # ESP
├─sda2   8:2    0    16M  0 part                  # MSR
├─sda3   8:3    0  89.7G  0 part                  #3  Win10
└─sda4   8:4    0   500M  0 part                  # Recovery

The 10 GB ESP hold usb-modboot:

root@grml / # tree -d /boot/efi/EFI
/boot/efi/EFI
├── Boot
│   ├── icons
│   ├── icons-backup
│   └── keys
├── Microsoft
│   ├── Boot
.....
│   └── Recovery
├── refind
│   ├── icons
│   ├── icons-backup
│   └── keys
├── tools
│   └── efifs
└── usb-modboot

I copied the stuff normaly resideing in usb-modboot-device/efi into /boot/efi/EFI/usb-modboot (sda1/EFI/usb-modboot).

Using rEFInd I can boot the EFI-Stuff shipped with the usb-modboot-modules, e.g. memtest.efi successfully.

Even the EFI/usb-modboot/loader.efi starts, but if I select "Continue to boot menu" nothing happens..

Invoking EFI/usb-modboot/grub.efi shows:

Starting grub.efi
Using load options ' ' 
Welcome to GRUB!

error: unknown filesystem.
error: disk 'core' not found.
Entering rescue mode....
grub rescue>

Any hints? I uses VirtualBox for the tests. In order to get rEFInd running, you have to "patch" a little bit: https://bbs.archlinux.org/viewtopic.php?pid=1231228#p1231228

cu, ramon

schierlm commented 6 years ago

You will probably need to rebuild grub.efi and make sure part_gpt is compiled into core.img instead of as a module. Maybe you need others too.

https://github.com/schierlm/usb-modboot/blob/master/build-grub#L37

de-ramon commented 6 years ago

Hi Michael, thank you so much :)

It work's and it's cool :)

Here my mini HowTo:

Generate GPT capable grub.efi

Boot UEFI system with linux (here: grml64-full_2017.05.iso, because only Win10 is installed)

mkdir /boot/efi
mount /dev/sda1 /boot/efi
cd /root # no need to save build-files on hd! Live-System /root is ok
git clone https://github.com/schierlm/usb-modboot.git
cd /root/usb-modboot
vim build-grub +37 # edit line 37 as mentioned above to include part-gpt

old and new line 37:

...
# ./grub-mkimage -d ./grub-core -O x86_64-efi -o ../../../dist/usb-modboot/efi/boot/grub.efi -p '' -c ../confscript_efi fat part_msdos loopback
./grub-mkimage -d ./grub-core -O x86_64-efi -o ../../../dist/usb-modboot/efi/boot/grub.efi -p '' -c ../confscript_efi fat part_msdos part_gpt loopback
...

Build new grub.efi

apt update
apt install build-essential unzip gettext libfreetype6-dev dosfstools autoconf automake bison flex xfonts-unifont python ca-certificates git
./build-grub
./build-main

Install usb-modboot to ESP

mkdir /boot/efi/usb-modboot # holds usb-modboot-files as normal
mkdir /boot/efi/EFI/usb-modboot # just holds efi-loader

cp /root/usb-modboot/dist/usb-modboot/efi/boot/grub.efi /boot/efi/EFI/usb-modboot/grub-gpt_x64.efi
cp /root/usb-modboot/dist/usb-modboot/usb-modboot/* /boot/efi/usb-modboot

Put ISO in usb-modboot-folder

cd /boot/efi/usb-modboot
wget http://download.grml.org/grml64-full_2017.05.iso
wget http://download.grml.org/grml64-full_2017.05.iso.sha1
sha1sum -c grml64-full_2017.05.iso.sha1

If rEFInd is installed, just reboot:

usb-modboot_hd_1 usb-modboot_hd_2 usb-modboot_hd_3 usb-modboot_hd_4

cu, ramon