From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: Re: [BLOG] custom kernel config Date: Thu, 16 May 2019 16:29:56 +0200 Message-ID: <87h89uo4kb.fsf@devup.no> References: <20190401180434.GF21029@macbook41> <20190515180945.GA7636@macbook41> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:54386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRHOd-0005xL-Iv for guix-devel@gnu.org; Thu, 16 May 2019 10:30:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRHOc-0000zd-9H for guix-devel@gnu.org; Thu, 16 May 2019 10:30:11 -0400 In-Reply-To: <20190515180945.GA7636@macbook41> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Efraim Flashner , guix-devel@gnu.org, Pierre Neidhardt , Ludovic Courts , Chris Marusich --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. > > --=20 > Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7= =9D =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 > GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 > Confidentiality cannot be guaranteed on emails sent or received unencrypt= ed > 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: =2D-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)))))) =2D-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 :-) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlzdc+QACgkQoqBt8qM6 VPo1Bwf/bXgCXMHnllz5dIHrMvjIJOh6CZbnhGkQmtiNC/zIEDDwSAqEOrfBa1ug hVbT1HavLL85Ytn2+FVbjq8Q78tZZf8oHKuRYDDOEXikIqw397xJ8Q++vx8Zvcch WzeBa1dMMgv+hgpiYM6Na/SLR6arZ9Tw3WJJDKqRDB0Qie2tYD51LtDWIdKVJJPz fepu+H5hNz71t7Ou8Nr+QIyrFXkoLS3zEXCEe+jdO9xfrH/t/6Cj22BAXGxMwRSs 4jzKz42OTcbb9NULwVCkVz8ZWq342q8U+amEyj7GLotvpN3MPQutrmri4mzR5GLq 3Z6/V/x5YYUyDyRE3efaius8Wk28xA== =ITD1 -----END PGP SIGNATURE----- --=-=-=--