Linux Migration FAQs

Source: Internet
Author: User

1. Add a new drive to the board ****************

First, the driver compiles into the kernel step
To add a program to the Linux kernel, you need to complete the following three tasks:
1. Copy the written source code to the appropriate directory of the Linux kernel source;
2. Add the compilation configuration option of the source code corresponding project in the Kconfig file of the directory;
3. Add a compile entry to the Xinyuan code in the directory's Makefile file.

The steps for compiling the bq27501 driver into the kernel are as follows:
1. First copy the drive Code bq27501 folder to the ti-davinci/drivers/directory.
Determine where the bq27501 driver module should be located in the kernel source tree.
The device driver is stored in the subdirectory of the kernel source root directory drivers/, within which the device driver files are organized in order by category, type, etc.
A. Character devices exist in the drivers/char/directory
B. Block devices are stored in the drivers/block/directory
C. The USB device is stored in the drivers/usb/directory.
Attention:
(1) The file organization rules here are not absolutely constant, for example: USB devices are also part of the character device, and can also be stored in the drivers/usb/directory.
(2) under the drivers/char/directory, there are a large number of C source code files and many other directories in this directory. All device drivers that have only one or two source files can be stored directly in that directory, but if the driver contains many source files and other auxiliary files, you can create a new subdirectory.
(3) bq27501 driver is a character device driver category, although the driver-related files only two, but in order to view, the relevant files in the bq27501 folder. Adding new devices to the drivers/char/directory is simple, but adding new devices directly under drivers/is slightly more complicated. So the following first gives the process of adding the bq27501 driver under drivers/, and then simply explains the process added under the drivers/char/directory.

2. Create a new makefile file under/bq27501. Add code to the inside:
obj-$ (config_bq27501) +=bq27501.o
At this point, the build system runs into the BQ27501/directory and compiles the bq27501.c to BQ27501.O
3. Create a new Kconfig file under/bq27501. Add code:
Menu "bq27501 Driver"

Config BQ27501
TriState "BQ27501"
Default Y
---help---
Say ' Y ' here, it'll be compiled into Thekernel; If you choose ' M ', it'll be compiled into a module named Asbq27501.ko.
Endmenu
Note: The text in Help cannot be added with a carriage return, otherwise the make Menuconfig will error when compiling.
4. Modify the Kconfig file in the/drivers directory, add a statement before Endmenu ' source Drivers/bq27501/kconfig ' for the driver, Kconfig is usually in the same directory as the source code. If a new directory is created and you want the Kconfig file to exist in that directory, then it must be introduced in an existing Kconfig file, and it needs to be hooked up to Kconfig in the drivers directory using the above statement.

5. Modify the/drivers makefile file to add ' obj-$ (config_bq27501) +=bq27501/'. This line of compilation instructions tells the module building system to enter the BQ27501/subdirectory when compiling the module. The compilation of the driver at this time depends on a special configuration config_bq27501 configuration option.

6. Modify the Kconfig file in the Arch/arm directory and add the statement directly in the menu "Device drivers......endmenu"
SOURCE "Drivers/bq27501/kconfig"

2. Error ************** when make is in kernel

Build Linux kernel Error

cc1:error:unrecognized command line option "-mlittle-endian"
cc1:error:unrecognized command line option "-mapcs"
cc1:error:unrecognized command line option "-mno-sched-prolog"
cc1:error:unrecognized command line option "-mabi=aapcs-linux"
cc1:error:unrecognized command line option "-mno-thumb-interwork"
Arch/arm/kernel/asm-offsets.c:1: Error:bad value (armv5t) for-march= switch
Arch/arm/kernel/asm-offsets.c:1: Error:bad value (strongarm) for-mtune= switch The reason is: Cross_compile is not set correctlyUse the command:Make arch=arm cross_compile=arm-linux- or modify makefile:

#ARCH? = $ (Subarch)
ARCH = Arm
#CROSS_COMPILE? =
Cross_compile = arm-linux-

Modify Makefile

CD linux-2.6.35.7

VI Makefile

191 ARCH? = Arm

192 cross_compile? = arm-linux-

Linux Migration FAQs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.