Updates to u-boot upgrade on sunxi hw

This commit is contained in:
zador-blood-stained 2016-10-23 14:18:14 +03:00
parent 031cbd326b
commit 44f20bfcb0
3 changed files with 25 additions and 12 deletions

View File

@ -77,6 +77,7 @@ compile_uboot()
[[ \$DEVICE == /dev/null ]] && exit 0
[[ -z \$DEVICE ]] && DEVICE="/dev/mmcblk0"
[[ \$(type -t setup_write_uboot_platform) == function ]] && setup_write_uboot_platform
echo "Updating u-boot on device \$DEVICE" >&2
write_uboot_platform \$DIR \$DEVICE
exit 0
EOF

View File

@ -19,7 +19,11 @@ fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "${consoleargs} console=ttyS0,115200"; fi
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} cgroup_enable=memory swapaccount=1 hdmi.audio=EDID:0 disp.screen0_output_mode=${disp_mode} panic=10 consoleblank=0 enforcing=0 loglevel=${verbosity} ${extraargs} ${extraboardargs}"
# get PARTUUID of first partition on SD/eMMC it was loaded from
# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from
part uuid mmc 0:1 partuuid
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} cgroup_enable=memory swapaccount=1 hdmi.audio=EDID:0 disp.screen0_output_mode=${disp_mode} panic=10 consoleblank=0 enforcing=0 loglevel=${verbosity} ubootpart=${partuuid} ${extraargs} ${extraboardargs}"
if test "${disp_mem_reserves}" = "off"; then setenv bootargs "${bootargs} sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16"; fi

View File

@ -32,15 +32,23 @@ write_uboot_platform()
setup_write_uboot_platform()
{
# This may cause overwriting u-boot for android or other non-Armbian OS installed on eMMC
# so don't run this function by default
[[ ! -f /var/lib/armbian/allow_uboot_update ]] && return
for dev in $(lsblk -d -n -p -o NAME); do
if grep -q 'eGON.BT0' <(dd if=$dev bs=32 skip=256 count=1 status=none); then
# Assuming that only one device with SPL signature is present
echo "SPL signature found on $dev" >&2
DEVICE=$dev
break
fi
done
if grep -q "ubootpart" /proc/cmdline; then
local tmp=$(cat /proc/cmdline)
tmp="${tmp##*ubootpart=}"
tmp="${tmp%% *}"
[[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2>/dev/null)
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2>/dev/null)
[[ -n $dev ]] && DEVICE="/dev/$dev"
elif [[ -f /var/lib/armbian/force_search_uboot ]]; then
# This may cause overwriting u-boot for android or other non-Armbian OS installed on eMMC
# so don't run this function by default
for dev in $(lsblk -d -n -p -o NAME); do
if grep -q 'eGON.BT0' <(dd if=$dev bs=32 skip=256 count=1 status=none); then
# Assuming that only one device with SPL signature is present
echo "SPL signature found on $dev" >&2
DEVICE=$dev
break
fi
done
fi
}