You are not logged in.

#1 2014-07-15 17:55:27

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

[Introduction into kernel] Reduce kernel and initramfs to a minimum

Hi

I want to make a little ArchBMC settopbox. The hardware is based on the mainboard of my old Acer 1810TZ. Runs pretty nice already, but I am not satisfied with the output of lsmod and systemd-analyze blame. There are a lot of modules that I dont need anymore. Right now I this is the first time I dive into kernel stuff. So please bear with me. My first try was to disable autodetect in mkinitcpio.conf. But this had not the desired effect. lsmod is still full of (acer)crap. Yes I know I could blacklist all the stuff, but 1. I want to make it clean, 2 I want to learn something about kernel related stuff 3. blacklisting is not able to exclude all I want. I already tried it. So can you please give me some hints on how to reduce the kernel and answer some questions? I'll begin slow big_smile

Is mkinitcpio related to kernel compiling? I know it packs the initramfs but does it so it imlpicitely?
How can I compile a Kernel, can I decide on what shall be integrated statically?

For the RTFMers: If you can give me reasonble and comprehensible! literature I will of course read it.

Thank you. Regards

Last edited by manuelschneid3r (2014-07-15 17:58:22)


Please feel free to correct my english.

Offline

#2 2014-07-15 18:22:28

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

mkinitcpio is about kernel image, not about the linux kernel.
Read the wiki :-)
https://wiki.archlinux.org/index.php/Mkinitcpio
https://wiki.archlinux.org/index.php/Kernels

I don't think you're going to make it boot much faster this way. Can you post the output that you're dissatisfied with?

Last edited by karol (2014-07-15 18:24:06)

Offline

#3 2014-07-15 18:43:36

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

This is the stuff that I think I dont need. Maybe I dont even know what some of them do, but imho I need nothing but ethernet for remotecontrol, graphics, sound, sdcard readerfor the os, fancontrol for reducing the noise. Sorry for not using the code block, but it doesn't let me highlight stuff.


[root@xbmc ~]# lsmod
Module                  Size  Used by
keucr                  58699  0
uas                    17010  0
i915                  796361  4
drm_kms_helper         39643  1 i915
drm                   244846  6 i915,drm_kms_helper
i2c_algo_bit            5480  1 i915
i2c_i801               11364  0
i2c_core               41648  5 drm,i915,i2c_i801,drm_kms_helper,i2c_algo_bit
joydev                 10367  0
snd_hda_codec_hdmi     40396  1
snd_hda_codec_realtek    54803  1
snd_hda_codec_generic    56366  1 snd_hda_codec_realtek
arc4                    2064  2
iTCO_wdt                5663  0
iwldvm                170799  0
acer_wmi               24550  0
sparse_keymap           3242  1 acer_wmi
led_class               3611  2 acer_wmi,iwldvm
iTCO_vendor_support     1929  1 iTCO_wdt
coretemp                6388  0
hwmon                   3346  1 coretemp
microcode              17157  0
acerhdf                 8897  0
pcspkr                  2059  0
snd_hda_intel          22831  3
snd_hda_controller     22911  1 snd_hda_intel
atl1c                  38362  0
psmouse                94918  0
evdev                  11784  12
mac_hid                 3273  0
lpc_ich                14008  0
snd_hda_codec         104665  5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller
serio_raw               5073  0
snd_hwdep               6652  1 snd_hda_codec
mac80211              495361  1 iwldvm
iwlwifi               148746  1 iwldvm
snd_pcm                83207  4 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_controller
intel_agp              11504  0
cfg80211              437959  3 iwlwifi,mac80211,iwldvm
rfkill                 15971  2 cfg80211,acer_wmi
intel_gtt              12856  3 i915,intel_agp
battery                 7885  0
snd_timer              19294  1 snd_pcm
acpi_cpufreq           10170  0
snd                    61276  14 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
shpchp                 25706  0
wmi                     8539  1 acer_wmi
ac                      3595  0
video                  12057  2 i915,acer_wmi
button                  4765  1 i915
soundcore               5551  2 snd,snd_hda_codec
processor              25153  3 acpi_cpufreq
ext4                  494292  1
crc16                   1359  1 ext4
mbcache                 9155  1 ext4
jbd2                   82948  1 ext4
sd_mod                 37554  2
crc_t10dif              1135  1 sd_mod
crct10dif_common        1436  1 crc_t10dif
hid_generic             1217  0
usbhid                 41250  0
hid                    93052  2 hid_generic,usbhid
usb_storage            50327  2 uas
atkbd                  17006  0
libps2                  4571  2 atkbd,psmouse
ahci                   24299  0
libahci                21772  1 ahci
libata                174089  2 ahci,libahci
scsi_mod              138333  5 uas,keucr,usb_storage,libata,sd_mod
ehci_pci                4152  0
uhci_hcd               34795  0
ehci_hcd               64619  1 ehci_pci
usbcore               188381  7 uas,keucr,uhci_hcd,usb_storage,ehci_hcd,ehci_pci,usbhid
usb_common              1712  1 usbcore
i8042                  13666  2 acer_wmi,libps2
serio                  11018  9 serio_raw,atkbd,i8042,psmouse



