[PATCH] gnu: Add embedded-controller-hx20.

OpenSubmitted by phodina.
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • phodina
Owner
unassigned
Severity
normal
P
P
phodina wrote on 10 May 12:28 +0200
(name . Guix Patches)(address . guix-patches@gnu.org)
hkArDpBVH_rMN8Az9OXMvoqup47IIXE3Clr0XELDWqHK9CIl4pkCDI75-mLYiZENReIZdxJKR-LhNVYQNax92lR5BkvLp90ANzST4rqenQw=@protonmail.com
Hi,

here's a patch that brings firmware for the Embedded Controller on Framework laptops.

I wanted to put this package into gnu/packages/firmware.scm but due to arm-none-eabi toolchain and the usage of embedded.scm module the build generates only errors due to inclusion. Therefore I temporarily placed the package to gnu/packages/embedded.scm.

I'm unfortunately not an owner of Framework laptop so I can't test the built firmware. I also don't want to ask people to reflash the EC as incorrectly built binary can result in a bricked computer.

Therefore I'd like to open the discussion what should be the steps to include EC [1][2] in general into Guix so that more parts of the firmware will be open source where possible.

----
Petr
Attachment: file
From eb4dcfad9ad9126941acc0ba9522bbaa9d856fdf Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Fri, 28 Jan 2022 19:29:56 +0100
Subject: [PATCH] gnu: Add embedded-controller-hx20.

* gnu/packages/embedded.scm (embedded-controller-hx20): New variable.

Toggle diff (49 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index de8d2944bc..8b5dd99dc8 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -70,6 +70,42 @@ (define-module (gnu packages embedded)
   #:use-module (gnu packages xorg)
   #:use-module (srfi srfi-1))
 
+
+(define-public embedded-controller-hx20
+(let ((commit "8109392adb17a2cd7d30a74eee8613a0cb72ee7d")
+      (revision "1"))
+  (package
+    (name "embedded-controller-hx20")
+    (version (git-version "0.1" revision commit))
+    (source
+	(origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/FrameworkComputer/EmbeddedController")
+                    (commit commit)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "16y6v886ci97yxn8q54iwm9clx0kgvszrxp5vjh0hdldc9pamaij"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+	   #:make-flags '("BOARD=hx20" "CROSS_COMPILE=arm-none-eabi-")
+	   #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'install))))
+    (native-inputs (list arm-none-eabi-toolchain-7-2018-q2-update
+	base:coreutils
+	perl pkg-config python python-2))
+    (inputs (list libftdi inetutils inetutils libusb))
+    (synopsis "Embedded Controller firmware for the Framework Laptop")
+    (description "The Embedded Controller on your Framework Laptop handles low
+level functions, including power sequencing the system.  Modifying the EC code
+can cause your system to not power on or boot or cause damage to the mainboard,
+battery, or other parts of the system or devices attached to the system.")
+    (home-page "https://github.com/FrameworkComputer/EmbeddedController")
+    (license license:bsd-3))))
 ;; We must not use the released GCC sources here, because the cross-compiler
 ;; does not produce working binaries.  Instead we take the very same SVN
 ;; revision from the branch that is used for a release of the "GCC ARM
-- 
2.34.0
M
M
Maxime Devos wrote on 10 May 14:52 +0200
9bdaad8485e5f80a27f3b1fbfeac425ef4862c8a.camel@telenet.be
phodina via Guix-patches via schreef op di 10-05-2022 om 10:28 [+0000]:
Toggle quote (8 lines)
> +    #:make-flags '("BOARD=hx20" "CROSS_COMPILE=arm-none-eabi-
> ")
> +    #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (delete 'install))))
> +    (native-inputs (list arm-none-eabi-toolchain-7-2018-q2-update

Maybe we can use Guix cross-compilation mechanism here:

(arguments
(list #:target "arm-none-eabi"
#:cross-implicit-inputs? #false ; custom gcc required because
[...]))
(native-inputs (list ...)

Also, why are 'libftdi, inetutils, ...' in inputs? Do they end up in
the firmware somehow? Or does embedded-controller-hx20 not only
contain firmware but also some kind of binaries to control the firmware
or such? If the latter, I don't think #:target can be used here.

Gree
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnpgGRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sP2AQD5578/COTtHTXFsv4ArRmnl65I
9Jauxg9Rc5RoKw2uqAEAp1XB8vsMziJJgxircthaWC4eJT8XvwenSF4wGk8ZpgQ=
=haDH
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 10 May 14:54 +0200
22879ed74824293fd864c95ad4cd828a25d68261.camel@telenet.be
phodina via Guix-patches via schreef op di 10-05-2022 om 10:28 [+0000]:
Toggle quote (4 lines)
> Modifying the EC code
> +can cause your system to not power on or boot or cause damage to the
> mainboard,

Maybe a qualifier ‘Modifying the EC code incorrectly’? Also maybe the
loss of warranty mentioned in the README?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnpgjhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7oUbAP9UMu2QdCdEZJ8LEaW3VA/0ll+t
/TTidNxJ6v1XDhqXwwEAw3lMihnF6fuW/S6y7e8U+hKMfZfjD13K8KMRKEF3uwE=
=q0V0
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 17 Jun 22:38 +0200
Re: bug#55348: [PATCH] gnu: Add embedded-controller-hx20.
(name . phodina)(address . phodina@protonmail.com)(address . 55348@debbugs.gnu.org)
87zgibc9fr.fsf@gnu.org
Hi phodina,

phodina <phodina@protonmail.com> skribis:

Toggle quote (7 lines)
> From eb4dcfad9ad9126941acc0ba9522bbaa9d856fdf Mon Sep 17 00:00:00 2001
> From: Petr Hodina <phodina@protonmail.com>
> Date: Fri, 28 Jan 2022 19:29:56 +0100
> Subject: [PATCH] gnu: Add embedded-controller-hx20.
>
> * gnu/packages/embedded.scm (embedded-controller-hx20): New variable.

Did you have a chance to look into addressing Maxime’s comments?


TIA,
Ludo’.
P
P
phodina wrote on 18 Jun 06:49 +0200
(address . ludo@gnu.org)(address . 55348@debbugs.gnu.org)
E5HhZOoefPY54IhT-9YHf0FcqINlK_NZricx371lvj_GSpWo3b1IS7WEXW6NsO27ksndrXfAxhEiLqRaqmkUsjLZY3H_khEhqQboSbENz1k=@protonmail.com
Hi Ludo’,

Toggle quote (3 lines)
> Did you have a chance to look into addressing Maxime’s comments?
> https://issues.guix.gnu.org/55348

not yet, but I plan to do so next week.

----
Petr
Attachment: file
?