From patchwork Tue Apr 16 04:46:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vagrant Cascadian X-Patchwork-Id: 3299 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AD0E216E87; Tue, 16 Apr 2019 05:48:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 122DF16E7E for ; Tue, 16 Apr 2019 05:48:12 +0100 (BST) Received: from localhost ([127.0.0.1]:59276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGG0x-0002Jn-Dp for patchwork@mira.cbaines.net; Tue, 16 Apr 2019 00:48:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGG0t-0002JX-Bq for guix-patches@gnu.org; Tue, 16 Apr 2019 00:48:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGG0r-0002jX-Ge for guix-patches@gnu.org; Tue, 16 Apr 2019 00:48:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50839) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hGG0o-0002ik-MR for guix-patches@gnu.org; Tue, 16 Apr 2019 00:48:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hGG0o-0007Rt-E4 for guix-patches@gnu.org; Tue, 16 Apr 2019 00:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35217] gnu: u-boot: Update to 2019.04. Resent-From: Vagrant Cascadian Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 16 Apr 2019 04:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35217 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Danny Milosavljevic Received: via spool by 35217-submit@debbugs.gnu.org id=B35217.155539005428600 (code B ref 35217); Tue, 16 Apr 2019 04:48:02 +0000 Received: (at 35217) by debbugs.gnu.org; 16 Apr 2019 04:47:34 +0000 Received: from localhost ([127.0.0.1]:36150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hGG0L-0007RD-SL for submit@debbugs.gnu.org; Tue, 16 Apr 2019 00:47:34 -0400 Received: from cascadia.aikidev.net ([173.255.214.101]:39568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hGG0J-0007Qw-GO for 35217@debbugs.gnu.org; Tue, 16 Apr 2019 00:47:32 -0400 Received: from localhost (unknown [IPv6:2600:3c01:e000:21:21:21:0:100e]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id 8BF321AA27; Mon, 15 Apr 2019 21:47:24 -0700 (PDT) From: Vagrant Cascadian In-Reply-To: <20190415230214.31877ad1@scratchpost.org> References: <87h8b6ia13.fsf@ponder> <87zhox33vu.fsf@ponder> <87v9zl33hh.fsf@ponder> <20190415230214.31877ad1@scratchpost.org> Date: Mon, 15 Apr 2019 21:46:57 -0700 Message-ID: <87lg0a1rr2.fsf@ponder> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 35217@debbugs.gnu.org Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches On 2019-04-15, Danny Milosavljevic wrote: > On Wed, 10 Apr 2019 15:22:18 -0700 > Vagrant Cascadian 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. >> 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... >> 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 From 2d9f80129801475002f6368074356a5eff9f24b4 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Mon, 18 Feb 2019 04:01:23 +0000 Subject: [PATCH] gnu: u-boot: Update to 2019.04. * 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): Build with modified am335x-evm config. (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 | 39 +++++++++++-- ...boot-fix-mkimage-header-verification.patch | 57 +++++++++++++++++++ 3 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch diff --git a/gnu/local.mk b/gnu/local.mk index df96b98f07..660e96c856 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1308,6 +1308,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..a2ac151978 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,32 @@ 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-boneblack + (let ((base (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))) + (package + (inherit base) + (name "u-boot-am335x-boneblack") + (description "U-Boot is a bootloader used mostly for ARM boards. It +also initializes the boards (RAM etc). + +This U-Boot is built for the BeagleBone Black, which was removed upstream, +adjusted from the am335x_evm build with several device trees removed so that +it fits within common partitioning schemes.") + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'patch-defconfig + ;; Patch out other devicetrees to build image small enough to + ;; fit within typical partitioning schemes where the first + ;; partition begins at sector 2048. + (lambda _ + (substitute* "configs/am335x_evm_defconfig" + (("CONFIG_OF_LIST=.*$") "CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"\n")) + #t))))))))) + +(define-public u-boot-am335x-evm + (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf")) (define-public (make-u-boot-sunxi64-package board triplet) (let ((base (make-u-boot-package board triplet))) @@ -637,7 +664,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 +674,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..063677db4a --- /dev/null +++ b/gnu/packages/patches/u-boot-fix-mkimage-header-verification.patch @@ -0,0 +1,57 @@ +From 48b52117235928cfd7ef1ec5c3f2cff5d7b03862 Mon Sep 17 00:00:00 2001 +From: Jordan Hand +Date: Wed, 10 Apr 2019 09:46:32 -0700 +Subject: [PATCH,v2] fdt: Fix mkimage list to try every header type +Origin: https://patchwork.ozlabs.org/patch/1083495/ + +Image type is not supplied to `mkimage -l`. For this reason, we cannot +use imagetool_verify_print_header_by_type. Instead, this patch uses +imagetool_verify_print_header to look through all header types to find +one where image validation succeeds. + +This patch fixes failures in test/image/test-imagetools.sh + +Signed-off-by: Jordan Hand +Tested-by: Alex Kiernan +Tested-by: Vagrant Cascadian +--- + tools/mkimage.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/tools/mkimage.c b/tools/mkimage.c +index 2899adff81..76c3406d37 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, ¶ms); ++ 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, ¶ms); ++ } 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, ¶ms); ++ } + + (void) munmap((void *)ptr, sbuf.st_size); + (void) close (ifd); +-- +2.20.1 + -- 2.20.1