linux kernel configuration and compilation

Posted by wopopd83 on Sat, 15 Jun 2019 03:50:59 +0200

Configuration and compilation of linux kernel

Select the Linux kernel transplanted by Jiuding s5pv210 development board, and download the address as follows:
Links: http://pan.baidu.com/s/1sl15QMD Password: by3o

1. First check Makefile
Check Makefile to see two variables in Makefile: ARCH and CROS_COMPILE.
(1) Check whether the cross-compiler tool chain is set correctly.
CROSS_COMPILE ?= /usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-
(2) Confirm ARCH = arm. The main purpose is to find the arch/arm directory at compile time.

2. Configuration process
(1) Configuration is mainly carried out in two steps:
The first step, make xx_defconfig, is make x 210ii_qt_defconfig in Jiuding X 210 development board. If you see the sentence "configuration written to. config" in the last line of configuration information, it indicates that all configuration options are written in the. config file.
The second step, make menuconfig, is to configure it in this graphical interface.

(2) Makexx_defconfig and make menuconfig cooperate
make xxx_defconfig refers to what others have already done. It has many advantages: it reduces a lot of workload, avoids many configuration items that you don't understand (such as configuration items for memory management, scheduling system and other modules), and we only care about what we need to manage.
In fact, make x 210ii_qt_defconfig is equivalent to: CP arch/arm/configs/x 210ii_qt_defconfig.config.
There are many xxx_defconfig files in arch/arm/configs directory. These files are manually configured for a certain development board. Cong files are saved in the past.

To make menuconfig is actually to read the. config obtained in the first step, and then give us a graphical interface so that we can find the configuration items we want to modify more easily, and then change the configuration.

(3) Notes for making menuconfig
The graphical interface after execution is shown as follows:

1. Usage:
Arrow keys navigate the entire menu;
Enter the key to select the submenu (note that the option with -> after the option is the submenu, there is no submenu without this logo);
The highlighted letters are hotkeys (shortcuts);
The functions of Y, N and M keys are respectively to weave, remove and modularize the selected modules. In the brackets before the options in menuconfig, * means to weave, blank means to remove, and M means to modularize.
Double-click ESC to indicate exit;
Press "? "Keyboard can display help information;
Press the "/" button to enter the search content for global search information (similar to the search in vi);
[] It is not possible to modularize, <> is the only way to modularize.

2. The working principle of menuconfig
The menu content displayed by menuconfig is supported by Kconfig files in various directories of the kernel source tree. The Kconfig file contains one configuration item after another in a certain format, and each configuration item becomes a menu item in make menuconfig. And the menu directory structure shown in menuconfig is the same as that of Kconfig in the source directory. Delete a config item in the corresponding Kconfig file and make menuconfig again when the item is not visible.

b. menuconfig reads/writes.config files
The menu content of menuconfig comes from the Kconfig file, but the selection results of each menu (Y, N, M) are not saved in the Kconfig file. The Kconfig file is the same. The Kconfig file just decides whether or not there is a menu item, regardless of the result of the selection of the menu item. When menuconfig works when we make menuconfig open, it reads the. config file and initializes the selection values of menu items in menuconfig with the configuration selection results in the. config file.

Summary: The item content of menu item comes from Kconfig file, and the selection value of menu item comes from. config file.

3.Kconfig file analysis
Almost all directories have a Kconfig file, so you can easily find a Kconfig file for analysis, such as the Kconfig file in kernel drivers net wireless directory, as follows:

menuconfig WLAN
    bool "Wireless LAN"
    depends on !S390
    depends on NET
    select WIRELESS
    default y
    ---help---
      This section contains all the pre 802.11 and 802.11 wireless
      device drivers. For a complete list of drivers and documentation
      on them refer to the wireless wiki:

      http://wireless.kernel.org/en/users/Drivers

if WLAN

config PCMCIA_RAYCS
    tristate "Aviator/Raytheon 2.4GHz wireless support"
    depends on PCMCIA
    select WIRELESS_EXT
    select WEXT_SPY
    select WEXT_PRIV
    ---help---
      Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
      (PC-card) wireless Ethernet networking card to your computer.
      Please read the file <file:Documentation/networking/ray_cs.txt> for
      details.

      To compile this driver as a module, choose M here: the module will be
      called ray_cs.  If unsure, say N.

config LIBERTAS_THINFIRM
    tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"
    depends on MAC80211
    select FW_LOADER
    ---help---
      A library for Marvell Libertas 8xxx devices using thinfirm.

config LIBERTAS_THINFIRM_DEBUG
    bool "Enable full debugging output in the Libertas thin firmware module."
    depends on LIBERTAS_THINFIRM
    ---help---
      Debugging support.

config LIBERTAS_THINFIRM_USB
    tristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware"
    depends on LIBERTAS_THINFIRM && USB
    ---help---
      A driver for Marvell Libertas 8388 USB devices using thinfirm.

config AIRO
    tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
    depends on ISA_DMA_API && (PCI || BROKEN)
    select WIRELESS_EXT
    select CRYPTO
    select WEXT_SPY
    select WEXT_PRIV
    ---help---
      This is the standard Linux driver to support Cisco/Aironet ISA and
      PCI 802.11 wireless cards.
      It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X
      - with or without encryption) as well as card before the Cisco
      acquisition (Aironet 4500, Aironet 4800, Aironet 4800B).

      This driver support both the standard Linux Wireless Extensions
      and Cisco proprietary API, so both the Linux Wireless Tools and the
      Cisco Linux utilities can be used to configure the card.

      The driver can be compiled as a module and will be named "airo".

config ATMEL
      tristate "Atmel at76c50x chipset  802.11b support"
      depends on (PCI || PCMCIA)
      select WIRELESS_EXT
      select WEXT_PRIV
      select FW_LOADER
      select CRC32
       ---help---
        A driver 802.11b wireless cards based on the Atmel fast-vnet
        chips. This driver supports standard Linux wireless extensions.

        Many  cards based on this chipset do not have flash memory
        and need their firmware loaded at start-up. If yours is
        one of these, you will need to provide a firmware image
        to be loaded into the card by the driver. The Atmel
        firmware package can be downloaded from
        <http://www.thekelleys.org.uk/atmel>

config PCI_ATMEL
      tristate "Atmel at76c506 PCI cards"
      depends on ATMEL && PCI
       ---help---
        Enable support for PCI and mini-PCI cards containing the
        Atmel at76c506 chip.

config PCMCIA_ATMEL
    tristate "Atmel at76c502/at76c504 PCMCIA cards"
    depends on ATMEL && PCMCIA
    select WIRELESS_EXT
    select FW_LOADER
    select CRC32
    ---help---
      Enable support for PCMCIA cards containing the
      Atmel at76c502 and at76c504 chips.

config AT76C50X_USB
        tristate "Atmel at76c503/at76c505/at76c505a USB cards"
        depends on MAC80211 && USB
        select FW_LOADER
        ---help---
          Enable support for USB Wireless devices using Atmel at76c503,
          at76c505 or at76c505a chips.

config AIRO_CS
    tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
    depends on PCMCIA && (BROKEN || !M32R)
    select WIRELESS_EXT
    select WEXT_SPY
    select WEXT_PRIV
    select CRYPTO
    select CRYPTO_AES
    ---help---
      This is the standard Linux driver to support Cisco/Aironet PCMCIA
      802.11 wireless cards.  This driver is the same as the Aironet
      driver part of the Linux Pcmcia package.
      It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X
      - with or without encryption) as well as card before the Cisco
      acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It also
      supports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom
      802.11b cards.

      This driver support both the standard Linux Wireless Extensions
      and Cisco proprietary API, so both the Linux Wireless Tools and the
      Cisco Linux utilities can be used to configure the card.

config PCMCIA_WL3501
    tristate "Planet WL3501 PCMCIA cards"
    depends on EXPERIMENTAL && PCMCIA
    select WIRELESS_EXT
    select WEXT_SPY
    help
      A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.
      It has basic support for Linux wireless extensions and initial
      micro support for ethtool.

config PRISM54
    tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'
    depends on PCI && EXPERIMENTAL
    select WIRELESS_EXT
    select WEXT_SPY
    select WEXT_PRIV
    select FW_LOADER
    ---help---
      This enables support for FullMAC PCI/Cardbus prism54 devices. This
      driver is now deprecated in favor for the SoftMAC driver, p54pci.
      p54pci supports FullMAC PCI/Cardbus devices as well. For details on
      the scheduled removal of this driver on the kernel see the feature
      removal schedule:

      Documentation/feature-removal-schedule.txt

      For more information refer to the p54 wiki:

      http://wireless.kernel.org/en/users/Drivers/p54

      Note: You need a motherboard with DMA support to use any of these cards

      When built as module you get the module prism54

config USB_ZD1201
    tristate "USB ZD1201 based Wireless device support"
    depends on USB
    select WIRELESS_EXT
    select WEXT_PRIV
    select FW_LOADER
    ---help---
      Say Y if you want to use wireless LAN adapters based on the ZyDAS
      ZD1201 chip.

      This driver makes the adapter appear as a normal Ethernet interface,
      typically on wlan0.

      The zd1201 device requires external firmware to be loaded.
      This can be found at http://linux-lc100020.sourceforge.net/

      To compile this driver as a module, choose M here: the
      module will be called zd1201.

