unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Custom libre kernel configuration
@ 2021-11-11 12:31 phodina
  2021-11-11 12:49 ` André A. Gomes
  2021-11-11 13:23 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 10+ messages in thread
From: phodina @ 2021-11-11 12:31 UTC (permalink / raw)
  To: help-guix

Hi!

I'm attempting to compile a custom linux libre kernel with several additional config options enabled (listed below).

Unfortunately I get the following error messages:

Throw to key `match-error' with args `("match" "no matching pattern" ("CONFIG_ANDROID" . y))'.

I followed the blog post[1] on customizing kernel.

Downloaded the sources and checked for the options in menuconfig:

tar xf $(guix build linux-libre --source)
guix environment linux-libre --ad-hoc ncurses -- make menuconfig

Could you please give me hint on what I'm doing wrong?

Petr

--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -722,6 +722,14 @@ (define %bpf-extra-linux-options
     ;; kheaders module
     ("CONFIG_IKHEADERS" . #t)))

+(define %waydroid-extra-linux-options
+  `(;; Modules required for waydroid:
+   ("CONFIG_ASHMEM" . m)
+   ("CONFIG_ANDROID" . y)
+   ("CONFIG_ANDROID_BINDER_IPC" . m)
+   ("CONFIG_ANDROID_BINDERFS" . n)
+   ("CONFIG_ANDROID_BINDER_DEVICES" . "binder,hwbinder,vndbinder")))
+
 (define (config->string options)
   (string-join (map (match-lambda
                       ((option . 'm)
@@ -1143,6 +1151,25 @@ (define-public linux-libre-mips64el-fuloong2e
                       `(("CONFIG_OVERLAY_FS" . m))
                       %default-extra-linux-options)))

