Hi Efraim, Efraim Flashner writes: > I've cleaned up the blog post a bit and run it through a spell checker. > I'm unsure about Linux-Libre vs linux-libre, regarding talking about the > kernel and the package. I think I glossed over it well enough that I > didn't actually get a custom kernel up and running on my laptop, but for > the purpose of the blog post I don't think it's actually necessary. > > -- > Efraim Flashner אפרים פלשנר > GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 > Confidentiality cannot be guaranteed on emails sent or received unencrypted > title: Creating and using a custom Linux kernel on Guix System > date: 2019-05-20 00:00 > author: Efraim Flashner > tags: kernel, customization > --- > > Guix is, at its core, a source based distribution with substitutes, and > as such building packages from their source code is an expected part of > regular package installations and upgrades. Given this starting point, > it makes sense that efforts are made to reduce the amount of time spent > compiling packages, and recent changes and upgrades to the building and > distribution of substitutes continues to be a topic of discussion within > Guix. One of the packages which I prefer to not build myself is the > Linux-Libre kernel. The kernel, while not requiring an overabundance of > RAM to build, does take a very long time on my build machine (which my > children argue is actually their Kodi computer), and I will often delay > reconfiguring my laptop while I want for a substitute to be prepared by > the official build farm. The official kernel configuration, as is the > case with many GNU/Linux distributions, errs on the side of > inclusiveness, and this is really what causes the build to take such a > long time when I build the package for myself. > > The Linux kernel, however, can also just be described as a package > installed on my machine, and as such can be customized just like any > other package. The procedure is a little bit different, although this > is primarily due to the nature of how the package definition is written. > > The linux-libre kernel package definition is actually a procedure which > creates a package. > > ```scheme > (define* (make-linux-libre version hash supported-systems > #:key > ;; A function that takes an arch and a variant. > ;; See kernel-config for an example. > (extra-version #f) > (configuration-file #f) > (defconfig "defconfig") > (extra-options %default-extra-linux-options) > (patches (list %boot-logo-patch))) > ...) > ``` > > The current linux-libre package is for the 5.1.x series, and is > declared like this: > > ```scheme > (define-public linux-libre > (make-linux-libre %linux-libre-version > %linux-libre-hash > '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux") > #:patches %linux-libre-5.1-patches > #:configuration-file kernel-config)) > ``` > > Any keys which are not assigned values inherit their default value from > the make-linux-libre definition. When comparing the two snippets above, > you may notice that the code comment in the first doesn't actually refer > to the extra-version keyword; it is actually for configuration-file. > Because of this, it is not actually easy to include a custom kernel > configuration from the definition, but don't worry, there are other ways > to work with what we do have. Thank you for writing this! I'm sure many would-be power users are stymied by the weird Scheme interfaces :-) I just want to point out an (IMO) easier way to provide a custom kernel configuration, that does not involve the "make-linux-libre" procedure: --8<---------------cut here---------------start------------->8--- (define-public linux-libre/custom (package (inherit linux-libre) (native-inputs `(("kconfig" ,(local-file "kernel.config")) ,@(alist-delete "kconfig" (package-native-inputs linux-libre)))))) --8<---------------cut here---------------end--------------->8--- At the end of the day, Linux-Libre is just a regular package that can be inherited and overridden like any other :-)