Skip to content

Instantly share code, notes, and snippets.

Nick Glynn 17twenty

View GitHub Profile
17twenty / Example
Created Oct 21, 2011
Introspecction Issue
View Example
#!/usr/bin/env python
import gi
from gi.repository import WebKit as webkit, Gtk as gtk, GLib, GObject
#print dir(gtk.WindowType)
<div id="testing">testing</div>
View syscallReplace.c
/* syscallReplace.c
* Replaces the 'open()' syscall and replaces it with something
* that looks for a given UID and reports it if it matches to klog
* This makes liberal use of some awesome code from the LKML and a syscall
* table finding technique from memset.
/* Standard in kernel modules */
#include <linux/init.h>
#include <linux/kernel.h>
17twenty / gist:2712354
Last active Aug 11, 2016
Getting Yocto working on the Beaglebone
View gist:2712354
# Setup for Fedora 17
sudo yum install python m4 make wget curl ftp hg tar bzip2 gzip unzip python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl sed docbook-style-xsl docbook-dtds docbook-utils sed bc glibc-devel ccache pcre pcre-devel quilt groff linuxdoc-tools patch linuxdoc-tools cmake help2man perl-ExtUtils-MakeMaker tcl-devel gettext chrpath ncurses apr SDL-devel mesa-libGL-devel mesa-libGLU-devel gnome-doc-utils autoconf automake
sudo yum install tftp-server
sudo yum install nfs-utils
sudo yum install minicom
sudo systemctl enable nfs-server.service
sudo systemctl disable firewalld.service # This may/maynot be on your system but causes grief if it is!
# -------------------------------------------------------------------------------
17twenty / gist:2718613
Created May 17, 2012
Force Beaglebone to boot your settings on powerup from uEnv.txt
View gist:2718613
So the Beaglebone uses the file uEnv.txt to store settings as it doesn't have any NAND allocated to do it with, by
default the file is pretty empty save from the line:
optargs=run_hardware_tests quiet
You may have read a number of things about boot.scr etc - ignore it, it's not correct.
The bootcmd is hardwired in uboot to do the following (i've seperated it all out to make things clearer) - you can see it by
interrupting the bootsequence and performing a 'printenv'.
17twenty / gist:2719093
Created May 17, 2012
Makefile for Beaglebone (assuming environment already sourced from /opt/poky/<whatever>
View gist:2719093
# Architecture
ARCH := arm
# We want to use the cross-compiler
CROSS_COMPILE := arm-poky-linux-gnueabi-
# Final object file
obj-m += simple.o
# Path of the ARM compiled kernel
ROOTDIR := /home/nick/Documents/BeagleBone/git-poky/Kernel/kernel_3.2.14_patched
17twenty / simple.c
Created May 17, 2012
Simplest Kernel Module I could do
View simple.c
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
static int __init hello_start(void)
printk(KERN_INFO "Hello world\n");
return 0;
17twenty / gist:2763814
Created May 21, 2012
Kernel Module to turn GPIO1_6 on and off
View gist:2763814
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
#include <plat/gpio.h>
#include <plat/am33xx.h>
#include <asm/io.h>
#define DEVICE_NAME "led_drv"
static __iomem unsigned char *gpio1_start;
17twenty / gist:2769392
Created May 22, 2012
GPIO1_7 interrupt driven
View gist:2769392
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <plat/gpio.h>
#include <asm/gpio.h>
#include <plat/am33xx.h>
#include <asm/io.h>
View beaglebone_patch
This file has been truncated, but you can view the full file.
diff -PurN linux-stable-23d8c3f/arch/arm/boot/compressed/Makefile kernel_3.2.14_patched/arch/arm/boot/compressed/Makefile
--- linux-stable-23d8c3f/arch/arm/boot/compressed/Makefile 2012-04-02 17:53:31.000000000 +0100
+++ kernel_3.2.14_patched/arch/arm/boot/compressed/Makefile 2012-05-16 13:40:12.000000000 +0100
@@ -123,7 +123,7 @@
ccflags-y := -fpic -fno-builtin -I$(obj)
-asflags-y := -Wa,-march=all
+asflags-y := -Wa,-march=armv7-a
17twenty / awesome.patch
Created Jun 14, 2012
Really simple example of using get_user_pages and memory aligned allocation using posix_memalign. Hope this helps!
View awesome.patch
diff -PurN dummy/gu_page.c get_user_pages/gu_page.c
--- dummy/gu_page.c 1970-01-01 01:00:00.000000000 +0100
+++ get_user_pages/gu_page.c 2012-06-14 14:41:31.797310260 +0100
@@ -0,0 +1,124 @@
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
You can’t perform that action at this time.