Skip to content

Instantly share code, notes, and snippets.

View dhilst's full-sized avatar
😻

Daniel Hilst dhilst

😻
View GitHub Profile
@dhilst
dhilst / Makefile
Created August 6, 2013 02:13
cdev07
obj-m += cdev07.o
KDIR = /home/geckos/abs/linux/src/linux-3.10
all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
@rm -v *~
@dhilst
dhilst / Makefile
Created February 2, 2016 15:59
respawn - a small utility to respawn process that exists when should keep up.
CFLAGS_respawn += -Wall
respawn: respawn.c
$(CC) $(CFLAGS_$@) $(LDFLAGS_$@) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f respawn
@dhilst
dhilst / Makefile
Last active June 24, 2016 18:51
unix socket
libus: libus.c libus.h
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm libus
. $1
export BUILD_SYS=$(echo $CONFIGURE_FLAGS | tr -s ' ' '\n' | grep host | cut -f2 -d=)
export HOST_SYS=$(echo $CONFIGURE_FLAGS | tr -s ' ' '\n' | grep build | cut -f2 -d=)
export STAGING_INCDIR=${OECORE_TARGET_SYSROOT}/usr/include
export STAGING_LIBDIR=${OECORE_TARGET_SYSROOT}/usr/lib
export PATH=${OECORE_NATIVE_SYSROOT}/usr/bin/python-native:${PATH}
# remove stripping, I face used symbols being stripped
# this has to do with linker option order
export LDFLAGS=${LDFLAGS/-Wl,--as-needed/}
@dhilst
dhilst / arm-env.sh
Created June 28, 2016 13:33
Kernel crosscompile environments
export ARCH=arm
export CROSS_COMPILE=arm-poky-linux-gnueabi-
# u-boot mkimage is inside Yocto's sysroot
# edit acordingly
export PATH=${PATH}:/opt/poky/1.6.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:/opt/poky/1.6.2/sysroots/x86_64-pokysdk-linux/usr/bin/
@dhilst
dhilst / example-core-image.bbclass
Created July 1, 2016 13:15
example-core-image.bbclass
inherit core-image
disable_getty () {
sed -e 's,^1:2345:respawn:/sbin/getty 38400 tty1$,# 1:2345:respawn:/sbin/getty 38400 tty1,' -i ${IMAGE_ROOTFS}/etc/inittab
}
ROOTFS_POSTPROCESS_COMMAND += "diable_getty; "
@dhilst
dhilst / parse_macaddr.c
Created July 9, 2016 03:38
parse_macaddr
#include <string.h>
#include <stdio.h>
static unsigned char b[6];
#include <assert.h>
#if !defined(__KERNEL__)
#define BUG_ON(cond) assert(!(cond))
#endif
@dhilst
dhilst / termcolors.h
Created July 13, 2016 21:05
Terminal colors
#ifndef _TERMCOLORS_H
#define _TERMCOLORS_H
#define _RED "\x1b[31m"
#define _GREEN "\x1b[32m"
#define _YELLOW "\x1b[33m"
#define _BLUE "\x1b[34m"
#define _MAGENTA "\x1b[35m"
#define _CYAN "\x1b[36m"
#define _RESET "\x1b[0m"
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Error executing a python function in /home/geckos/yocto/yocto-daisy/sources/meta-csi-utils/recipes-csicore/libpharosstack-c/libpharosstack-c_1.0.0.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'emit_pkgdata', lineno: 136, function: <module>
0132:
0133: bb.utils.unlockfile(lf)
0134:
@dhilst
dhilst / Makefile
Last active August 4, 2016 19:45
mcp2210.ko: device tree settting up
obj-m := nrf24.o
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD)
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean