From 7e21c0085fec669979039856ea3754ac9573bbf3 Mon Sep 17 00:00:00 2001
From: Silvino Silva
Default crux configuration can be obtained from iso, - kernel port depend on dracut, grub2 - and grub2-efi. You don't need them to build with pkgmk, to install - boot related tools use prt-get;
- +Spectre-meltdown checker;
- $ prt-get depinst linux-gnu
+ https://github.com/speed47/spectre-meltdown-checker/
- Download Linux Source from linux libre, or using the port system;
-Linux-gnu port comes with default config that is a good starting - point to personalize according to your needs.
-
$ mkdir ~/kernel
$ cd ~/kernel
@@ -75,15 +66,34 @@
$ patch -p1 < ../enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch
- Configure kernel according to your current kernel - hardware support;
+Cleaning targets:
+ ++ clean - Remove most generated files but keep the config and + enough build support to build external modules + mrproper - Remove all generated files + config + various backup files + distclean - mrproper + remove editor backup and patch files ++ +
Prepare sources for configuration;
+ ++ $ make distclean ++ +
Port linux-gnu port comes with default configuration file that is + a good starting point to tune kernel according to your needs. To + automatically configure kernel with support to your hardware + based on modules loaded by current kernel run.
$ make localmodconfig
- Get information about your hardware, for example information - about which graphic module (driver) is in use +
To get more information about the hardware, for example + information about which graphic module (driver) is in use as root run;
@@ -91,101 +101,602 @@
Kernel driver in use: i915
- Before start compiling check configuration;
+Make configuration targets;
+ ++ config - Update current config utilising a line-oriented program + nconfig - Update current config utilising a ncurses menu based program + menuconfig - Update current config utilising a menu based program + xconfig - Update current config utilising a Qt based front-end + gconfig - Update current config utilising a GTK+ based front-end + oldconfig - Update current config utilising a provided .config as base + localmodconfig - Update current config disabling modules not loaded + localyesconfig - Update current config converting local mods to core + silentoldconfig - Same as oldconfig, but quietly, additionally update deps + defconfig - New config with default from ARCH supplied defconfig + savedefconfig - Save current config as ./defconfig (minimal config) + allnoconfig - New config where all options are answered with no + allyesconfig - New config where all options are accepted with yes + allmodconfig - New config selecting modules when possible + alldefconfig - New config with all symbols set to default + randconfig - New config with random answer to all options + listnewconfig - List new options + olddefconfig - Same as silentoldconfig but sets new symbols to their default value + kvmconfig - Enable additional options for kvm guest kernel support + xenconfig - Enable additional options for xen dom0 and guest kernel support + tinyconfig - Configure the tiniest possible kernel ++ +
Following configuration try's to be generic about the hardware + support while addressing the requirements of applications such as + qemu, docker, etc. For more information about hardening options read + kernsec.org. Configure kernel + using ncurses;
$ make nconfig
+ + CONFIG_BUG_ON_DATA_CORRUPTION=y + + # Perform extensive checks on reference counting. + CONFIG_REFCOUNT_FULL=y + + # Check for memory copies that might overflow a structure in str*() and mem*() functions both at build-time and run-time. + CONFIG_FORTIFY_SOURCE=y + ++ +
Make targets;
- $ make help
- Cleaning targets:
- clean - Remove most generated files but keep the config and
- enough build support to build external modules
- mrproper - Remove all generated files + config + various backup files
- distclean - mrproper + remove editor backup and patch files
-
- Configuration targets:
- config - Update current config utilising a line-oriented program
- nconfig - Update current config utilising a ncurses menu based
- program
- menuconfig - Update current config utilising a menu based program
- xconfig - Update current config utilising a Qt based front-end
- gconfig - Update current config utilising a GTK+ based front-end
- oldconfig - Update current config utilising a provided .config as base
- localmodconfig - Update current config disabling modules not loaded
- localyesconfig - Update current config converting local mods to core
- silentoldconfig - Same as oldconfig, but quietly, additionally update deps
- defconfig - New config with default from ARCH supplied defconfig
- savedefconfig - Save current config as ./defconfig (minimal config)
- allnoconfig - New config where all options are answered with no
- allyesconfig - New config where all options are accepted with yes
- allmodconfig - New config selecting modules when possible
- alldefconfig - New config with all symbols set to default
- randconfig - New config with random answer to all options
- listnewconfig - List new options
- olddefconfig - Same as silentoldconfig but sets new symbols to their
- default value
- kvmconfig - Enable additional options for kvm guest kernel support
- xenconfig - Enable additional options for xen dom0 and guest kernel support
- tinyconfig - Configure the tiniest possible kernel
-
Other generic targets:
all - Build all targets marked with [*]
* vmlinux - Build the bare kernel
* modules - Build all modules
- modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
- firmware_install- Install all firmware to INSTALL_FW_PATH
- (default: $(INSTALL_MOD_PATH)/lib/firmware)
- dir/ - Build all files in dir and below
- dir/file.[ois] - Build specified target only
- dir/file.lst - Build specified mixed source/assembly target only
- (requires a recent binutils and recent build (System.map))
- dir/file.ko - Build module including final link
- modules_prepare - Set up for building external modules
- tags/TAGS - Generate tags file for editors
- cscope - Generate cscope index
- gtags - Generate GNU GLOBAL index
- kernelrelease - Output the release version string (use with make -s)
- kernelversion - Output the version stored in Makefile (use with make -s)
- image_name - Output the image name (use with make -s)
- headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
(default: ./usr)
- Static analysers
- checkstack - Generate a list of stack hogs
- namespacecheck - Name space analysis on compiled kernel
- versioncheck - Sanity check on version.h usage
- includecheck - Check for duplicate included header files
- export_report - List the usages of all exported symbols
- headers_check - Sanity check on exported headers
- headerdep - Detect inclusion cycles in headers
- coccicheck - Check with Coccinelle.
-
- Kernel selftest
- kselftest - Build and run kernel selftest (run as root)
- Build, install, and boot kernel before
- running kselftest on it
- kselftest-clean - Remove all generated kselftest files
- kselftest-merge - Merge all the config dependencies of kselftest to existed
- .config.
-
- Kernel packaging:
- rpm-pkg - Build both source and binary RPM kernel packages
- binrpm-pkg - Build only the binary kernel RPM package
- deb-pkg - Build both source and binary deb kernel packages
- bindeb-pkg - Build only the binary kernel deb package
- tar-pkg - Build the kernel as an uncompressed tarball
- targz-pkg - Build the kernel as a gzip compressed tarball
- tarbz2-pkg - Build the kernel as a bzip2 compressed tarball
- tarxz-pkg - Build the kernel as a xz compressed tarball
- perf-tar-src-pkg - Build perf-4.9.9-gnu.tar source tarball
- perf-targz-src-pkg - Build perf-4.9.9-gnu.tar.gz source tarball
- perf-tarbz2-src-pkg - Build perf-4.9.9-gnu.tar.bz2 source tarball
- perf-tarxz-src-pkg - Build perf-4.9.9-gnu.tar.xz source tarball
-
Documentation targets:
Linux kernel internal documentation in different formats (Sphinx):
htmldocs - HTML
@@ -210,12 +721,6 @@
installmandocs - install man pages generated by mandocs
cleandocs - clean all generated DocBook files
- make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml
- valid values for DOCBOOKS are: z8530book.xml kernel-hacking.xml kernel-locking.xml deviceiobook.xml writing_usb_driver.xml networking.xml kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml debugobjects.xml sh.xml regulator.xml alsa-driver-api.xml writing-an-alsa-driver.xml tracepoint.xml w1.xml writing_musb_glue_layer.xml crypto-API.xml iio.xml
-
- make DOCBOOKS="" [target] Don't generate docs from Docbook
- This is useful to generate only the ReST docs (Sphinx)
-
Architecture specific targets (x86):
* bzImage - Compressed kernel image (arch/x86/boot/bzImage)
install - Install kernel using
@@ -244,15 +749,23 @@
2: warnings which occur quite often but may still be relevant
3: more obscure warnings, can most likely be ignored
Multiple levels can be combined with W=12 or W=123
-
- Execute "make" or "make all" to build all targets marked with [*]
- For further info see the ./README file
- $
$ make -j $(nproc) bzImage modules
+
+
+ + modules_install - Install all modules to INSTALL_MOD_PATH (default: /) + firmware_install- Install all firmware to INSTALL_FW_PATH + (default: $(INSTALL_MOD_PATH)/lib/firmware) + modules_prepare - Set up for building external modules + headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH ++ +
$ sudo make modules_install
$ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.9.86-gnu
$ sudo cp System.map /boot/System.map-4.9.86-gnu
@@ -264,7 +777,7 @@
# grub-mkconfig -o /boot/grub/grub.cfg
-
$ sudo rm -r /lib/modules/4.9.86-gnu
--
cgit