all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Coming up with a generic kernel config
@ 2014-06-25 19:26 Ludovic Courtès
  2014-06-25 19:48 ` Sree Harsha Totakura
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-06-25 19:26 UTC (permalink / raw)
  To: linux-libre; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 5863 bytes --]

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Coming up with a generic kernel config
  2014-06-25 19:26 Coming up with a generic kernel config Ludovic Courtès
@ 2014-06-25 19:48 ` Sree Harsha Totakura
  2014-06-25 20:34   ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Sree Harsha Totakura @ 2014-06-25 19:48 UTC (permalink / raw)
  To: guix-devel

On 06/25/2014 09:26 PM, Ludovic Courtès wrote:
> 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?

My kernel config has the following for serial console:
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_RSA=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y

Sree

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Coming up with a generic kernel config
  2014-06-25 19:48 ` Sree Harsha Totakura
@ 2014-06-25 20:34   ` Ludovic Courtès
  2014-06-27  4:20     ` Mark H Weaver
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-06-25 20:34 UTC (permalink / raw)
  To: Sree Harsha Totakura; +Cc: guix-devel

Sree Harsha Totakura <sreeharsha@totakura.in> skribis:

> On 06/25/2014 09:26 PM, Ludovic Courtès wrote:
>> 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?
>
> My kernel config has the following for serial console:
> CONFIG_SERIAL_NONSTANDARD=y
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_PNP=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_SERIAL_8250_DMA=y
> CONFIG_SERIAL_8250_PCI=y
> CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_MANY_PORTS=y
> CONFIG_SERIAL_8250_SHARE_IRQ=y
> CONFIG_SERIAL_8250_RSA=y
> CONFIG_SERIAL_CORE=y
> CONFIG_SERIAL_CORE_CONSOLE=y

The one I built has all these as well.  :-/

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Coming up with a generic kernel config
  2014-06-25 20:34   ` Ludovic Courtès
@ 2014-06-27  4:20     ` Mark H Weaver
  2014-06-27  9:05       ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Mark H Weaver @ 2014-06-27  4:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Sree Harsha Totakura <sreeharsha@totakura.in> skribis:
>
>> On 06/25/2014 09:26 PM, Ludovic Courtès wrote:
>>> 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?
>>
>> My kernel config has the following for serial console:
>> CONFIG_SERIAL_NONSTANDARD=y
>> CONFIG_SERIAL_8250=y
>> CONFIG_SERIAL_8250_PNP=y
>> CONFIG_SERIAL_8250_CONSOLE=y
>> CONFIG_SERIAL_8250_DMA=y
>> CONFIG_SERIAL_8250_PCI=y
>> CONFIG_SERIAL_8250_EXTENDED=y
>> CONFIG_SERIAL_8250_MANY_PORTS=y
>> CONFIG_SERIAL_8250_SHARE_IRQ=y
>> CONFIG_SERIAL_8250_RSA=y
>> CONFIG_SERIAL_CORE=y
>> CONFIG_SERIAL_CORE_CONSOLE=y
>
> The one I built has all these as well.  :-/

I think you need to pass something like "console=ttyS0" as a kernel
command line option.  See Documentation/serial-console.txt in the
linux-libre source tree.

     Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Coming up with a generic kernel config
  2014-06-27  4:20     ` Mark H Weaver
@ 2014-06-27  9:05       ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2014-06-27  9:05 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Sree Harsha Totakura <sreeharsha@totakura.in> skribis:
>>
>>> On 06/25/2014 09:26 PM, Ludovic Courtès wrote:
>>>> 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?
>>>
>>> My kernel config has the following for serial console:
>>> CONFIG_SERIAL_NONSTANDARD=y
>>> CONFIG_SERIAL_8250=y
>>> CONFIG_SERIAL_8250_PNP=y
>>> CONFIG_SERIAL_8250_CONSOLE=y
>>> CONFIG_SERIAL_8250_DMA=y
>>> CONFIG_SERIAL_8250_PCI=y
>>> CONFIG_SERIAL_8250_EXTENDED=y
>>> CONFIG_SERIAL_8250_MANY_PORTS=y
>>> CONFIG_SERIAL_8250_SHARE_IRQ=y
>>> CONFIG_SERIAL_8250_RSA=y
>>> CONFIG_SERIAL_CORE=y
>>> CONFIG_SERIAL_CORE_CONSOLE=y
>>
>> The one I built has all these as well.  :-/
>
> I think you need to pass something like "console=ttyS0" as a kernel
> command line option.

Yes, of course.  :-)  When I wrote serial console is unavailable, I meant
it’s unavailable when I pass ‘console=ttyS0’.

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-27  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 19:26 Coming up with a generic kernel config Ludovic Courtès
2014-06-25 19:48 ` Sree Harsha Totakura
2014-06-25 20:34   ` Ludovic Courtès
2014-06-27  4:20     ` Mark H Weaver
2014-06-27  9:05       ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.