-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
pvgrub_image: add package #25724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pvgrub_image: add package #25724
Conversation
@michalpalka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @wkennington, @dezgeg and @edolstra to be potential reviewers. |
# if we include it. | ||
grub-mkimage -O ${efiSystemsBuild.${stdenv.system}.target}-xen -c grub-bootstrap.cfg \ | ||
-m memdisk.tar -o grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin \ | ||
`ls ${grub2_xen}/lib/grub/${efiSystemsBuild.${stdenv.system}.target}-xen/ |grep 'mod''$'|grep -v '^all_video\.mod''$'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use find, not ls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also don't use back ticks, but $().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And add ""s pretty much everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have put quotes around all file names with variables in them, and addressed the other changes. Please let me know if this is what you wanted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I had to revert back to using ls
instead of find
, as find produces full paths instead of just file names. If there is some specific reason not to use ls
, please let me know. Otherwise I would prefer to stay with ls
, as using find
will require adding one more processing step to the pipeline.
-m memdisk.tar -o grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin \ | ||
`ls ${grub2_xen}/lib/grub/${efiSystemsBuild.${stdenv.system}.target}-xen/ |grep 'mod''$'|grep -v '^all_video\.mod''$'` | ||
mkdir -p $out/lib/grub-xen | ||
cp grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin $out/lib/grub-xen/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The braces look unbalanced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variables also need to be quoted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you point at which braces are unbalanced here? I can't see any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have put quotes around file names here too.
@@ -0,0 +1,9 @@ | |||
if search -s -f /boot/grub/grub.cfg ; then | |||
echo "Reading (${root})/boot/grub/grub.cfg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parentheses and ${root} might make sense in a larger context, but they don't to me in this small context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parentheses are here to match Grub's config file syntax. In fact, the file has been taken from here. If you think that there is a good reason to remove them, then of course I can do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there two paths to read grub.cfg from? One is /boot/grub/grub.cfg. If we only use one, eliminate one please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the parentheses, adding the comment
The parentheses around ${root} here to match Grub's config file syntax
to the source code would work wonders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that it is a convenience feature, which allows you to have a separate /boot
partition and still use the same pre-built pvgrub image, as explained on the Xen project wiki:
Bootstrapping into this more complex grub.cfg allows us to cope with guests which have a separate /boot partition by searching for a file named /boot/grub/grub.cfg or /grub/grub.cfg on any partition. Note that ${root} is set by the search command and should be entered literally, not substituted while creating this file.
Since the Xen project wiki is advocating for this solution, I would recommend keeping it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the comment about parentheses.
description = "PvGrub image for use for booting PV Xen guests"; | ||
|
||
longDescription = | ||
'' This package provides a PvGrub image for booting PV Xen guests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a long description, so just state Paravirtualization (PV).
Thanks for the comments! I have amended the commit to address them. |
buildCommand = '' | ||
cp "${configs}"/* . | ||
tar -cf memdisk.tar grub.cfg | ||
# We include all modules except all_video.mod as otherwise grub will fail printing "no symbol table" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://wiki.xenproject.org/wiki/Xen_EFI lists all_video.mod in one particular configuration, so your statement doesn't seem precise enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is based on my observation that pvgrub fails when we include that module. The website that you linked to concerns booting Xen itself using EFI, which requires compiling grub as an EFI loader. The all_video.mod
module is probably working in that setup, which does not contradict what I wrote. Please let me know if I should include any clarification in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michalpalka I like content without words like "I believe" or "probably" better than content that just guesses something.
While I understand it's hard to know everything, striving to documenting the reasons for failures makes it possible to improve things later on.
It has already been merged, which is good for continuity, but if you do have a superior understand of exactly why things happen the way they do with all_video.mod, please document it.
Add a package containing a pvgrub image for xen generated from grub2
Add a package containing a pvgrub image for xen generated from grub2
Motivation for this change
This package provides a
pvgrub
image for booting PV guests in xen. Currently, xen in NixOS also providespygrub
, but it can be used only to boot guests that use older grub utilisingmenu.lst
, and fails with new NixOS guests, for example.I would appreciate if someone takes a look at this before merging.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)