Skip to content

Instantly share code, notes, and snippets.

View devimc's full-sized avatar
🐶
arf arf!

Julio Montes devimc

🐶
arf arf!
  • planet earth
View GitHub Profile
@devimc
devimc / debugging-kata-agent.md
Last active November 4, 2022 23:35
Debugging kata-agent

Create a functional Clear Container image using osbuilder

sudo -E FS_TYPE="ext4" USE_DOCKER=1 DISTRO=clearlinux AGENT_INIT=no EXTRA_PKGS="dbus-bin dbus-autostart util-linux-bin p11-kit-bin bash shadow ca-certs dist-pam-configs xz-bin tar-bin grep-bin sed-bin pigz-bin iproute2-bin procps-ng-bin psstop-bin htop-bin curl nano make-bin coreutils-bin pciutils strace-bin e2fsprogs-extras" make -e rootfs
sudo -E FS_TYPE="ext4" USE_DOCKER=1 DISTRO=clearlinux make -e image

WARNING: Comment "The list of systemd units and files that are not needed in Kata Containers" in image-builder/image_builder.sh

@devimc
devimc / hotplug.md
Last active April 14, 2021 01:59
Hot plugging devices

Hot plugging devices using ACPI, SHPC and native

This gist is to show different ways to hot plug devices in a Virtual Machine

Set up the environment

Create a device mapper

dd if=/dev/zero of=devmap.img count=1 bs=50M
@devimc
devimc / config
Last active February 10, 2018 17:29
Kernel config for virtcontainers on ARM
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 4.9.51 Kernel Configuration
#
CONFIG_ARM64=y
CONFIG_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_MMU=y
CONFIG_DEBUG_RODATA=y
CONFIG_ARM64_PAGE_SHIFT=12

run command and exit

socat -d -d unix-client:/run/vc/sbs/18b2d72aa31b721b96d50e606684ab92fac19244cddd604dae35428fda5a28ce/console.sock pty,echo=0,raw &> /tmp/log &
sleep 1
pts=$(grep "N PTY is" /tmp/log | egrep -o "/dev/pts/[0-9]+")
echo "" > $pts
echo "uptime" > $pts
uptime=$(head -4 $pts)
killall socat
@devimc
devimc / time_parse.cpp
Created March 22, 2020 22:10
metaprogramming: parse 24-hour clock to seconds
// Copyright (c) 2020 Julio Montes
//
// SPDX-License-Identifier: Apache-2.0
//
// convert a string in format 24h to seconds at compile time
#include <stdexcept>
#include <string>
using namespace std;
@devimc
devimc / vfio-passthrough-k8s.md
Created April 21, 2020 19:14
VFIO passthought with k8s and kata containers

install a device pluging for kubernetes

git clone https://github.com/intel/sriov-network-device-plugin
pushd sriov-network-device-plugin
# [optional] Running on a VM? - add a virtio net to the ConfigMap
# NOTE: The QEMU VM must have an extra virtio NIC device and support iommu:
# -machine q35,accel=kvm,kernel_irqchip=split -device intel-iommu,intremap=on,caching-mode=on,device-iotlb=on -netdev user,id=mynet1 -device virtio-net-pci,netdev=mynet1,disable-legacy=on,disable-modern=off,iommu_platform=on,ats=on
sed -i 's|resourceList.*|resourceList": [{"resourceName":"virtio_net","selectors":{"vendors":["1af4"],"devices":["1041"],"drivers":["vfio-pci"],"pfNames":["eth1"]}},{|g' deployments/configMap.yaml
#