config USB_NET_RNDIS_WLAN
    tristate "Wireless RNDIS USB support"
    depends on USB && EXPERIMENTAL
    depends on CFG80211
    select USB_USBNET
    select USB_NET_CDCETHER
    select USB_NET_RNDIS_HOST
    ---help---
      This is a driver for wireless RNDIS devices.
      These are USB based adapters found in devices such as:

      Buffalo WLI-U2-KG125S
      U.S. Robotics USR5421
      Belkin F5D7051
      Linksys WUSB54GSv2
      Linksys WUSB54GSC
      Asus WL169gE
      Eminent EM4045
      BT Voyager 1055
      Linksys WUSB54GSv1
      U.S. Robotics USR5420
      BUFFALO WLI-USB-G54

      All of these devices are based on Broadcom 4320 chip which is the
      only wireless RNDIS chip known to date.

      If you choose to build a module, it'll be called rndis_wlan.

source "drivers/net/wireless/rtl818x/Kconfig"

config ADM8211
    tristate "ADMtek ADM8211 support"
    depends on MAC80211 && PCI && EXPERIMENTAL
    select CRC32
    select EEPROM_93CX6
    ---help---
      This driver is for ADM8211A, ADM8211B, and ADM8211C based cards.
      These are PCI/mini-PCI/Cardbus 802.11b chips found in cards such as:

      Xterasys Cardbus XN-2411b
      Blitz NetWave Point PC
      TrendNet 221pc
      Belkin F5D6001
      SMC 2635W
      Linksys WPC11 v1
      Fiberline FL-WL-200X
      3com Office Connect (3CRSHPW796)
      Corega WLPCIB-11
      SMC 2602W V2 EU
      D-Link DWL-520 Revision C

      However, some of these cards have been replaced with other chips
      like the RTL8180L (Xterasys Cardbus XN-2411b, Belkin F5D6001) or
      the Ralink RT2400 (SMC2635W) without a model number change.

      Thanks to Infineon-ADMtek for their support of this driver.

config MAC80211_HWSIM
    tristate "Simulated radio testing tool for mac80211"
    depends on MAC80211
    ---help---
      This driver is a developer testing tool that can be used to test
      IEEE 802.11 networking stack (mac80211) functionality. This is not
      needed for normal wireless LAN usage and is only for testing. See
      Documentation/networking/mac80211_hwsim for more information on how
      to use this tool.

      To compile this driver as a module, choose M here: the module will be
      called mac80211_hwsim.  If unsure, say N.

config MWL8K
    tristate "Marvell 88W8xxx PCI/PCIe Wireless support"
    depends on MAC80211 && PCI && EXPERIMENTAL
    ---help---
      This driver supports Marvell TOPDOG 802.11 wireless cards.

      To compile this driver as a module, choose M here: the module
      will be called mwl8k.  If unsure, say N.

source "drivers/net/wireless/ath/Kconfig"
source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig"
source "drivers/net/wireless/bcm4329/Kconfig"
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/ipw2x00/Kconfig"
source "drivers/net/wireless/iwlwifi/Kconfig"
source "drivers/net/wireless/iwmc3200wifi/Kconfig"
source "drivers/net/wireless/libertas/Kconfig"
source "drivers/net/wireless/orinoco/Kconfig"
source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/rt2x00/Kconfig"
source "drivers/net/wireless/wl12xx/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"

endif # WLAN

(1) The line at the beginning of # is the comment line
(2)menuconfig represents the menu and config represents a configuration item in the menu.
(3) The upper case letters separated by spaces after menuconfig or config denote the name of the configuration item. The name of the configuration item in. config is formed by adding CONFIG_before the string.
(4) All the config items that follow a menuconfig are the submenu of the menuconfig. This is the directory relationship represented in Kconfig.
(5) Each Kconfig in the kernel source directory tree will be sourced into all its subdirectories to ensure that all Kconfig projects are included in menuconfig. This also tells us: if you add a folder in the linux kernel, you must create a Kconfig file under this folder, and then source in the Kconfig of the upper directory of this folder introduces the Kconfig file under this folder.
(6) The meaning of tristate and bool:
Tristate means three states (three states, corresponding to Y, N, M) and bool is either true or false (corresponding to Y and N). So tristate means that the configuration item can be selected in three ways, bool means that the configuration item can only be selected in two ways.
(7) The meaning of depends:
This configuration item depends on another configuration item. If the dependent configuration item is Y or M, then this configuration item is meaningful; if the dependent configuration item itself is set to N, then this configuration item is meaningless at all.
Dependency projects cause some configuration items to be missing when making menuconfig. So if you can't find an option in menuconfig, but this option is available in Kconfig, the possible reason is that one of the configuration items that the configuration item depends on is not valid.
Dependency does not require that the dependent configuration item must be one, it can be multiple, and it can also have logical operations. In this case, as long as the bare computer results depend on the project expression are true, then the dependence will hold.
(8)select: automatic selection
(9)default: The default configuration value is n, y, or m

Topics: Linux Makefile