help-grub
[Top][All Lists]
Advanced

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

Re: Using "grub-mkimage -c" for a USB holding multiple /boot partitions.


From: Jordan Uggla
Subject: Re: Using "grub-mkimage -c" for a USB holding multiple /boot partitions.
Date: Thu, 18 Dec 2014 16:31:23 -0800

On Thu, Dec 18, 2014 at 12:35 PM, Diagon <address@hidden> wrote:
> Hi folks. Just finished reading the manual, and trying to figure if what I
> want to do is doable.
>
> I see that I can install a config file into grub, using "grub-mkimage -c".
> I'd like the config file to do something like this:
>
>    If (this is my laptop) then (run the config file in Partition 1)
>    else if (this is my desktop) then (run the config file in Partition 2)
>    else (run the config file in Partition 3)

The above doesn't seem to depend on having an embedded config at all.
I highly recommend simply having a grub.cfg file on the USB drive that
implements this logic, and using a standard grub-install invocation to
install grub.

>
> The idea being to have one USB stick that hold multiple boot partitions, one
> for each of my machines, plus one for an OS that completely resides on the
> USB.
>
> For this to work, I need some way of probing some characteristics of the
> machine, to figure out which one I'm on.  I won't be able to probe the disks
> for UUID's since they will be encrypted, holding nothing but apparently
> random data.  I tried cpuid, but even after insmod'ing it, it's response is
> completely empty (at least on my laptop).  I don't see anything else here I
> might be able to use.  Thoughts?

cpuid is for checking for specific cpu features, and returns a 0 exit
status if the feature is supported, and 1 if not. There are only two
feature checks currently supported, described in the output of "help
cpuid":

grub> help cpuid
Usage: cpuid [-l]
Check for CPU features.

-l, --long-mode         Check if CPU supports 64-bit (long) mode (default).
-p, --pae               Check if CPU supports Physical Address Extension.
-h, --help              Display this help and exit.
-u, --usage             Display the usage of this command and exit.

Since most CPUs today support both pae and long mode this command
probably won't help for your purposes.

The "hwmatch" command might be useful for you, but unfortunately it's
an Ubuntu specific addition that hasn't made its way upstream.

>
> On a related issue that may be more appropriately asked elsewhere (?), how
> do I get a Debian-like system (Ubuntu) to insert that config into grub (or
> use the new core.img) when grub updates?

It seems like this USB drive should be manually configured and
independent of the OSs, and thus shouldn't be automatically updated in
any way.

>
> Thnks!
> /D
>
> _______________________________________________
> 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]