+(define-public linux-libre-with-waydroid
+  (let ((base-linux-libre
+         (make-linux-libre*
+          linux-libre-5.14-version
+          linux-libre-5.14-gnu-revision
+          linux-libre-5.14-source
+          '("x86_64-linux" "i686-linux" "armhf-linux"
+            "aarch64-linux" "riscv64-linux")
+          #:extra-version "bpf"
+          #:configuration-file kernel-config
+          #:extra-options
+          (append %bpf-extra-linux-options
+                  %waydroid-extra-linux-options
+                  %default-extra-linux-options))))
+    (package
+      (inherit base-linux-libre)
+         (name "linux-libre-waydroid")
+      (inputs `(("cpio" ,cpio) ,@(package-inputs base-linux-libre))))))
+
 (define-public linux-libre-with-bpf
   (let ((base-linux-libre
          (make-linux-libre*

---

[1] https://guix.gnu.org/en/blog/2019/creating-and-using-a-custom-linux-kernel-on-guix-system


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

* Re: Custom libre kernel configuration
  2021-11-11 12:31 phodina
@ 2021-11-11 12:49 ` André A. Gomes
  2021-11-11 13:08   ` phodina
  2021-11-11 13:23 ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 10+ messages in thread
From: André A. Gomes @ 2021-11-11 12:49 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

phodina <phodina@protonmail.com> writes:

> --- a/gnu/packages/linux.scm
> +++ b/gnu/packages/linux.scm
> @@ -722,6 +722,14 @@ (define %bpf-extra-linux-options
>      ;; kheaders module
>      ("CONFIG_IKHEADERS" . #t)))

Isn't there an extra closing parenthesis on this s-exp?


-- 
André A. Gomes
"Free Thought, Free World"


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

* Re: Custom libre kernel configuration
  2021-11-11 12:49 ` André A. Gomes
@ 2021-11-11 13:08   ` phodina
  0 siblings, 0 replies; 10+ messages in thread
From: phodina @ 2021-11-11 13:08 UTC (permalink / raw)
  To: André A. Gomes; +Cc: help-guix

Hi Andre,

On Thursday, November 11th, 2021 at 1:49 PM, André A. Gomes <andremegafone@gmail.com> wrote:

> phodina phodina@protonmail.com writes:
>
> > --- a/gnu/packages/linux.scm
> >
> > +++ b/gnu/packages/linux.scm
> >
> > @@ -722,6 +722,14 @@ (define %bpf-extra-linux-options
> >
> > ;; kheaders module
> >
> > ("CONFIG_IKHEADERS" . #t)))
>
> Isn't there an extra closing parenthesis on this s-exp?
>

Unfortunately no. If I leave only CONFIG_ASHMEM and CONFIG_ANDROID_BINDER_IPC the kernel builds.

Then again when I check the kernel menuconfig the other options are present, but for some reason Guix fails.

Petr




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

* Re: Custom libre kernel configuration
  2021-11-11 12:31 phodina
  2021-11-11 12:49 ` André A. Gomes
@ 2021-11-11 13:23 ` Tobias Geerinckx-Rice
  2021-11-11 14:13   ` phodina
  1 sibling, 1 reply; 10+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-11-11 13:23 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

On 2021-11-11 13:31, phodina wrote:
> Throw to key `match-error' with args `("match" "no matching pattern"
> ("CONFIG_ANDROID" . y))'.

I guess you meant to write #t here.  With that change the rest looks 
correct, goodl uck!

Kind regards,

T G-R

Sent from a Web browser.  Excuse or enjoy my brevity.


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

* Re: Custom libre kernel configuration
  2021-11-11 13:23 ` Tobias Geerinckx-Rice
@ 2021-11-11 14:13   ` phodina
  2021-11-11 15:01     ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 10+ messages in thread
From: phodina @ 2021-11-11 14:13 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

Hi Tobias,

On Thursday, November 11th, 2021 at 2:23 PM, Tobias Geerinckx-Rice <me@tobias.gr> wrote:

> On 2021-11-11 13:31, phodina wrote:
>
> > Throw to key `match-error' with args` ("match" "no matching pattern"
> >
> > ("CONFIG_ANDROID" . y))'.
>
> I guess you meant to write #t here. With that change the rest looks
>
> correct, goodl uck!
>
> Kind regards,
>
> T G-R
>

Thanks! Somehow it was staring at my face :-D

Though there is also one more issue. The match lambda does not accept strings. I'm added one more "case", though I'm not sure if it won't have any consequences.

(define (config->string options)
  (string-join (map (match-lambda
                      ((option . 'm)
                       (string-append option "=m"))
                      ((option . #t)
                       (string-append option "=y"))
                      ((option . #f)
                       (string-append option "=n"))
                      ((option . value)
                       (string-append option "=" value)))
                    options)
               "\n"))


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

* Re: Custom libre kernel configuration
  2021-11-11 14:13   ` phodina
@ 2021-11-11 15:01     ` Tobias Geerinckx-Rice
  2021-11-11 15:19       ` phodina
  0 siblings, 1 reply; 10+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-11-11 15:01 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

> Though there is also one more issue. The match lambda does not accept 
> strings.
> I'm added one more "case", though I'm not sure if it won't have any
> consequences.

You're right.

I'm not on a GNU system right now but from memory, Kconfig places double 
quotation marks around "string values", doesn't add any around numbers.  
Don't know how liberal it is in accepting foo="42" and bar=string.

Add "s to you current string fallbakc and add a 'number' quasipattern 
above that without "s to play it safe.

Stupid: if I were on GNU I could just paste the code I use which does 
all that.  Sorz.

Kind regards,

T G-R

Sent from a Web browser.  Excuse or enjoy my brevity.


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

* Re: Custom libre kernel configuration
  2021-11-11 15:01     ` Tobias Geerinckx-Rice
@ 2021-11-11 15:19       ` phodina
  2021-11-12 23:38         ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 10+ messages in thread
From: phodina @ 2021-11-11 15:19 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix


> I'm not on a GNU system right now but from memory, Kconfig places double
>
> quotation marks around "string values", doesn't add any around numbers.
>
> Don't know how liberal it is in accepting foo="42" and bar=string.
>
> Add "s to you current string fallbakc and add a 'number' quasipattern
>
> above that without "s to play it safe.
>

I've modified it already. Seems to build, but I want to wait (well have to on my x230 :-D) till I can give a spin.

Here's the modification:

(define (config->string options)
  (string-join (map (match-lambda
                      ((option . 'm)
                       (string-append option "=m"))
                      ((option . #t)
                       (string-append option "=y"))
                      ((option . #f)
                       (string-append option "=n"))
                      ((option . number)
                       (string-append option "=" number))
                      ((option . string)
                       (string-append option "=\"" string "\"")))
                    options)
               "\n"))



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

* Re: Custom libre kernel configuration
  2021-11-11 15:19       ` phodina
@ 2021-11-12 23:38         ` Tobias Geerinckx-Rice
  2021-11-13  8:08           ` phodina
  0 siblings, 1 reply; 10+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-11-12 23:38 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

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

Petr,

phodina 写道:
> Here's the modification:
>
> (define (config->string options)
>   (string-join (map (match-lambda
>                       ((option . 'm)
>                        (string-append option "=m"))
>                       ((option . #t)
>                        (string-append option "=y"))
>                       ((option . #f)
>                        (string-append option "=n"))
>                       ((option . number)
>                        (string-append option "=" number))
>                     options)
>                "\n"))

At this point, (option . number) will match anything.

You're not matching numbers here: ‘number’ is your chosen variable 
name, not magic.  It could be ‘foo’.  It could be anything, 
without changing the effect of this code.

>                       ((option . string)
>                        (string-append option "=\"" string 
>                        "\"")))

This will never be reached.

I'm almost certain that this is, at least in part, why your BINDER 
configuration isn't taking effect.

Here's mine:

(define option->string
  (match-lambda ((option . #f)
                 (format #f "# ~a is not set" option))
                ((option . #t)
                 (format #f "~a=y" option))
                ((option . 'm)
                 (format #f "~a=m" option))
                ((option . (? number? value))
                 (format #f "~a=~a" option value))
                ((option . (? string? value))
                 (format #f "~a=\"~a\"" option value))))

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

* Re: Custom libre kernel configuration
  2021-11-12 23:38         ` Tobias Geerinckx-Rice
@ 2021-11-13  8:08           ` phodina
  0 siblings, 0 replies; 10+ messages in thread
From: phodina @ 2021-11-13  8:08 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

Thanks Tobia,

> You're not matching numbers here: ‘number’ is your chosen variable name, not magic. It could be ‘foo’. It could be anything, without changing the effect of this code.
>
> >                       ((option . string)
> >                        (string-append option "=\\"" string >                        "\\"")))
> >
>
> This will never be reached.
>
> I'm almost certain that this is, at least in part, why your BINDER configuration isn't taking effect.
>
> Here's mine:
>
> (define option->string
>
> (match-lambda ((option . #f)
>
> (format #f "# ~a is not set" option))
>
> ((option . #t)
>
> (format #f "~a=y" option))
>
> ((option . 'm)
>
> (format #f "~a=m" option))
>
> ((option . (? number? value))
>
> (format #f "~a=~a" option value))
>
> ((option . (? string? value))
>
> (format #f "~a=\"~a\"" option value))))
>
> Kind regards,
>
> T G-R

I took your changes and applied them to the code:

(define (config->string options)
  (string-join (map (match-lambda
                      ((option . #f)
                       (format #f "# ~a is not set" option))
                      ((option . #t)
                       (format #f "~a=y" option))
                      ((option . 'm)
                       (format #f "~a=m" option))
                      ((option . (? number? value))
                       (format #f "~a=~a" option value))
                      ((option . (? string? value))
                       (format #f "~a=\"~a\"" option value)))
                    options)
               "\n"))

However, the CONFIG_ANDROID_BINDER_IPC is still not part of the config :-/

$ grep BINDER .config
# CONFIG_ANDROID_BINDER_IPC is not set

The Guix part of generating the code is fine though. Thanks.

So I digged little deeper and it seems that they have to be compiled into the kernel.

$ tar xf $(guix build linux-libre --source)
$ cd linux-5.14.17
$ guix environment linux --ad-hoc ncurses pkg-config -- make MENUCONFIG_COLOR=mono menuconfig
$ grep ANDROID .config
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set

Though the issue seems to come from the Archlinux Wiki[1] where they supply wrong CONFIG options.

Kind regards
Petr

[1] https://wiki.archlinux.org/title/Waydroid


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

* Re: Custom libre kernel configuration
@ 2021-11-13 12:35 Stefan
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan @ 2021-11-13 12:35 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

Hi Petr!

> However, the CONFIG_ANDROID_BINDER_IPC is still not part of the config :-/

It is possible that these settings have conflicts or unfulfilled dependencies. Maybe try my patch series¹ and use the modify-linux function. It creates a defconfig file from a linux package and applies your settings to that. Beside the docstring of modify-linux, you can find a usage example in gnu/system/examples/raspberry-pi-64-nfs-root.tmpl.


Bye

Stefan


P. S. Did the guix system init work for your Raspberry? There was another hint to use --target=aarch64-linux-gnu and possibly --skip-checks.

¹ <http://issues.guix.gnu.org/48314#10> patches 2 and 4, patch 8 for the usage example

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

end of thread, other threads:[~2021-11-13 12:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 12:35 Custom libre kernel configuration Stefan
  -- strict thread matches above, loose matches on Subject: below --
2021-11-11 12:31 phodina
2021-11-11 12:49 ` André A. Gomes
2021-11-11 13:08   ` phodina
2021-11-11 13:23 ` Tobias Geerinckx-Rice
2021-11-11 14:13   ` phodina
2021-11-11 15:01     ` Tobias Geerinckx-Rice
2021-11-11 15:19       ` phodina
2021-11-12 23:38         ` Tobias Geerinckx-Rice
2021-11-13  8:08           ` phodina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).