summaryrefslogtreecommitdiff
path: root/libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-23 23:40:35 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-24 00:54:32 +0200
commit26258c970a5de46a243ffccd74a30ecdaed85b9c (patch)
treec5520924fb822771235f31a299569794cfd8f69c /libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch
parent88462e5cc21168872df53543d9607335bb4ba625 (diff)
downloadabslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.tar.gz
abslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.tar.bz2
abslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.zip
move WIP u-boot modifications in libre-testing
I asked bill-auger to push his modifications so he uploaded the packages to libre-testing and the PKGBUILD modifications to abslibre. Since the pakcages have been uploaded to libre-testing it's better to move them here. While the code is not ready yet, it enables users to test the new u-boot which fixes the Ethernet PHY. From linux-sunxi we have[1]: Proper fix for rev. F and newer is to apply trace length compensation at the PHY. This is done by default (also for rev. H and newer despite commit message mentioning only realtek not Micrel) since mainline linux v5.15 and since mainline u-boot v2022.04; [1]https://linux-sunxi.org/Olimex_A20-OLinuXino-Lime2#calibrate_at_PHY That page also has more background on the issue being fixed here (basically making all the various Lime 2 A20 revisions (which have different Ethernet PHY) work with the same u-boot binary / package. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch')
-rw-r--r--libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch b/libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch
new file mode 100644
index 000000000..ee89767f2
--- /dev/null
+++ b/libre-testing/uboot4extlinux-sunxi/0001-Add-tool-to-dump-sunxi-images.patch
@@ -0,0 +1,85 @@
+From b4e67c5112b8d8ec8f9255af057c3515c5ea71c1 Mon Sep 17 00:00:00 2001
+From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+Date: Sat, 29 May 2021 19:14:22 +0200
+Subject: [PATCH] Add tool to dump sunxi images
+
+ $./tools/dumpimage -l ~/work/temp/lime1.img
+ Allwinner eGON image, size: 24576 bytes
+ SPL header version 0.2
+ DT name: sun7i-a20-olinuxino-lime2-emmc
+ $ ./tools/dumpimage -l ~/work/temp/parabola.img
+ Allwinner eGON image, size: 24576 bytes
+ SPL header version 0.2
+ DT name: sun7i-a20-olinuxino-lime2-emmc
+
+TODO:
+- why do we have the lime2 dt detected above? is the
+ env a leftover from the previous image somehow?
+- Handle block devices:
+ $ sudo ./tools/dumpimage -l /dev/sdb
+ Image Type: MVEBU Boot from (null) Image
+ Image version:0
+ Data Size: -4 Bytes = 4194304.00 KiB = 4096.00 MiB
+ Load Address: 00000000
+ Entry Point: 00000000
+- Make it easily parsable by tools
+- Force type to sunxi_egon
+
+Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+---
+ tools/dumpimage.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/tools/dumpimage.c b/tools/dumpimage.c
+index e5481435a7..9d0d0c448b 100644
+--- a/tools/dumpimage.c
++++ b/tools/dumpimage.c
+@@ -71,6 +71,9 @@ int main(int argc, char **argv)
+ char *ptr;
+ int retval = EXIT_SUCCESS;
+ struct image_type_params *tparams = NULL;
++ off_t offset = 0;
++
++ offset = 8192; /* Allwinner SOCs */
+
+ params.cmdname = *argv;
+
+@@ -159,6 +162,14 @@ int main(int argc, char **argv)
+ exit(EXIT_FAILURE);
+ }
+
++ /* Handle block devices */
++ if (sbuf.st_size == 0) {
++ /* 1M should be sufficient as we have the first partition that
++ * is typically aligned at 1M for MBR partitioning.
++ */
++ sbuf.st_size = 1024*1024;
++ }
++
+ if ((uint32_t)sbuf.st_size < tparams->header_size) {
+ fprintf(stderr, "%s: Bad size: \"%s\" is not valid image\n",
+ params.cmdname, params.imagefile);
+@@ -182,7 +193,7 @@ int main(int argc, char **argv)
+ * Extract the data files from within the matched
+ * image type. Returns the error code if not matched
+ */
+- retval = dumpimage_extract_subimage(tparams, ptr, &sbuf);
++ retval = dumpimage_extract_subimage(tparams, ptr + offset, &sbuf);
+ if (retval)
+ fprintf(stderr, "%s: Can't extract subimage from %s\n",
+ params.cmdname, params.imagefile);
+@@ -191,10 +202,9 @@ int main(int argc, char **argv)
+ * Print the image information for matched image type
+ * Returns the error code if not matched
+ */
+- retval = imagetool_verify_print_header(ptr, &sbuf, tparams,
++ retval = imagetool_verify_print_header(ptr + offset, &sbuf, tparams,
+ &params);
+ }
+-
+ (void)munmap((void *)ptr, sbuf.st_size);
+ (void)close(ifd);
+
+--
+2.31.1
+