[PATCH 1/2] gnu: linux: Support numbers and strings in options.

  • Open
  • quality assurance status badge
Details
2 participants
  • outlook user
  • phodina
Owner
unassigned
Submitted by
phodina
Severity
normal
P
P
phodina wrote on 11 Nov 2021 20:02
(name . Guix Patches)(address . guix-patches@gnu.org)
iOvT9g1d7_K-thdi2Zsdn4SxPyMuPrPFP6k121oLlG67EGRxi5tPyWOE8vb3jvCfsgZPQ13b7dKWRdVdAY6VCXV0goFY5AYOPBRV4nsvdRA=@protonmail.com
Hi,

this patch should add support for waydroid which requires certain options in the kernel enabled.

In order to enable the features the lambda-match has to be extended to support numbers and strings.

However, the kernel compiles and I can reconfigure the system, + reboot. But I do not see /dev/binder device. Details are in the last mail.

Petr

* gnu/packages/linux.scm: Match numbers and strings in options.

Toggle diff (17 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index f386139638..ffbaed0c57 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -729,7 +729,11 @@ (define (config->string options)
((option . #t)
(string-append option "=y"))
((option . #f)
- (string-append option "=n")))
+ (string-append option "=n"))
+ ((option . number)
+ (string-append option "=" number))
+ ((option . string)
+ (string-append option "=\"" string "\"")))
options)
"\n"))

--
2.33.0
P
P
phodina wrote on 11 Nov 2021 20:04
[PATCH 2/2] gnu: Add linux-libre-with-waydroid.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
vT1t7q1nSybGdcbnNv0gBkOmsLDQKTpuvLjBmsObWL0vH3rxO_vtPlSdqRKap4nKqivgnqL4pQi0LUmjJ66XJMqDTdAOmmgyn3Pcg3BMmO8=@protonmail.com
* gnu/packages/linux.scm (linux-libre-with-waydroid,
* waydroid-extra-linux-options): New variables.

