ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:23.49KB ,
资源ID:4983036      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/4983036.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(构建linux之最小系统.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

构建linux之最小系统.docx

1、构建linux之最小系统构建linux之最小系统声明:该文件是对我2009年最后两周学习过程的总结,希望能帮助到学习中的人们。该文档按照当前日期的最新版GPL协议发布。欢迎转载,但须注明作者及出处。作者:Jim Zheng。接触Linux 4年,但是一直处于自学状态,没有机会参与Linux平台的产品开发。很希望能用上Linux平台作实际开发。联系方式:zhengweishang日期:2010.1.1内容提要:1。最小系统的意义2。最小系统的要素3。主机环境介绍4。软件版本选择5。构建完成之文件6。最小系统启动信息7。详细构建过程8。下一步工作1。最小系统的意义在我的开发经历中,每当要使用新的硬

2、件或软件平台时,我都会从他们的最小系统开始。比如新使用一款单片机,我会首先研究其电源、复位、时钟、JTAG、UART。根据这些可以搭建一个开发的最小硬件系统。我在维护一套3W行的C语言软件时,也曾将起其精简到1千行的最小系统,仅包含消息机制、在屏幕上显示一个小图标、队列服务等,而其他的功能都是一些添加上去的模块。吃透这个最小系统后,增加功能或修正bug就简单很多。最小系统有些像建房子打的地基,对它理解透了,会发现那些眼花缭乱的功能通过添砖加瓦的工作就可以完成了。现今的软硬件系统设计时模块化都做得很好,增减一个功能模块已经是个比较简单的事情。我想比较深入的学习Linux,于是想到:Linux的最

3、小系统是什么样?2。最小系统的要素Linux的发布版本都提供了大量完善的功能和服务,而我想建立的最小系统之仅包含以下要素:A. 有字符显示。B。能通过键盘输入字符C。能执行ls等简单命令根据以上需求,并分析Linux平台的架构。该最小系统特征如下A。kernel+rootfs, 不使用initrd.B. ls等命令放在rootfs中,elf格式。静态编译,不支持动态链接库。C。 kernel支持elf可执行文件格式D。 kernel不支持可加载模块功能。必要的驱动直接编译到kernel中。E。kernel应包含字符的显示驱动、键盘驱动。F。rootfs放在IDE硬盘上,所以kernel应包含P

4、ATA驱动G。rootfs为EXT3文件系统,kernel应包含EXT2、EXT3文件系统驱动。3。主机环境介绍rootgoldway # cat /proc/versionLinux version 2.6.18-1.2798.fc6 (brewbuilderhs20-bc2-) (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30) #1 SMP Mon Oct 16 14:37:32 EDT 2006rootgoldway # cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu fami

5、ly : 15model : 2model name : Intel(R) Celeron(R) CPU 2.60GHzstepping : 9cpu MHz : 2625.987cache size : 128 KBfdiv_bug : nohlt_bug : nof00f_bug : nocoma_bug : nofpu : yesfpu_exception : yescpuid level : 2wp : yesflags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts a

6、cpi mmx fxsr sse sse2 ss ht tm pbe up cid xtprbogomips : 5257.90rootgoldway # lspci00:00.0 Host bridge: VIA Technologies, Inc. P4M266 Host Bridge00:01.0 PCI bridge: VIA Technologies, Inc. VT8633 Apollo Pro266 AGP00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80

7、)00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Brid

8、ge00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)00:11.5 * audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50)00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 Rhine-II (rev 74)01:00.0 VGA

9、compatible controller: nVidia Corporation NV34 GeForce FX 5200 (rev a1)rootgoldway # fdisk -lDisk /dev/hda: 160.0 GB, 160041885696 bytes255 heads, 63 sectors/track, 19457 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks IdSystem/dev/hda1 * 1 1001 8040501 7HPFS/N

10、TFS/dev/hda2 1002 19457 148247820 fW95 Extd (LBA)/dev/hda5 1002 5001 32129968+ 7HPFS/NTFS/dev/hda6 5002 9001 32129968+ 7HPFS/NTFS/dev/hda7 9002 13001 32129968+ cW95 FAT32 (LBA)/dev/hda8 13002 17001 32129968+ cW95 FAT32 (LBA)/dev/hda9 18213 19457 10000431 83Linux/dev/hda10 17002 18081 8675068+83Linux

11、/dev/hda11 18082 18212 1052226 82Linux swap / SolarisPartition table entries are not in disk orderrootgoldway # mount/dev/hda10 on / type ext3 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw)/dev/hda7 on

12、/mnt/windows/f type vfat (rw)/dev/hda8 on /mnt/windows/g type vfat (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)/dev/hda9 on /mnt/cdrom type ext3 (rw)请注意以下几点:A。硬盘是IDE接口,所以这篇文档描述的操作不适合于使用SATA硬盘的朋友。B。我使用的linux dist是fedora core 6. gcc v

13、ersion 4.1.1C。/dev/hda10是fc6的/, 即将构建的最小系统的文件将放在/dev/hda9中。4。软件版本选择A. 选择busybox-1.15.3构建rootfs.B. 内核版本选择linux-2.6.26.5 。gcc4.1.1不支持最新版的kernel. 5。构建完成之文件rootgoldway # ll /mnt/cdrom总计 728drwxr-xr-x 2 root root 4096 12-31 19:20 bin-rw-r-r- 1 root root 701872 01-01 00:28 bzImagedrwxr-xr-x 2 root root 409

14、6 12-31 19:27 dev-rw-r-r- 1 root root 3900 2010-01-01 dmesg.txtdrwxr-xr-x 3 root root 4096 01-01 13:03 etcdrwxr-xr-x 2 root root 4096 01-01 13:07 mntdrwxr-xr-x 2 root root 4096 12-31 19:25 procdrwxr-xr-x 2 root root 4096 12-31 19:20 sbindrwxr-xr-x 2 root root 4096 12-31 19:25 sysdrwxr-xr-x 4 root ro

15、ot 4096 12-31 19:20 usr以上文件夹打包给大家rootgoldway cdrom# tar jcf ./rootfs.tar.bz2 *rootgoldway cdrom# ll .总计 1508drwxr-xr-x 10 root root 4096 2010-01-01 cdrom-rw-r-r-1 root root 1516709 01-01 13:14 rootfs.tar.bz2drwxr-xr-x2 root root 4096 12-11 19:14 usbdrwxr-xr-x6 root root 4096 11-07 17:38 windows以下为gr

16、ub引导设置:rootgoldway # cat /etc/grub.conf# grub.conf generated by anaconda# Note that you do not have to rerun grub after making changes to this file# NOTICE:You do not have a /boot partition.This means that# all kernel and initrd paths are relative to /, eg.# root (hd0,9)# kernel /boot/vmlinuz-versio

17、n ro root=/dev/hda10# initrd /boot/initrd-version.img#boot=/dev/hdadefault=2timeout=5splashimage=(hd0,9)/boot/grub/splash.xpm.gzhiddenmenutitle kernel test root (hd0,8) kernel /bzImage ro root=/dev/hda9title Fedora Core (2.6.18-1.2798.fc6) root (hd0,9) kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=

18、LABEL=/1 rhgb quiet initrd /boot/initrd-2.6.18-1.2798.fc6.imgtitle Other rootnoverify (hd0,0) chainloader +16。最小系统启动信息Linux version 2.6.26.5 (rootgoldway) (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30) #12 Fri Jan 1 00:28:28 CST 2010BIOS-provided physical RAM map:BIOS-e820: 0000000000000000 - 000000

