Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@17twenty
17twenty / Example
Created October 21, 2011 08:55
Introspecction Issue
#!/usr/bin/env python
import gi
from gi.repository import WebKit as webkit, Gtk as gtk, GLib, GObject
#dir(gtk)
#print dir(gtk.WindowType)
init_string="""
<div id="testing">testing</div>
@17twenty
17twenty / syscallReplace.c
Created May 2, 2012 13:23
Naughty codes
/* 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
17twenty / gist:2712354
Last active December 9, 2021 09:34
Getting Yocto working on the Beaglebone
# 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
17twenty / gist:2718613
Created May 17, 2012 12:33
Force Beaglebone to boot your settings on powerup from uEnv.txt
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'.
bootcmd=
@17twenty
17twenty / gist:2719093
Created May 17, 2012 13:57
Makefile for Beaglebone (assuming environment already sourced from /opt/poky/<whatever>
# 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
17twenty / simple.c
Created May 17, 2012 14:17
Simplest Kernel Module I could do
#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
17twenty / gist:2763814
Created May 21, 2012 18:34
Kernel Module to turn GPIO1_6 on and off
#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
17twenty / gist:2769392
Created May 22, 2012 14:25
GPIO1_7 interrupt driven
#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>
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 @@
endif
ccflags-y := -fpic -fno-builtin -I$(obj)
-asflags-y := -Wa,-march=all
+asflags-y := -Wa,-march=armv7-a
@17twenty
17twenty / awesome.patch
Created June 14, 2012 13:58
Really simple example of using get_user_pages and memory aligned allocation using posix_memalign. Hope this helps!
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>
+