How-to guide for beginner-level Linux Kernel patch submissions

Every day I see new Linux Kernel hackers fail at their first patch submission. I'm not an expert, but I've learned how the process works and most importantly I've learned how to avoid irritating Linux Kernel maintainers. The "maintainers" are the gate keepers to the Linux Kernel. If you piss them off you will never land any patches into the Linux Kernel. All Linux Kernel development takes place in the open and hundreds (thousands?) of Linux Kernel developers will see and possibly read your patch submissions. You will want to make every effort to submit the best possible patch you can. That's where I come in. If you follow my guide there's a better than average chance you will actually land your patch into the Linux Kernel. For a beginner I recommend working on the drivers/staging tree maintained by Greg Kroah-Hartman. Clone Greg KH's staging tree: > git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git This will take a while. After that you need to checkou

Read More...

linux (10) kernel (5) git (3) sed (1) diff (1) patch (1)

Raspberry Pi LEDs Test

#!/usr/bin/env python3 import time import RPi.GPIO as GPIO GPIO.setmode( GPIO.BCM ) ENABLE = 1; DISABLE = 0 RED = 23; GREEN = 24; BLUE = 25 RGB = [ RED, GREEN, BLUE ] RGB2 = RGB[::-1]

Read More...

raspberry-pi (2)

Shell script to automate go lang pkg test coverage

#!/bin/sh PACKAGE=mypkg # set mode go test -coverprofile=coverage.out $PACKAGE go tool cover -func=coverage.out go tool cover -html=coverage.out # count mode go test -covermode=count -coverprofile=count.out $PACKAGE go tool cover -func=count.out go tool cover -html=count.out # more info: http://blog.golang.org/cover

Read More...

go-lang (3) testing (2)

go log function

func log(s ...interface{}) { f, err := os.OpenFile("info.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { fmt.Printf("error opening log file: %v", err) os.Exit(1) } defer f.Close() log.SetOutput(f) ss := "" for _, p := range s { switch p.(type) { case bool: ss += fmt.Sprintf("%t ", p.(bool)) case int: ss += fmt.Sprintf("%d ", p.(int)) case float64: ss += fmt.Sprintf("%.2f ", p.(float64)) case string: ss += fmt.Sprintf("%s ", p.(string)) } } log.Println(ss) }

Read More...

go-lang (3)

How to filter out Bash arguments

Ever want to know how to drop an argument (and value), --dir in this case, from a Bash script? Someone from my local LUG asked how to do it and this is what I came up with: Fun ;) #!/usr/bin/env bash args=("$@") myargs=() nextarg=-1 for ((i=0; i<$#; i++)) { if [ $nextarg == $i ]; then continue; fi case ${args[$i]} in --dir) nextarg=$((i+1)) ;; *) myargs+="${args[$i]} " esac } echo $myargs ./remove_dir.bash --dir foo --bar baz --bar baz

Read More...

bash (3)

MongoDB Data Durability

It doesn't seem you can lose data even when you might otherwise expect to ;) I setup a small replica set using mongod --fork --logpath a.log --smallfiles --oplogSize 50 --port 27001 --dbpath data/z1 --replSet z mongod --fork --logpath b.log --smallfiles --oplogSize 50 --port 27002 --dbpath data/z2 --replSet z mongod --fork --logpath c.log --smallfiles --oplogSize 50 --port 27003 --dbpath data/z3 --replSet z And initalized it: > rs.initiate( { _id:'z', members:[ { _id:1, host:'localhost:27001' }, { _id:2, host:'localhost:27002' }, { _id:3, host:'localhost:27003' } ] } ); Then I killed all three processes: kill -9 25542 25496 25483 Next I brought one of them back up mongod --fork --logpath c.log --smallfiles --oplogSize 50 --port 27003 --dbpath data/z3 and inserted a doc > db.foo.insert({a:1}) Then I killed that process kill -9 25885 and brought the replica set back online using mongod --for

Read More...

mongodb (1)