Toggle diff (44 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index ffbaed0c57..2ec9c88ecb 100644
--- 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" . #t)
+ ("CONFIG_ANDROID_BINDER_IPC" . m)
+ ("CONFIG_ANDROID_BINDERFS" . #f)
+ ("CONFIG_ANDROID_BINDER_DEVICES" . "binder,hwbinder,vndbinder")))
+
(define (config->string options)
(string-join (map (match-lambda
((option . 'm)
@@ -1147,6 +1155,24 @@ (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 "linux"
+ #:configuration-file kernel-config
+ #:extra-options
+ (append %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*
--
2.33.0
P
P
phodina wrote on 11 Nov 2021 20:31
Binder kernel module missing
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
0x0kMfnducz-ThC0YbUbYb30kvJWgoZAHD3WmxuZavOg4kbFXSuDmmi4-Ioql-RUrILvGUewjO0bcdl4OPWK3JtsByM_HP8z2QO6IOW4iUY=@protonmail.com
Unfortunately, as stated above the binder interface is missing. I looked for the kernel module but couldn't find it. As the /proc/config.gz is not present I can't verify it's enabled.

$ find /run/booted-system/kernel/lib/modules/5.14.17-gnu/kernel/ -iname "*binder*"
$ cat /proc/cmdline
BOOT_IMAGE=/gnu/store/fr1cwmbn19hyrs3wxr5sqr7iy4cj674y-linux-libre-waydroid-5.14.17/bzImage --root=/dev/mapper/cryptsystem --system=/gnu/store/8g26gi6v9dni0cagc3l1ny8shyz8r38h-system --load=/gnu/store/8g26gi6v9dni0cagc3l1ny8shyz8r38h-system/boot modprobe.blacklist=usbmouse,usbkbd quiet

Therefore the waydroid userspace manager also doesn't work:

# waydroid.py init
[19:40:05] Failed to load binder driver
[19:40:06] modprobe: FATAL: Module binder_linux not found in directory /run/booted-system/kernel/lib/modules/5.14.17-gnu
[19:40:06] ERROR: Binder node "binder" for waydroid not found
[19:40:06] See also: https://github.com/waydroid
Run 'waydroid log' for details.

$ waydroid.py log
(006323) [19:40:05] % modprobe binder_linux devices="anbox-binder,anbox-vndbinder,anbox-hwbinder"
modprobe: FATAL: Module binder_linux not found in directory /run/booted-system/kernel/lib/modules/5.14.17-gnu
(006323) [19:40:05] Failed to load binder driver
(006323) [19:40:06] modprobe: FATAL: Module binder_linux not found in directory /run/booted-system/kernel/lib/modules/5.14.17-gnu
(006323) [19:40:06] ERROR: Binder node "binder" for waydroid not found
(006323) [19:40:06] See also: https://github.com/waydroid
(006323) [19:40:06] Traceback (most recent call last):
File "/gnu/store/iprc2yqsx5zi8nc2g3nqvlmlqzbw7nrf-waydroid-1.2.0/lib/waydroid/tools/__init__.py", line 54, in main

My conclusion is the module is not enabled and built. It could be do the the extended match-lambda expression as I'm not Guile guru.

The patch related to waydroid can be find here [1].

P
P
phodina wrote on 13 Nov 2021 11:49
Re: [PATCH 2/2] gnu: Add linux-libre-with-waydroid.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
u_ib1orir8DkVGJMursHiPxOfqbl1Ltc1JOk1yo5z7NJPM2fbz1-Tc2WiPJ5BEoHC88RR4k4dgmGx_fK0EFDcuO7oivGtuf5JMn6NB_vFGM=@protonmail.com
[PATCH v2 1/2] gnu: linux: Support numbers and strings in options.

* gnu/packages/linux.scm: Match numbers and strings in options.

Toggle diff (26 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index f386139638..cfc09580a3 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -724,12 +724,16 @@ (define %bpf-extra-linux-options

(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")))
+ (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"))

--
2.33.0
P
P
phodina wrote on 13 Nov 2021 11:50
[PATCH v2 2/2] gnu: Add linux-libre-with-waydroid.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
bciESSWCCUIRrqs-S99j2QIWcaajFIzIu6juLy255EbPcONI6YFJZlpcFQndyRZUnoFgmUMzsCN11xpWCzgsqAiDHNvqa3LohQsQKG8kuZQ=@protonmail.com
* gnu/packages/linux.scm (linux-libre-with-waydroid,
* waydroid-extra-linux-options): New variables.

Toggle diff (44 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index cfc09580a3..a5d95bf5d4 100644
--- 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" . #t)
+ ("CONFIG_ANDROID" . #t)
+ ("CONFIG_ANDROID_BINDER_IPC" . #t)
+ ("CONFIG_ANDROID_BINDERFS" . #t)
+ ("CONFIG_ANDROID_BINDER_DEVICES" . "binder,hwbinder,vndbinder")))
+
(define (config->string options)
(string-join (map (match-lambda
((option . #f)
@@ -1147,6 +1155,24 @@ (define-public linux-libre-mips64el-fuloong2e
`(("CONFIG_OVERLAY_FS" . m))
%default-extra-linux-options)))

+(define-public linux-libre-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 "linux"
+ #:configuration-file kernel-config
+ #:extra-options
+ (append %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*
--
2.33.0
P
P
phodina wrote on 13 Nov 2021 11:53
Linux-libre-with-waydroid.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
1KXnjy2aoaA0TTPejA7lCvXrBNTRnnK8w5PJhEwHqZd8-1ppEx1bPlWqvFlfcfCJZT_vOZ5UtRr8rTm6A5quQsX2xzmvyntPBGYsrde-c2E=@protonmail.com
Hi,

here are the updated patches that:

- enable to set numbers and strings as options in kernel config
- define a new linux kernel which has support for waydroid

$ grep -E "ANDROID|ASHMEM" /run/current-system/kernel/.config
CONFIG_ASHMEM=y
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

Huge thanks to Tobias Geerinckx-Rice for help with the parsing issue!

Petr
P
P
phodina wrote on 24 Mar 2022 14:30
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
yspArvxtQ67y3K-bMyD9ywkUwKrsImOufKZSqFbH1bynT9verUnNqC42ERDhR8T2xlFVbdMQAJxdfBYrGcnQrPi3mT2tCBV9OMOAsdKne4U=@protonmail.com
Hi,

would it be possible to just review the first patch which adds support for strings in kernel options?

Unfortunately, there is no way to build just the kernel modules with support for ASHMEM as the coded misused the `kallsyms_lookup_name` [1].

Therefore the only way to have working waydroid is to build a kernel with the options enabled.

I'll leave the second patch for the other open issue [2].


----
Petr
P
P
phodina wrote on 14 Apr 2022 10:07
Linux-libre-with-waydroid.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
yYsCzlnIBReK7PzR1jtmGDxlTpyjSH-j7HmyjUZZBgNsLrV1RZZCiPSMNr-tskq3AWN_-COo4weUWFT2Kh-znGFThqAtRoBTzhws9tGNhHE=@protonmail.com
Hi,

could you please share your thoughts on the parsing of the config and possibly also on waydroid?

Petr
O
O
outlook user wrote on 8 Apr 22:27 +0200
%5BPATCH%201%2F2%5D%20gnu%3A%20linux%3A%20Support%20numbers%20and%20strings%20in%20options.
(name . 51771@debbugs.gnu.org)(address . 51771@debbugs.gnu.org)
AS8P251MB0854DF780378C0AAB62AAA6B97002@AS8P251MB0854.EURP251.PROD.OUTLOOK.COM
phodina: Is this 51737 duplicate?
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 51771@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51771
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch