简体   繁体   中英

Embedded linux driver load-up

I'm developing a device driver for embedded linux(ARM). How can I compile the KO file generated as a part of the kernel, in a way that the module will be loaded in boot?

this is the first time I need to compile the driver into the kernel and not as a loadable module. so I'm not sure how to do it.

Thanks, Ramon.

For your first question, I assume that you want to build your driver statically into the kernel image(not as a module). First, you select a directory in drivers directory where you want to put your driver files. Assume you want to put your files in drivers/char/ . Copy your files into this directory. There will be a Kconfig file in the drivers/char/ directory, open it and add an entry like this in the before the endmenu .

config MYDRIVER
    bool "This is a driver for something"
    default n
    help
      This is a test driver.

Save the file and open Makefile in the same directory. Goto end of the file and add the following entry.

     obj-$(CONFIG_MYDRIVER)            += mydriver.o

That's it you have added the file to the kernel tree. Now, as usual, do make menuconfig and select MYDRIVER .

See this Kernel Compilation article for more info.

You need to build your device driver as a built-in . You can either edit your kernel .config file manually and change "=m" to "=y" for the CONFIG option that belongs to your module, or use make menuconfig to change <M> to <*> for your device driver.

before -> <M> Your Device Driver Name Here
after  -> <*> Your Device Driver Name Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM