help-grub
[Top][All Lists]
Advanced

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

Re: How to use grub-mkimage prefix?


From: Andrei Borzenkov
Subject: Re: How to use grub-mkimage prefix?
Date: Thu, 3 Nov 2016 18:34:45 +0300

On Wed, Nov 2, 2016 at 4:23 PM, J. Eppler <address@hidden> wrote:
> On 11/01/2016 01:35 PM, Andrei Borzenkov wrote:
>> 01.11.2016 19:39, J. Eppler пишет:
>>> Hello,
>>>
>>> I use the following command to create a grub image:
>>>
>>> ~~~
>>> ./grub-mkimage --verbose --output=out/grubaa64.efi
>> grub-mkimage is internal tool that is not intended to be used directly
>> for day to day grub installations. What are you trying to do and why
>> provided tools (grub-install, grub-mkstandalone and several others) are
>> not enough?
> What I try to do is cross-compile Grub2 for arm64 (also called aarch64)
> for the HiKey board. I use a x86_64 virtual machine running Debian
> "Stretch" (Testing) on my Laptop to cross-compile Grub2.
>
> I use grub-mkimage, because the developer from the HiKey board gave me
> some instructions (see:
> http://www.96boards.org/forums/topic/grub2-cant-find-command-multiboot-and-module/#post-16820).

Yes, instructions there are incomplete. When you use tools and modules
from build directory directly, you need to use "--directory grub-core"
prefix - it is where just built stuff is located. Otherwise tools
attempt to locate them under standard prefix (which is probably
something like /usr/local/lib/grub).

I.e. it is always

./grub-mkimage -d grub-core ...

As you supply embedded config that sets prefix, you may simply use
--prefix "" to set empty prefix. Actually, having empty prefix
triggers some internal magic to autodetect it.

> I try to adjust the instructions to my own needs, but have little to no
> experience with the Grub2 commands, such as grub-mkstandalone. In short
> I am happy about every advice, hint and help I can get.
>

grub-mkstandalone creates memory disk with all grub modules and other
support files and configures grub to use $prefix that points to it.
You can augment files list and put anything else on this memory disk;
where "anything else" includes /boot/grub/grub.cfg *on memory disk*.
That has advantage of having full grub available and having full power
of grub scripting language in /boot/grub/grub.cfg. Note that embedded
config is processed in much less reach environment.

Other consideration is, everything you add to modules list in
grub-mkimage will be unconditionally loaded and started when grub
itself starts. There are cases of mutually incompatible modules that
should *not* be loaded at the same time.

Of course above remark of --directory option applies here too as long
as you use build directory without installing first.

>>> --config=out/grub.configfile --format=arm64-efi $GRUB_MODULES
>>> Prefix not specified (use the -p option).
>>> Usage: ./grub-mkimage [OPTION...] [OPTION]
>>> ~~~
>>>
>>> I get the message: "prefix not specified". My problem is that I do not
>>> understand what the prefix directory should be. The man page
>>> `grub-mkimage` for the -p option only says: "set prefix directory". It
>>> does not explain what a prefix directory value could be nor does it
>>> explain the function of the prefix directory.
>>>
>> Prefix is location of /boot/grub from grub point of view. Normally all
>> other modules and configuration files are searched for relative to
>> $prefix. grub always needs to know $prefix value which is why it is
>> mandatory.
>>
>>> ---
>>>
>>> Appendix
>>>
>>> config file:
>>>
>>> ~~~
>>> $ cat out/grub.configfile
>>> search.fs_label rootfs root
>>> set prefix=($root)'/boot/grub'
>>> configfile $prefix/grub.cfg
>>> ~~~
>>>
>>> grub modules:
>>>
>>> ~~~
>>> GRUB_MODULES="boot chain configfile echo efinet eval ext2 fat font
>>> gettext gfxterm gzio help linux loadenv lsefi normal part_gpt part_msdos
>>> read regexp search search_fs_file search_fs_uuid search_label terminal
>>> terminfo test tftp time xen_boot"
>>> ~~~
>>>
>>> best regards
>>>   J. Eppler
>>>
>>> _______________________________________________
>>> Help-grub mailing list
>>> address@hidden
>>> https://lists.gnu.org/mailman/listinfo/help-grub
>>>
>



reply via email to

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