Need Suggestions
Himanshu Jha
himanshujha199640 at gmail.com
Wed Jul 25 17:37:27 EDT 2018
On Wed, Jul 18, 2018 at 10:09:28AM +0530, inventsekar wrote:
> Hi Athul...
> This is my collegemate's writing, ... This will solve all your
> confusions....
>
> ---
>
> The most important quality that you need to inculcate if you want to do any
> kernel space programming is "Patience" (or persistence if you will).
Very true!! Patience.. :)
> Though it is a good quality for any large scale project, it is a fundamental
> requirement for kernel programming. It is very easy to see progress and
> make an impact on userspace projects, but even simple changes in the kernel
> core will take a lot of time to get accepted, and will often require
> multiple rewrites. But fear not, as there are plenty of people who have
> conquered this mountain and it is not something to be worried about.
>
> The starting steps will be:
>
> 1) Try to understand how to use git <http://git-scm.com/>. We were (are ?)
> not taught to use a version control system in our college and it is such a
> fundamental thing. So start using git for college assignments and get the
> hang of it.
You'll learn eventually...
For instance, when you base your work on old an tree and send cleanup to
Greg. And Greg patiently explains
"the patch doesn't apply, please rebase :( "
Then you get know how to do an interactive rebase and more preferably
base your work on -next(https://www.kernel.org/doc/man-pages/linux-next.html)
> 2) Start writing a lot of C programs and get experienced with pointers,
> memory allocation, threading. You can start implementing things like Stack,
> Queue, Trees etc. (whatever you study in datastructures) in a simple,
> thread-safe way. Do not focus on how you can visualize these datastructures
> but how you can effectively implement their functionality and thread
> safety. Use pthreads for threading. Do not use any library (like Glib) for
> giving you convenient datastructures (like Strings). Implement each of the
> things on your own. (But when you are writing code for a product, use a
> standard library always instead of re-inventing the wheel)
>
> Write these C programs on Linux and compile using gcc. In our college days
> we were using turboc on windows and I hope things have changed. Use a linux
> distro (fedora <http://fedoraproject.org/>, debian <https://www.debian.org/>
> , openSUSE <http://en.opensuse.org/>, Gentoo <https://www.gentoo.org/> etc.)
> exclusively; Do not use Windows (at least for a while) to make yourself
> aware of the sysadmin, shell-scripting parts of linux, which will come in
> handy.
Now, this part of section is really important and somehow if you think
you really learnt C well in the course offered at University. Then
please take a look at implicit conversions:
https://en.cppreference.com/w/c/language/conversion
assert(sizeof(int) > -1);
That should be enough to shatter your confidence.
I learnt various concepts by reading ISO-C11 draft:
https://port70.net/~nsz/c/c11/n1570.html
You can also grab a pdf copy and refer when in doubt.
> 3) Grab a (any) book on Operating Systems theory and read it. The dinosaur
> book <http://en.wikipedia.org/wiki/Operating_System_Concepts> by
> Silberschatz et. al. is a good start.
If you're a computer undergrad, then you can certainly skip and move to
Love. Otherwise if you're an electronics student like me then you should
read this atleast few chapters.
> 4) Without hesitation buy, Robert Love's Linux Kernel Programming
> <http://www.amazon.com/gp/product/0672329468/> book. It is one of the best
> beginner material and start reading it parallel to the OS book. This is
> easier to read than the previous one and more practical. But the previous
> one adds more value and is more theoretical. Handle (3) and (4) in parallel
> without blocking on any of the other activities.
Highly recommended!
> 5) After you are done with (1) and (2), and feel sufficiently confident
> with C and pointers, grab the linux kernel sources from
> http://git.kernel.org/ and try to build the sources yourself.
> http://kernelnewbies.org/KernelBuild should help. Learn how to install and
> boot with the kernel that you have built.
>
> 6.1) Subscribe to Kernel Newbies mailing list
> http://kernelnewbies.org/MailingList and read every mail, *even* if you do
> not understand most of it.
Indeed.
> 6.2) Watch: https://www.youtube.com/watch?v=LLBrBBImJt4
That's how I started :)
Thanks Greg!
> 6.3) Subscribe to http://lwn.net RSS feeds.
Another great resource.
Thanks Jonathan!
> After this, you should be able to fix and send any trivial, documentation,
> staging fixes. Once you have done this and get the hang of the process, you
> will know how to send patches for any parts of the kernel.
>
> By this time, you would have found your areas of interest in kernel
> (filesystems, memory management, io scheduler, CPU scheduling etc.). You
> will then have to dig deeper in those particular areas, by:
> a) subscribing to the individual mailing lists (such as fs-devel
> <http://marc.info/?l=linux-fsdevel>, etc.)
> b) reading about the bug reports for the individual component
> c) finding the literature that is relevant for your subsystem (The linux
> memory management book
> <https://www.kernel.org/doc/gorman/pdf/understand.pdf>Mel Gorman, etc).
>
> Three other non-technical things that I would recommend are:
>
> 1) Create a new email address and use that for all your open source
> activities. That way you do not miss any important updates from your
> friends.
>
> 2) Kernel programming will not give you big money in the short and medium
> term (at least in India). If your motivation is not excellence in
> engineering, but becoming popular or rich (it is not wrong btw) then you
> should focus on some other areas of programming (developing apps, websites,
> solving user problems, making meaning etc.).
>
> It will often take months (or even years) before you make a significant
> contribution that is not merely a memory leak or bug fix. Be prepared for
> that. But since you have age, energy, time (once you get married and/or
> have kids you will understand) on your side, it is not that difficult.
>
> Many people try kernel programming and then quit because they do not have
> the patience and perseverance.
I know few students especially Indians.
Sad :(
> It may also happen that they have found a
> more interesting technology at its nascent stage (like Distributed
> Computing, Artificial Intelligence, Containers, NLP etc.) It is not wrong
> to quit midway :) Any little time spent on kernel programming will
> immensely benefit you as a programmer even when you are doing user space
> programming. This holds good for not just kernel programming but any
> large-code-base/system programming (like Compilers, glibc, webkit, chrome,
> firefox etc.)
>
> 3) Be more aware of the GSoC community in colleges around you.
I can certainly help you on this _any_ time.
Background: I am an undergraduate student(3rd year), started nearly one
year ago and have contributed significantly in kernel. Currently working
on Google Summer of Code project:
https://summerofcode.withgoogle.com/projects/#6691473790074880
And probably I will be pushing nearly 1.3k lines of code next week for
the mainline, and more if we need advanced features for the sensor.
https://lore.kernel.org/lkml/20170726143215.GB28875@nazgul.tnic/
You see how things have changed in *exactly* 1 year ;)
Another great source is Linux Foundation's Youtube channel:
If you want know what I'm working on, I mean what IIO actually is then
take a look https://www.youtube.com/watch?v=lBU77crSvcI
But Documentation is more important!
Lastly, thanks inventsekar for such a lucid explaination :)
Goodluck & Best wishes!
--
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
More information about the Kernelnewbies
mailing list