[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub-mkimage

From: Andrei Borzenkov
Subject: Re: grub-mkimage
Date: Mon, 24 Jan 2022 21:11:04 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 24.01.2022 17:53, Pascal wrote:
> hi,
> I use grub successfully to boot my removable "UEFI only" roaming live
> system.
> I use grub-mkimage as follows to generate the EFI executable :
> cat > /tmp/cfg <<< "normal /efi/menu.cfg"
> grub-mkimage  \
>   --disable-shim-lock  \
>   -p "(,gpt2)/efi/boot/"  \
>   -o /run/live/bootmnt/efi/boot/bootx64.efi  \
>   -O x86_64-efi  \
>   -c /tmp/cfg  \
>   linux normal minicmd gzio efi_uga efi_gop fat part_gpt chain
> cat > /run/live/bootmnt/efi/menu.cfg <<~~~~
> insmod linux normal minicmd gzio efi_uga efi_gop fat part_gpt
> menuentry "My Live Linux" {
>       linux …
>       initrd …
> }
> ~~~~
> the executable being really minimal, I can't do much with it when I
> encounter a boot problem.
> so, I set up another EFI executable next to it, this time with all the
> available modules :
> mods=$( ls -1 /usr/lib/grub/x86_64-efi/*.mod | sed -e
> 's;/usr/lib/grub/x86_64-efi/;;g' -e 's/\.mod$//g' | tr '\n' ' ' )
> echo $mods
> acpi adler32 affs afs afsplitter ahci all_video aout appleldr archelp
> at_keyboard ata backtrace bfs bitmap bitmap_scale blocklist boot boottime
> bsd bswap_test btrfs bufio cacheinfo cat cbfs cbls cbmemc cbtable cbtime
> chain cmdline_cat_test cmp cmp_test configfile cpio cpio_be cpuid crc64
> crypto cryptodisk cs5536 ctz_test date datehook datetime disk diskfilter
> div div_test dm_nv echo efi_gop efi_uga efifwsetup efinet ehci elf eval
> exfat exfctest ext2 extcmd f2fs fat file fixvideo font fshelp
> functional_test gcry_arcfour gcry_blowfish gcry_camellia gcry_cast5
> gcry_crc gcry_des gcry_dsa gcry_idea gcry_md4 gcry_md5 gcry_rfc2268
> gcry_rijndael gcry_rmd160 gcry_rsa gcry_seed gcry_serpent gcry_sha1
> gcry_sha256 gcry_sha512 gcry_tiger gcry_twofish gcry_whirlpool geli gettext
> gfxmenu gfxterm gfxterm_background gfxterm_menu gptsync gzio halt hashsum
> hdparm hello help hexdump hfs hfsplus hfspluscomp http iorw iso9660 jfs
> jpeg json keylayouts keystatus ldm legacy_password_test legacycfg linux
> linux16 loadbios loadenv loopback ls lsacpi lsefi lsefimmap lsefisystab
> lsmmap lspci lssal luks luks2 lvm lzopio macbless macho mdraid09
> mdraid09_be mdraid1x memdisk memrw minicmd minix minix2 minix2_be minix3
> minix3_be minix_be mmap morse mpi msdospart mul_test multiboot multiboot2
> nativedisk net newc nilfs2 normal ntfs ntfscomp odc offsetio ohci
> part_acorn part_amiga part_apple part_bsd part_dfly part_dvh part_gpt
> part_msdos part_plan part_sun part_sunpc parttool password password_pbkdf2
> pata pbkdf2 pbkdf2_test pcidump pgp play png priority_queue probe procfs
> progress raid5rec raid6rec random rdmsr read reboot regexp reiserfs
> relocator romfs scsi search search_fs_file search_fs_uuid search_label
> serial setjmp setjmp_test setpci sfs shift_test signature_test sleep
> sleep_test smbios spkmodem squash4 strtoull_test syslinuxcfg tar terminal
> terminfo test test_blockarg testload testspeed tftp tga time tpm tr trig
> true udf ufs1 ufs1_be ufs2 uhci usb usb_keyboard usbms usbserial_common
> usbserial_ftdi usbserial_pl2303 usbserial_usbdebug usbtest video
> video_bochs video_cirrus video_colors video_fb videoinfo videotest
> videotest_checksum wrmsr xfs xnu xnu_uuid xnu_uuid_test xzio zfs zfscrypt
> zfsinfo zstd
> grub-mkimage  \
>   --disable-shim-lock  \
>   -p "(,gpt2)/efi/boot"  \
>   -o /run/live/bootmnt/efi/boot/helpx64.efi  \
>   -O x86_64-efi  \
>   -c /tmp/cfg  \
>   $mods
> however, when I choose to boot this one, I get the following error :
> error: disk `,gpt2' not found.
> error: you need to load the kernel first.
> does anyone know why the *minimal* is fully functional while the *maximal*
> refuses to consider (,gpt2)/efi/boot/ ?

Modules listed in grub-mkimage are intended only for access to /boot/grub
directory and are initialized when grub image is executed. One of modules
is nativedisk which replaces firmware disk drivers with native drivers (like
ahci. usb, etc). These driver are using different name conventions so none of
them recognizes gpt2. Moreover, I am not really sure whether those drivers
will work under UEFI at all (they compete with UEFI for hardware access).

If you need image with more grub modules consider using grub-mkstandalone. It
creates image with embedded RAM disk and sets $prefix to refer to this disk.
So you have usual grub environment with modules autoloading and avoid this
problem. You can chose which modules are included into RAM disk. You can also
create usual grub.cfg on this RAM disk which boots whatever you like 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]