How-To :: kernel 4.16.7 com patchs -CK


E hoje veremos como compilar um kernel mais recente, o 4.16.7 no Slackware 14.2, nele serão adicionados os patches de Con Kolivas, os famosos -ck, dentre eles está o MuQSS (Multiple Queue Skiplist Scheduler), em tradução livre “Agendador de fila múltipla), uma variação do também famoso BFS (Brain Fuck Scheduler), você pode pular esses passos de aplicação dos patches e seguir com o feijão-com-arroz tradicional, OK?

Slackware com o novo kernel, boot em 55s, lento pra variar rsrs

Mãos à obra!

Para acelerar os passos, logue-se como root para diminuir as etapas (aqui fiz uma parte como usuário normal, como visto nas imagens):

$ su <senha-de-root>
# cd /usr/src

Baixe o novo kernel:

# wget -nv https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.16.7.tar.xz
kernel e patches baixados (aqui como usuário normal)

Baixe a config mais recente do kernel do Slackware -current, relativa a sua arquitetura:

# wget -nv https://mirrors.slackware.com/slackware/slackware-current/source/k/kernel-configs/config-huge-4.14.39.x64
ou
# wget -nv https://mirrors.slackware.com/slackware/slackware-current/source/k/kernel-configs/config-huge-4.14.39

Extraia o kernel baixado:

# tar xvf linux-4.16.7.tar.xz
# rm -f linux-4.16.7.tar.xz ### remove o arquivo baixado.

Se existente, remova a pasta linux:

# rm -rf linux

Crie um novo link simbólico apontando para o novo kernel:

# ln -sf linux-4.16.7 linux

Acesse esse novo diretório:

# cd linux

Faça uma limpeza completa antes de iniciar a compilação:

# make clean && make distclean && make mrproper

Baixe os patches via lftp:

# lftp -c "open http://ck.kolivas.org/patches/4.0/4.16/4.16-ck1/; mirror patches"

Mova a config baixada para este diretório:

# mv ../config-huge-4.14.39.x64 .config

Você também pode pular esse passo de baixar a config mais atual de kernel do Slackware Current e executar apenas:

# zcat /proc/config.gz > .config

Também pode usar a config atual do kernel corrente assim:

# make olddefconfig

Ou optar por utilizar apenas os módulos locais habilitados assim:

# make localmodconfig

Agora, você tanto pode aplicar somente o patch MuQSS (o primeiro) ou aplicar logo todos os patches (18 ao todo), que foi o que eu fiz:

# patch -p1 < patches/0001-MultiQueue-Skiplist-Scheduler-version-0.171.patch
# patch -p1 < patches/0002-Make-preemptible-kernel-default.patch
# patch -p1 < patches/0003-Expose-vmsplit-for-our-poor-32-bit-users.patch
# patch -p1 < patches/0004-Create-highres-timeout-variants-of-schedule_timeout-.patch
# patch -p1 < patches/0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch
# patch -p1 < patches/0006-Convert-msleep-to-use-hrtimers-when-active.patch
# patch -p1 < patches/0007-Replace-all-schedule-timeout-1-with-schedule_min_hrt.patch
# patch -p1 < patches/0008-Replace-all-calls-to-schedule_timeout_interruptible-.patch
# patch -p1 < patches/0009-Replace-all-calls-to-schedule_timeout_uninterruptibl.patch
# patch -p1 < patches/0010-Don-t-use-hrtimer-overlay-when-pm_freezing-since-som.patch
# patch -p1 < patches/0011-Make-hrtimer-granularity-and-minimum-hrtimeout-confi.patch
# patch -p1 < patches/0012-Reinstate-default-Hz-of-100-in-combination-with-MuQS.patch
# patch -p1 < patches/0013-Make-threaded-IRQs-optionally-the-default-which-can-.patch
# patch -p1 < patches/0014-Swap-sucks.patch
# patch -p1 < patches/0015-Enable-BFQ-io-scheduler-by-default.patch
# patch -p1 < patches/0016-Fix-Werror-build-failure-in-tools.patch
# patch -p1 < patches/0017-Export-symbol-swiotlb_map_sg_attrs-for-3rd-party-dri.patch
# patch -p1 < patches/0018-Add-ck1-version.patch
# rm -rf patches ### remove a pasta de patches
aplicação dos patches…

Ou pra ficar mais xiki:

# for patch in patches/* ; do patch -p1 < $patch; done
# rm -rf patches ### remove a pasta de patches

Vejam o log:

edps@slack64 ~/linux-4.16.7-ck
☺  for patch in patches/* ; do patch -p1 < $patch; done                        
zsh: correct '$patch' to '$path' [nyae]? n
patching file Documentation/admin-guide/kernel-parameters.txt
patching file Documentation/scheduler/sched-BFS.txt
patching file Documentation/scheduler/sched-MuQSS.txt
patching file Documentation/sysctl/kernel.txt
patching file arch/powerpc/platforms/cell/spufs/sched.c
patching file arch/x86/Kconfig
patching file fs/proc/base.c
patching file include/linux/init_task.h
patching file include/linux/ioprio.h
patching file include/linux/sched.h
patching file include/linux/sched/nohz.h
patching file include/linux/sched/prio.h
patching file include/linux/sched/rt.h
patching file include/linux/sched/task.h
patching file include/linux/skip_list.h
patching file include/uapi/linux/sched.h
patching file init/Kconfig
patching file init/init_task.c
patching file init/main.c
patching file kernel/Makefile
patching file kernel/delayacct.c
patching file kernel/exit.c
patching file kernel/kthread.c
patching file kernel/livepatch/transition.c
patching file kernel/rcu/Kconfig
patching file kernel/sched/Makefile
patching file kernel/sched/MuQSS.c
patching file kernel/sched/MuQSS.h
patching file kernel/sched/cpufreq_schedutil.c
patching file kernel/sched/cputime.c
patching file kernel/sched/idle.c
patching file kernel/sched/sched.h
patching file kernel/sched/topology.c
patching file kernel/skip_list.c
patching file kernel/sysctl.c
patching file kernel/time/clockevents.c
patching file kernel/time/posix-cpu-timers.c
patching file kernel/time/timer.c
patching file kernel/trace/trace_selftest.c
patching file arch/arc/configs/tb10x_defconfig
patching file arch/arm/configs/bcm2835_defconfig
patching file arch/arm/configs/imx_v6_v7_defconfig
patching file arch/arm/configs/mps2_defconfig
patching file arch/arm/configs/mxs_defconfig
patching file arch/blackfin/configs/BF518F-EZBRD_defconfig
patching file arch/blackfin/configs/BF526-EZBRD_defconfig
patching file arch/blackfin/configs/BF527-EZKIT-V2_defconfig
patching file arch/blackfin/configs/BF527-EZKIT_defconfig
patching file arch/blackfin/configs/BF527-TLL6527M_defconfig
patching file arch/blackfin/configs/BF533-EZKIT_defconfig
patching file arch/blackfin/configs/BF533-STAMP_defconfig
patching file arch/blackfin/configs/BF537-STAMP_defconfig
patching file arch/blackfin/configs/BF538-EZKIT_defconfig
patching file arch/blackfin/configs/BF548-EZKIT_defconfig
patching file arch/blackfin/configs/BF561-ACVILON_defconfig
patching file arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
patching file arch/blackfin/configs/BF561-EZKIT_defconfig
patching file arch/blackfin/configs/BF609-EZKIT_defconfig
patching file arch/blackfin/configs/BlackStamp_defconfig
patching file arch/blackfin/configs/CM-BF527_defconfig
patching file arch/blackfin/configs/PNAV-10_defconfig
patching file arch/blackfin/configs/SRV1_defconfig
patching file arch/blackfin/configs/TCM-BF518_defconfig
patching file arch/mips/configs/fuloong2e_defconfig
patching file arch/mips/configs/gpr_defconfig
patching file arch/mips/configs/ip22_defconfig
patching file arch/mips/configs/ip28_defconfig
patching file arch/mips/configs/jazz_defconfig
patching file arch/mips/configs/mtx1_defconfig
patching file arch/mips/configs/nlm_xlr_defconfig
patching file arch/mips/configs/pic32mzda_defconfig
patching file arch/mips/configs/pistachio_defconfig
patching file arch/mips/configs/pnx8335_stb225_defconfig
patching file arch/mips/configs/rm200_defconfig
patching file arch/parisc/configs/712_defconfig
patching file arch/parisc/configs/c3000_defconfig
patching file arch/parisc/configs/default_defconfig
patching file arch/powerpc/configs/c2k_defconfig
patching file arch/powerpc/configs/ppc6xx_defconfig
patching file arch/score/configs/spct6600_defconfig
patching file arch/sh/configs/se7712_defconfig
patching file arch/sh/configs/se7721_defconfig
patching file arch/sh/configs/titan_defconfig
patching file arch/sparc/configs/sparc64_defconfig
patching file arch/tile/configs/tilegx_defconfig
patching file arch/tile/configs/tilepro_defconfig
patching file arch/x86/configs/i386_defconfig
patching file arch/x86/configs/x86_64_defconfig
patching file kernel/Kconfig.preempt
patching file arch/x86/Kconfig
patching file include/linux/freezer.h
patching file include/linux/sched.h
patching file kernel/time/hrtimer.c
patching file kernel/time/timer.c
patching file kernel/time/timer.c
patching file drivers/block/swim.c
patching file drivers/bluetooth/hci_qca.c
patching file drivers/char/ipmi/ipmi_msghandler.c
patching file drivers/char/ipmi/ipmi_ssif.c
patching file drivers/char/snsc.c
patching file drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
patching file drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
patching file drivers/media/pci/ivtv/ivtv-ioctl.c
patching file drivers/media/pci/ivtv/ivtv-streams.c
patching file drivers/mfd/ucb1x00-core.c
patching file drivers/misc/sgi-xp/xpc_channel.c
patching file drivers/net/caif/caif_hsi.c
patching file drivers/net/can/usb/peak_usb/pcan_usb.c
patching file drivers/net/usb/lan78xx.c
Hunk #1 succeeded at 2569 (offset 1 line).
patching file drivers/net/usb/usbnet.c
patching file drivers/scsi/fnic/fnic_scsi.c
patching file drivers/scsi/snic/snic_scsi.c
patching file drivers/staging/comedi/drivers/ni_mio_common.c
Hunk #1 succeeded at 4648 (offset 2 lines).
patching file drivers/staging/lustre/lnet/lnet/lib-eq.c
patching file drivers/staging/rts5208/rtsx.c
patching file drivers/staging/speakup/speakup_acntpc.c
patching file drivers/staging/speakup/speakup_apollo.c
patching file drivers/staging/speakup/speakup_decext.c
patching file drivers/staging/speakup/speakup_decpc.c
patching file drivers/staging/speakup/speakup_dectlk.c
patching file drivers/staging/speakup/speakup_dtlk.c
patching file drivers/staging/speakup/speakup_keypc.c
patching file drivers/staging/speakup/synth.c
patching file drivers/staging/unisys/visornic/visornic_main.c
patching file drivers/video/fbdev/omap/hwa742.c
patching file drivers/video/fbdev/pxafb.c
patching file fs/btrfs/extent-tree.c
Hunk #1 succeeded at 6081 (offset 6 lines).
patching file fs/btrfs/inode-map.c
patching file sound/usb/line6/pcm.c
patching file drivers/hwmon/fam15h_power.c
patching file drivers/iio/light/tsl2563.c
patching file drivers/media/i2c/msp3400-driver.c
patching file drivers/media/pci/ivtv/ivtv-gpio.c
patching file drivers/media/radio/radio-mr800.c
patching file drivers/media/radio/radio-tea5777.c
patching file drivers/media/radio/tea575x.c
patching file drivers/parport/ieee1284.c
patching file drivers/parport/ieee1284_ops.c
patching file drivers/platform/x86/intel_ips.c
patching file net/core/pktgen.c
patching file sound/soc/codecs/wm8350.c
patching file sound/soc/codecs/wm8900.c
patching file sound/soc/codecs/wm9713.c
patching file drivers/media/pci/cx18/cx18-gpio.c
patching file drivers/net/wireless/intel/ipw2x00/ipw2100.c
patching file drivers/rtc/rtc-wm8350.c
patching file drivers/scsi/lpfc/lpfc_scsi.c
patching file sound/pci/maestro3.c
patching file sound/soc/codecs/rt5631.c
patching file sound/soc/soc-dapm.c
patching file kernel/time/hrtimer.c
patching file kernel/time/timer.c
patching file kernel/sysctl.c
patching file kernel/time/clockevents.c
patching file kernel/time/hrtimer.c
patching file kernel/Kconfig.hz
patching file kernel/irq/Kconfig
patching file kernel/irq/manage.c
patching file mm/vmscan.c
patching file block/Kconfig.iosched
patching file drivers/scsi/Kconfig
patching file tools/objtool/Makefile
patching file lib/swiotlb.c
patching file Makefile
edps@slack64 ~/linux-4.16.7-ck
☺     

Continuamos então com:

# make menuconfig

Verifique se na seção General Setup o Agendador MuQSS está habilitado (como na imagem abaixo):

Agendador habilitado!

Salve a nova config, saia e comece a compilação com:

# make bzImage modules
ou
# make -s bzImage modules ### silencioso....
ou
# make -s -j(nº de cores da CPU+1) bzImage modules ### acelera o tempo de compilação

Ao término da compilação, instale os módulos:

# make modules_install
compilação e instalação dos módulos…

Copie os arquivos necessários para utilizar o novo kernel:

# cp arch/x86/boot/bzImage /boot/vmlinuz-4.16.7-ck1
# cp System.map /boot/System.map-4.16.7-ck1
# cp .config /boot/config-4.16.7-ck1
# cd /boot
# rm System.map
# ln -s System.map-4.16.7-ck1 System.map

Se desejar, crie um initrd para o novo kernel (abaixo segue um exemplo, meu sistema de arquivos é ext4, minha partição é /dev/sdb1):

# mkinitrd -c -k 4.16.7-ck1 -m ext4 -f ext4 -r /dev/sdb1

Atualize as configurações do Grub (do Lilo eu nem lembro como se faz! rsrs, mas deve ter alguma coisa aqui no blog)

# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda

Reinicie para ver se está tudo OK!

# reboot

Deve estar! rsrs

Anúncios
How-To :: kernel 4.16.7 com patchs -CK

5 comentários sobre “How-To :: kernel 4.16.7 com patchs -CK

  1. zezaocapoeira disse:

    Salve mano.

    Parabéns pelo trabalho.

    Aqui também uso um kernel modificado.

    Uso atualmente:

    https://dev.gentoo.org/~mpagano/genpatches/index.html

    https://gitweb.gentoo.org/proj/linux-patches.git

    E uso o BFQ.

    http://algo.ing.unimo.it/people/paolo/disk_sched/

    https://www.kernel.org/doc/Documentation/block/bfq-iosched.txt

    Atualmente incluiram o BFQ no kernel, antes tinha que manobrar/aplicar os patches referentes ao BFQ.

    Só que para ativar ele aqui:

    Tive que criar esse arquivo “/etc/udev/rules.d/60-schedulers.rules”, com a seguinte linha:

    ACTION==”add|change”, KERNEL==”sd[a-z]”, ATTR{queue/rotational}==”1″, ATTR{queue/scheduler}=”bfq”

    E também acrescentar/modificar o “/etc/default/grub” deixando essa linha assim:

    GRUB_CMDLINE_LINUX_DEFAULT=”scsi_mod.use_blk_mq=1″

    Tem que rodar o comando abaixo para gravar essa opção no “grub.cfg”

    # grub-mkconfig -o /boot/grub/grub.cfg

    Com essas modificações o BFQ vai subir no boot e ser selecionado automaticamente:

    $ cat /sys/block/sda/queue/scheduler

    mq-deadline [bfq] none

    Obrigado pela atenção, salve!!!

    Curtir

    1. Blz @zezao!

      aqui removi o kernel do Slack deixando apenas o kernel-headers (na falta dele ocorrem muitos erros durante compilações) e o kernel-firmware (mas não sei se tem algum problema em removê-lo).

      Também já usei o gentoo-sources no Slack.

      Um abraço!

      Curtir

      1. zezaocapoeira disse:

        Salve mano.

        Aqui sempre gero o kernel-headers da versão do kernel que vou usar:

        Depois de descompactar para “/usr/src” e criar e linkar ” ln -sf linux-versão-que-usa linux”.

        Entro no diretório linkado “linux” e aplico os patches , e ainda dentro dele faço seguinte para empacotar o kernel-header.

        # mkdir -p /tmp/kernel-headers/usr

        # make INSTALL_HDR_PATH=/tmp/kernel-headers/usr headers_install

        # cd /tmp/kernel-headers/

        # find /tmp/kernel-headers/usr/include/ \( -name .install -o -name ..install.cmd \) -delete ( é para remover arquivos desnecessários)

        # makepkg -l y -c n ../kernel-headers-versao-que-usa-x86-1.txz

        NOTA:

        O empacotamento fiz simples não acrescentei o arquivo “slack-desc”.

        Faço a remoção do kernel-headers antigo e depois instalo o recém empacotado.

        # removepkg kernel-headers-versão-antiga-x86-1

        # installpkg /tmp/kernel-headers-versao-que-usa-x86-1.txz

        Tem um vídeo que gravei fazendo essa parte, talvez ajude:

        Obrigado pela atenção, salve!!!

        Curtir

  2. games4TUX Brasil disse:

    Oi fera, parabéns pelo tutorial. Com esses patches aumenta o desempenho de jogos no slackware? Selecionar a familia do processador tambem ajuda, ou isso é mito? Falow

    Curtir

    1. Se aumenta eu não sei até porque não jogo, mas acho que certas configurações para uso específico tendem a ser melhores que a config padrão do Slackware, a qual é muito genérica (ou seja, pra funcionar em tudo), você pode tentar e ver por si só.

      Aqui removi o kernel padrão do Slack, mantendo apenas (kernel-modules e kernel-headers) por questão de compatibilidade, atualmente uso o 4.17.2.

      Curtir

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s