Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Any way to make faster kernel boot?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Tomosius
n00b
n00b


Joined: 19 Jun 2005
Posts: 49

PostPosted: Tue Nov 11, 2014 10:28 am    Post subject: Any way to make faster kernel boot? Reply with quote

Hello everyone,

I have few questions.
Is there any way to check and disable unnecessary (for my laptop) services and modules in kernel?
Because just a kernel is taking about 4.5 seconds to boot, while remaining boot process takes much less time...
Also, any other ideas why Wifi takes longer to start? I boot in to KDE, even can start office or anything, but Wifi appears just maybe after 1 minute... even ifconfig does not show that i have wifi... :( what could be wrong?

Thank you

Regards
Tomas
Back to top
View user's profile Send private message
Pipeng
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jul 2013
Posts: 80

PostPosted: Tue Nov 11, 2014 7:10 pm    Post subject: Optimizing Boot Reply with quote

Hi, first sorry for my poor english, well, the boot procces depends of 3 parts:

1)gcc optimization
in the file make.conf all know we change the cfalgs ldflags and the cxxflags, the basic configuration is of the manual of gentoo
Code:
-O2 -pipe -march=native
in cfalgs and cxxflags, for more you can enable manually yours functions in this, here you can have a lot of info:

basic: https://wiki.gentoo.org/wiki/GCC_optimization
medium: https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/i386-and-x86_002d64-Options.html and https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options
hard: https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html

the last don't is very dificult, but you will have to much to read,a little detail, someuse flags enable cpu funcionts, for example sse ssse3, you can check you cpu function with
Code:
cat /proc/cpuinfo

end next compare with the use vars and enable it, well next.

2)Kernel
Here is very simple, the only of you need the modules you really need in built-in, all the others modules most be out of the kernel, for do this more easy you can check yours started modules with 'lsmod'

3)System start up
well in openrc, the first thing is edit the /etc/conf.d/rc and change or add this line
Code:
RC_PARALLEL_STARTUP="no"

for
Code:
RC_PARALLEL_STARTUP="yes"

next edit /etc/init.d/modules and change
Code:
ebegin "Calculating module dependencies"
                /sbin/modules-update &>/dev/null
                eend $? "Failed to calculate dependencies"

for
Code:
if [ /etc/modules.d -nt /etc/modules.conf ]
    then
        ebegin "Calculating module dependencies"
        /sbin/modules-update &>/dev/null
        eend $? "Failed to calculate dependencies"
    else
        einfo "Module dependencies are up-to-date"
fi


now edit /etc/init.d/localmount and change:
Code:
mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null

for
Code:
mount -aFt nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null


edit /etc/init.d/bootmisc and change
Code:
if [ -x /sbin/env-update.sh ]
then
    ebegin "Updating environment"
    /sbin/env-update.sh >/dev/null
    eend 0
fi

for
Code:
if [ -x /sbin/env-update.sh ]
then
    if [ /etc/env.d -nt /etc/profile.env ]
    then
        ebegin "Updating environment"
        /sbin/env-update.sh >/dev/null
        eend 0
    else
        einfo "Environment up-to-date"
    fi
fi


well the info of openrc i get of this link https://forums.gentoo.org/viewtopic-t-197983.html

in systemd i don't know how optimize it, and this enable parallel start up as default, the only idea i have is you can disable the service you don't need.

Well that is all, i hope this can help you.
Back to top
View user's profile Send private message
Tomosius
n00b
n00b


Joined: 19 Jun 2005
Posts: 49

PostPosted: Wed Nov 12, 2014 8:24 am    Post subject: Reply with quote

Hello Pipelight,

thanks for your reply, but what has GCC optimizations to do with kernel modifications, finding and disabling unnecessary services and modules?
I have done all things you have mentioned, simply i want to fine tune, find what is not needed ad remove it making it smaller and booting faster.
lsmod strange, but shows just one module... mut when i enter to manual kernel configuration, there are options like AMD firmware loading ant etc, even i have Intel CPU. i guess i do not need those functions for AMD. and there are even more such thins, that is what i am interested in doing.

Regards
Tomas
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Wed Nov 12, 2014 11:45 am    Post subject: Reply with quote

Kernel boot time doesn't depend on gcc optimizations at all, because, to start with, make.conf is not read or sourced by gcc in any way, and because the kernel is not built using the system libc, but its own. Even more, you will probably need to patch the kernel sources for most of the essoteric gcc flags to be taken into account at all, since it tends to use very conservative settings about the CFLAGS it admits and uses. And that's for a good reason.

So, all in all, kernel boot time (which is what the thread is about) depends only in the configuration of the kernel, and, of course, the machine. If you build everything statically, and only the strict subset of code that you need for your machine to work, then the kernel will not need to lookup module files in your HD. Besides that, there's little else you can do.

You might have some look experimenting with the kind of compression used, depending on your cpu features (such as the size of the L1 and L2 cache) and the cpu instruction set.

