Research on Embedded Linux-Kernel configuration solutions for several typical systems
Source: Internet
Author: User
Research on Embedded Linux-Kernel configuration solutions for several typical systems-general Linux technology-Linux programming and kernel information. The following is a detailed description. Summary
This article mainly introduces several methods to reduce Linux core, which can be used for core configurations of embedded systems and embedded servers.
--------------------------------------------------------------------------------
1. General PC Kernel configuration
?? 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.
?? Installing Red-Hat on a Dell machine with a P3-566? 7.2, kernel version 2.4.6
?? The following are some machine configurations:
?? Loadable? Module? Support? : Y
?? Networking? Support :? Y
?? PCI? Support: Y
?? System? V? IPC? : Y because it can be implemented based on System? V Program
?? Kernel? Support? For? A. out? Binaries: Y
?? Kernel? Support? For? ELF? Binaries: Y
?? Block? Devices? : According to the hardware configuration of the machine, some support modules for hardware devices not available on the machine are removed. 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? Or? 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 the VFAT partition 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.
2. PDA kernel settings
?? PDA (Personal? Digital? Assist) such as mobile phone, 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.
3. Kernel configuration for small Embedded Systems
?? A small embedded Linux system only requires the following three basic elements:
??
Boot Tool ??
The Linux microkernel consists of memory management, process management, and transaction processing ??
Initialization Process
?? If you want it to do something and keep it small, you need to add:
??
Hardware driver ??
One or more applications that provide the required features.
?? To add more features, you may need these :? In a file system (maybe in ROM or RAM? The TCP/IP network stack has different settings for this type of system:
?? No? Floppy; Do not SMP or MTRR; do not? Networking, SCSI; put all? Block? Device? Remove, leave only? IDE? Device; put all? Character? Device? Remove; put all? Filesystem? Remove, leave only? Minix; no? Sound? Supported. In this way, all options have been removed. After this is done,? 188 K? Core.
?? In the following two files? -O3,-O2? Use? -OS? Replace.
?? In this way, the entire core becomes smaller? 9 K, become? 179 K.
?? But I am afraid this core is hard to play? Linux? So the network is added back. Set General? In setup? Network? Support? Add it back, recompile it, and change the core? 189? K. Add one at 10 k? TCP/IP? Stack .? If there is a stack and there is no driver, why? Embedded? The commonly used RTL8139 driver of the board is added back, 195 KB.
?? If you need? DOS? What is the size of the file system? 213 K. If? Minix? Use? Ext2? Upgrade, then the size will grow? 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 enough to do something, but? A complete system can be executed after 4 MB or more.
?? Because of the Linux filesystem? Very large, about? 230 K? Left or right, occupied? 1/3? . Memory management accounts for 80 KB, which is similar to the sum of other core components. TCP/IP? Stack? The driver accounts for 65 K and 120 K. SysV? Is IPC occupied? 21 K. If necessary, you can remove it. The core file should be about 10 K smaller.
?? What if we want to crop the core size ?? The answer is obvious, of course, the file system. Linux? ? VFS simplifies the design of the file system, buffer? Cache ,? Directory? Cache increases system efficiency. However, these embedded systems are useless at all. If you can remove them, can the core be reduced immediately? 20 K? Left and right. If you skip the entire process? VFS, directly write the file system as? Driver? Type, which can be set? 230K is reduced to about 50 K. The entire core is reduced to about KB.
4. Computer Kernel configuration
?? 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:
?? Symmetric? Multi-processing? Support: Y
?? Loadable? Module? Support: N? The 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 the specific hardware configuration
?? 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? It is a network thread table that schedules certain packets to be sent first. It can be processed by multiple network packets at the same time and sorted 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. so how many packages does the Kernel provide? Scheduling? Algorithm.
?? Filesystems
??? Second? Extended? Fs? Support: Y
?? The remaining configurations are slightly different from those of small embedded systems. The size of the kernel compiled on the same machine is more than 800 KB.
5. Server Kernel configuration:
????
?? The server kernel is critical to network settings and process scheduling. perform the following Configuration:
?? Symmetric? 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 be firewils? Server? Or is it in TCP/IP? In the network structure of the 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 packages 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 the remote computer sees is the packets sent from the received firewall server, instead of from an 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] for the three options. And the next option IP: always? Deframent? Select [Y].
??? IP: ICMP? Masquerading :? What is masquerading? Can only process TCP or UDP? Packets, if you want to make masqurerading? Can also handle ICMP? Packets. Select [Y] for this option.
??? IP: always? Defragment: Can packet be received? Fragments is combined back to the original package.
??? IP: accounting: IP count? Packet traffic, that is, network traffic.
??? IP: optimize? As? Router? Not? Host: Can I disable copy & checksum to prevent IP addresses of servers with high traffic? Packets is lost.
??? IP: tunneling: linux can be used in different domains, and you can directly access the Internet without changing the IP address. Suitable for local computer users.
??? IP: Reverse? ARP? : It mainly provides the bootp function to enable the computer to Boot from the Nic? Start Ram.
??? IP: Disable? Path? MTU? Discovery: Do you want to cancel the Path? MTU? Discovery. MTU? Helps handle crowded networks.
??? The? IPX? Protocol: IPX is Netware? The communication protocol used by the network.
?? Set other parameters as needed. The compiled kernel is 800 KB.
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.