--- title: Gentoo Tips, Tricks & Shenanigans description: These are Gentoo relevations which surprised me at some point, along with nice to haves. published: true date: 2022-04-30T20:10:31.949Z tags: gentoo, performance editor: markdown dateCreated: 2021-09-02T08:10:07.601Z --- Below are stuff I found out about Gentoo. # Moving package from Testing to Stable Gentoo's testing branch (`~arch`) is actually quite stable. However, in case you'd like to keep something on stable for whatever reason (I encountered this with the kernel, trying to Clang it), you can mask the `~amd64` keyword under `/etc/portage/package.accept_keywords/your_package`. Example: ```bash /etc/portage/package.accept_keywords/gentoo-sources: sys-kernel/gentoo-sources -~amd64 ``` That is, if your `/etc/portage/make.conf` contains ~amd64, you can un-`~amd64`-it this way. Noice! # Clang Clang is an LLVM frontend and an alternative to GCC. Clang has recently [surpassed GCC](https://www.phoronix.com/scan.php?page=article&item=clang12-gcc11-icelake&num=6) performance wise, as well as being easier to set up for goodies like LTO. [Gentoo's wiki page](https://wiki.gentoo.org/wiki/Clang) lays out how to use Clang as a system compiler instead of GCC - but note the few caveats below: > READ THE INSTRUCTIONS CAREFULLY! the order is crucial and is not chronological! {.is-danger} - All DE's tested (KDE5, GNOME3) require `samba`, and `samba` requires GCC's own `libunwind`. Hence, when following instructions above, do not use `llvm-libunwind` (unfortunately). This is only relevant for GUI installations - servers are fine. - Clone the [Portage Git repository](http://git.pukeko.xyz/shmick/portage.git) for necessary overrides back to GCC (such as Python3, GNU libc). - Use `flto=thin`. It's easy and it works great. - > Use `LDFLAGS` per compiler - when adding Clang's `LDFLAGS` to the global `make.conf`, GCC also reads them (and fails!). {.is-warning} - Use ninja for faster compile times. - if following [Compiling on the RAM](/Compiling_on_RAM) When building Clang itself, unmount `/var/tmp/portage` - it doesn't play nicely. Happy compiling! # Virtualizing with UEFI on QEMU When trying to create a UEFI VM on `virt-manager`, some settings will lead to a blank screen. In order to use UEFI: - emerge the UEFI firmware - `sys-firmware/edk2-ovmf` - restart libvirtd if running - when creating a VM, select the Q35 chipset (440FX does not work), and use the `secure_code` option - `UEFI x86_64: /usr/share/qemu/edk2-x86_64-secure-code.fd`. > Reference: https://forums.gentoo.org/viewtopic-t-1066336-start-0.html {.is-info} # The `Makefile` is just a file! You can read it! you can tweak it! yay! > Thanks, [Gentoo-folk](https://forums.gentoo.org/viewtopic-t-1140180.html)!