From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Coming up with a generic kernel config Date: Wed, 25 Jun 2014 21:26:22 +0200 Message-ID: <87vbrooko1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wzspz-0001Zp-AN for guix-devel@gnu.org; Wed, 25 Jun 2014 15:26:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wzspt-00017C-Rq for guix-devel@gnu.org; Wed, 25 Jun 2014 15:26:31 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:45310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wzspt-00015U-Ci for guix-devel@gnu.org; Wed, 25 Jun 2014 15:26:25 -0400 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: linux-libre@fsfla.org Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, In trying to get a generalist kernel config with Linux-Libre 3.15 for the GNU system (via GNU=C2=A0Guix), I thought I=E2=80=99d start from =E2=80= =98allmodconfig=E2=80=99. Then I figured there are several issues: 1. Serial console is unavailable when booting. I thought that=E2=80=99d = be addressed by explicitly setting CONFIG_SERIAL_8250=3Dy etc. (see below for the list), but that=E2=80=99s not enough. What am I missing? 2. A whole bunch of test suites that run at startup are enabled by =E2=80=98allmodconfig=E2=80=99 (and not =E2=80=98defconfig=E2=80=99.) = I=E2=80=99ve explicitly added =3Dn options to disable some of them, but it seems there are still some lying around. Any idea whether/how these could be systematically turned off? For reference, below is my current patch. Please let me know if this is off-topic. (And apologies for being such a noob.) Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 841ec58..03411d8 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -20,11 +20,14 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages linux) + #:use-module (guix utils) #:use-module ((guix licenses) #:hide (zlib)) #:use-module (gnu packages) #:use-module ((gnu packages compression) #:renamer (symbol-prefix-proc 'guix:)) + #:use-module ((gnu packages openssl) + #:renamer (symbol-prefix-proc 'guix:)) #:use-module (gnu packages flex) #:use-module (gnu packages bison) #:use-module (gnu packages gperf) @@ -158,10 +161,47 @@ `insmod', `lsmod', and more.") (license gpl2+))) +(define-syntax-rule (string-append* rest ...) + "Compile-time string concatenation." + (compile-time-value (string-append rest ...))) + (define-public linux-libre (let* ((version "3.15") + (common-options + (string-append* + ;; Require support for loadable modules. + "CONFIG_MODULES=y\n" + ;; Disable drivers not for this platform. + "CONFIG_COMPILE_TEST=n\n" + ;; Disable various test suites. + "CONFIG_FTRACE_STARTUP_TEST=n\n" + "CONFIG_RING_BUFFER_STARTUP_TEST=n\n" + "CONFIG_KGDB_TESTS=n\n" + "CONFIG_KGDB_TESTS_ON_BOOT=n\n" + "CONFIG_DEBUG_NMI_SELFTEST=n\n" + ;; FIXME: Try to make sure we can use 'console=ttyS0' early on. + "CONFIG_SERIAL_CORE_CONSOLE=y\n" + "CONFIG_SERIAL_8250=y\n" + "CONFIG_SERIAL_8250_CONSOLE=y\n" + "CONFIG_SERIAL_8250_CS=y\n" + "CONFIG_SERIAL_8250_PCI=y\n" + "CONFIG_PARPORT=y\n" + "CONFIG_PARPORT_PC=y\n" + "CONFIG_PARPORT_SERIAL=y\n" + "CONFIG_NETCONSOLE=y\n" + "CONFIG_FRAMEBUFFER_CONSOLE=y\n" + ;; Disable some of the debugging facilities. + "CONFIG_GCOV_KERNEL=n\n" + "CONFIG_MEMTEST=n\n" + "CONFIG_USB_DEBUG=n\n" + "CONFIG_DEBUG_DEVRES=n\n" + "CONFIG_DEBUG_NX_TEST=n\n" + "CONFIG_DEBUG_STACK_USAGE=n\n" + "CONFIG_DEBUG_STACKOVERFLOW=n\n" + ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html + "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n")) (build-phase - '(lambda* (#:key system #:allow-other-keys #:rest args) + `(lambda* (#:key system #:allow-other-keys #:rest args) (let ((arch (car (string-split system #\-)))) (setenv "ARCH" (cond ((string=? arch "i686") "i386") @@ -169,27 +209,15 @@ (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))) (let ((build (assoc-ref %standard-phases 'build))) - (and (zero? (system* "make" "defconfig")) + ;; We take options (1) from 'allmodconfig', and (2) from our + ;; own set of options. When concatenating option lists, the + ;; last one wins. + (and (zero? (system* "make" "allmodconfig")) (begin ;; Appending works even when the option wasn't in the ;; file. The last one prevails if duplicated. (let ((port (open-file ".config" "a"))) - (display (string-append "CONFIG_NET_9P=m\n" - "CONFIG_NET_9P_VIRTIO=m\n" - "CONFIG_VIRTIO_BLK=m\n" - "CONFIG_SATA_SIS=y\n" - "CONFIG_VIRTIO_NET=m\n" - "CONFIG_SIS190=y\n" - ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html - "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n" - "CONFIG_VIRTIO_PCI=m\n" - "CONFIG_VIRTIO_BALLOON=m\n" - "CONFIG_VIRTIO_MMIO=m\n" - "CONFIG_FUSE_FS=m\n" - "CONFIG_CIFS=m\n" - "CONFIG_9P_FS=m\n" - "CONFIG_E1000E=m\n") - port) + (display ,common-options port) (close-port port)) (zero? (system* "make" "oldconfig"))) @@ -226,17 +254,26 @@ (build-system gnu-build-system) (native-inputs `(("perl" ,perl) ("bc" ,bc) - ("module-init-tools" ,module-init-tools))) + ("module-init-tools" ,module-init-tools) + + ;; OpenSSL is used to sign modules. + ("openssl" ,guix:openssl))) (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) - (ice-9 match)) + (ice-9 match) + (ice-9 rdelim)) #:phases (alist-replace 'build ,build-phase (alist-replace 'install ,install-phase (alist-delete 'configure %standard-phases))) + + ;; Shrink all the .ko files. With just --strip-debug, the whole thing + ;; is twice as big (350 MiB vs. 160 MiB.) + #:strip-flags '("--strip-all") + #:tests? #f)) (synopsis "100% free redistribution of a cleaned Linux kernel") (description --=-=-=--