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

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
dsj
帖子: 810
注册时间: 2008-08-21 20:26

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

#1

帖子 dsj » 2008-10-01 16:54

这个是原文
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>
软件交流群:17264279
图书分享群:18246379
互动社区:http://www.ubuntuchina.com/
头像
想入非非
帖子: 8078
注册时间: 2008-07-14 22:42
来自: Beijing
联系:

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

#2

帖子 想入非非 » 2008-10-01 19:08

没有什么兴趣。。。启动速度不能准确的说明什么东西 :em05
Ubuntu User
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

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

#3

帖子 BigSnake.NET » 2008-10-01 19:17

这个根本就是变态玩法嘛..
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

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

#4

帖子 bones7456 » 2008-10-01 19:19

5秒钟我的bios还没启动好grub呢~ :em03
关注我的blog: ε==3
头像
xjpvictor
帖子: 2837
注册时间: 2007-08-22 15:55
系统: Archlinux
来自: 新加坡
联系:

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

#5

帖子 xjpvictor » 2008-10-01 19:22

bones7456 写了:5秒钟我的bios还没启动好grub呢~ :em03
Me too..
Entschuldigung. Ich habe keine ahnung.
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
头像
Vivi.FFix
帖子: 94
注册时间: 2008-08-11 1:38

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

#6

帖子 Vivi.FFix » 2008-10-01 19:33

5秒应该是从grub到X吧,亲眼见到才信,udev、autodetect就会占用3-4秒
grub前的扫描 机子不同效果不同
还是老方法:只加载必要模块、精简启动脚本。
>_<
吃飯睡覺打Vivi
‘千杯不醉只醉月光’
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

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

#7

帖子 自由建客 » 2008-10-01 21:58

我家的黑白电视机都没那么快
头像
sinyadvan
帖子: 724
注册时间: 2008-04-02 15:36
来自: O_O

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

#8

帖子 sinyadvan » 2008-10-01 22:30

呃,进grub就要6s的飘过
^o^ && O_O && ^_^
One World|One Dream|One Piece
愛 ^_^ 這個 美麗的世界O_O

本公司专治各种不服、不爽、谩骂、挑衅。
头像
yimo
帖子: 4
注册时间: 2008-05-24 15:47

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

#9

帖子 yimo » 2008-10-01 22:53

这个觉得跟windows的那种超快启动一个样,没什么大的价值……
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

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

#10

帖子 adagio » 2008-10-01 23:55

自由建客 写了:我家的黑白电视机都没那么快
嗯,我家机顶盒启动都要1分多钟……
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
slg1984
帖子: 69
注册时间: 2008-05-13 22:02

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

#11

帖子 slg1984 » 2008-10-03 8:07

尝试一下还不错,不过总体意义不大
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

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

#12

帖子 eexpress » 2008-10-03 15:46

OneSecondX 我要。等人搞定先。
● 鸣学
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

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

#13

帖子 自由建客 » 2008-10-03 17:41

靠!用笔记本通常都是开盖即用的。
头像
sinyadvan
帖子: 724
注册时间: 2008-04-02 15:36
来自: O_O

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

#14

帖子 sinyadvan » 2008-10-03 19:01

自由建客 写了:靠!用笔记本通常都是开盖即用的。
呃,你说的是忘关机的吧
^o^ && O_O && ^_^
One World|One Dream|One Piece
愛 ^_^ 這個 美麗的世界O_O

本公司专治各种不服、不爽、谩骂、挑衅。
头像
想入非非
帖子: 8078
注册时间: 2008-07-14 22:42
来自: Beijing
联系:

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

#15

帖子 想入非非 » 2008-10-03 22:37

看看又没有小白鼠的实验报告 :em06
Ubuntu User
回复