From f0efaa2d0c8bf7ba7c7cf8e1bbb26aa4d2f43f11 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 8 Jan 2025 23:31:43 -0500 Subject: [PATCH] pmos/u-boot-remarkable-zero-gravitas: port to pmos --- pmos/u-boot-remarkable-zero-gravitas/APKBUILD | 35 +++++ ...egment-has-dynamic-relocations-error.patch | 13 ++ .../uboot-config.patch | 0 .../uboot-enable-fastboot.patch | 31 +++++ user/u-boot-rm/APKBUILD | 125 ----------------- user/u-boot-rm/README.txt | 32 ----- user/u-boot-rm/fix-linking-with-ld.patch | 52 ------- user/u-boot-rm/rm1-ttygs0-serial.diff | 13 -- user/u-boot-rm/rm2-uboot-config-patch.diff | 75 ---------- user/u-boot-rm/update-u-boot | 129 ------------------ 10 files changed, 79 insertions(+), 426 deletions(-) create mode 100644 pmos/u-boot-remarkable-zero-gravitas/APKBUILD create mode 100644 pmos/u-boot-remarkable-zero-gravitas/gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch rename user/u-boot-rm/rm1-uboot-config-patch.diff => pmos/u-boot-remarkable-zero-gravitas/uboot-config.patch (100%) create mode 100644 pmos/u-boot-remarkable-zero-gravitas/uboot-enable-fastboot.patch delete mode 100644 user/u-boot-rm/APKBUILD delete mode 100644 user/u-boot-rm/README.txt delete mode 100644 user/u-boot-rm/fix-linking-with-ld.patch delete mode 100644 user/u-boot-rm/rm1-ttygs0-serial.diff delete mode 100644 user/u-boot-rm/rm2-uboot-config-patch.diff delete mode 100755 user/u-boot-rm/update-u-boot diff --git a/pmos/u-boot-remarkable-zero-gravitas/APKBUILD b/pmos/u-boot-remarkable-zero-gravitas/APKBUILD new file mode 100644 index 0000000..f842279 --- /dev/null +++ b/pmos/u-boot-remarkable-zero-gravitas/APKBUILD @@ -0,0 +1,35 @@ +# Maintainer: Antoine Martin (ayakael) +pkgname=u-boot-remarkable-zero-gravitas +pkgver=2020.09 +pkgrel=0 +pkgdesc="U-Boot for reMarkable zero-gravitas tablet" +_gittag=97b35fdddf0077abd2e0f0409b94ef20adbe8565 +url="https://github.com/reMarkable/uboot" +arch="armv7" +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" +options="!check" +makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev + py3-setuptools linux-headers u-boot-tools" +source=" + u-boot-remarkable-zero-gravitas-$_gittag.tar.gz::https://github.com/reMarkable/uboot/archive/$_gittag.tar.gz + gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch + uboot-config.patch + uboot-enable-fastboot.patch +" +builddir="$srcdir/uboot-$_gittag" + +build() { + make ARCH=arm zero-gravitas_config + make ARCH=arm CC="${CC:-gcc}" +} + +package() { + install -Dm755 "$builddir"/u-boot.imx "$pkgdir"/usr/share/u-boot/remarkable-zero-gravitas/u-boot.imx +} +sha512sums=" +7cc8d513cac1d63ee5119529caa056164ee3bc3633da5d880fbfb344b770c7c53c41475d42dd129b505390dcd5449e14524afc06f7cdba9354af7e70a7035ef9 u-boot-remarkable-zero-gravitas-97b35fdddf0077abd2e0f0409b94ef20adbe8565.tar.gz +b894955579d5a163dc33d689feed7bd6e6d8fcf76952fbf50051debe1f39c60cfde774827e6bb888ecec8f1d22c2ec3d487ee17bae695f63a2357b14e7adf33b gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch +673cb917cc565ae245d4a7d659227bc240473112bc9c73ae184a64ce74be7994273d6dc4db17194d348941f83a42b3b67d3140f6f23c37c13d6dc93f7d76cc39 uboot-config.patch +26f477cf4b945eb9acbdf541602148a1f279c8b30555ceac40aa82fcff9731e3d8791924b092ac6feedffb92b83101a2071ce499830226d3410e97e58b228071 uboot-enable-fastboot.patch +" diff --git a/pmos/u-boot-remarkable-zero-gravitas/gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch b/pmos/u-boot-remarkable-zero-gravitas/gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch new file mode 100644 index 0000000..4edeffc --- /dev/null +++ b/pmos/u-boot-remarkable-zero-gravitas/gcc-12-u-boot-2020-fix-read-only-segment-has-dynamic-relocations-error.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.orig b/Makefile +index a4c2adce3..f8ff517a3 100644 +--- a/Makefile.orig ++++ b/Makefile +@@ -771,6 +771,8 @@ ifneq ($(CONFIG_BUILD_TARGET),) + ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) + endif + ++LDFLAGS_u-boot += -z notext $(call ld-option, --apply-dynamic-relocs) ++ + LDFLAGS_u-boot += $(LDFLAGS_FINAL) + ifneq ($(CONFIG_SYS_TEXT_BASE),) + LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) diff --git a/user/u-boot-rm/rm1-uboot-config-patch.diff b/pmos/u-boot-remarkable-zero-gravitas/uboot-config.patch similarity index 100% rename from user/u-boot-rm/rm1-uboot-config-patch.diff rename to pmos/u-boot-remarkable-zero-gravitas/uboot-config.patch diff --git a/pmos/u-boot-remarkable-zero-gravitas/uboot-enable-fastboot.patch b/pmos/u-boot-remarkable-zero-gravitas/uboot-enable-fastboot.patch new file mode 100644 index 0000000..d0e9052 --- /dev/null +++ b/pmos/u-boot-remarkable-zero-gravitas/uboot-enable-fastboot.patch @@ -0,0 +1,31 @@ +diff --git a/include/configs/zero-gravitas.h.orig b/include/configs/zero-gravitas.h +index 818ed5689..312b10c90 100644 +--- a/include/configs/zero-gravitas.h.orig ++++ b/include/configs/zero-gravitas.h +@@ -156,6 +156,26 @@ + #define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC2*/ + #endif + ++/*Fastboot configs*/ ++#define CONFIG_CMD_FASTBOOT ++#define CONFIG_USB_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR ++#define CONFIG_USB_FASTBOOT_BUF_SIZE 0x10000000 ++#define CONFIG_FASTBOOT_FLASH ++#define CONFIG_FASTBOOT_FLASH_MMC_DEV 0 ++ ++#define CONFIG_USB_GADGET ++#define CONFIG_USB_GADGET_VBUS_DRAW 2 ++#define CONFIG_USB_GADGET_DUALSPEED ++#define CONFIG_G_DNL_MANUFACTURER "Freescale" ++#define CONFIG_G_DNL_VENDOR_NUM 0x18d1 ++#define CONFIG_G_DNL_PRODUCT_NUM 0x0d02 ++#define CONFIG_CI_UDC ++#define CONFIG_USBDOWNLOAD_GADGET ++ ++#define CONFIG_EFI_PARTITION ++#define CONFIG_PARTITION_UUIDS ++#define CONFIG_CMD_GPT ++ + #define CONFIG_IMX_THERMAL + + #endif /* __ZERO_GRAVITAS_H */ diff --git a/user/u-boot-rm/APKBUILD b/user/u-boot-rm/APKBUILD deleted file mode 100644 index da2e135..0000000 --- a/user/u-boot-rm/APKBUILD +++ /dev/null @@ -1,125 +0,0 @@ -# Maintainer: Antoine Martin (ayakael) -# Contributor: Antoine Martin (ayakael) - -pkgname=u-boot-rm -pkgver=2020.09 -_rm1tag=97b35fdddf0077abd2e0f0409b94ef20adbe8565 -_rm2tag=47c91918aa7724c16b6eaf87cf5dfbf4548eafc1 -pkgrel=9 -pkgdesc="u-boot bootloader common files" -url="https://www.denx.de/wiki/U-Boot/" -arch="armv7" -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" -options="!check" # no tests -makedepends=" - bc - bison - dtc - flex - gnutls-dev - linux-headers - openssl-dev>3 - py3-elftools - py3-setuptools - python3-dev - swig - util-linux-dev - " -source=" - u-boot-rm1-$_rm1tag.tar.gz::https://github.com/reMarkable/uboot/archive/$_rm1tag.tar.gz - u-boot-rm2-$_rm2tag.tar.gz::https://github.com/reMarkable/uboot/archive/$_rm2tag.tar.gz - update-u-boot - README.txt - rm1-uboot-config-patch.diff - rm2-uboot-config-patch.diff - " -builddir="$srcdir" - -#rm2:zero-sugar broken -case "$CARCH" in -arm*) board_configs=" - zerogravitas:zero-gravitas - ";; -esac - -for board_config in $board_configs; do - _allboards="$_allboards $pkgname-${board_config%%:*}" -done - -subpackages="$pkgname-all:_all $_allboards" -prepare() { - default_prepare - - cd "$builddir"/uboot-$_rm1tag - patch -p1 -i "$srcdir"/rm1-uboot-config-patch.diff - # patch -p1 -i "$srcdir"/rm1-ttygs0-serial.diff - cd "$builddir"/uboot-$_rm2tag - patch -p1 -i "$srcdir"/rm2-uboot-config-patch.diff -} - -build() { - local board_config board - for board_config in $board_configs; do - local configs="${board_config#*:}" - for board in ${configs//,/ }; do - msg "Building u-boot for $board" - case $board in - zero-gravitas) cd "$builddir"/uboot-$_rm1tag;; - zero-sugar) cd "$builddir"/uboot-$_rm2tag;; - esac - - touch include/config.h - LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h - LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h - - export BUILD_DIR="$builddir"/build/$board - mkdir -p "$BUILD_DIR" - make O="$BUILD_DIR" ${board}_config - make O="$BUILD_DIR" all - done - done -} - -package() { - mkdir -p "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/sbin - install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt - install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin -} - -_all() { - pkgdesc="u-boot for all boards (meta package)" - depends="$_allboards" - - mkdir -p "$subpkgdir"/ -} - -_split_boards() { - cd "$builddir"/build - pkgdesc="u-boot for $1" - depends="u-boot-rm" - shift - local board - for board; do - msg "Including board $board" - mkdir -p "$subpkgdir"/usr/share/$pkgname/$board - export BUILD_DIR="$builddir"/build/$board - - cp "$BUILD_DIR"/u-boot.imx "$subpkgdir"/usr/share/$pkgname/$board/u-boot.bin - done -} - -for board_config in $board_configs; do - _board="${board_config%%:*}" - _configs="${board_config#*:}" - eval "$_board() { _split_boards $_board ${_configs//,/ }; }" -done - -sha512sums=" -7cc8d513cac1d63ee5119529caa056164ee3bc3633da5d880fbfb344b770c7c53c41475d42dd129b505390dcd5449e14524afc06f7cdba9354af7e70a7035ef9 u-boot-rm1-97b35fdddf0077abd2e0f0409b94ef20adbe8565.tar.gz -d0d18b123c4281285a8b3c1afd9ef623b48a33506399c8e0dbc393f22d967ee3e5df7030aab26c4fe8cad614f3f22f1ea5d6b5bb4ef5cc46fffe56b7ac7c3c28 u-boot-rm2-47c91918aa7724c16b6eaf87cf5dfbf4548eafc1.tar.gz -a905e4dcdb2704e0b1d4f0ab4a6333d3f1ffcec5c3a8359f5789800eb2114dad673cf0b5f24cae3a590f27333dff2e96b6f1efae5a466f9281a3d65efe403a1e update-u-boot -f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt -673cb917cc565ae245d4a7d659227bc240473112bc9c73ae184a64ce74be7994273d6dc4db17194d348941f83a42b3b67d3140f6f23c37c13d6dc93f7d76cc39 rm1-uboot-config-patch.diff -0e98404ca6d20eb01bd9c129b05e2eb10c60a692a56adc221ea283b4bfe7b0bcc2851121d4c3fe51e07a9784c339f7ccb221e0cc3f3603144fec46be66d0cbcc rm2-uboot-config-patch.diff -" diff --git a/user/u-boot-rm/README.txt b/user/u-boot-rm/README.txt deleted file mode 100644 index c342913..0000000 --- a/user/u-boot-rm/README.txt +++ /dev/null @@ -1,32 +0,0 @@ -WandBoard ---------- - -- ROM loads boot loader from raw MMC sectors at fixed address -- NOTE: 1st partition needs to start after boot loader - -- Install u-boot with: - dd if=wandboard/SPL of=/dev/mmcblk0 bs=1k seek=1 - dd if=wandboard/u-boot.img of=/dev/mmcblk0 bs=1k seek=69 - sync - - (Note - the SD card node may vary, so adjust this as needed). - -- Insert the SD card into the slot located in the bottom of the board - (same side as the mx6 processor) - -BeagleBoard ------------ - -- ROM looks for 1st partition with FAT, and loads MLO from it -- NOTE: MLO needs to be the first file created on this partition - -- Install u-boot with: - cp am335x_boneblack/{MLO,u-boot.img} /media/mmcblk0p1/ - -Sunxi (Cubie* etc) ------------------- - -- ROM loads boot loader from SD-CARD sectors at fixed address -- Install u-boot with: - sudo dd if=/u-boot-sunxi-with-spl.bin of=/dev/sda bs=1024 seek=8 - diff --git a/user/u-boot-rm/fix-linking-with-ld.patch b/user/u-boot-rm/fix-linking-with-ld.patch deleted file mode 100644 index 827c566..0000000 --- a/user/u-boot-rm/fix-linking-with-ld.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 58772283210e15f8d803db4aa67c877d668db867 Mon Sep 17 00:00:00 2001 -Patch-Source: https://github.com/u-boot/u-boot/commit/58772283210e15f8d803db4aa67c877d668db867 -From: Alistair Delva -Date: Wed, 20 Oct 2021 21:31:33 +0000 -Subject: [PATCH] x86: Fix linking u-boot with ld.lld - -When linking the final u-boot binary with LLD, the following link errors -are seen: - -ld.lld: error: can't create dynamic relocation R_386_32 against local - symbol in readonly segment; recompile object files with - -fPIC or pass '-Wl,-z,notext' to allow text relocations - in the output ->>> defined in arch/x86/cpu/start.o ->>> referenced by arch/x86/cpu/start.o:(.text.start+0x32) -[...] ->>> defined in arch/x86/cpu/start16.o ->>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C) - -According to Nick Desaulniers: - -"This is a known difference between GNU and LLVM linkers; the GNU - linkers permit relocations in readonly segments (making them not read - only), LLVM does not (by default)." - -Since U-Boot apparently seems to use relocations in readonly segments, -change the global linker flags to permit them when linking with LLD by -specifying '-z notext'. - -Signed-off-by: Alistair Delva -Cc: Nick Desaulniers -Cc: Simon Glass -Cc: Bin Meng -Reviewed-by: Simon Glass ---- - Makefile | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Makefile b/Makefile -index c0ea933cb636..286757986c02 100644 ---- a/Makefile -+++ b/Makefile -@@ -776,6 +776,9 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) - LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) - endif - -+# ld.lld support -+LDFLAGS_u-boot += -z notext -+ - # Normally we fill empty space with 0xff - quiet_cmd_objcopy = OBJCOPY $@ - cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \ diff --git a/user/u-boot-rm/rm1-ttygs0-serial.diff b/user/u-boot-rm/rm1-ttygs0-serial.diff deleted file mode 100644 index 9596fc4..0000000 --- a/user/u-boot-rm/rm1-ttygs0-serial.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/configs/zero-gravitas.h.orig b/include/configs/zero-gravitas.h -index 818ed56..6eb7447 100644 ---- a/include/configs/zero-gravitas.h.orig -+++ b/include/configs/zero-gravitas.h -@@ -73,7 +73,7 @@ - "active_partition=2\0" \ - "bootlimit=1\0" \ - "por=undefined\0" \ -- "mmcargs=setenv bootargs console=${console},${baudrate} " \ -+ "mmcargs=setenv bootargs console=${console},${baudrate} console=ttyGS0,115200 " \ - "root=/dev/mmcblk1p2 rootwait rootfstype=ext4 rw por=${por};\0" \ - "loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ diff --git a/user/u-boot-rm/rm2-uboot-config-patch.diff b/user/u-boot-rm/rm2-uboot-config-patch.diff deleted file mode 100644 index 4aa04bc..0000000 --- a/user/u-boot-rm/rm2-uboot-config-patch.diff +++ /dev/null @@ -1,75 +0,0 @@ -diff --git a/include/configs/zero-sugar.h.orig b/include/configs/zero-sugar.h -index 6b5450a..dd6da5c 100644 ---- a/include/configs/zero-sugar.h.orig -+++ b/include/configs/zero-sugar.h -@@ -122,12 +122,10 @@ - "panel=EPD\0" \ - "mmcdev=0\0" \ - "active_partition=2\0" \ -- "fallback_partition=3\0 " \ - "bootlimit=1\0 " \ - "mmcautodetect=yes\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ -- "root=/dev/mmcblk2p${active_partition} rootwait rootfstype=ext4 rw " \ -- "quiet panic=20 systemd.crash_reboot\0" \ -+ "root=/dev/mmcblk2p2 rootwait rootfstype=ext4 rw " \ - "loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ -@@ -140,41 +138,13 @@ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ -- "fi;\0" \ -- "memboot=echo Booting from memory...; " \ -- "setenv bootargs console=${console},${baudrate} " \ -- "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ -- "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ -- "g_mass_storage.iSerialNumber=\"\" rdinit=/linuxrc; "\ -- "bootz ${loadaddr} ${initrd} ${fdt_addr};\0" \ -- "altbootcmd=echo Running from fallback root...; " \ -- "run memboot; " \ -- "if test ${bootcount} -gt 10; then " \ -- "echo WARN: Failed too much, resetting bootcount and turning off; " \ -- "setenv bootcount 0; " \ -- "saveenv; " \ -- "poweroff; " \ -- "fi; " \ -- "setenv mmcpart ${fallback_partition}; " \ -- "setenv bootargs console=${console},${baudrate} " \ -- "root=/dev/mmcblk2p${fallback_partition} rootwait rootfstype=ext4 quiet rw " \ -- "systemd.log_level=debug systemd.log_target=kmsg memtest " \ -- "log_buf_len=1M printk.devkmsg systemd.journald.forward_to_console=1; " \ -- "run mmcboot;\0" \ -+ "fi;\0" - - /* Always try to boot from memory first, in case of USB download mode */ - #define CONFIG_BOOTCOMMAND \ -- "if test ! -e mmc 0:1 uboot.env; then " \ -- "saveenv; " \ -- "fi; " \ -- "run memboot; " \ - "run mmcargs; " \ - "setenv mmcpart ${active_partition}; " \ -- "run mmcboot; " \ -- "echo WARN: unable to boot from either RAM or eMMC; " \ -- "setenv upgrade_available 1; " \ -- "saveenv; " \ -- "reset; " -+ "run mmcboot; " - - #define CONFIG_SYS_MEMTEST_START 0x80000000 - #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x20000000) -@@ -198,10 +168,8 @@ - /* Environment organization */ - #define CONFIG_ENV_SIZE SZ_8K - --#ifdef CONFIG_ENV_IS_IN_FAT --#define CONFIG_BOOTCOUNT_LIMIT --#define CONFIG_BOOTCOUNT_ENV --#endif -+/*#define CONFIG_ENV_IS_IN_FAT*/ -+#define CONFIG_ENV_IS_NOWHERE - - #define CONFIG_SYS_FSL_USDHC_NUM 2 - diff --git a/user/u-boot-rm/update-u-boot b/user/u-boot-rm/update-u-boot deleted file mode 100755 index e90bcbd..0000000 --- a/user/u-boot-rm/update-u-boot +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/sh - -verbose= -board= -device= -dryrun= -imagedir= - -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 ;; - esac - fi - - if [ -z "$device" ]; then - case "$board" in - wand|cubie|cubie2) device=/dev/mmcblk0p0 ;; - zero-gravitas) device=/dev/mmcblk1 ;; - esac - fi - - if [ -z "$imagedir" ]; then - imagedir="$(realpath $(dirname $0))" - [ -f "$imagedir/README.txt" ] || imagedir="/usr/share/u-boot-rm" - fi -} - -die() { - echo "ERROR: $@" - exit 1 -} - -usage() { - get_defaults - - cat <] [-d|--device ] - -options: - - -b,--board Specify the board type: wand, cubie, cubie2 - (current default: ${board:-none}) - - -d,--device Specify the device where to install u-boot - (current default: ${device:-none}) - - -i,--imagedir Specify u-boot image directory - (current default: ${imagedir:-none}) - - -n,--dry-run Print commands but don't execute them - -EOF -} - -while [ $# -gt 0 ]; do - opt="$1" - shift - case "$opt" in - -b|--board) - case "$1" in - wand|wandboard) board="wand" ;; - cubie|cubieboard) board="cubie" ;; - zerogravitas) board="zero-gravitas" ;; - zerosugar) board="zero-sugar" ;; - *) usage; exit 1;; - esac - shift - ;; - -d|--device) - device="$1" - shift - ;; - -i|--imagedir) - imagedir="$1" - shift - ;; - -n|--dry-run) - dryrun="echo" - ;; - --) - break - ;; - -*) - usage - exit 1 - ;; - esac -done - -get_defaults -if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then - usage - exit 1 -fi - -if [ -z "$dryrun" ]; then - echo "Updating $board u-boot in $device in 3 seconds..." - sleep 3 -fi - -( -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 - ;; -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=/dev/sda bs=1024 seek=8 status=none - ;; -zero-gravitas) - [ -e "$imagedir/zero-gravitas" ] || die "rM1 images not installed, apk add u-boot-rm1" - $dryrun dd if=/dev/zero of=$device bs=512 seek=1536 count=16 - [ -z "$dryrun" ] && echo 0 > /sys/block/${device/\/dev\/}boot0/force_ro - $dryrun dd if=/dev/zero of=${device}boot0 bs=512 count=2 - $dryrun dd if=$imagedir/zero-gravitas/u-boot.bin of=${device}boot0 bs=512 seek=2 - [ -z "$dryrun" ] && echo 1 > /sys/block/${device/\/dev\/}boot0/force_ro - ;; -zero-sugar) - die "rM2 not yet tested" - ;; -esac -$dryrun sync -) || die "U-Boot installation in $device failed" - -[ -z "$dryrun" ] && echo "Completed successfully."