Skip to content

Commit

Permalink
Add pine64_install_uboot.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Oct 27, 2018
1 parent e722c24 commit 975da50
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions package/root/usr/local/sbin/pine64_install_uboot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -e

if [ "$(id -u)" -ne "0" ]; then
echo "This script requires root."
exit 1
fi

DEVICE="${1:-/dev/mmcblk0}"

if [ ! -b "$DEVICE" ]; then
echo "Block device ${DEVICE} not found."
exit 2
fi

local boot0_position=8 # KiB
local boot0_size=64 # KiB
local uboot_position=19096 # KiB
local uboot_size=1384 # KiB

echo "Flashing boot0 ..."
dd if="/boot/pine64/boot0-pine64-$(cat /etc/pine64_model).bin" conv=notrunc bs=1k seek=$boot0_position oflag=sync of="${DEVICE}"

echo "Flashing U-Boot ..."
dd if="/boot/pine64/u-boot-pine64-$(cat /etc/pine64_model).bin" conv=notrunc bs=1k seek=$uboot_position oflag=sync of="${DEVICE}"

sync
echo "Done - you should reboot now."

0 comments on commit 975da50

Please sign in to comment.