Skip to content
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

Support MBR disks as boot devices #6

Open
reanimus opened this issue Jan 22, 2017 · 4 comments
Open

Support MBR disks as boot devices #6

reanimus opened this issue Jan 22, 2017 · 4 comments
Labels

Comments

@reanimus
Copy link

As it stands, the configuration for buildkernel is completely oriented toward devices that use GPT disks. This is fine (mostly), but it's caused issues for me as I use a USB key as a boot device, but also wish to use it as a data drive. Unfortunately, Windows doesn't seem to support GPT USB disks with EFI system partitions on them (as it seems to cause some weird funkiness where it tries to treat it as a single-partition disk but chooses the ESP as the partition it shows). As such, I can't use a disk with a proper EFI system partition and a separate data partition.

My solution to this is to initialize the disk as an MBR disk, create a FAT32 partition on it, and simply place the EFI directory/files/keyfile on it. It's not perfect (there's no separate partition where the boot stuff is stored separately), but it works enough for me to use the drive as both a boot key and a data drive. My EFI seems to accept these disks (and I've found most EFI implementations are fairly forgiving of MBR boot disks)

However, in order to do this with buildkernel, I've gone in and implemented a kludge. Since MBR disks have no partition UUID, you can't provide one for buildkernel to use. As a workaround, I changed PARTUUIDDEVDIR to point to /dev/disk/by-uuid/ rather than /dev/disk/by-partuuid. This uses the filesystem UUID, which both the LUKS partition and the boot key have. I also disable the lowercase fixing for the boot partition, as FAT32 UUIDs are uppercase.

Would it be possible to have more formal support for filesystem UUIDs? This kludge is a bit of an annoyance to go in and add and I also feel it would be useful for others in a similar situation.

@sakaki-
Copy link
Owner

sakaki- commented Jan 23, 2017

OK I will have a look at supporting filesystem as well as partition UUIDs. Could you pls attach a diff of your workaround buildkernel changes for initial reference?

@reanimus
Copy link
Author

https://gist.github.com/reanimus/881876812cb38a19aa9f7a0431ee92ed

This essentially makes all disks use FS UUIDs instead of the partition ones. It also doesn't account for different combinations of other options beyond having the keyfile on the boot USB. I also don't know how that affects the functionality beyond basic kernel build/copying to key.

@sakaki-
Copy link
Owner

sakaki- commented Feb 17, 2017

Hi,
I have just pushed a new topic branch, add_MBR_support, with your requested functionality added. If you run buildkernel --easy-setup (on this branch's version) there's now a Set GPT mode option. Use this to select "permissive" mode, and you should be all set. buildkernel will do its best to map by-partuuid names to by-uuid when you do this (and vice-versa should you switch back again), and all the menu options should work in either mode. You can also just edit /etc/buildkernel.conf directly if you want (I have added comments into the manpage files).
Please give this version a bit of testing and let me know if you find any issues. I'm going to try it myself for a while here before merging into master, as it is quite a significant change.

@sakaki- sakaki- added the EOL label Oct 31, 2020
@sakaki-
Copy link
Owner

sakaki- commented Oct 31, 2020

31 Oct 2020: sadly, due to legal obligations arising from a recent change in my 'real world' job, I must announce I am standing down as maintainer of this project with immediate effect. For the meantime, I will leave the repo up (for historical interest, and it may be of use to others); however, I plan no further updates, nor will I be accepting / actioning further pull requests or bug reports from this point. Email requests for support will also have to be politely declined, so, please treat this as an effective EOL notice.

For further details, please see my post here.

With sincere apologies, sakaki ><

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants