怎样编译内核去掉 initrd?
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
怎样编译内核去掉 initrd?
这两天在练习编译内核,已经把模块数从 2298 裁减到了 1694,看到有的帖子提到可以把磁盘和文件系统驱动编到内核里去掉 initrd 提升启动时间,搜索了一下没有具体的例子。哪位实践过指点一下具体是哪几个选项,还有 grub 引导时有没有什么要注意的,谢谢。
- HuntXu
- 帖子: 5776
- 注册时间: 2007-09-29 3:09
Re: 怎样编译内核去掉 initrd?
1694...
去掉initrd在general setup里的,自己仔细看看吧...
去掉initrd在general setup里的,自己仔细看看吧...
代码: 全选
[hunt@bubble ~]$ O_< modprobe -l|wc -l
16
[hunt@bubble ~]$ O_< uname -r
2.6.28.7-hunt
HUNT Unfortunately No Talent...
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
Re: 怎样编译内核去掉 initrd?
多谢指教,已经成功去掉 initrd 了,开机时间缩短 20%,慢慢优化,不急。
上面怎么会只有 16 个模块?我开机 lsmod 也有 100 多个的,太恐怖了。
上面怎么会只有 16 个模块?我开机 lsmod 也有 100 多个的,太恐怖了。
- HuntXu
- 帖子: 5776
- 注册时间: 2007-09-29 3:09
Re: 怎样编译内核去掉 initrd?
其他的都在内核里了...1.5M带了ext4...AutoXBC 写了:多谢指教,已经成功去掉 initrd 了,开机时间缩短 20%,慢慢优化,不急。
上面怎么会只有 16 个模块?我开机 lsmod 也有 100 多个的,太恐怖了。
HUNT Unfortunately No Talent...
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
Re: 怎样编译内核去掉 initrd?
很强,能否把 config 帖上来,学习一下。
- HuntXu
- 帖子: 5776
- 注册时间: 2007-09-29 3:09
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
Re: 怎样编译内核去掉 initrd?
哦,自己搞也好,更有乐趣。
-
- 帖子: 3
- 注册时间: 2009-05-15 16:13
Re: 怎样编译内核去掉 initrd?
AutoXBC,
我也在make menuconfig去掉initrd支持了,还需要哪些配置才能使编译出来的内核镜像不需要initrd就能启动啊,能否说得详细点?
我也在make menuconfig去掉initrd支持了,还需要哪些配置才能使编译出来的内核镜像不需要initrd就能启动啊,能否说得详细点?
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
Re: 怎样编译内核去掉 initrd?
需要把硬盘控制器的驱动和根分区文件系统模块编译入内核。
可以把 lspci -v 的输出贴上来看看。
可以把 lspci -v 的输出贴上来看看。
-
- 帖子: 3
- 注册时间: 2009-05-15 16:13
Re: 怎样编译内核去掉 initrd?
根分区文件系统是ext3,ext2和ext3都已经编进内核了,lspci -v 输出很多,如下:
root@AMTT:~# lspci -v
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 0
Kernel driver in use: agpgart-intel
Kernel modules: intel-agp
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
Flags: bus master, 66MHz, medium devsel, latency 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=64
Kernel modules: shpchp
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 0
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [Master SecP PriP])
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled]
I/O ports at 1050
Kernel driver in use: ata_piix
Kernel modules: ata_piix
00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64, IRQ 19
I/O ports at 1060
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
Subsystem: VMware Inc Device 1976
Flags: medium devsel, IRQ 9
Kernel modules: i2c-piix4
00:0f.0 VGA compatible controller: VMware Inc Abstract SVGA II Adapter
Subsystem: VMware Inc Abstract SVGA II Adapter
Flags: medium devsel
I/O ports at 1400
Memory at f0000000 (32-bit, non-prefetchable)
Memory at e8000000 (32-bit, non-prefetchable)
[virtual] Expansion ROM at 40100000 [disabled]
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
Flags: bus master, medium devsel, latency 64, IRQ 17
I/O ports at 1080 [size=128]
Memory at e8800000 (32-bit, non-prefetchable) [size=4K]
[virtual] Expansion ROM at 40108000 [disabled] [size=16K]
Kernel driver in use: mptspi
Kernel modules: mptspi
00:11.0 PCI bridge: VMware Inc PCI bridge (rev 01)
Flags: bus master, medium devsel, latency 64
Memory at e8801000 (64-bit, non-prefetchable) [size=4K]
Bus: primary=00, secondary=02, subordinate=02, sec-latency=68
I/O behind bridge: 00002000-00002fff
Memory behind bridge: e8900000-e89fffff
Prefetchable memory behind bridge: 0000000040000000-00000000400fffff
Capabilities: [40] Subsystem: VMware Inc PCI bridge
Kernel modules: shpchp
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
Subsystem: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Flags: bus master, medium devsel, latency 64, IRQ 18
I/O ports at 2000 [size=128]
[virtual] Expansion ROM at 40000000 [disabled] [size=64K]
Kernel driver in use: pcnet32
Kernel modules: pcnet32
02:01.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
Subsystem: Ensoniq ES1371 [AudioPCI-97]
Flags: bus master, ?? devsel, latency 64, IRQ 19
I/O ports at 2080 [size=64]
Kernel driver in use: ENS1371
Kernel modules: snd-ens1371
02:02.0 USB Controller: VMware Inc Abstract USB2 EHCI Controller (prog-if 20)
Subsystem: VMware Inc Abstract USB2 EHCI Controller
Flags: bus master, fast devsel, latency 64, IRQ 16
Memory at e8900000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ehci_hcd
Kernel modules: ehci-hcd
root@AMTT:~# lspci -v
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 0
Kernel driver in use: agpgart-intel
Kernel modules: intel-agp
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
Flags: bus master, 66MHz, medium devsel, latency 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=64
Kernel modules: shpchp
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 0
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [Master SecP PriP])
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled]
I/O ports at 1050
Kernel driver in use: ata_piix
Kernel modules: ata_piix
00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64, IRQ 19
I/O ports at 1060
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
Subsystem: VMware Inc Device 1976
Flags: medium devsel, IRQ 9
Kernel modules: i2c-piix4
00:0f.0 VGA compatible controller: VMware Inc Abstract SVGA II Adapter
Subsystem: VMware Inc Abstract SVGA II Adapter
Flags: medium devsel
I/O ports at 1400
Memory at f0000000 (32-bit, non-prefetchable)
Memory at e8000000 (32-bit, non-prefetchable)
[virtual] Expansion ROM at 40100000 [disabled]
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
Flags: bus master, medium devsel, latency 64, IRQ 17
I/O ports at 1080 [size=128]
Memory at e8800000 (32-bit, non-prefetchable) [size=4K]
[virtual] Expansion ROM at 40108000 [disabled] [size=16K]
Kernel driver in use: mptspi
Kernel modules: mptspi
00:11.0 PCI bridge: VMware Inc PCI bridge (rev 01)
Flags: bus master, medium devsel, latency 64
Memory at e8801000 (64-bit, non-prefetchable) [size=4K]
Bus: primary=00, secondary=02, subordinate=02, sec-latency=68
I/O behind bridge: 00002000-00002fff
Memory behind bridge: e8900000-e89fffff
Prefetchable memory behind bridge: 0000000040000000-00000000400fffff
Capabilities: [40] Subsystem: VMware Inc PCI bridge
Kernel modules: shpchp
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
Subsystem: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Flags: bus master, medium devsel, latency 64, IRQ 18
I/O ports at 2000 [size=128]
[virtual] Expansion ROM at 40000000 [disabled] [size=64K]
Kernel driver in use: pcnet32
Kernel modules: pcnet32
02:01.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
Subsystem: Ensoniq ES1371 [AudioPCI-97]
Flags: bus master, ?? devsel, latency 64, IRQ 19
I/O ports at 2080 [size=64]
Kernel driver in use: ENS1371
Kernel modules: snd-ens1371
02:02.0 USB Controller: VMware Inc Abstract USB2 EHCI Controller (prog-if 20)
Subsystem: VMware Inc Abstract USB2 EHCI Controller
Flags: bus master, fast devsel, latency 64, IRQ 16
Memory at e8900000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ehci_hcd
Kernel modules: ehci-hcd
- AutoXBC
- 帖子: 1744
- 注册时间: 2007-10-23 12:54
Re: 怎样编译内核去掉 initrd?
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [Master SecP PriP])
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled]
I/O ports at 1050
Kernel driver in use: ata_piix
Kernel modules: ata_piix
这个模块编到内核里,scsi 条目中的一些模块也编进去,具体哪些忘记了,我已经不玩编译了。
Subsystem: VMware Inc Device 1976
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled]
I/O ports at 1050
Kernel driver in use: ata_piix
Kernel modules: ata_piix
这个模块编到内核里,scsi 条目中的一些模块也编进去,具体哪些忘记了,我已经不玩编译了。
-
- 帖子: 3
- 注册时间: 2009-05-15 16:13
Re: 怎样编译内核去掉 initrd?
谢谢楼上的,这个选了,仍启不来,键盘后面两个灯一直在闪;不知道是不是udev的缘故,貌似ubuntu的udev是在initrd里实现的;有知道的DX指点一二啊。。。
- lonelycorn
- 帖子: 438
- 注册时间: 2007-05-20 18:44
- 来自: 唐山,河北,中国
- 联系:
Re: 怎样编译内核去掉 initrd?
想当年我也为了把内核减小几KB而奋斗在一堆看不懂的选项和google上。现在我懒了,想开了,就用人家编译好的,多省心!