Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id D36A47819A7 for <~alpine/aports@lists.alpinelinux.org>; Fri, 28 Feb 2020 19:39:20 +0000 (UTC) Received: by mail-qv1-f68.google.com with SMTP id dc14so1899229qvb.9 for <~alpine/aports@lists.alpinelinux.org>; Fri, 28 Feb 2020 11:39:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=santana-tech.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EJPa0pdsTjOqPSFVHBhLBQkaXo4/g4aRcX5fPLwprLQ=; b=aXEdMA/3gVslze+bWPACEza0OwfY/oq8phM1x1YIsiXxufUdhEqJwNOzVmlntlc7p/ hYtQ0Hw2i8If7Q3TPIgFz2+QZEoFxA3xxZT73vvTWu102i6RGgQG7g1JW0pzSc/+7rxg yWz5B812XGQx9WpRmKybc1xHOpgAw0QBUxt2ZR4qb12/BlmJV7gOSA/ZHoxp2ALe4Wkr FLbm/TZoE3W6YK+g4F7exhfxHDomQ3TF+Tzq93GtB/VWb9hcBGQoag8zlcpKE0wErKBX eYybRQmLZ6t/Oge2m0s69d2IxVbTFrun+QO00YJGAfiK9pXG8CeQpQUg45om9OsfXdZF JeMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EJPa0pdsTjOqPSFVHBhLBQkaXo4/g4aRcX5fPLwprLQ=; b=q5qJCCzjUA1OoeJiupwbQhCC+4O/EW3omI1sYIFqG3QlcMGqV27wYSU0RsRBCIs9or eRat0cesUwTI6TXnBAC6m9ojsDtAHrmxXGLuSKHxm/vlIlZuuXgwKzItEX7n7aQELM4e rOtIS6DlAUlZsadARY1Gm/3FQUXfkHkIHNV9SIHo8i9EW7DpwsYzPU1kxwsc5pKtmAvh AzKn9jOgLepBjDPPjKC0g5xpRl4t5naRyCq0rcp/1iBx5C64mUqnQfsX2XHg8s72xChw GzkITgrxVg43UZZcIbCe7wBBwEruBpn12XcgaZ29Ov8TvTjypEhdaPPS3dcUn3eFpvux aiZQ== X-Gm-Message-State: APjAAAXETVrw6/+ITCBYe46qMq4fZIQ2DXOLtciarAaduB0ShUhVFo4Y I0tfDW6QmSlHX4WXZ0BSfkgEt7fxXoo= X-Google-Smtp-Source: APXvYqxLx0UxynsTl/T32vPaIw/2liLk+cWhn3OZgiCfNLfVQMv9dUhrIs8oUJzot+uOn3qbs0q+2g== X-Received: by 2002:ad4:5009:: with SMTP id s9mr5203173qvo.30.1582918759054; Fri, 28 Feb 2020 11:39:19 -0800 (PST) Received: from localhost ([179.55.210.213]) by smtp.gmail.com with ESMTPSA id 64sm5662775qkd.78.2020.02.28.11.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 11:39:18 -0800 (PST) From: Daniel Santana To: ~alpine/aports@lists.alpinelinux.org Cc: Daniel Santana Subject: [PATCH] main/u-boot: add ODROID-C2 signed bootloader Date: Fri, 28 Feb 2020 16:39:14 -0300 Message-Id: <20200228193914.7256-1-daniel@santana.tech> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit --- main/u-boot/APKBUILD | 29 +++++++++++++++++++++++++---- main/u-boot/update-u-boot | 38 +++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/main/u-boot/APKBUILD b/main/u-boot/APKBUILD index 4aa36df3d1..0048c82168 100644 --- a/main/u-boot/APKBUILD +++ b/main/u-boot/APKBUILD @@ -3,17 +3,19 @@ # Maintainer: Leonardo Arena pkgname=u-boot pkgver=2020.01 -pkgrel=0 +pkgrel=1 pkgdesc="u-boot bootloader common files" url="http://www.denx.de/wiki/U-Boot/" arch="armhf armv7 aarch64" license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs ISC LGPL-2.0-only LGPL-2.1-only X11" -makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev" +makedepends="$depends_dev bc dtc python2-dev swig bison flex openssl-dev bsd-compat-headers meson-tools" if [ "$CARCH" = "aarch64" ]; then makedepends="$makedepends arm-trusted-firmware-sun50i" fi +_odroidc2_commit=205c7b3259559283161703a1a200b787c2c445a5 source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2 + u-boot-odroidc2.tar.gz::https://github.com/hardkernel/u-boot/archive/${_odroidc2_commit}.tar.gz README.txt update-u-boot " @@ -68,6 +70,23 @@ build() { mkdir -p "$BUILD_DIR" make O="$BUILD_DIR" ${board}_config || return 1 make O="$BUILD_DIR" all || return 1 + + if [ "$board" = "odroid-c2" ]; then + # ODROID-C2 requires a signed bootloader + local odroid_dir="$srcdir"/u-boot-$_odroidc2_commit + sed -i 's/-Werror//' "$odroid_dir"/tools/fip_create/Makefile + make -C "$odroid_dir"/tools/fip_create + "$odroid_dir"/tools/fip_create/fip_create \ + --bl30 "$odroid_dir"/fip/gxb/bl30.bin \ + --bl301 "$odroid_dir"/fip/gxb/bl301.bin \ + --bl31 "$odroid_dir"/fip/gxb/bl31.bin \ + --bl33 "$BUILD_DIR"/u-boot.bin \ + "$BUILD_DIR"/fip.bin + cat "$odroid_dir"/fip/gxb/bl2.package "$BUILD_DIR"/fip.bin > "$BUILD_DIR"/boot_new.bin + amlbootsig "$BUILD_DIR"/boot_new.bin "$BUILD_DIR"/u-boot.img + dd if="$BUILD_DIR"/u-boot.img of="$BUILD_DIR"/u-boot.gxbb bs=512 skip=96 + cp "$odroid_dir"/sd_fuse/bl1.bin.hardkernel "$BUILD_DIR" + fi done done } @@ -97,7 +116,8 @@ _split_boards() { mkdir -p "$subpkgdir"/usr/share/$pkgname/$board export BUILD_DIR="$builddir"/build/$board local ok=no - for image in u-boot-sunxi-with-spl.bin -- MLO SPL u-boot.img -- u-boot.bin; do + for image in u-boot-sunxi-with-spl.bin -- bl1.bin.hardkernel u-boot.gxbb -- \ + MLO SPL u-boot.img -- u-boot.bin; do if [ "$image" = "--" ]; then [ "$ok" = yes ] && break continue @@ -119,5 +139,6 @@ for board_config in $board_configs; do done sha512sums="073d4e0234095c1bda1ffa7a648972aa4530d106ee1a73035e0501b1aba2951653582c8b7bcf338d4e95012fa67e75f97b7e1fbac5cc764d609b671ef29617f7 u-boot-2020.01.tar.bz2 +7929bd3ae90dea5966678dc4673627b58c9d270ef898bb42e3ba80f8626d4a821c0093c9d71d8eca08451906c7cba1eb6951cd0ec3a88c056c74eb9e1b5af6c4 u-boot-odroidc2.tar.gz f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt -b3b4fb70c4eea2034bae45c513bca7b738be7507b46d3f2d62b31c794cd238d492acf960c95078cb1c945520debd5d2762103df7cef0fc36acfe9ff9a94549fc update-u-boot" +fe086b84d867bbdc78568559a3e822a22b348c81bed0326bdc94f15f6a633d40d5a5f0326139d1d39314dab7dccfe6434ceba06643e11edd914aa73b8c80cbfc update-u-boot" diff --git a/main/u-boot/update-u-boot b/main/u-boot/update-u-boot index b012b5fedf..f7ab8f9781 100755 --- a/main/u-boot/update-u-boot +++ b/main/u-boot/update-u-boot @@ -10,6 +10,7 @@ get_defaults() { if [ -z "$board" -a -e /sys/firmware/devicetree/base/compatible ]; then case "$(cat /sys/firmware/devicetree/base/compatible 2>/dev/null)" in wand,*) board=wand ;; + hardkernel,odroid-c2amlogic,*) board=odroid-c2 ;; esac fi @@ -17,6 +18,7 @@ get_defaults() { case "$board" in wand|cubie|cubie2) device=/dev/mmcblk0p0 ;; mx6cuboxi) device=/dev/mmcblk0 ;; + odroid-c2) device=/dev/mmcblk0 ;; esac fi @@ -39,7 +41,7 @@ usage: $0 [-b|--board ] [-d|--device ] options: - -b,--board Specify the board type: wand, cubie, cubie2, cuboxi + -b,--board Specify the board type: wand, cubie, cubie2, cuboxi, odroid-c2 (current default: ${board:-none}) -d,--device Specify the device where to install u-boot @@ -62,6 +64,7 @@ while [ $# -gt 0 ]; do wand|wandboard) board="wand" ;; cubie|cubieboard) board="cubie" ;; cuboxi|mx6cuboxi) board="mx6cuboxi" ;; + odroid-c2) board="odroid-c2" ;; *) usage; exit 1;; esac shift @@ -77,18 +80,18 @@ while [ $# -gt 0 ]; do -n|--dry-run) dryrun="echo" ;; - --) - break - ;; - -*) - usage - exit 1 - ;; - esac + --) + break + ;; + -*) + usage + exit 1 + ;; + esac done get_defaults -if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then +if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then usage exit 1 fi @@ -103,18 +106,23 @@ set -e case "$board" in wand) [ -e "$imagedir/wandboard" ] || die "wandboard images not installed, apk add u-boot-wandboard" - $dryrun dd if=$imagedir/wandboard/SPL of=$device bs=1k seek=1 status=none - $dryrun dd if=$imagedir/wandboard/u-boot.img of=$device bs=1k seek=69 status=none + $dryrun dd if="$imagedir"/wandboard/SPL of="$device" bs=1k seek=1 conv=notrunc status=none + $dryrun dd if="$imagedir"/wandboard/u-boot.img of="$device" bs=1k seek=69 conv=notrunc status=none ;; cubie|cubie2) [ -e "$imagedir/Cubieboard${board#cubie}" ] || die "Cubieboard images not installed, apk add u-boot-cubieboard" - $dryrun dd if=$imagedir/Cubieboard${board#cubie}/u-boot-sunxi-with-spl.bin of=$device bs=1024 seek=8 status=none + $dryrun dd if="$imagedir"/Cubieboard"${board#cubie}"/u-boot-sunxi-with-spl.bin of="$device" bs=1024 seek=8 conv=notrunc status=none ;; mx6cuboxi) [ -e "$imagedir/mx6cuboxi" ] || die "iMX6 Cubox-i images not installed, apk add u-boot-cuboxi" - $dryrun dd if=$imagedir/mx6cuboxi/SPL of=$device bs=1k seek=1 status=none - $dryrun dd if=$imagedir/mx6cuboxi/u-boot.img of=$device bs=1k seek=69 status=none + $dryrun dd if="$imagedir"/mx6cuboxi/SPL of="$device" bs=1k seek=1 conv=notrunc status=none + $dryrun dd if="$imagedir"/mx6cuboxi/u-boot.img of="$device" bs=1k seek=69 conv=notrunc status=none ;; +odroid-c2) + [ -e "$imagedir/odroid-c2" ] || die "ODROID-C2 images not installed, apk add u-boot-odroid" + $dryrun dd if="$imagedir"/odroid-c2/bl1.bin.hardkernel of="$device" bs=1 count=442 conv=notrunc status=none + $dryrun dd if="$imagedir"/odroid-c2/bl1.bin.hardkernel of="$device" bs=512 skip=1 seek=1 conv=notrunc status=none + $dryrun dd if="$imagedir"/odroid-c2/u-boot.gxbb of="$device" bs=512 seek=97 conv=notrunc status=none esac $dryrun sync ) || die "U-Boot installation in $device failed" -- 2.25.1