Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
darkbit
ffbs-gluon
Commits
858c7ed8
Commit
858c7ed8
authored
5 years ago
by
Matthias Schiffer
Committed by
chrissi^
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
uboot-fritz4040: add fixes for bootloader image generation
parent
ad01e15f
Branches
v2018.2.2.1-ffbs
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
patches/openwrt/0025-uboot-fritz4040-add-fixes-for-bootloader-image-generation.patch
+111
-0
111 additions, 0 deletions
...fritz4040-add-fixes-for-bootloader-image-generation.patch
with
111 additions
and
0 deletions
patches/openwrt/0025-uboot-fritz4040-add-fixes-for-bootloader-image-generation.patch
0 → 100644
+
111
−
0
View file @
858c7ed8
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 20 Jul 2019 13:12:58 +0200
Subject: uboot-fritz4040: add fixes for bootloader image generation
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/boot/uboot-fritz4040/patches/200-fritzcreator-replace-obscure-padding-generation-with.patch b/package/boot/uboot-fritz4040/patches/200-fritzcreator-replace-obscure-padding-generation-with.patch
new file mode 100644
index 0000000000000000000000000000000000000000..44062b88048f483b618992c51b1dffdfe7ca511a
--- /dev/null
+++ b/package/boot/uboot-fritz4040/patches/200-fritzcreator-replace-obscure-padding-generation-with.patch
@@ -0,0 +1,63 @@
+From 9af24ea29494a279eba01d2b284c9c94d4fdb267 Mon Sep 17 00:00:00 2001
+Message-Id: <9af24ea29494a279eba01d2b284c9c94d4fdb267.1563619497.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 20 Jul 2019 12:35:01 +0200
+Subject: [PATCH 1/2] fritzcreator: replace obscure padding generation with
+ something more compatible
+
+It as reported that OpenWrt/Gluon would sometimes generate invalid
+bootloader images with insufficient for the FritzBox 4040, presumably
+depending on the distro version used on the build host.
+
+This commit tries to fix this by replacing the printf-based padding
+generation (that in one case relies on 65536 arguments being passed to the
+printf command) with a more compatible read from /dev/zero.
+
+[1] https://github.com/freifunk-gluon/gluon/issues/1766
+---
+ fritz/fritzcreator.sh | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/fritz/fritzcreator.sh b/fritz/fritzcreator.sh
+index 8ed0c08cc5ed..8ea412e5aca5 100755
+--- a/fritz/fritzcreator.sh
++++ b/fritz/fritzcreator.sh
+@@ -55,7 +55,7 @@ cat "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" >> $UBOOT_FRITZ4040
+ rm -f "$FRITZ_DTB"
+
+ # Add 512 bytes of pad area
+-printf "%0.s\0" {1..512} >> $UBOOT_FRITZ4040
++dd if=/dev/zero bs=512 count=1 >> $UBOOT_FRITZ4040
+
+ # This table links to the individual DTBs for every HWSubRevision.
+ # A table entry consists of two 32-bit words.
+@@ -84,7 +84,7 @@ mv "$UBOOT_FRITZ4040.new" "$UBOOT_FRITZ4040"
+
+
+ # Add 64k bytes of pad area
+-printf "%0.s\0" {1..65536} >> $UBOOT_FRITZ4040
++dd if=/dev/zero bs=1024 count=64 >> $UBOOT_FRITZ4040
+
+ # Pack it with lzma
+ fritz/lzma e "$UBOOT_FRITZ4040" -lc1 -lp2 -pb2 "$UBOOT_FRITZ4040.new"
+@@ -99,7 +99,7 @@ fritz/lzma2eva $UBOOT_LOADADDR $UBOOT_LOADADDR "$UBOOT_FRITZ4040.new" "$UBOOT_FR
+ # The next bit. The hshqs partition should be aligned to 0x100
+ let size=$(stat -c%s "$UBOOT_FRITZ4040")
+ let "pad = 256 - ( $size % 256) % 256"
+-( printf "%0.s\377" {1..256} | dd conv=sync bs=$pad count=1 ) > $UBOOT_FRITZ4040.pad
++dd if=/dev/zero bs=$pad count=1 | tr '\0' '\377' > $UBOOT_FRITZ4040.pad
+
+ cat "$UBOOT_FRITZ4040" "$UBOOT_FRITZ4040.pad" > $UBOOT_FRITZ4040.new
+
+@@ -109,7 +109,7 @@ rm -f "$UBOOT_FRITZ4040.pad"
+
+ # Apparently, EVA checks for the SquashFS filesystem MAGIC too. Likely for the rootfs
+ # entry.
+-(cat "$UBOOT_FRITZ4040"; echo "hsqs"; printf "%0.s\0" {1..124} ) > $UBOOT_FRITZ4040.new
++(cat "$UBOOT_FRITZ4040"; echo "hsqs"; dd if=/dev/zero bs=124 count=1 ) > $UBOOT_FRITZ4040.new
+
+ # Make it so that this fits into 512k (Note: we have to add 8 Bytes for the final checksum
+ # so 524280 is 512k - 8.
+--
+2.22.0
+
diff --git a/package/boot/uboot-fritz4040/patches/201-fritzcreator-actually-add-checksum-spacer.patch b/package/boot/uboot-fritz4040/patches/201-fritzcreator-actually-add-checksum-spacer.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f92060a23312a4961ddc75716fd06b9d6a106a1d
--- /dev/null
+++ b/package/boot/uboot-fritz4040/patches/201-fritzcreator-actually-add-checksum-spacer.patch
@@ -0,0 +1,30 @@
+From dd05d1bb619b372e4717a74da560450dd93d4c3b Mon Sep 17 00:00:00 2001
+Message-Id: <dd05d1bb619b372e4717a74da560450dd93d4c3b.1563619497.git.mschiffer@universe-factory.net>
+In-Reply-To: <9af24ea29494a279eba01d2b284c9c94d4fdb267.1563619497.git.mschiffer@universe-factory.net>
+References: <9af24ea29494a279eba01d2b284c9c94d4fdb267.1563619497.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 20 Jul 2019 12:43:48 +0200
+Subject: [PATCH 2/2] fritzcreator: actually add checksum spacer
+
+The spacer was written to $UBOOT_FRITZ4040.new, but this file was not used
+at all before it was overwritten again.
+---
+ fritz/fritzcreator.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fritz/fritzcreator.sh b/fritz/fritzcreator.sh
+index 8ea412e5aca5..ea5a50df1f87 100755
+--- a/fritz/fritzcreator.sh
++++ b/fritz/fritzcreator.sh
+@@ -94,7 +94,7 @@ fritz/lzma2eva $UBOOT_LOADADDR $UBOOT_LOADADDR "$UBOOT_FRITZ4040.new" "$UBOOT_FR
+
+ # The bootloader seems to add a TI checksum signature (8 Bytes) as part of the
+ # "check mtd1" command in the FTP prompt. To make this easier we add spacer here.
+-(cat "$UBOOT_FRITZ4040"; printf "\xff\xff\xff\xff\xff\xff\xff\xff" ) > $UBOOT_FRITZ4040.new
++printf "\xff\xff\xff\xff\xff\xff\xff\xff" >> $UBOOT_FRITZ4040
+
+ # The next bit. The hshqs partition should be aligned to 0x100
+ let size=$(stat -c%s "$UBOOT_FRITZ4040")
+--
+2.22.0
+
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment