Pphodina wrote on 10 May 2022 12:28
(name . Guix Patches)(address . email@example.com)
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  in general into Guix so that more parts of the firmware will be open source where possible.
From eb4dcfad9ad9126941acc0ba9522bbaa9d856fdf Mon Sep 17 00:00:00 2001
From: Petr Hodina <firstname.lastname@example.org>
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
@@ -70,6 +70,42 @@ (define-module (gnu packages embedded)
#:use-module (gnu packages xorg)
#:use-module (srfi srfi-1))
+(let ((commit "8109392adb17a2cd7d30a74eee8613a0cb72ee7d")
+ (revision "1"))
+ (name "embedded-controller-hx20")
+ (version (git-version "0.1" revision commit))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/FrameworkComputer/EmbeddedController")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (build-system gnu-build-system)
+ `(#:tests? #f
+ #:make-flags '("BOARD=hx20" "CROSS_COMPILE=arm-none-eabi-")
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'install))))
+ (native-inputs (list arm-none-eabi-toolchain-7-2018-q2-update
+ 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