[root@xbmc ~]# systemd-analyze blame
          1.518s systemd-logind.service
          1.298s dhcpcd.service
           545ms systemd-tmpfiles-setup.service
           328ms polkit.service
           220ms systemd-remount-fs.service
           212ms dev-hugepages.mount
           211ms sys-kernel-debug.mount
           200ms dev-mqueue.mount
           197ms sys-kernel-config.mount
           193ms systemd-vconsole-setup.service
           189ms systemd-udev-trigger.service
           187ms systemd-sysctl.service
           187ms tmp.mount
           187ms systemd-rfkill@rfkill0.service
           161ms systemd-backlight@backlight:acpi_video0.service
           152ms systemd-update-utmp.service
           137ms systemd-journal-flush.service
           133ms kmod-static-nodes.service
            73ms systemd-udevd.service
            48ms user@420.service
            35ms systemd-tmpfiles-setup-dev.service
            26ms systemd-random-seed.service
            24ms systemd-backlight@backlight:intel_backlight.service
            21ms user@0.service
            15ms systemd-user-sessions.service
            13ms rtkit-daemon.service
             9ms systemd-tmpfiles-clean.service

Last edited by manuelschneid3r (2014-07-15 18:46:12)


Please feel free to correct my english.

Offline

#4 2014-07-15 19:00:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

Offline

#5 2014-07-15 19:09:30

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

The systemd-analyze output is unrelated to the kernel or initramfs.  As for kernels, you can compile a custom kernel with the necessary components (such as your root filesystem) built in, eliminating the need for an initramfs. I think that would speed up boot (though probably not by much), but it would require a recompile with every new kernel release.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#6 2014-07-15 21:17:39

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,163
Website

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

ids1024 wrote:

TAs for kernels, you can compile a custom kernel with the necessary components (such as your root filesystem) built in, eliminating the need for an initramfs. I think that would speed up boot (though probably not by much), but it would require a recompile with every new kernel release.

That's it to a T.

I'd start by downloading the source files for the ARCH kernel and using one of the make menuconfig/nconfig to modify your config down. by commenting the appropriate line out in the PKGBUILD.


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#7 2014-07-15 21:30:09

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

ids1024 wrote:

...it would require a recompile with every new kernel release.

It is pretty trivial to automate this, should OP want to head down this path.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2014-07-15 22:07:15

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

If you do stick with having an initramfs then you could probably shave a few ms off your boot time by playing about with the compression settings. If you have a fast processor and a slow drive then a highly compressed image will be quicker to load, if you have a slow processor and and a fast drive then uncompressed will be quickest. Play about with the setting in mkinitcpio.conf and do some benchmarks for your system. You can also play with the compression settings for the kernel itself, but it will take a lot longer to benchmark though as you'll have to recompile between runs.


If you're compiling a kernel specific to your system then look into localmodconfig during the make process, it will include only the modules that are currently loaded. I know that you're trying to optimize that list but the kernel has auto-detected those modules for a reason, in my experience it's always a good one.


Although all of the advice in this thread is good, you have to ask yourself  -  'Is it worth it?'
I don't know how much your time is worth but days of kernel compiling and testing is not worth it just to shave tenths of a second off your boot time IMHO.

Last edited by Slithery (2014-07-15 23:11:11)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2014-07-16 05:17:19

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: [Introduction into kernel] Reduce kernel and initramfs to a minimum

There are scripts called autokernconf and diet-kconfig for compiling a kernel with only the necessary modules.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

Board footer

Powered by FluxBB