Research on Linux-kernel configuration solutions for several typical systems

Source: Internet
Author: User
Article title: Research on Linux-kernel configuration solutions for several typical systems. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Common kernel configuration of P
  
For general users, the Linux kernel efficiency and size requirements are not high. Therefore, kernel configuration is not generally re-configured, because the Linux installer will perform default settings for most of the settings according to the installation requirements and actual hardware during installation. Such a kernel will be more redundant than actually needed. many modules are useless after being loaded, but the current PC memory is usually hundreds of MB, the size of a Linux kernel is several hundred kb. Therefore, for general users, there is no need to re-compile the kernel.
  
Install Red-Hat 7.2 on a P3-566 Dell machine with kernel version 2.4.
The following are some machine configurations:
  
Loadable module support: Y
Networking support: Y
PCI support: Y
System v ipc: Y can be used as a System V-based program.
Kernel support for a. out binaries: Y
Kernel support for ELF binaries: Y
Block devices: the hardware of the machine is configured accordingly to remove support modules for hardware devices not available on the machine. For example, Loopback device support
Networking options:
Packet socket: Y
TCP/IP networking: Y
Network firewils: Y
The IPX protocol: Y
Network device support:
Network device support: Y
Ethernet (10/100 Mb/s): Y
Character device
Virtual terminal: Y
Support for console on virtual terminal: Y
Filesystems
Second extended fs support: Y
VFAT fs support: m I sometimes use VFAT partitions on this machine
/Proc filesystem support Y
ISO9660 cdrom filesystem support: m
Network File Systems
NFS filesystem support: Y
SMB filesystem support: m
Console drivers
VGA text console: Y
Video mode selection support: Y
Vesa vga graphics console: Y
Kernel hacking
Magic SysRq key: Y
  
I have not changed some default settings. In this way, the compiled version is 700K. After debugging, no problems have occurred.
  
PDA kernel settings
  
Personal Digital Assist (PDA), such as mobile phones, quick translation, and wenquxing. Such systems require system stability, low kernel size, and high efficiency. special hardware support is often required. Single process scheduling and file system requirements, some of which are single process systems. Network support depends on your needs. The RedHat kernel cannot be used directly to design PDAs with some special requirements. it is generally necessary to add specific hardware modules.
  
Make the following settings:
  
Networking support: Y: generally, PDAs support Internet update.
Kernel support for ELF binaries: Y
Compile as ELF? If your GCC is ELF-GCC: Y these two settings make the system's execution files all ELF
Advanced Power Manager Bios support: Y
Block devices: special hardware support modules should be added.
Networking options
Packet socket
FileSystem
Second extended fs support: Y
  
Some other functions are N. of course, some functions must be used to support the above modules. After compilation, the value is 100KB---400KB.
  
Small embedded system
  
A small embedded Linux system only requires the following three basic elements:
  
1. pilot tool,
2. the Linux microkernel consists of memory management, process management, and transaction processing.
3. initialize the process
  
If you want it to do something and keep it small, you need to add:
  
1. hardware driver
2. one or more applications that provide the required features.
  
To add more features, you may need these: a TCP/IP network stack in a file system (maybe in ROM or RAM ).
  
Different settings are made for this type of system:
  
Do not floppy; do not SMP, MTRR; do not Networking, SCSI; remove all block devices, leaving only IDE devices; remove all character devices; remove all filesystems, leave only minix; do not support sound. In this way, all options have been removed. After doing so, we get a 188 K core.
  
Replace-O3 and-O2 in the following two files with-OS.
./Makefile
./Arch/i386/kernel/
Makefile
In this way, the entire core becomes 9 K and becomes 179 K.
  
However, I am afraid this core is difficult to use the Linux function, so I can add the network back. Add the network support in General setup and re-compile it. The core is 189 KB. Add a TCP/IP stack at 10 k. Adding the RTL8139 driver commonly used in embedded board to 195 KB.
  
If you need a DOS file system, the size is 213 KB. If minix is replaced by ext2, the size will grow to 222 K.
  
