Current State For Debian Testing > Stable Switch Process? Scripts?

If the firmware was flashed wrong, it is more likely that your keyboard is not working at all rather than sending a wrong key event. Since flashing the keyboard firmware manually is more complex and risky compared to flashing and booting a vanilla system image from sd-card, I would try that first if I were you. If you want to flash the keyboard firmware, here is a script that does it and from which you can probably learn all the things that tell you how to do it manually:

script worked perfectly, evtest shows no errors. 100% was the wrong key event.

I have a local commit which creates a Debian installer image with firmware. With that image I can run Debian installer on A311D which requires realtek firmware for wifi and I get this as expected:

From 0bbfc53dea2f2f4ae5556bded8b1e041f91adb01 Mon Sep 17 00:00:00 2001
From: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
Date: Sun, 28 Dec 2025 13:11:18 +0100
Subject: [PATCH] add non-free-firmware packages to initramfs

Closes: https://salsa.debian.org/reform-team/reform-debian-installer/-/issues/3
---
 run.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 54 insertions(+), 6 deletions(-)

diff --git a/run.sh b/run.sh
index f0b8520..931dd25 100755
--- a/run.sh
+++ b/run.sh
@@ -101,10 +101,12 @@ esac
 
 cleanup() {
   rm -f Release Release.gpg SHA256SUMS cpio.modules.gz cpio.preseed.gz \
+    Components-arm64.yml Components-arm64.yml.gz Packages.xz \
+    cpio.modules cpio.preseed cpio.firmware \
     extlinux.conf initrd-full.gz initrd initrd.gz preseed.cfg \
     "reform_${DIST%-backports}.sources" "reform_${DIST%-backports}-backports.sources" \
     flash.bin ls1028a-mhdpfw.bin cpiofilter.py machines/*.conf
-  rm -rf usr var
+  rm -rf usr var firmware
 }
 
 rm -f partition.img partition.img.bmap
@@ -287,10 +289,54 @@ case "$DIST" in
     /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/Release" Release
     /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/Release.gpg" Release.gpg
     gpgv --quiet --keyring=/usr/share/keyrings/debian-archive-keyring.gpg Release.gpg Release
-    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/main/installer-arm64/current/images/SHA256SUMS" SHA256SUMS
-    sed -ne 's/^ \([a-f0-9]\{64\}\)\s\+[1-9][0-9]* main\/installer-arm64\/current\/images\/SHA256SUMS/\1  SHA256SUMS/p' Release | sha256sum --check
-    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/main/installer-arm64/current/images/netboot/debian-installer/arm64/initrd.gz" initrd.gz
-    sed -ne 's/^\([a-f0-9]\{64\}\)  \.\/netboot\/debian-installer\/arm64\/initrd\.gz/\1  initrd.gz/p' SHA256SUMS | sha256sum --check
+    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/main/installer-arm64/current/images/SHA256SUMS" SHA256SUMS "SHA256:$(sed -ne 's/^ \([a-f0-9]\{64\}\)\s\+[1-9][0-9]* main\/installer-arm64\/current\/images\/SHA256SUMS$/\1/p' Release)"
+    # download Debian installer netboot image
+    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/main/installer-arm64/current/images/netboot/debian-installer/arm64/initrd.gz" initrd.gz "SHA256:$(sed -ne 's/^\([a-f0-9]\{64\}\)  \.\/netboot\/debian-installer\/arm64\/initrd\.gz$/\1/p' SHA256SUMS)"
+    # download firmware packages
+    mkdir -p firmware/dep11
+    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/non-free-firmware/dep11/Components-arm64.yml.gz" Components-arm64.yml.gz "SHA256:$(sed -ne 's/^ \([a-f0-9]\{64\}\)\s\+[1-9][0-9]* non-free-firmware\/dep11\/Components-arm64\.yml\.gz$/\1/p' Release)"
+    gzip --keep --decompress --to-stdout Components-arm64.yml.gz >Components-arm64.yml
+    sed -ne 's/^ \([a-f0-9]\{64\}\)\s\+[1-9][0-9]* non-free-firmware\/dep11\/Components-arm64\.yml$/\1  Components-arm64.yml/p' Release | sha256sum --check
+    /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/dists/${DIST%-backports}/non-free-firmware/binary-all/Packages.xz" Packages.xz "SHA256:$(sed -ne 's/^ \([a-f0-9]\{64\}\)\s\+[1-9][0-9]* non-free-firmware\/binary-all\/Packages\.xz$/\1/p' Release)"
+    # from images-team/debian-cd:tools/make-firmware-image
+    : >firmware/Contents-firmware
+    for f in atheros iwlwifi mediatek misc-nonfree realtek; do
+      filename=$(xzcat Packages.xz | grep-dctrl -P "firmware-$f" -n -s Filename)
+      basename=$(basename "$filename")
+      sha256sum=$(xzcat Packages.xz | grep-dctrl -P "firmware-$f" -n -s SHA256)
+      /usr/lib/apt/apt-helper -oAPT::Sandbox::User=root download-file "http://deb.debian.org/debian/$filename" "firmware/$basename" "SHA256:$sha256sum"
+      dpkg --contents "firmware/$basename" | perl -ne 'printf "%-55s %s %s\n", "/$1", "'"$basename"'", "non-free-firmware" if m,^[-|l]\S+\s+\S+\s+\d+\s+\S+\s+\S+\s+./(\S+/firmware/\S+),' >>firmware/Contents-firmware
+      echo non-free-firmware > firmware/dep11/$basename.component
+    done
+    # from images-team/debian-cd:tools/generate_firmware_patterns
+    perl <<'END'
+use List::Util qw(none);
+use List::MoreUtils qw(apply);
+use YAML::XS   qw(LoadFile);
+my @c = LoadFile "Components-arm64.yml";
+my @fwpkgs = ("atheros", "iwlwifi", "mediatek", "misc-nonfree", "realtek");
+my @found;
+foreach my $array (@c) {
+    next if not defined $array->{Provides};
+    next if not defined $array->{Provides}->{modaliases};
+    next if not defined $array->{Package};
+    my $pkgname = $array->{Package};
+    next if none { "firmware-$_" eq $pkgname } @fwpkgs;
+    my $fname = "firmware/dep11/$pkgname.patterns";
+    open my $fh, ">", $fname or die "cannot open $fname";
+    foreach my $alias ( @{ $array->{Provides}->{modaliases} } ) {
+        $alias =~ s/[*]/.*/g;
+        print $fh "^$alias\$\n";
+    }
+    close "$fh";
+    push @found, $pkgname;
+}
+print STDERR join(" ", @found);
+print STDERR "\n";
+print STDERR join(" ", apply { $_ = "firmware-$_" } @fwpkgs);
+print STDERR "\n";
+join(" ", sort @found) eq join(" ", apply { $_ = "firmware-$_" } @fwpkgs) or die "not all fw pkgs found";
+END
     ;;
   *)
     echo "Performing initrd.gz download without gpg verification" >&2
@@ -521,6 +567,8 @@ if __name__ == "__main__":
 END
 chmod +x cpiofilter.py
 
+find firmware -print0 | LC_ALL=C sort -z | cpio --null --quiet -o -H newc >cpio.firmware
+
 # chdir to not include a leading slash in the cpio archive members
 env --chdir=/ sh -c 'exec find lib/modules/*'"$abiname"'/ -print0' \
   | LC_ALL=C sort -z \
@@ -537,7 +585,7 @@ env --chdir=/ sh -c 'exec find lib/modules/*'"$abiname"'/ -print0' \
   [ "$SYSIMAGE" = "reform-system-ls1028a" ] && echo ls1028a-mhdpfw.bin
 } | cpio --quiet -o -H newc >cpio.preseed
 gzip --decompress --force initrd.gz
-./cpiofilter.py initrd cpio.modules cpio.preseed | gzip >initrd-full.gz
+./cpiofilter.py initrd cpio.modules cpio.preseed cpio.firmware | gzip >initrd-full.gz
 
 # Create a ~146 MB image
 truncate --size="$((300 * 1024 * 1000))" partition.img
-- 
2.47.3

1 Like