VMware中打造自己的最小Linux系统


一. 最小系统要求 1. 接受键盘输入,能显示字符信息 2. 能处理普通linux发行版中的大部分基本命令,如:ls, mv... 3. 具有网络功能 4. 不使用ramdisk, 所需驱动全部编译进内核
二. 主机环境 1. VMware 7.0 / windows 7 2. 主机系统Ubuntu 10.04 x86 3. 最小系统内核版本 linux-2.6.38
三. 详细构建过程 1. 下载linux-2.6.38内核
  1. #cd /usr/src  
  2. #wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.gz  
  3. #tar xvf linux-2.6.38.tar.gz  
  4. #cd linux-2.6.38  

2.编译内核 这一步主要就是内核的配置,如果配置错了可能导致系统无法启动,因此需要非常仔细。
  1. #make mrproper               
  2. #make allnoconfig  
  3. #make menuconfig  

首先利用lspci查看硬件信息:
  1. #lspci  
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08) 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10) 00:0f.0 VGA compatible controller: VMware SVGA II Adapter 00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01) 00:11.0 PCI bridge: VMware PCI bridge (rev 02) 00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01) ................... ......................... ....................... 00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01) 00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01) 02:00.0 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB 02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10) 02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02) 02:03.0 USB Controller: VMware USB2 EHCI Controller 根据查到的硬件型号配置.config文件 以下详细介绍内核的配置 General setup ---> [*] System V IPC [*] Enable loadable module support ---> Processor type and features ---> Processor family (Pentium Pro) ---> [*] Generuc x86 support Bus options (PCI etc.) ---> [*] PCI support PCI access mode (Any) ---> Executable file formats / Emulations ---> [*] Kernel support for ELF binaries [*] Write ELF core dumps with partial segments [*] Networking support  ---> Networking options ---> <*> Packet socket <*> Unix domain sockets (NEW) [*] TCP/IP networking <*>   IP: IPsec transport mode (NEW) <*>   IP: IPsec tunnel mode (NEW) <*>   IP: IPsec BEET mode (NEW)  <*>   Large Receive Offload (ipv4/tcp) (NEW) <*>   INET: socket monitoring interface (NEW)  Device Drivers  ---> [*] Block devices ---> <*> Loopback device support SCSI device support ---> <*> SCSI device support [*] legacy /proc/scsi/ support (NEW) <*> SCSI disk support [*] SCSI low-level drivers (NEW) ---> <*> BusLogic SCSI support [*] Fusion MPT device support ---> <*> Fusion MPT ScsiHost drivers for SPI <*> Fusion MPT ScsiHost drivers for FC <*> Fusion MPT ScsiHost drivers for SAS <*> Fusion MPT misc device (ioctl) driver [*] Network device support ---> [*] Ethernet (10 or 100Mbit) ---> [*] EISA, VLB, PCI and on board controllers <*> AMD PCnet32 PCI support Graphics support  ---> <*> Support for frame buffer devices ---> File systems  ---> <*> Second extended fs support [*]   Ext2 extended attributes  [*]     Ext2 POSIX Access Control Lists   [*]     Ext2 Security Labels [*] Ext2 execute in place support <*> Ext3 journalling file system support  [*]   Default to 'data=ordered' in ext3 (NEW) [*]   Ext3 extended attributes (NEW)   [*]     Ext3 POSIX Access Control Lists    [*]     Ext3 Security Labels    CD-ROM/DVD Filesystems ---> <*> ISO 9660 CDROM file system support <*> Native language support ---> <*> Codepage 437 (United States, Canada) <*> Simplified Chinese charset (CP936, GB2312) 配置完成后就可以开始编译了:
  1. #make bzImage  
注意:在make menuconfig的时候一定要选对磁盘驱动,否则会出现kernel panic -- VFS error: 这里我用的是SCSI的磁盘,IDE的要做相应修改。
  • 1
  • 2
  • 3
  • 下一页
【内容导航】
第1页:构建内核 第2页:文件系统
第3页:配置网络

相关内容