分页: 1 / 2

[转贴]5秒钟启动你的linux

发表于 : 2008-10-01 16:54
dsj
这个是原文
finit 官方地址是: http://helllabs.org/finit/

Boots into Linux in 5 Seconds
Introduction

Booting fast can significantly impact the user experiences. This HowTo briefly introduce Boot Gear, a method to make a Linux desktop boot into X window faster, and yet remain full functional.

The best result so-far is 5 seconds from boot loader into X:

To reduce the boot time, Boot Gear bypass lots of initial actions, improve the parallel process, and use a rewritten init/startx program instead of autologin and display manager.

Hardware detail of testing platform is Ubuntu 8.04 x86, with Linux Kernel 2.6.24:

Motherboard: Gigabyte C51-MCP51
CPU: AMD Athlon 64 Processor 3000+
Memory: Hyundai 1GB
Hard Disk: WDC WD1600JS-55N

Step 1: Get rid of initrd

By building the necessary funtions into kernel, you can directly boot without initial ramdisk.

For example, the kernel needs these modules to initialize my SATA2 hard drive:

sd_mod (CONFIG_BLK_DEV_SD)
scsi_mod (CONFIG_SCSI)
libata (CONFIG_ATA)
sata_nv (CONFIG_SATA_NV)
ata_generic (CONFIG_ATA_GENERIC)

Since I use Ext3 as filesystem, CONFIG_EXT3_FS is also needed. Change these settings in .config from =m to =y, build by make bzImage, and copy the file arch/x86/boot/bzImage to /vmlinuz-fast. This is our new kernel.
Step 2: Use a fast init

The init used to be InitNG, but soon I have moved to finit due to its extremely fast speed.

Check out the source code:

git clone http://helllabs.org/git/eeepc.git

Be sure to modify the default user account in Makefile, after make, copy the file finit-mdv to /sbin/finit-mdv.
Step 3: Start the X

The Xorg needs dbus, udev and hal daemon. Add a script called /usr/sbin/services.sh:

#!/bin/sh
/etc/init.d/dbus start 2&>1 > /var/log/service.log
/etc/init.d/udev start 2&>1 >> /var/log/service.log &
/etc/init.d/hal start 2&>1 >> /var/log/service.log &

This will be executed by finit after startx.
Step 4: Log everything while booting (Optinal)

To profile (and showing off) the result of boot time, you need a tool called bootchart.

Download bootchart-0.9.tar.bz2 from the website, extract it and install by ./install.sh.

Edit /sbin/bootchartd and change init variable:

init="/sbin/finit-mdv"

Add a new line into /usr/sbin/services.sh:

/sbin/bootchartd stop

Finally, modify the bootloader entry (GRUB for example):

title Boot Gear fast booting
root (hd0,6)
kernel /vmlinuz-fast root=/dev/sda7 ro init=/sbin/bootchartd

Note that you can't use UUID format as root parameter.

After reboot, we have a fast booting Linux system now.
Where do we go from here

Let's take a more detail look at booting process:

You may have noticed that X start from the third second, and then services.sh was executed.

There still quite some hard works to do, including:

* BIOS setting adjust
* startx script simplify
* udev script/rule simplify

Fedora has discussed a worth reading feature named OneSecondX.

Boot Gear is a sub-project of PUD GNU/Linux, a Live CD aim to provide a light and quick Linux desktop, yet remain simple and easy to use.

Thanks, and feedback welcome!
Pin-Shiun Chen (penk) <penkia@gmail.com>

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 19:08
想入非非
没有什么兴趣。。。启动速度不能准确的说明什么东西 :em05

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 19:17
BigSnake.NET
这个根本就是变态玩法嘛..

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 19:19
bones7456
5秒钟我的bios还没启动好grub呢~ :em03

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 19:22
xjpvictor
bones7456 写了:5秒钟我的bios还没启动好grub呢~ :em03
Me too..

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 19:33
Vivi.FFix
5秒应该是从grub到X吧,亲眼见到才信,udev、autodetect就会占用3-4秒
grub前的扫描 机子不同效果不同
还是老方法:只加载必要模块、精简启动脚本。

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 21:58
自由建客
我家的黑白电视机都没那么快

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 22:30
sinyadvan
呃,进grub就要6s的飘过

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 22:53
yimo
这个觉得跟windows的那种超快启动一个样,没什么大的价值……

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-01 23:55
adagio
自由建客 写了:我家的黑白电视机都没那么快
嗯,我家机顶盒启动都要1分多钟……

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-03 8:07
slg1984
尝试一下还不错,不过总体意义不大

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-03 15:46
eexpress
OneSecondX 我要。等人搞定先。

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-03 17:41
自由建客
靠!用笔记本通常都是开盖即用的。

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-03 19:01
sinyadvan
自由建客 写了:靠!用笔记本通常都是开盖即用的。
呃,你说的是忘关机的吧

Re: [转贴]5秒钟启动你的linux

发表于 : 2008-10-03 22:37
想入非非
看看又没有小白鼠的实验报告 :em06