Skip to content

Instantly share code, notes, and snippets.

@Vicfred
Last active July 1, 2025 07:49
Show Gist options
  • Save Vicfred/9800506fadb1daaa965e352d9a7762a7 to your computer and use it in GitHub Desktop.
Save Vicfred/9800506fadb1daaa965e352d9a7762a7 to your computer and use it in GitHub Desktop.
qemu kvm gentoo make.conf

no need separate /boot partition for BIOS on qemu EFI requires extra work to configure on qemu, BIOS is enough

/etc/portage/make.conf

#------------------------------------------------------------------------------
# CPU & optimization flags
#------------------------------------------------------------------------------
# march=znver4      → tune for AMD Zen 4 (Ryzen 7000 series)
# O2                → safe optimization level
# pipe              → use pipes rather than temp files
# fstack-protector-strong → lightweight stack smashing protection
# fomit-frame-pointer    → omit frame pointers for a bit more speed
COMMON_FLAGS="-march=native -O2 -pipe -fstack-protector-strong -fomit-frame-pointer"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j31 -l16"

ABI_X86="64"
LC_MESSAGES=C.utf8

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"

# qemu uses BIOS by default, EFI requires extra configuration.
GRUB_PLATFORMS="pc"

# Check active USE flags with `emerge --info`.
USE="$USE udev"
USE="$USE -bindist -ipv6 -libtirpc -man -multilib -systemd -test-rust -wayland -X"

GENTOO_MIRRORS="https://mirror.rackspace.com/gentoo/"

things to consider in the kernel configuration ARCH=x86_64 make defconfig

  • General setup
    • Default hostname
    • Kernel .config support
    • Initial RAM filesystem and RAM disk (initramfs/initrd) support
    • Profiling support
  • Processor type and features
    • Disable either everything Intel or everything AMD
    • Support for extended (non-PC) x86 platforms
    • Linux guest support
    • EFI runtime service support
  • Power management and ACPI options
    • Suspend to RAM and standby
    • Hibernation (aka 'suspend to disk')
  • Binary Emulations
    • IA32 Emulation
  • Virtualization
  • Enable loadable module support
  • Networking support
    • Networking options
      • The IPv6 protocol
    • Wireless to disable you must disable the driver first
  • Device Drivers
    • PCCard (PCMCIA/CardBus) support
    • Misc devices
    • SCSI device support disable everything you can
    • Serial ATA and Parallel ATA drivers (libata)
    • Multiple devices driver support (RAID and LVM)
    • Macintosh device drivers
    • Network device support
      • Virtio network driver this is enough for qemu, dont need the ethernet one
      • Ethernet driver support
      • USB Network Adapters
      • Wireless LAN
    • Input device support
      • Mouse interface
      • Joystick interface
      • Keyboards you can disable this if you only ssh but keyboard stops working in the vm directly
      • Mice
      • Joysticks/Gamepads
      • Tablets
      • Touchscreens
      • Miscellaneous devices
      • Graphics support
      • Sound card support
      • HID bus support
      • USB support
      • Microsoft Surface Platform-Specific Device Drivers
      • X86 Platform Specific Device Drivers
      • IOMMU Hardware Support
    • File systems
      • Enable the necesary ones like ext4, btrfs as needed
      • CD-ROM/DVD Filesystems
      • DOS/FAT/EXFAT/NT Filesystems
      • Pseudo filesystems give a check here
      • Miscellaneous filesystems
      • Network File Systems
    • Kernel hacking
      • Kernel debugging
      • Generic Kernel Debugging Instruments
        • Magic SysRq key
        • Debug Filesystem
      • Tracers
      • Remote debugging over FireWire early on boot

/etc/default/grub

GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true

/etc/inittab

comment all unneeded

# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
#c2:2345:respawn:/sbin/agetty 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment