acidanthera / bugtracker

Acidanthera Bugtracker
383 stars 44 forks source link

[Feature Request] Icons for custom boot entries #1042

Closed tkashkin closed 4 years ago

tkashkin commented 4 years ago

If I understand documentation and code correctly there's currently no way to set icons for custom boot entries except using .VolumeIcon.icns. I'd like to be able to set icons for entries like it's currently possible for tools.

I have a slightly unusual multiboot setup (macOS, Windows and multiple Linux distros). All EFI bootloaders are located on one ESP so .VolumeIcon.icns won't work for a case like this.

The easiest solution would probably be to try to append .icns to entry's Path and load that. It should be consistent with how tools icons currently work.

ESP file structure * `EFI` * `BOOT` - `BOOTx64.efi` - OpenCore * `Microsoft` * `Boot` - `bootmgfw.efi` - Windows bootloader - __`bootmgfw.efi.icns` - custom icon should probably be loaded from here if that's how it currently works for tools__ * `OC` - OpenCore * `linux` - Linux efistubs and initrds are here * `fedora` - `initrd.img` - ramdisk - `vmlinuz.efi` - kernel - __`vmlinuz.efi.icns` - custom icon should probably be loaded from here__ * ... (more subdirs like `fedora` for other distros)

That's how it is setup in config.plist:

<plist version="1.0">
<dict>
    <key>Misc</key>
    <dict>
        <key>Entries</key>
        <array>
            <dict>
                <key>Name</key>
                <string>Windows</string>
                <key>Enabled</key>
                <true/>
                <key>Path</key>
                <string>PciRoot(0x0)/[Full path to ESP]/\EFI\Microsoft\Boot\bootmgfw.efi</string>
                <key>Arguments</key>
                <string></string>
            </dict>
            <dict>
                <key>Name</key>
                <string>Fedora</string>
                <key>Enabled</key>
                <true/>
                <key>Path</key>
                <string>PciRoot(0x0)/[Full path to ESP]/\EFI\linux\fedora\vmlinuz.efi</string>
                <key>Arguments</key>
                <string>root=UUID=baacb13a-a97a-4bfc-a83c-a47eb5ade9f5 ro rootflags=subvol=@fedora initrd=\EFI\linux\fedora\initrd.img mitigations=off quiet splash nouveau.modeset=0</string>
            </dict>
            <!-- Other distros are also here -->
        </array>
    </dict>
</dict>
</plist>

I tried to setup entries as tools, OpenCore loads icons for tools but fails to boot them.

How it was setup in Clover previously Entries have `Image` property which should accept builtin icon name or path relative to current theme. ```xml Arguments root=UUID=baacb13a-a97a-4bfc-a83c-a47eb5ade9f5 ro rootflags=subvol=@fedora initrd=\EFI\linux\fedora\initrd.img mitigations=off quiet splash nouveau.modeset=0 FullTitle Fedora Hotkey F Image icons\os_fedora.icns Path \EFI\linux\fedora\vmlinuz.efi Type Linux Volume ESP ```
Andrey1970AppleLife commented 4 years ago

In yours ESP file structure, different bootloaders in different folders, I don't see a problem.

kommtzeitkonrad commented 4 years ago

If I understand documentation and code correctly there's currently no way to set icons for custom boot entries except using .VolumeIcon.icns.

Don't think about how to set this in OpenCore. Instead look up how to solve this on a real Mac.

To achieve what you want to have, you can follow the instructions in this link (ignore naming convention for grub.efi). Bonus: You can select all your multiple Linux distros in Startup Disk.

tkashkin commented 4 years ago

So should I:

I'm not sure if I can use Linux partitions for this since I have 4 distros on a single btrfs partition with subvolumes. Maybe btrfs EFI driver could work, but does it support subvolumes?

Also I don't think it's possible to pass arguments to the kernel this way. I'd like to avoid having to chainload GRUB or something else just to pass arguments. I'd also like to avoid having another bootloader and chainload REFInd/Clover/... -> OpenCore -> macOS.

All I care about here are the icons in OpenCore's GUI, everything else already works (except Startup Disk, but I don't really care about that). I don't think custom entries shouldn't support icons while tools support them already.

vit9696 commented 4 years ago

Well, ok. I can reopen this. I think both Tools and Custom entries can support manually specified icons from OpenCore ESP partition, but I will not work on this. If anybody is interest, he can discuss the design here, and then submit a PR.

kommtzeitkonrad commented 4 years ago

So should I:

  • Create a separate APFS volume or HFS+ partition (or FAT32 partition if it works) for each bootloader (Windows + 4 Linux distros in my case)

Create /boot partitions (real GPT partitions, no Btrfs subvolumes) for each Linux distro in HFS+.

Make sure journaling is disabled, when creating them in macOS. When creating partitions from Linux, journaling is not enabled using mkfs.hfsplus from hfsprogs package. Don't forget to edit your /etc/fstab and do whatever you always do with your /boot partition.

  • Put .VolumeIcon.icns, mach_kernel, SystemVersion.plist and boot.efi on it

Yes! To have your command line parameters passed, the kernel and the parameters can be combined into a unified kernel image. Just put this to /boot/System/Library/CoreServices/boot.efi.

A more easier approach would be to link .../boot.efi to /boot/grub/x86-64-efi/core.efi and set GRUB_TIMEOUT=0.1 in /etc/default/grub, which also immediately boots your kernel (if that is your only problem regarding GRUB).

  • bless each bootloader

You do not need to bless the file since /System/Library/CoreServices/boot.efi is a predefined path in Open Core.

I'm not sure if I can use Linux partitions for this since I have 4 distros on a single btrfs partition with subvolumes. Maybe btrfs EFI driver could work, but does it support subvolumes?

I don't know, but every time I'm using filesystem drivers from elsewhere I'm running into trouble in OpenCore

Regarding Windows: /EFI/OC/Resources/Image/Windows.icns should be automatically selected for the default MS path.

13010405