Linux requires about kB of memory ~ Between KB. 1 MB memory may be able to boot, but it is not very useful, because it is difficult to attach to the C library. 2 MB memory should be able to do something, but it will take more than 4 MB to execute a relatively complete system.
  
Because Linux's filesystem is quite large, it is about 230 K, accounting for 1/3 of the volume. Memory management accounts for 80 KB, which is similar to the sum of other core components. TCP/IP stack accounts for 65 K, and drivers account for 120 K. SysV IPC accounts for 21 K, and can be removed if necessary. The core file should be smaller than 10 K.
  
What if we want to crop the core size? The answer is obvious, of course, the file system. Linux VFS simplifies the file system design. buffer cache and directory cache increase the system efficiency. However, these embedded systems are useless at all. If you can remove them, the core can be reduced to about 20 K. If you skip the entire VFS and directly write the file system as a driver type, you can reduce the K to about 50 k. The entire core is reduced to about KB.
  
IPC kernel
  
For the IPC kernel, kernel size requirements are not strict, the key is correctness, robustness and real-time (some machines require high real-time performance ). A single file system requirement, but ensure correctness. set the network as needed.
  
The following configurations are available:
  
Invalid Ric multi-processing support: Y
Loadable module support: N industrial computer generally loads all modules that may be used into the memory.
Networking support: Y
System v ipc: Y
Kernel supply for ELF binaries: Y
Block devices:
Based on specific hardware configurations
Networking options
Packet socket: Y
Generally, an industrial computer is connected through a LAN and isolated from the outside world. Therefore, the IPX protocol is required. In addition, TCP/IP is also required.
QoS and/or fair queueing: Y
QoS (Quality Of Service) and fair queueling is a network thread table that schedules certain packets to be sent first. it can process multiple network packets at the same time and sort them in the order Of priority, it is called packet schedulers. this function is especially important for real-time systems. when multiple packets are sent to network devices at the same time, the Kernel can determine which packet must be processed first. therefore, the Kernel provides several packet scheduling algorithm.
Filesystems
Second Extended fs support: Y
  
The remaining configurations are slightly different from those of small embedded systems.
  
The size of the compiled kernel on the same machine is more than 800 KB.
  
Server kernel:
  
The server kernel is critical to network settings and process scheduling. perform the following configuration:
  
Invalid Ric multi-processing support: Y
Loadable module support: Y
Networking support: Y
Networking option
Packet socket: Y.
TCP/IP networkeing: Y
Network firewils: whether to use a Network firewall. If the computer wants to use firewallserver or a network structure in a TCP/IP communication protocol, select [Y]
Network aliasing [Y/m/n/?] : A computer on a network can have multiple IP addresses. If the computer wants to have multiple IP addresses, select [Y].
IP: forwarding/gatewaying [Y/m/n/?] : If you want to be a vro, select [Y], but the prerequisite is that there are two NICs, one for the external network and the other for the internal network, in addition, you must set the routing at the end of the ISP to allow the user to access this vro.
IP: multicasting: transfers a packet to several computers at a time.
IP: syn_cookies: a protection measure that encrypts various TCP/IP communication protocols, prevents Attacker from attacking users' computers, and records IP addresses of computers attempting to attack users.
IP: firewalling: whether the computer is a firewall server
IP: firewall packet logging: whether the klogd records the packets received by the firewall server.
IP: masquerading: Packets sent from computers in the internal network can be directly transmitted to remote computers through the firewall server, what remote computers see is the packets sent from the firewall server rather than from the internal computer. In this way, if only one computer can access the Internet, other machines can connect to the Internet through the firewall server. To select this option, you must first determine the previous Network firewils IP: forwarding/gatewaying IP: firewalling. select [Y]. And the next option IP: always deframent should also select [Y].
IP: ICMP masquerading: generally, masquerading only supports TCP and UDP packets. to enable masqurerading to handle ICMP packets, select [Y].
IP: always defragment
Related Article

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.