-
Notifications
You must be signed in to change notification settings - Fork 40
efi: rewrite ensure_mounted_esp()
#932
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
Conversation
|
Skipping CI for Draft Pull Request. |
aacbb09 to
d34bf3b
Compare
ensure_mounted_esp()
314c7ba to
ea09938
Compare
|
Ready for review now, thanks! |
cgwalters
left a 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.
Looks reasonable to me overall, I just have some nits
9c9c6c7 to
a85552e
Compare
cgwalters
left a 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.
It looks like the cosa build is legitimately failing.
|
Seems the |
3ff06fe to
950feab
Compare
|
/test test |
950feab to
ed38ae0
Compare
Split into 2 parts: - `get_mounted_esp()` to get mounted point esp - `mount_esp_device()` to mount the passed esp device, return the mount point Then in `ensure_mounted_esp()` call the above 2 functions: firstly check if esp is already mounted, if not, mount the passed esp device.
ed38ae0 to
53ea47f
Compare
| log::debug!("Found metadata {}", meta.version); | ||
| let srcdir_name = component_updatedirname(self); | ||
| let ft = crate::filetree::FileTree::new_from_dir(&src_root.sub_dir(&srcdir_name)?)?; | ||
| let destdir = &self.ensure_mounted_esp(Path::new(dest_root))?; |
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 can't we keep calling this one to do the "mount if not mounted" logic?
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.
Good question. After change, the function ensure_mounted_esp() will check if esp is already mounted, else mount the passed esp device, return the mount point and append path /EFI.
For installation, during bootc install to-disk, the esp device is not mounted and will call get_esp_device() to get esp device via /dev/disk/by-partlabel, but when running cosa build, not sure if it would also call bootc, find that esp device is already mounted, and can not find esp device via /dev/disk/by-partlabel (do not why). Before I use esp_device = self.get_esp_device() before ensure_mounted_esp(), but cosa build failed.
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.
If failed get_esp_device() (via /dev/disk/by-partlabel), change to get_esp_partition(device) (via sfdisk).
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.
According to comment, use blockdev to find the partition, instead of partlabel.
c17b92c to
e0cfb73
Compare
d2716e4 to
5998d92
Compare
dustymabe
left a 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.
LGTM - a few small suggestions
5998d92 to
e4b7a71
Compare
instead of `partlabel` Copy Dusty's comment from https://github.com/coreos/bootupd/pull/932/files#r2112567301: During `bootc install to-disk` the esp device is not mounted but we can call `get_esp_device()` and it will find the device via the `/dev/disk/by-partlabel/` symlink. When running `cosa build` and building a disk image using `OSBuild` the EFI partitions is mounted but no udev `/dev/disk/by-partlabel/` symlinks exist because it's just a chroot and not a full linux environment. In that case fallback to using `blockdev` to find the partition. Even better, get rid of `self.get_esp_device()` altogether and just use `blockdev`
e4b7a71 to
f6ef3d1
Compare
dustymabe
left a 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.
LGTM - merge when ready
This is the preparation for #855.
The main target for this PR is: "efi: rewrite
ensure_mounted_esp()", but find there are much to update consequently.efi: rewrite
ensure_mounted_esp()Split into 2 parts:
get_mounted_esp()to get mounted point espmount_esp_device()to mount the passed esp device, returnthe mount point
Then in
ensure_mounted_esp()call the above 2 functions:firstly check if esp is already mounted, if not, mount the passed
esp device.
efi: update
install()andupdate()according to split changeadopt_update: pass
RootContextas parameterefi: update
validate()according to the split change