Skip to content

Instantly share code, notes, and snippets.

@a3f
a3f / qemu-interactive.py
Created May 17, 2026 20:01
Start QEMU interactively from a labgrid env YAML
#!/usr/bin/env python3
"""Start QEMU interactively from a labgrid env YAML
Usage:
qemu-interactive.py <env.yaml> [extra qemu args]
"""
import subprocess
import sys
from labgrid import Environment
qemu = Environment(config_file=sys.argv[1]).get_target("main").get_driver("QEMUDriver")
cmd = qemu.get_qemu_base_args() + sys.argv[2:]
INFO: Preloader serial: 2
NOTICE: BL31: v2.3():v2.3-135-gcda1658bc-dirty:xsf
NOTICE: BL31: Built : 14:19:26, Jun 1 2021
INFO: GICv3 without legacy support detected.
INFO: ARM GICv3 driver initialized in EL3
&gmac0 { /* Ethernet MAC node */
nvmem-cells = <&gmac0_address>;
nvmem-cell-names = "mac-address";
};
&eeprom { /* or some other device with NVMEM driver */
#address-cells = <1>;
#size-cells = <1>;
gmac0_address: mac-addr@0 {
@a3f
a3f / gist:d8289e3cf518df7e921f37748db0d8f0
Created July 29, 2025 13:22
barebox stacktrace after piping through decode_stacktrace.sh
barebox@TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MPxL:/ mw 0 0
NULL pointer dereference: DABT (current EL) exception (ESR 0x9600004b) at 0x0000000000000000
elr: 00000000bfda34ec lr : 00000000bfda35c0
x0 : 0000000000000000 x1 : 00000000bfff7b8c
x2 : 0000000000000004 x3 : 0000000000000004
x4 : 0000000000000000 x5 : 0000000000000004
x6 : 000000007ff06c10 x7 : 0000000000000001
x8 : 0000000000000048 x9 : 000000007ff5af90
x10: 00000000bfff7b28 x11: 00000000bfff7b8c
x12: 00000000bfff7620 x13: 00000000ffffffc8
#!/bin/sh
set -e
RUSTFLAGS='-C link-arg=-s -Clinker=arm-linux-gnueabihf-ld' cargo build --profile=minimal --target armv7-unknown-linux-musleabihf
outdir=$PWD
tmpdir=$(mktemp -d)
cp target/armv7-unknown-linux-musleabihf/minimal/init $tmpdir/
cd $tmpdir
@a3f
a3f / bootchooser
Created December 20, 2023 17:54
Simple Bootchooser + Bootloader Spec configuration with overlays
# cat /env/nv/bootchooser.system1.boot
mmc0.root-a
# cat /env/nv/bootchooser.system2.boot
mmc0.root-b
#!/bin/bash
set -e
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "USAGE: $0 kernel-recipe [defconfig path]"
exit 1
fi
recipe=$1
#!/bin/bash
add=1
while getopts "dur" o; do
case "${o}" in
d|u|r)
add=0
;;
*)
@a3f
a3f / sndrv-interposer.c
Created July 5, 2021 16:59
Poor man's strace for SNDRV_PCM_IOCTL_SYNC_PTR and brethern
#define _GNU_SOURCE
#include <sound/asound.h>
#include <linux/ioctl.h>
#include <stdio.h>
#include <dlfcn.h>
#define report(...) fprintf(stderr, __VA_ARGS__)
static void decode_pcm_state(snd_pcm_state_t state)
{
@a3f
a3f / .twitter
Last active February 8, 2018 16:57
[API]
access_token=ADD_YOUR_TOKEN_HERE
access_token_secret=ADD_YOUR_TOKEN_HERE
api_key=ADD_YOUR_KEY_HERE
api_secret=ADD_YOUR_KEY_HERE
[SEARCH]
lastid=