Contents

VirtualMachine

KVM

bridge

  • NOTE: start dhcpcd.service
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
nmcli connection add type bridge ifname br0 stp no
nmcli connection add type bridge-slave ifname enp7s0 master br0

nmcli connection show --active
nmcli connection down bridge-br0
nmcli connection down Wired\ connection\ 1

nmcli connection show
nmcli connection up bridge-br0
nmcli connection up bridge-slave-enp7s0

kernel

compilation

1
2
3
4
5
make -j24 && \
sudo make -j24 modules_install headers_install install && \
sudo cp arch/x86_64/boot/bzImage /boot/vmlinuz-6.0-ebpf-x86_64 && \
sudo mkinitcpio -p linux60-ebpf && \
sudo update-grub
Cannot find LILO
  • manually update boot loader
1
sudo pacman -S grub
install
1
sudo make -j24 modules_install headers_install install
mkinitcpio
1
sudo mkinitcpio -p linux60
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# /etc/mkinitcpio.d/linux60.preset
# mkinitcpio preset file for the '6.0-x86_64' package

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-6.0-x86_64"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-6.0-x86_64.img"
#default_options=""

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-6.0-x86_64-fallback.img"
fallback_options="-S autodetect"

serial console

  • change the grub config
1
2
3
4
5
6
7
# /etc/default/grub
GRUB_TERMINAL="serial console"
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service

gdb

kernel config

  • Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave CONFIG_DEBUG_INFO_REDUCED off.
  • Turn off KASLR if necessary by adding “nokaslr” to the kernel command line.
  • If your architecture supports CONFIG_FRAME_POINTER, Enable FRAME_POINTER!!!

QEMU/KVM

  • Add qemu commandline
  • -s stands for -gdb & tcp:1234
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <qemu:commandline>
    <qemu:arg value='-s'/>
  </qemu:commandline>
  <!-- or -->
  <qemu:commandline>
    <qemu:arg value="-gdb"/>
    <qemu:arg value="tcp::1235"/>
  </qemu:commandline>
</domain>

Attach

  • Copy vmlinux from Linux kernel root directory first
1
2
3
gdb ./vmlinux
target remote :1234
lx-symbols
  • Edit ~/.config/gdb/gdbinit
1
add-auto-load-safe-path /PATH/linux/scripts/gdb/vmlinux-gdb.py

Image

qemuqcow2
virtual boxvmdk
vmwarevmdk
  • unzip OVA →
1
2
tar -xf ova-file.ova
qemu-img convert -O qcow2 vmdk-file.vmdk qcow2-file.qcow2

boot from disk

1
qemu-system-x86_64 -drive format=qcow2,file=fact.qcow2