1 / 15

Add My Code into Kernel Source Tree

Add My Code into Kernel Source Tree. # cd # cd src # cd linux-2.6.30.4 # make i386_defconfig # ls # more . config ... CONFIG_ARCH_DEFCONFIG ="arch/x86/ configs /i386_defconfig". #1. 1. arch/x86/ Kconfig ... source " init/ Kconfig " menu "Processor type and features". #2.

yoko-moran
Download Presentation

Add My Code into Kernel Source Tree

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Add My Code into Kernel Source Tree

  2. # cd # cdsrc # cd linux-2.6.30.4 # make i386_defconfig # ls # more .config ... CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" ...

  3. #1 1. arch/x86/Kconfig ... source "init/Kconfig" menu "Processor type and features" ...

  4. #2 2. init/Kconfig ... menu "My Menu ..." config MYMENU bool "Hello ..." defualt y endmenu menu "General setup" ...

  5. ... menu "General setup" config MYTEST bool "Add My Test menu ..." config EXPERIMENTAL ...

  6. #3 3. arch/Kconfig ... # General architecture dependent options config MYGENARCH bool "Add My General Arch Menu" default n config OPROFILE ...

  7. Lab

  8. 1. arch/x86/Kconfig ... source "net/Kconfig" source "drivers/Kconfig" ... 2. net/Kconfig ... if INET source "net/ipv4/Kconfig" ... endif # if INET ...

  9. 3. net/ipv4/Kconfig ... config MYPROTOCOLTEST bool "My protrocol test ..." config IP_MULTICAST bool "IP: multicasting" ...

  10. # make menuconfig ... [*] Networking support ---> Networking support Networking options ---> ... [*] TCP/IP networking [ ] My protocol test ... (NEW) [*] IP: multicasting Device Drivers --->

  11. net/ipv4/Makefile # # Makefile for the Linux TCP/IP (INET) layer. # obj-y := route.oinetpeer.oprotocol.o \ ... \ inet_fragment.o obj-$(CONFIG_MYPROTOCOLTEST) += myprotocol.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o ...

  12. net/ipv4/myprotcol.c #include <autoconf.h> myprotocol () { #ifdefCONFIG_MYPROTOCOLTEST printk(“Wired communications ...\n”); #endif }

  13. net/ipv4/route.c #include <autoconf.h> ... #ifdefCONFIG_MYPROTOCOLTEST myprotocol(); #endif ...

  14. include/linux/autoconf.h # make menuconfig # ls –a # more .config # make bzImage // include/linux/autoconf.h ... CC arch/x86/boot/video-bios.o LD arch/x86/boot/setup.elf OBJCOPY arch/x86/boot/setup.bin OBJCOPY arch/x86/boot/vmlinux.bin HOSTCC arch/x86/boot/tools/build BUILD arch/x86/boot/bzImage Kernel: arch/x86/boot/bzImage is ready (#1)

  15. Procedure • 추가하려고 하는 기능이 어느 곳에 있는가 ? Kconfig • 기능 항목을 추가 config MYTEST default y • # make menuconfig .config CONFIG_MYTEST=y • 소스코드 작성 및 저장 => 해당되는 디렉토리에서 mytest.c • 내가 작성한 커널함수를 어디에서 호출할 것인지 결정 후 코딩 #include <linux/autoconf.h> #ifdef CONFIG_MYTEST mytest(); #endif • Makefile에 나의 파일이 추가되도록 obj-$(CONFIG_MYTEST) += mytest.o • # make bzImage arch/x86/boot/bzImage생성된다

More Related