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.

Revisions

  1. Vicfred revised this gist Jul 1, 2025. 1 changed file with 69 additions and 0 deletions.
    69 changes: 69 additions & 0 deletions qemu_kvm_make_conf.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    > no need separate /boot partition for BIOS on qemu
    > EFI requires extra work to configure on qemu, BIOS is enough
    `/etc/portage/make.conf`
    ```bash
    #------------------------------------------------------------------------------
    @@ -30,6 +33,72 @@ USE="$USE -bindist -ipv6 -libtirpc -man -multilib -systemd -test-rust -wayland -

    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`
    ```bash
    GRUB_TIMEOUT_STYLE=hidden
  2. Vicfred revised this gist Jul 1, 2025. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions qemu_kvm_make_conf.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    `/etc/portage/make.conf`
    ```bash
    #------------------------------------------------------------------------------
    # CPU & optimization flags
    @@ -28,4 +29,23 @@ USE="$USE udev"
    USE="$USE -bindist -ipv6 -libtirpc -man -multilib -systemd -test-rust -wayland -X"

    GENTOO_MIRRORS="https://mirror.rackspace.com/gentoo/"
    ```
    `/etc/default/grub`
    ```bash
    GRUB_TIMEOUT_STYLE=hidden
    GRUB_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    ```
    `/etc/inittab`
    > comment all unneeded
    ```bash
    # 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
    ```
  3. Vicfred revised this gist Jun 30, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions qemu_kvm_make_conf.md
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,7 @@ 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`.
  4. Vicfred created this gist Jun 30, 2025.
    30 changes: 30 additions & 0 deletions qemu_kvm_make_conf.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    ```bash
    #------------------------------------------------------------------------------
    # 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="*"

    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/"
    ```