From a09154bb7b2399d94e95738604ce81301273fb1b Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Fri, 29 Aug 2014 21:54:53 +0000 Subject: [PATCH] alarm/uboot-odroid-xu3 to 2012.07-3 --- alarm/uboot-odroid-xu3/PKGBUILD | 8 +- alarm/uboot-odroid-xu3/sd_fusing.sh | 75 +++++++++++++++++++ .../uboot-odroid-xu3/uboot-odroid-xu3.install | 54 +++++++++++++ 3 files changed, 134 insertions(+), 3 deletions(-) create mode 100755 alarm/uboot-odroid-xu3/sd_fusing.sh create mode 100644 alarm/uboot-odroid-xu3/uboot-odroid-xu3.install diff --git a/alarm/uboot-odroid-xu3/PKGBUILD b/alarm/uboot-odroid-xu3/PKGBUILD index 028ee3a5c..690524913 100644 --- a/alarm/uboot-odroid-xu3/PKGBUILD +++ b/alarm/uboot-odroid-xu3/PKGBUILD @@ -5,27 +5,29 @@ buildarch=4 pkgname=uboot-odroid-xu3 pkgver=2012.07 -pkgrel=2 +pkgrel=3 pkgdesc="U-Boot for ODROID-XU3" arch=('armv7h') url="https://github.com/hardkernel/linux/tree/odroidxu3-3.10.y" license=('GPL') +install=$pkgname.install backup=('boot/boot.ini') _commit=814386d3e43b8ab8d81f04aa7fe402952503d8fe source=("https://github.com/hardkernel/linux/raw/${_commit}/tools/hardkernel/prebuilt_uboot/bl1.bin" "https://github.com/hardkernel/linux/raw/${_commit}/tools/hardkernel/prebuilt_uboot/bl2.bin" "https://github.com/hardkernel/linux/raw/${_commit}/tools/hardkernel/prebuilt_uboot/tzsw.bin" "https://github.com/hardkernel/linux/raw/${_commit}/tools/hardkernel/prebuilt_uboot/u-boot.bin" - "https://github.com/hardkernel/linux/raw/${_commit}/tools/hardkernel/prebuilt_uboot/sd_fusing.sh" + 'sd_fusing.sh' 'boot.ini') md5sums=('3908379f82f972ece88ca1b5a280b5fd' '8580c2b2701bf5936f42104b3cc5d725' 'fd01dda20b999e0b731c7063431a42b3' '85ff8b8e20fe4c7639ed87781f473512' - '916a38e34d6f678083902f1a601467f0' + 'b5616d1971ac48e93e2f92f8cd8eeba8' '9e3083f40a05692c41f92f0439be0243') package() { mkdir -p "${pkgdir}"/boot cp {bl{1,2},tzsw,u-boot}.bin sd_fusing.sh boot.ini "${pkgdir}"/boot + chmod +x "${pkgdir}"/boot/sd_fusing.sh } diff --git a/alarm/uboot-odroid-xu3/sd_fusing.sh b/alarm/uboot-odroid-xu3/sd_fusing.sh new file mode 100755 index 000000000..7ab7c394a --- /dev/null +++ b/alarm/uboot-odroid-xu3/sd_fusing.sh @@ -0,0 +1,75 @@ +#!/usr/bin/bash +#################################### +# +# Copyright (C) 2011 Samsung Electronics Co., Ltd. +# http://www.samsung.com/ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +#################################### +# +# Modified for Arch Linux ARM package uboot-odroid-xu3 +# +#################################### + +if [ -z $1 ] +then + echo "usage: ./sd_fusing.sh " + exit 0 +fi + +if [ -b $1 ] +then + echo "$1 reader is identified." +else + echo "$1 is NOT identified." + exit 0 +fi + +if [ -d /sys/block/${1##*/}boot0 ]; then + echo "$1 is an eMMC card, disabling ${1##*/}boot0 ro" + if ! echo 0 > /sys/block/${1##*/}boot0/force_ro; then + echo "Enabling r/w for $1boot0 failed" + exit 1 + fi + emmc=1 +fi + +#################################### +# fusing images + +if [ -n "$emmc" ]; then + signed_bl1_position=0 + bl2_position=30 + uboot_position=62 + tzsw_position=718 + device=$1boot0 +else + signed_bl1_position=1 + bl2_position=31 + uboot_position=63 + tzsw_position=719 + device=$1 +fi + +# +echo "BL1 fusing" +dd iflag=dsync oflag=dsync if=./bl1.bin of=$device seek=$signed_bl1_position + +# +echo "BL2 fusing" +dd iflag=dsync oflag=dsync if=./bl2.bin of=$device seek=$bl2_position + +# +echo "u-boot fusing" +dd iflag=dsync oflag=dsync if=./u-boot.bin of=$device seek=$uboot_position + +# +echo "TrustZone S/W fusing" +dd iflag=dsync oflag=dsync if=./tzsw.bin of=$device seek=$tzsw_position + +#################################### +# +echo "U-boot image is fused successfully." diff --git a/alarm/uboot-odroid-xu3/uboot-odroid-xu3.install b/alarm/uboot-odroid-xu3/uboot-odroid-xu3.install new file mode 100644 index 000000000..48b8de0f1 --- /dev/null +++ b/alarm/uboot-odroid-xu3/uboot-odroid-xu3.install @@ -0,0 +1,54 @@ +sd_fuse() { + if [ ! -b /dev/mmcblk0 ]; then + echo "No MMC device to flash, exiting." + exit 0 + fi + + if [ -d /sys/block/mmcblk0boot0 ]; then + echo "/dev/mmcblk0 is an eMMC card, disabling read-only.." + if ! echo 0 > /sys/block/mmcblk0boot0/force_ro; then + echo "Disabling read-only for /dev/mmcblk0boot0 failed." + exit 1 + fi + signed_bl1_position=0 + bl2_position=30 + uboot_position=62 + tzsw_position=718 + device=/dev/mmcblk0boot0 + else + signed_bl1_position=1 + bl2_position=31 + uboot_position=63 + tzsw_position=719 + device=/dev/mmcblk0 + fi + + echo "BL1 fusing" + dd iflag=dsync oflag=dsync if=/boot/bl1.bin of=$device seek=$signed_bl1_position + echo "BL2 fusing" + dd iflag=dsync oflag=dsync if=/boot/bl2.bin of=$device seek=$bl2_position + echo "u-boot fusing" + dd iflag=dsync oflag=dsync if=/boot/u-boot.bin of=$device seek=$uboot_position + echo "TrustZone S/W fusing" + dd iflag=dsync oflag=dsync if=/boot/tzsw.bin of=$device seek=$tzsw_position +} + +flash_uboot() { + echo "A new U-Boot version needs to be flashed onto /dev/mmcblk0." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + sd_fuse + else + echo "You can do this later by running:" + echo "# cd /boot; ./sd_fusing.sh /dev/mmcblk0" + fi +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +}