gnu: u-boot: Update to 2019.04.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Vagrant Cascadian
Severity
normal

Debbugs page

Vagrant Cascadian wrote 6 years ago
(address . guix-patches@gnu.org)
87h8b6ia13.fsf@ponder
* gnu/packages/bootloaders (u-boot): Update to 2019.04.
[source]: Add patch.
(u-boot-novena): Update dynamic patch to handle variable rename.
(u-boot-am335x-evm): New variable.
(u-boot-am335x-boneblack): Deprecate variable.
(u-boot-novena): Fix typo in description.
* gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch: New file.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
---
gnu/local.mk | 1 +
gnu/packages/bootloaders.scm | 18 ++++---
...boot-fix-mkimage-header-verification.patch | 48 +++++++++++++++++++
3 files changed, 61 insertions(+), 6 deletions(-)
create mode 100644 gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch

Toggle diff (125 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 6c39c3fef5..d8b74c0650 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1307,6 +1307,7 @@ dist_patch_DATA = \
%D%/packages/patches/totem-meson-easy-codec.patch \
%D%/packages/patches/tuxpaint-stamps-path.patch \
%D%/packages/patches/twinkle-include-qregexpvalidator.patch \
+ %D%/packages/patches/u-boot-fix-mkimage-header-verification.patch \
%D%/packages/patches/unzip-CVE-2014-8139.patch \
%D%/packages/patches/unzip-CVE-2014-8140.patch \
%D%/packages/patches/unzip-CVE-2014-8141.patch \
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index d6ef7d52b5..6064e699f8 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -378,7 +378,7 @@ tree binary files. These are board description files used by Linux and BSD.")
(define u-boot
(package
(name "u-boot")
- (version "2019.01")
+ (version "2019.04")
(source (origin
(method url-fetch)
(uri (string-append
@@ -386,7 +386,10 @@ tree binary files. These are board description files used by Linux and BSD.")
"u-boot-" version ".tar.bz2"))
(sha256
(base32
- "08hwsmh5xsb1gcxsv8gvx00bai938dm5y3889n8jif3a8rd7xgah"))))
+ "1vwv4bgbl7fjcm073zrphn17hnz5h5h778f88ivdsgbb2lnpgdvn"))
+ (patches
+ (search-patches
+ "u-boot-fix-mkimage-header-verification.patch"))))
(native-inputs
`(("bc" ,bc)
("bison" ,bison)
@@ -577,8 +580,11 @@ board-independent tools.")))
(define-public u-boot-malta
(make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
-(define-public u-boot-beagle-bone-black
- (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf"))
+(define-public u-boot-am335x-evm
+ (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
+
+(define-public u-boot-am335x-boneblack
+ (deprecated-package "u-boot-am335x-boneblack" u-boot-am335x-evm))
(define-public (make-u-boot-sunxi64-package board triplet)
(let ((base (make-u-boot-package board triplet)))
@@ -637,7 +643,7 @@ board-independent tools.")))
also initializes the boards (RAM etc).
This U-Boot is built for Novena. Be advised that this version, contrary
-to Novena upstream, does not load u-boot.img from the first patition.")
+to Novena upstream, does not load u-boot.img from the first partition.")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
@@ -647,7 +653,7 @@ to Novena upstream, does not load u-boot.img from the first patition.")
;; allowing it to be installed at a device offset.
(lambda _
(substitute* "configs/novena_defconfig"
- (("CONFIG_SPL_FAT_SUPPORT=y") "# CONFIG_SPL_FAT_SUPPORT is not set"))
+ (("CONFIG_SPL_FS_FAT=y") "# CONFIG_SPL_FS_FAT is not set"))
#t)))))))))
(define-public u-boot-cubieboard
diff --git a/gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch b/gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch
new file mode 100644
index 0000000000..a24519d2f4
--- /dev/null
+++ b/gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch
@@ -0,0 +1,48 @@
+From da8dc3e61bab213b322eafeffa2802585508f288 Mon Sep 17 00:00:00 2001
+From: Jordan Hand <jordanhand22@gmail.com>
+Date: Tue, 9 Apr 2019 10:36:09 -0700
+Subject: [PATCH] fdt: Fix mkimage list to try every header type
+Origin: https://patchwork.ozlabs.org/patch/1082572/
+
+Signed-off-by: Jordan Hand <jorhand@microsoft.com>
+---
+ tools/mkimage.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/tools/mkimage.c b/tools/mkimage.c
+index 2899adff81..d1e1a6743d 100644
+--- a/tools/mkimage.c
++++ b/tools/mkimage.c
+@@ -403,14 +403,21 @@ int main(int argc, char **argv)
+ exit (EXIT_FAILURE);
+ }
+
+- /*
+- * scan through mkimage registry for all supported image types
+- * and verify the input image file header for match
+- * Print the image information for matched image type
+- * Returns the error code if not matched
+- */
+- retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
+- tparams, &params);
++ if (params.fflag) {
++ /*
++ * Verifies the header format based on the expected header for image
++ * type in tparams
++ */
++ retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
++ tparams, &params);
++ } else {
++ /**
++ * When listing the image, we are not given the image type. Simply check all
++ * image types to find one that matches our header
++ */
++ retval = imagetool_verify_print_header(ptr, &sbuf,
++ tparams, &params);
++ }
+
+ (void) munmap((void *)ptr, sbuf.st_size);
+ (void) close (ifd);
+--
+2.20.1
+
--
2.20.1
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXK2duAAKCRDcUY/If5cW
qlXfAP9v/z8F9+1bNFzsCm/vrcaAodjvq9phWQsTVH3hZchArQEArrFdjFo83fgJ
G+T3iSIwbouHpXftgzFavKQM8KMDqg4=
=MJ46
-----END PGP SIGNATURE-----

Vagrant Cascadian wrote 6 years ago
(address . 35217@debbugs.gnu.org)
87v9zl33hh.fsf@ponder
Toggle quote (2 lines)
> On 2019-04-10, Vagrant Cascadian wrote:
> * gnu/packages/bootloaders (u-boot): Update to 2019.04.
...
Toggle quote (3 lines)
> (u-boot-am335x-evm): New variable.
> (u-boot-am335x-boneblack): Deprecate variable.

The am335x-boneblack configuration was dropped from upstream.

The am335x-evm image is considerably larger than the am335x-boneblack
images, which leads to issues when installing at a device offset, as it
will overwrite the first partition unless the first partition starts
significantly later than most tools (parted, cfdisk) default of sector
2048 (beagleboard.org images start the first partition at sector 8192).

The embedded-os-installation code should probably check to make sure
they aren't trampling the first partition if installing to the raw
device offset.

Alternately, it's possible to copy the u-boot.img onto the first FAT
partition of the microSD/eMMC, which will be loaded instead of the
offset. But that takes some rethinking of how to install the bootloader
(which would be good to not diverge from upstream for other platforms,
such as u-boot-novena).

I've unsuccessfully tried to make a minimal variant of the am335x-evm
that only supports the beaglebone black, by removing the other device
trees, which made it considerably smaller, but not small enough.
Disabling NAND and related features might still be possible, but I
haven't managed to get a configuration that compiles.

So there's no clear upgrade path for existing beaglebone black installs.

The upside to all this is that am335x-evm supports multiple boards!

In light of all that, I'm not sure what a proper way forward is...


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXK5smwAKCRDcUY/If5cW
qiFQAQDpyMrHLl6e/211Ko4EqJISj1E/WfaZOxyXwUwGY3n45wD/cjm1tJZCL47E
15wleRc6dUQRqDbXpEz7N5sLgvr6yQo=
=jMib
-----END PGP SIGNATURE-----

Danny Milosavljevic wrote 6 years ago
Re: [bug#35217] gnu: u-boot: Update to 2019.04.
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 35217@debbugs.gnu.org)
20190415230214.31877ad1@scratchpost.org
Hi Vagrant,

On Wed, 10 Apr 2019 15:22:18 -0700
Vagrant Cascadian <vagrant@debian.org> wrote:

Toggle quote (18 lines)
> > On 2019-04-10, Vagrant Cascadian wrote:
> > * gnu/packages/bootloaders (u-boot): Update to 2019.04.
> ...
> > (u-boot-am335x-evm): New variable.
> > (u-boot-am335x-boneblack): Deprecate variable.
>
> The am335x-boneblack configuration was dropped from upstream.
>
> The am335x-evm image is considerably larger than the am335x-boneblack
> images, which leads to issues when installing at a device offset, as it
> will overwrite the first partition unless the first partition starts
> significantly later than most tools (parted, cfdisk) default of sector
> 2048 (beagleboard.org images start the first partition at sector 8192).
>
> The embedded-os-installation code should probably check to make sure
> they aren't trampling the first partition if installing to the raw
> device offset.

That would make the parted bindings a hard dependency, probably even
build-side. But I think that would still be better than the alternative:
destroying user filesystems.

Toggle quote (6 lines)
> Alternately, it's possible to copy the u-boot.img onto the first FAT
> partition of the microSD/eMMC, which will be loaded instead of the
> offset. But that takes some rethinking of how to install the bootloader
> (which would be good to not diverge from upstream for other platforms,
> such as u-boot-novena).

Yeah, I think sooner or later it's going to come to this. Might as well
bite the bullet now.

Toggle quote (2 lines)
> In light of all that, I'm not sure what a proper way forward is...

Yeah, sounds like a bad situation with no nice solution that allows
updating of existing installations. In that case, keeping existing
installations on the old version would be preferrable to breaking
them.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAly08VYACgkQ5xo1VCww
uqWS6Af9GwqyupWEmemtQkHnlNwAcFPktXjrC0qUltDn8w5EJ0v+F8b2wBC7zJ7r
V4On0loBt2UHjOAOdqQQbfLQTQYhP6Ld8hPOVFxh9rOhFdsCU8Y5N54PLVMyW58d
x/2DOgqU44DQizsz3fHu8yNK1jFnzhgfN3sBBWxuweumyAIO+Yw/JOXNYEKFMTCP
3e/OZ07Sk3iSOmWXo7BIcOwccYaO0b1tY7r2NzLrB83Meiu4/ReY0ZHKx2wkwRUH
6Jfy3YVtTR9xBJ4JRh4yZl5HDE1WAqMCYmvPXYRHk5lwTqvZKwdugb+tCA+KzWum
KTtow5jPfnrhur5Msp1jmyoR+2zDqQ==
=56sX
-----END PGP SIGNATURE-----


Vagrant Cascadian wrote 6 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 35217@debbugs.gnu.org)
87lg0a1rr2.fsf@ponder
On 2019-04-15, Danny Milosavljevic wrote:
Toggle quote (25 lines)
> On Wed, 10 Apr 2019 15:22:18 -0700
> Vagrant Cascadian <vagrant@debian.org> wrote:
>
>> > On 2019-04-10, Vagrant Cascadian wrote:
>> > * gnu/packages/bootloaders (u-boot): Update to 2019.04.
>> ...
>> > (u-boot-am335x-evm): New variable.
>> > (u-boot-am335x-boneblack): Deprecate variable.
>>
>> The am335x-boneblack configuration was dropped from upstream.
>>
>> The am335x-evm image is considerably larger than the am335x-boneblack
>> images, which leads to issues when installing at a device offset, as it
>> will overwrite the first partition unless the first partition starts
>> significantly later than most tools (parted, cfdisk) default of sector
>> 2048 (beagleboard.org images start the first partition at sector 8192).
>>
>> The embedded-os-installation code should probably check to make sure
>> they aren't trampling the first partition if installing to the raw
>> device offset.
>
> That would make the parted bindings a hard dependency, probably even
> build-side. But I think that would still be better than the alternative:
> destroying user filesystems.

Could do some math; e.g. the offset is 768, first sector is 2048. So if
2048-768-(size-of-in-sectors u-boot.img) >> 0, it should be ok. Better
checking that done currently, at least.

But more sophisticated, of course, would be checking the actual layout
of the partition table... some targets (pine64+/pinebook) have offsets
that conflict with GPT partition tables, for example.


Toggle quote (9 lines)
>> Alternately, it's possible to copy the u-boot.img onto the first FAT
>> partition of the microSD/eMMC, which will be loaded instead of the
>> offset. But that takes some rethinking of how to install the bootloader
>> (which would be good to not diverge from upstream for other platforms,
>> such as u-boot-novena).
>
> Yeah, I think sooner or later it's going to come to this. Might as well
> bite the bullet now.

Hmmm...


Toggle quote (7 lines)
>> In light of all that, I'm not sure what a proper way forward is...
>
> Yeah, sounds like a bad situation with no nice solution that allows
> updating of existing installations. In that case, keeping existing
> installations on the old version would be preferrable to breaking
> them.

Short of that, here's an updated u-boot 2019.04 patch that:

- Generates a u-boot-am335x-boneblack package with a slightly modified
am335x_evm configuration removing extra device-trees; that *should* be
small enough to fit with the common partition tables (but so far
untested). It theoretically has about 80k of wiggle-room for
u-boot.img to grow before it becomes a problem again.

- Better commented patch fixing mkimage to pass test-imagetools test
suite. Patch was accepted in at least one of the maintainer trees
upstream.

live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXLVeQgAKCRDcUY/If5cW
qj3/AP4ue2S14GY3dVIFulUDKSdd8yrBsfoWCZm9tMIh8qhf9QEAiMw9vd675vwx
6Lem2pyA2udTL7/mDKsnDSmfPcOpywE=
=i3IU
-----END PGP SIGNATURE-----

Danny Milosavljevic wrote 6 years ago
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 35217-done@debbugs.gnu.org)
20190429123531.38fbc9d9@scratchpost.org
Thanks! Pushed to guix master as commit 6b99afeef89233b71d113a63cf04a6b4b49a4679.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzG03MACgkQ5xo1VCww
uqU0AAf8C82ek5nfxDjvg7ybV0McZkP6O2VcF11jYrzBMg3Ki86TxLMNitk+gzvE
ZDv+Ain46KB3NkNh7j16n1Cx/e7sMxOgxTVd2bPbLK4voRc8Y7+zI3Lfgth/afKb
eP3Zoe6Iqbi+32tEBLauP1qC+UHkmfKxCKqtzfu8krvIyI9XZjJpDSF67TfXyxYF
sQ3xNv5NnlbY0yTpB8TLrGnD30V/gqlx68zhjmSSvYImMpnBnt89x1fHbpjL7F1K
faFAo2OF9dtVT7guGqPk5EzGGbbV1+f0Pdau19yIsU+PnXP62do2f+cZD7acUoXs
rj4XNQ0lhI580ZUsYnSd3YFeMwsbHQ==
=h7Zw
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 35217@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 35217
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help