学习内核黑客和嵌入式开发在家里? [英] Learning kernel hacking and embedded development at home?

查看:249
本文介绍了学习内核黑客和嵌入式开发在家里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直被内部黑客和嵌入式系统所吸引。

有没有人有开始混淆这些东西的好教程(+易于使用的硬件)?

有些写作驱动程序的工具包等,它们附有良好的文档,并且价格合理?



谢谢!

解决方案

如果你是全新的内核开发,我建议不要从硬件开发开始,去一些仅软件的内核模块,如proc file / sysfs或更复杂的示例文件系统/网络开发,在uml / vmware / virtualbox / ...机器上开发,所以碰撞你的机器不会受到太多的伤害:)对于嵌入式开发,你可以去一个小型的ARM开发工具包或一个小的Via C3 / C4机器,或任何旧电脑,你可以用自制USB / PCI /任何设备烧录。



开始的好地方可能是 Kern elnewbies.org - 它为内核开发人员提供了很多链接和有用的信息,并且还提供了一些易于实施的任务来解决初学者。



读一些书:



了解Linux内核 - 一个非常好的参考资料,详细介绍了内核子系统的设计



Linux设备驱动程序 - 更像是一个教程,有很多示例代码,重点是让你去解释linux内核的关键方面。它介绍了内核模块的构建过程和基础知识。



Linux内核模块编程指南 - 更多介绍性材料



如前所述,看linux代码总是一个好主意,特别是因为Linux内核API往往会经常变化... LXR通过非常漂亮的浏览界面帮助很多 - lxr.linux。否



要了解内核构建过程,此链接可能会有所帮助:



Linux内核Makefile(kbuild)



最后但并非最不重要的一点,浏览内核源代码分发的文档目录。



这是从内核开发类中无关紧要的一些有趣的练习:




  • 编写一个创建文件的内核模块/ proc / jiffies在每次读取访问时报告jiffies中的当前时间。

  • 编写一个提供proc文件/ proc / sleep的内核模块。当应用程序将ASCII文本写入此文件(echo 3> / proc / sleep)中时,应阻塞指定的秒数。写访问应该对文件的内容没有副作用,即在读取访问时,文件应该是空的(参见LDD3,第6/7页)

  • 写一个proc文件,您可以临时存储一些文本(使用echoblah> / proc / pipe)并重新出现(cat / proc / pipe),清除文件。注意同步问题。

  • 修改管道示例模块以注册为字符设备/ dev / pipe,为写入请求添加动态内存分配。

  • 写一个非常简单的文件系统。


I was always attracted to the world of kernel hacking and embedded systems.
Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff?
Something like kits for writing drivers etc, which come with good documentation and are affordable?

Thanks!

解决方案

If you are completely new to kernel development, i would suggest not starting with hardware development and going to some "software-only" kernel modules like proc file / sysfs or for more complex examples filesystem / network development , developing on a uml/vmware/virtualbox/... machine so crashing your machine won't hurt so much :) For embedded development you could go for a small ARM Development Kit or a small Via C3/C4 machine, or any old PC which you can burn with your homebrew USB / PCI / whatever device.

A good place to start is probably Kernelnewbies.org - which has lots of links and useful information for kernel developers, and also features a list of easy to implement tasks to tackle for beginners.

Some books to read:

Understanding the Linux Kernel - a very good reference detailing the design of the kernel subsystems

Linux Device Drivers - is written more like a tutorial with a lot of example code, focusing on getting you going and explaining key aspects of the linux kernel. It introduces the build process and the basics of kernel modules.

Linux Kernel Module Programming Guide - Some more introductory material

As suggested earlier, looking at the linux code is always a good idea, especially as Linux Kernel API's tend to change quite often ... LXR helps a lot with a very nice browsing interface - lxr.linux.no

To understand the Kernel Build process, this link might be helpful:

Linux Kernel Makefiles (kbuild)

Last but not least, browse the Documentation directory of the Kernel Source distribution!

Here are some interesting exercises insolently stolen from a kernel development class:

  • Write a kernel module which creates the file /proc/jiffies reporting the current time in jiffies on every read access.
  • Write a kernel module providing the proc file /proc/sleep. When an application writes a number of seconds as ASCII text into this file ("echo 3 > /proc/sleep"), it should block for the specified amount of seconds. Write accesses should have no side effect on the contents of the file, i.e., on the read accesses, the file should appear to be empty (see LDD3, ch. 6/7)
  • Write a proc file where you can store some text temporarily (using echo "blah" > /proc/pipe) and get it out again (cat /proc/pipe), clearing the file. Watch out for synchronisation issues.
  • Modify the pipe example module to register as a character device /dev/pipe, add dynamic memory allocation for write requests.
  • Write a really simple file system.

这篇关于学习内核黑客和嵌入式开发在家里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