Skip to content

Instantly share code, notes, and snippets.

@shimomura1004
shimomura1004 / triangle_simple.c
Created December 4, 2022 01:33
Use texture on wayland egl
/*
* A simple Wayland EGL program to show a triangle
*
* cc -o triangle_simple triangle_simple.c -lwayland-client -lwayland-egl -lEGL -lGLESv2
*/
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <assert.h>
#include <stdio.h>
@shimomura1004
shimomura1004 / v4l2loopback_0.12.7.bb
Created November 15, 2022 15:14
build v4l2loopback for aarch64 target on x64 host
SUMMARY = "V4L2Loopback"
DESCRIPTION = "v4l2loopback module"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI = "git://github.com/umlaeute/v4l2loopback.git;protocol=https;branch=main;rev=v0.12.7"
S = "${WORKDIR}/git"
inherit module
@shimomura1004
shimomura1004 / gist:7d29567786f733f8224001263a8c5720
Created April 13, 2022 05:49
Raspberry Pi 4B (BCM2711C0) で Xen をブートするための u-boot スクリプトを作る
boot.source の雛形を作成
bash ../imagebuilder/scripts/uboot-script-gen -c config3 -d . -t sd
boot.source を修正
======================================================================================================
fdt get value bootargs /chosen bootargs
fatload mmc 0:1 0xE00000 Image
fatload mmc 0:1 0x2600000 xen-raspberrypi4-64
load mmc 0:1 0x2800000 bcm2711-rpi-4-b.dtb
ブリッジ作成
# ip link add name xenbr0 type bridge
# ip link set dev enp0s3 master xenbr0
# ip link set dev xenbr0 up
仮想マシン作成
# xen-create-image --hostname=my-jessie --dir=/home/xen --dhcp --memory=256mb --pygrub --dist=jessie
仮想マシン起動
# xl create /etc/xen/my-jessie.cfg
@shimomura1004
shimomura1004 / gist:4fe54ad0a74b2ee8e8c4fd18b911570f
Last active December 18, 2021 11:50
x86-64 の QEMU で arm64 の Linux カーネルを実行する
まず arm64 用の Linux カーネルをビルドする
https://kasiviswanathanblog.wordpress.com/arm64-vanilla-kernel-in-qemu/
実行には、カーネルをビルドしたときにできる start_qemu を参考にする
別途 yocto などで作った rootfs などを QEMU に渡して起動する
sudo qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=/dev/sdb2,if=none,format=raw,id=hd1 -device virtio-blk-device,drive=hd1
Xen と併用するなら "-machine virtualization=true" を追加する
(https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/qemu-system-aarch64)
@shimomura1004
shimomura1004 / rtp_audio_emitter
Created May 12, 2021 13:05
audio streaming with rtp
GST_DEBUG=2 gst-launch-1.0 -vvv filesrc location=test.mp3 ! decodebin ! audioconvert ! rtpL24pay ! udpsink host=192.168.0.194 port=5000
@shimomura1004
shimomura1004 / lane_finder.py
Last active February 4, 2018 03:53
https://github.com/ajsmilutin/CarND-Advanced-Lane-Lines/blob/master/lane_finder.py の入力サイズを 640x360 に変更して、認識レーン数を4本にしたもの
import pickle
import cv2
import os
import numpy as np
import settings
import math
from settings import CALIB_FILE_NAME, PERSPECTIVE_FILE_NAME
import sys
# ~/tmp/bin にホストでビルドした ocaml バイナリをインストールしておく
PATH=~/tmp/bin:$PATH ./configure -no-ocamldoc -no-pthread -prefix ~/tmp/qnx -verbose -host x86_64-unknown-linux-gnu -target i486-pc-nto-qnx6.6.0 -target-bindir ~/tmp
# ビルドされた ocaml/ocamlc とかを byterun/ocamlrun で実行できる
@shimomura1004
shimomura1004 / fluentd_sample.cpp
Created April 12, 2017 12:29
fluentd sender sample with Qt
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <qmsgpack/msgpack.h>
#include <QTcpSocket>
int main(int argc, char *argv[])
{
QVariantMap log;
log.insert("status", "error");