19、000009fc00 (usable)BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)BIOS-e820: 0000000000100000 - 000000000fff0000 (usable)BIOS-e820: 000000000fff0000 - 000000000fff3000 (ACPI NVS)BIOS-e820: 000000000fff3000 - 0000000010000000 (ACPI da

20、ta)BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)0MB HIGHMEM available.255MB LOWMEM available.Entering add_active_range(0, 0, 65520) 0 entries of 256 usedZone PFN ranges:DMA 0 - 4096Normal 4096 - 65520HighMem 65520 - 65520Movable zone start PFN for each nodeearly_node_map1 active PFN rang

21、es 0: 0 - 65520On node 0 totalpages: 65520DMA zone: 32 pages used for memmapDMA zone: 0 pages reservedDMA zone: 4064 pages, LIFO batch:0Normal zone: 480 pages used for memmapNormal zone: 60944 pages, LIFO batch:15HighMem zone: 0 pages used for memmapMovable zone: 0 pages used for memmapDMI 2.3 prese

22、nt.Allocating PCI resources starting at 20000000 (gap: 10000000:eec00000)Built 1 zonelists in Zone order, mobility grouping on.Total pages: 65008Kernel command line: ro root=/dev/hda9Enabling fast FPU save and restore. done.Enabling unmasked SIMD FPU exception support. done.Initializing CPU#0PID has

23、h table entries: 1024 (order: 10, 4096 bytes)Detected 2625.912 MHz processor.Console: colour VGA+ 80x25console tty0 enabledDentry cache hash table entries: 32768 (order: 5, 131072 bytes)Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)Memory: 257764k/262080k available (912k kernel code,

24、3808k reserved, 300k data, 100k init, 0k highmem)virtual kernel memory layout: fixmap: 0xfffee000 - 0xfffff000 (68 kB) pkmap : 0xff800000 - 0xffc00000 (4096 kB) vmalloc : 0xd0800000 - 0xff7fe000 ( 751 MB) lowmem: 0xc0000000 - 0xcfff0000 ( 255 MB) .init : 0xc0232000 - 0xc024b000 ( 100 kB) .data : 0xc

25、01e4097 - 0xc022f42c ( 300 kB) .text : 0xc0100000 - 0xc01e4097 ( 912 kB)Checking if this processor honours the WP bit even in supervisor mode.Ok.CPA: page pool initialized 1 of 1 pages preallocatedSLUB: Genslabs=12, HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1Calibrating delay using timer s

26、pecific routine. 5257.16 BogoMIPS (lpj=10514322)Mount-cache hash table entries: 512CPU: Trace cache: 12K uops, L1 D cache: 8KCPU: L2 cache: 128KCPU: Intel(R) Celeron(R) CPU 2.60GHz stepping 09Checking hlt instruction. OK.Freeing SMP alternatives: 0k freedSetting up standard PCI resourcesio scheduler

27、 noop registered (default)Uniform Multi-Platform E-IDE driveride: Assuming 50MHz system bus speed for PIO modes; override with idebus=xxide_generic: please use probe_mask=0x3f module parameter for probing all legacy ISA IDE portsProbing IDE interface ide0.hda: ST3160215A, ATA DISK driveProbing IDE i

28、nterface ide1.ide0 at 0x1f0-0x1f7,0x3f6 on irq 14ide1 at 0x170-0x177,0x376 on irq 15hda: max request size: 512KiBhda: 312581808 sectors (160041 MB) w/2048KiB Cache, CHS=19457/255/63hda: cache flushes supportedhda: hda1 hda2 serio: i8042 KBD port at 0x60,0x64 irq 1serio: i8042 AUX port at 0x60,0x64 i

29、rq 12mice: PS/2 mouse device common for all miceUsing IPI Shortcut modeinput: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0kjournald starting.Commit interval 5 secondsEXT3-fs: mounted filesystem with ordered data mode.VFS: Mounted root (ext3 filesystem) readonly.Freeing unused kernel memory: 100k freedEXT3-fs warning: maximal mount count reached, running e

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1