Update to Make your own kernels (sleekmason)

Forum Forums General Tips and Tricks Update to Make your own kernels (sleekmason)

  • This topic has 6 replies, 3 voices, and was last updated Apr 30-6:41 pm by sleekmason.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9737
    Moderator
    Brian Masinick

      By request, this was asked by sleekmason to be moved to the second slot in the topic about making your own kernel.

      I moved it to a different conversation so it can be easily seen.

      Here are a list of some of the changes I have made over the course of time that may be interesting to others. Having a starting point for change may be useful to some.
      Most everything I looked up online as well to see if there was relevance to my personal computer usage. Many items
      here are simply not necessary for a laptop computer that is being used for common tasks, web surfing, email, usb, bluetooth, etc.

      The smaller the kernel size, the faster the reads.


      No way is this even close to everything. For instance, networking and drivers are machine dependent, while security, crypto, and the like are personal. There are over 4,300 options in the config file.

      I don’t go over schedulers and such. There is a tutorial on changing to BFQ here: https://www.antixforum.com/forums/topic/how-to-use-the-bfq-io-scheduler/


      After opening make menuconfig:

      Under General Setup:
      1. () Local version – append to kernel release – – – Add a 1 to this to get started;)
      2. POSIX Message Queues – – – Disable unless using solaris.
      3. uselib syscall – – – Disable – Glibc doesn’t use this.
      4. Memory placement aware NUMA scheduler – – – Disable – soon deprecated.
      5. Configure standard kernel features (expert). – – – Enable, then INSIDE:
      Enable ELF core dumps – – – Disable
      Enable PC-Speaker support – – – Disable – -unless you like beeps-
      Load all symbols for debugging/ksymoops – – – Disable – debugging.
      6. Enable SLUB debugging support – – – Disable – debugging.
      7. SLUB per cpu partial cache. – – – EITHER – performance (N) on mine.
      8. Profiling support – – – Disable – used by oprofile.


      Enable loadable module support —>
      1. Forced module loading – – – Disable – Really shouldn’t need this.
      2. Forced module unloading – – – Disable – Really shouldn’t need this.
      3. Module versioning support – – – Disable – for using modules from other kernels/systems.


      Enable the block layer —>
      1. Zoned block device support – – – Disable – Unless you have a ZAC or ZBC Storage device.
      2. Block layer debugging information in debugfs – – – Disable – Debugging.
      3. For interfacing with Opal enabled SEDs – – – Disable – Unless you know what this is.
      4. Under Partition Types —>
      Advanced partition selection – – – Disable – Unless using hard disks from another system.


      Processor type and features —>
      1. Enable MPS table. – – – If 64 bit, Disable, if not, read.
      2. Linux guest support – – – Disable – Unless running under Hypervisor
      3. Processor family (Generic-x86-64) – – – Change to yours! – cat /proc/cpuinfo to find out.
      4. Supported processor vendors – – – Enable – and remove unused vendors.
      5. Old AMD GART IOMMU support – – – Disable – Unless AMD Athlon64, Opteron, turion, etc. Then maybe.
      6. IBM Calgary IOMMU support – – – Disable – Unless using IBM.
      7. Maximum number of CPUs – – – Change to 4 or 8 Each adds 8 kb (256 x 8 = 2048).
      8. CPU core priorities scheduler support – – – Enable – If using Intel – New support in latest kernel possible.
      9. Reroute for broken boot IRQs – – – Disable – unless affected – read.
      10. Enable support for 16-bit segments – – – Disable – Unless running Wine.
      11. Numa Memory Allocation and Scheduler Support – – – READ – I disabled on mine.
      12. Contiguous Memory Allocator – – – READ – I disabled on mine.
      13. x86 architectural random number generator – – – Disable – How many do you need?
      14. Supervisor Mode Access Prevention – – – Disable – Read – Security feature in newer intel.
      15. EFI runtime service support – – – Disable – unless you have EFI support.
      16. Timer frequency – – – Change to 1000HZ.
      17. kexec system call – – – Disable – If you need this, you will know what it is:)
      18. Build a relocatable kernel – – – Disable.


      Power management and ACPI options —>
      1. Enable workqueue power-efficient mode by default. – – Disable – Read.


      Bus options (PCI etc.) —> Your on your own:)


      Executable file formats / Emulations —> On your own:)


      Networking support —>
      1. Amateur Radio support – – – Disable – unless using amateur radio.
      2. CAN bus subsystem support – – – Disable – Medical equipment type stuff.
      3. Bluetooth subsystem support – – – Disable – Unless using Bluetooth.


      Device Drivers —> On your own:)


      Firmware Drivers —> On your own:)


      File systems —>
      1. Reiserfs support – – – Disable – Unless you formatted with Reiser.
      2. JFS filesystem support. – – – Disable – Unless formatted with.
      3. XFS filesystem support. – – – Disable – Unless formatted with.
      4. GFS2 file system support. – – – Disable – Unless using a cluster.
      5. OCFS2 file system support. – – – Disable – Unless using.
      6. Btrfs assert support – – – Disable – Just this. Keep the file system.
      7. NILFS2 file system support. – – – Disable – unless used.
      8. F2FS filesystem support. – – – Disable – Read.
      9. Direct Access (DAX) support. – – – Disable – unless needed.
      10. Quota support – – – Disable – unless setting user limits.
      11. Kernel automounter version 4 support│ – – – Disable – Distributed network stuff.
      12. Overlay filesystem support. – – – Disable – Unless you know what this is.
      13. Caches —>
      Gather statistical information on local caching – – Disable – Debugging.
      Gather latency information on local caching – – – Disable – Debugging.
      Filesystem caching on files – – – Disable – READ FIRST.


      Kernel hacking —>
      1. printk and dmesg options —>
      Show timing information on printks – – – Disable – unneeded for common tasks.
      2. Compile-time checks and compiler options —>
      Enable unused/obsolete exported symbols – – – Disable – unused.
      3. Magic SysRq key – – – Disable – READ I don’t need this.
      4. Kernel debugging – – – Disable – Debugging.
      5. Tracers – – – Disable – unneeded.
      6. (go back 2) Stack backtrace support – – – Disable – unneeded.
      7. Runtime Testing – – – Disable – self tests.
      8. Early printk via the EFI framebuffer – – – Disable – Debugging.
      9. TOM Punit debug driver – – – Disable – Debugging.


      Security options —> On your own:)
      Cryptographic API —> On your own;)
      Virtualization —> On your own:)
      Library routines —> On your own:)

      Good luck! This is just a starting point, but should show noticeable improvements. Does for me anyway.

      --
      Brian Masinick

      #9744
      Member
      sleekmason
        Helpful
        Up
        0
        ::

        Thank you Brian!

        Was unsure what would be best. This works:)

        #9746
        Moderator
        Brian Masinick
          Helpful
          Up
          0
          ::

          Nice job with this research sleekmason! I hope that others find it useful!

          --
          Brian Masinick

          #9769
          Member
          sleekmason
            Helpful
            Up
            0
            ::

            Here are some different ways to configure your kernel before doing custom modifications.


            These targets allow the kernel to be configured in a wide range of different ways.

            Description:

            config
            Updates the current kernel configuration by using a line-oriented program.

            menuconfig
            Updates the current kernel configuration by using a text based menu program.

            xconfig
            Updates the current kernel configuration by using a QT-based graphical program.

            gconfig
            Updates the current kernel configuration by using a GTK+-based graphical program.

            oldconfig
            Updates the current kernel configuration by using the current .config file and prompting for any new options that have been added to the kernel.

            silentoldconfig
            Just like oldconfig, but prints nothing to the screen except when a question needs to be answered.

            randconfig
            Generates a new kernel configuration with random answers to all of the different options.

            defconfig
            Generates a new kernel configuration with the default answer being used for all options. The default values are taken from a file located in the arch/$ARCH/defconfig file, where $ARCH refers to the specific architecture for which the kernel is being built.

            allmodconfig
            Generates a new kernel configuration in which modules are enabled whenever possible.

            allyesconfig
            Generates a new kernel configuration with all options set to yes.

            allnoconfig
            Generates a new kernel configuration with all options set to no.

            Note that the allyesconfig, allmodconfig, allnoconfig, and randconfig targets also take advantage of the environment variable KCONFIG_ALLCONFIG. If that variable points to a file, that file will be used as a list of configuration values that you require to be set to a specific value. In other words, the file overrides the normal behavior of the make targets.

            For more information: http://archive.oreilly.com/pub/a/linux/excerpts/9780596100797/kernel-build-command-line-reference.html

            #9775
            Moderator
            Brian Masinick
              Helpful
              Up
              0
              ::

              @sleekmason: Thanks! More good information.

              Here are some more useful resources. The first is reasonably recent for the “would-be” do-it-yourself kernel builder:
              https://kernelnewbies.org/KernelBuild
              https://kernel-handbook.debian.net/ch-common-tasks.html – or more generally, https://kernel-handbook.debian.net/index.html, contain the Debian Linux Kernel Handbook.
              https://kernelnewbies.org/ is the “initial stop” for newbie kernel information. There’s not a lot at this particular page, but it does provide useful pointers to other sites. For example, Wikipedia explains “about” a kernel, what it is and what it is used for, the functions of a kernel (with some nice diagrams), some design approaches to various types of different systems, and some obligatory history about system kernel development.

              Armed with all of this, an undergraduate (or even graduate) student of Computer Science could use these things as a few starting points for their research. I have used books writing about MULTICS and early UNIX systems in my own DISTANT PAST research (wink, said the “historian”).

              Stay off the STREETS at night and WRITE some good code! (LOL)

              --
              Brian Masinick

              #9791
              Member
              ohh
                Helpful
                Up
                0
                ::

                sleekmason,

                Excellent info, will now have to work on getting my kernel fine tuned. Thank you for your interest and research.

                cheers,
                ohh

                Every matter requires prior knowledge.

                - Du Mu
                The Art of War

                #9804
                Member
                sleekmason
                  Helpful
                  Up
                  0
                  ::

                  @masinick
                  Thank you for the links. There is a lot of good info there.


                  @ohh
                  Glad I can be of some service. That was a fun list to make:)

                  • This reply was modified 5 years ago by sleekmason.
                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.