Besides that, enable the time stamps in the kernel output and carefully analyze the dmesg log and see what takes the bigger lapses of time.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
HerrSchafer
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2011
Posts: 139

PostPosted: Wed Nov 12, 2014 1:46 pm    Post subject: Reply with quote

I also would like to know how to properly set my hardware drivers into the kernel, by using the output of a command like
Code:
lspci
or
Code:
lsusb


Code:
# lspci
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 05)
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 05)
00:1c.2 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 (rev 05)
00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 05)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 05)
02:00.0 Network controller: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05)
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
04:00.1 SD Host controller: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
7f:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
7f:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
7f:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
7f:02.1 Host bridge: Intel Corporation 1st Generation Core Processor QPI Physical 0 (rev 02)
7f:02.2 Host bridge: Intel Corporation 1st Generation Core Processor Reserved (rev 02)
7f:02.3 Host bridge: Intel Corporation 1st Generation Core Processor Reserved (rev 02)


For this output, for an example, I don't know the model of my graphics card (I know that is built within the processor); the model of eth controller listed above, doesn't exists in the kernel's options; how can I know which model is the best choice?

The idea is to built a minimal kernel, which will be faster and lighter than a kernel with a lot of default options enabled (I think), but I know there are things that depends on others that I may have not installed on my laptop.

Thanks for any reply.
_________________
“Long is the way, and hard, that out of hell leads up to light.”
― John Milton
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Wed Nov 12, 2014 2:03 pm    Post subject: Reply with quote

HerrSchafer wrote:
I also would like to know how to properly set my hardware drivers into the kernel, by using the output of a command like
Code:
lspci
or
Code:
lsusb

..
Thanks for any reply.

Try:
Code:
lspci -k

IME all you really need are mobo chipset drivers for your hard-drive controller, and whatever fs is on root builtin (ext4 is nice because you can use the same module for ext2 and ext3 as well.)

I also tend to build in my ethernet controller, so it's always up when I boot; don't forget DEVTMPFS_MOUNT either. I think the latter is set by the Gentoo options.

I prefer to leave the whole of USB modular, but if you need to boot from USB that's not an option, ofc. (You also have to tell your BIOS to delay usually.)
Back to top
View user's profile Send private message
HerrSchafer
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2011
Posts: 139

PostPosted: Wed Nov 12, 2014 2:43 pm    Post subject: Reply with quote

steveL wrote:
... don't forget DEVTMPFS_MOUNT either.


I'm not sure if I understood it correctly; I have mounted my /var/tmp/portage as tmpfs and I know there are more things mounted like that. Is it what you meant?
Code:
 # mount
rootfs on / type rootfs (rw)
/dev/sda3 on / type ext4 (rw,noatime,data=ordered)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=287452k,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=358842,mode=755)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)
cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda4 on /win type fuseblk (rw,nosuid,nodev,noexec,noatime,allow_other,blksize=4096)
tmpfs on /var/tmp/portage type tmpfs (rw,noatime,uid=250,gid=250,mode=0775,size=2048M)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nodev,noexec,nosuid)


And back to the thread's question, who can I kill:
Code:
# rc-update show
       NetworkManager |      default                 
                acpid |      default                 
         avahi-daemon |      default                 
             bootmisc | boot                         
           consolekit |      default                 
                cupsd |      default                 
                 dbus |      default                 
                devfs |                       sysinit
                dmesg |                       sysinit
                 fsck | boot                         
               hdparm |      default                 
             hostname | boot                         
              hwclock | boot                         
              keymaps | boot                         
            killprocs |              shutdown       
    kmod-static-nodes |                       sysinit
           lm_sensors |      default                 
                local |      default                 
           localmount | boot                         
             loopback | boot                         
              modules | boot                         
             mount-ro |              shutdown       
                 mtab | boot                         
             netmount |      default                 
               procfs | boot                         
                 root | boot                         
                samba |      default                 
            savecache |              shutdown       
                 swap | boot                         
            swapfiles | boot                         
               sysctl | boot                         
                sysfs |                       sysinit
            syslog-ng |      default                 
         termencoding | boot                         
         tmpfiles.dev |                       sysinit
       tmpfiles.setup | boot                         
                 udev |                       sysinit
           udev-mount |                       sysinit
              urandom | boot                         
                  xdm |      default     


(I'm on a windows network)[i]
_________________
“Long is the way, and hard, that out of hell leads up to light.”
― John Milton
Back to top
View user's profile Send private message
Tomosius
n00b
n00b


Joined: 19 Jun 2005
Posts: 49

PostPosted: Thu Nov 13, 2014 3:28 pm    Post subject: Reply with quote

One more question:

how to enable bootchart in EFI STUB kernel (kernel command line)?
because if i try to enable addint to my line:
root=..... initcall_debug printk.time=y init=/sbin/bootchartd

booting stops at waiting for uevents to be processed (or something like that)...

what could be wrong?

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum