Linux Kernel Module Programming – 03 Coding, Compiling the Module

by Lanh on March 29, 2013

In this video we get into actually writing a simple hello world version of a linux module. Recall a kernel module is used to extend the functionally of an ex…
Video Rating: 4 / 5

Flashed the beta firmware for xbmc-linux for xios. Go over some of the more frequent things I do with XBMC. Firmware: http://www.pivosforums.com/viewtopic.ph…
Video Rating: 5 / 5

38 comments

great work….

by Ameya patale on March 29, 2013 at 8:24 pm. Reply #

What is the dependency between using void and assembly level code? Why can’t I have () in function declaration while writing module?

by ezeegupta on March 29, 2013 at 9:00 pm. Reply #

thank man it worked

by judeaugustinej on March 29, 2013 at 9:50 pm. Reply #

at 5.29 you used gedit Makefile , does it open utomatically with the code or do we need to create the Makefile ?

In Unbuntu i installed, gedit Makefile opens a blank file. tried copying thefile but it doesnt work .
i tried installing many headers and nothing seems to working out !
please help !

by Ramesh Dileep Kumar Appana on March 29, 2013 at 10:19 pm. Reply #

thanks SolidusCode. m a newbie and ur tutorial helped a lot. if u can also post links where newbie lyk me can find information on kernel and drivers it will supplement what you want to do… thanks again :)

by Anurag Priyadarshi on March 29, 2013 at 10:53 pm. Reply #

hi when i run make I only get the .symver and .order files, i don’t get the .ko and .mod file…….help?

by kalio sobomabo on March 29, 2013 at 11:22 pm. Reply #

Im getting “Kernel configuration is invalid” when I run my Makefile. Does anyone know how to fix this?

by 4thKyuubi on March 30, 2013 at 12:21 am. Reply #

Hello, I am having an issue with making the makefile.

I am using linux-3.6.0 and when I type in “ls /usr/src”, I dont get a list like the one you have. Instead, I only get the following folders,

debug kernels vboxguest-4.2.0

Can anyone tell me what am i missing?

by 4thKyuubi on March 30, 2013 at 12:21 am. Reply #

I tried this but when I “make” I get the following:

makefile:10: *** missing separator. Stop.

by Eddy Quicksall on March 30, 2013 at 1:04 am. Reply #

you simply rock. :)
great work.

by Kaustubh Deshmukh on March 30, 2013 at 1:13 am. Reply #

trying the following makefile:

obj-m := stick_driver.o

KERNEL_DIR = /lib/modules/$(shell uname -r)/build
PWD = $(shell pwd)
all:
$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules

clean:
rm -rf *.o *.ko *.mod.* *.symvers *.order *~

by SolidusCode on March 30, 2013 at 1:29 am. Reply #

thanks for your tutorial is wonderful.
but I have a problem when I try compile the Makefile.
I get the follow error:
/usr/src/linux-headers-3.0.0-23-generic/include/linux/linkage.h:5:25: fatal error: asm/linkage.h: No such file or directory
compilation terminated

I was try reinstall the kernel-headers with apt-get (I’m using ubuntu) and nothin work, someone can help me?
thanks

by willian Henrique on March 30, 2013 at 1:31 am. Reply #

You don’t really need the static keywords in the hello.c; Also, i encountered a problem with my version of Ubuntu, but i solved it by changing the Makefile a bit:”all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules” then it worked as intended. Thanks for the videos :D

by SMFloris on March 30, 2013 at 2:05 am. Reply #

the best tutorial for create module
Thank you

by Twike672 on March 30, 2013 at 2:06 am. Reply #

Hey, man! You’re awsome, thx for the tutorials!

by Carlos Filho on March 30, 2013 at 2:56 am. Reply #

thanks…. great tutorial… hope you will continue

by bvasyb1 on March 30, 2013 at 3:03 am. Reply #

apologies about the mic, please feel free to donate to my blog at soliduscode.blogspot.com, that donation will feed the microphone fund

thank for watching my videos

by SolidusCode on March 30, 2013 at 3:25 am. Reply #

thank you

