Hello, In trying to get a generalist kernel config with Linux-Libre 3.15 for the GNU system (via GNU Guix), I thought I’d start from ‘allmodconfig’. Then I figured there are several issues:
1. Serial console is unavailable when booting. I thought that’d be addressed by explicitly setting CONFIG_SERIAL_8250=y etc. (see below for the list), but that’s not enough. What am I missing? 2. A whole bunch of test suites that run at startup are enabled by ‘allmodconfig’ (and not ‘defconfig’.) I’ve explicitly added =n 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’.
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 <http://www.gnu.org/licenses/>. (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