by SolidusCode on March 30, 2013 at 3:52 am. Reply #

great lessons but you really need a new mic thnx

by skywolf009 on March 30, 2013 at 4:26 am. Reply #

Your work is wonderful.
Thank you for your sharing.

by Sevenx Wasly on March 30, 2013 at 4:30 am. Reply #

now, its much easier now:
1.) load .img file to MSD
2.) go to: apps – upgrade – local upgrade.
3.) select your MSD.

then you just wait.
The new firmware especially for the M3 version is pretty quick…

by Roxas Earnshaw on March 30, 2013 at 5:27 am. Reply #

nice device i wonder if i can do that in my xios ds ? is any link that i can used.

by Jesus Quiles on March 30, 2013 at 5:54 am. Reply #

This box is worth owning for XBMC alone. Everything else is icing on the cake. I think it will only get better with time and once they start making newer devices with quad core processors.

by eurorootz on March 30, 2013 at 6:09 am. Reply #

it worked out of the box.

by Jack Waterworth on March 30, 2013 at 6:50 am. Reply #

how did you get the remote to work /w linux

by chessbeard on March 30, 2013 at 7:01 am. Reply #

lets pool our coin and get this guy a tripod!

by gusto247 on March 30, 2013 at 7:39 am. Reply #

Thanks for posting the video. It looks like the Linux version with XBMC runs much better than the Android version. Just a tip: for future videos you might consider turning the audio on the TV down and using a stand for the camera.

by Joshua Lyon on March 30, 2013 at 8:39 am. Reply #

Under load power consumption is abut 6W. Yes, you read that right.

by Bloodlvst on March 30, 2013 at 9:32 am. Reply #

Just ordered one from Newegg cant wait to get it :) along with a 16 gb micro sdhc.I have a ATV3 sitting here collecting dust

by ozzman39 on March 30, 2013 at 10:25 am. Reply #

I only used wifi when I first got the box while it was running Android. I haven’t tried with xbmc-linux.

by Jack Waterworth on March 30, 2013 at 10:38 am. Reply #

Perfect. Thanks for the info!
Just curious, have you tried playing this file (or similar) over wifi?

by Josh Ryan on March 30, 2013 at 10:52 am. Reply #

Very easy to upgrade teh firmware. You put an update.img file on a mini-sd card and reboot the box while holding down a special button on the bottom. The firmware update is automatic. Im uncertain about the power consumption.

by Jack Waterworth on March 30, 2013 at 11:31 am. Reply #

Yes. My storage is being shared out via samba. Im using gigabit ethernet, although I think I may have a 10/100 bottleneck right before the xios (i’d have to double check). Here is the output from the file I played in the video:
—————————-
[root@hoarder movies]# ll -h Back to the Future Part II.mkv
-rw-r–r– 1 root root 7.5G Dec 6 2011 Back to the Future Part II.mkv
—————————-

by Jack Waterworth on March 30, 2013 at 11:31 am. Reply #

Thanks for the video!
Was the file being played from a SMB share? If so, are you wired or wireless?
What format was the file? How large was the file?

by Josh Ryan on March 30, 2013 at 11:42 am. Reply #

Thank you for that.

I am convinced. Just need to find a good guide on how to change the firmware. (I am a complete noob to androind let alone Linux). XBMC is the only reason I would want one of these. I dont see how apple hasn’t seen that part of its customers. Hope they post to Australia. Amazon wont let me.

Also how much power does it chew through. I would assume less than 30W. Would it make sence just to leave it on all the time?

by paulb36utube on March 30, 2013 at 12:18 pm. Reply #

I have not tried 1channel. I usually only use local streaming media.

by Jack Waterworth on March 30, 2013 at 1:11 pm. Reply #

also IceFilms was one I wanted to know about

by Antonio Elizondo on March 30, 2013 at 1:39 pm. Reply #

Have you tried the 1channel add-on. It has a lot of streaming videos.

It works on the XBMC for AppleTV (jailbroken)

by Antonio Elizondo on March 30, 2013 at 2:00 pm. Reply #

Leave your comment

Required.

Required. Not published.

If you have one.