Helios4: Changes / fixes related to bootscript issue (#1169)

* helios4: next branch use u-boot 2018

use new u-boot based on upstream 2018

Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* helios4: Tweak fancontrol configuration

Adjusted MINSTART and MINSTOP to suit both old and new fan.
Adjusted TEMP threshold so fan would stop or run in minimal speed when
the system idle.
Fixed wrong MINPWM value.

URL:https://wiki.kobol.io/pwm/#configuration-file
Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* kernel: mvebu-next: use upstream helios4 dts

Helios4 device tree has been merged on upstream since 4.19.
Rework the patch to produce same device tree.

URL:https://patchwork.kernel.org/patch/10449393/

Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* Helios4: Use boot-mvebu-next bootscript

Use boot-mvebu-next.cmd that make use of upstream's Generic Distro
Configuration.
Since loadaddr and fdt_addr varibales are no longer required, remove the
patch.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* Helios4: mvebu-next: Add workaround for SPI and SATA concurrent access issue

Concurrent access on SPI NOR and SATA drives can lead to unstable SATA.
Therefore as workaround, disable SATA controller when SPI flash access
is needed and make it as user configurable item in armbianEnv.txt

This workaround might applies to Clearfog too.

Refer to
Commit 59af84c07c ("Helios4: Add SPI bootloader install feature
(#1126)")

Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* Bootscripts: Fixed boot-mvebu-next.cmd

The environment setting (armbianEnv.txt) is loaded to RAM located on
${load_addr} but the env import use wrong address (${pxefile_addr_r}).

bootargs still expect ${boot_interface} which carried over from boot-
marvell.cmd. Upstream's distro configuration use ${devtype} instead.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>

* uboot: mvebu-next: only apply DT fixup script if it exists

* [ buildscript ] Add FORCE_BOOTSCRIPT_UPDATE option

If enabled bootscript will get updated during bsp upgrade.

* Helios4: Enable FORCE_BOOTSCRIPT_UPDATE by default in board config.

* Helios4: Added boot-marvell.cmd compability to u-boot 2018

Revert the changes to use boot-mvebu-next.cmd instead of boot-
marvell.cmd to prevent unbootable system due to incompatibility between
u-boot 2013.01 and boot-mvebu-next.cmd
This reverts commit 0f17ecb233babe ("Helios4: Use boot-mvebu-next
bootscript")

U-Boot 2018 will failed load dtb and script due to missing some
variables on boot-marvell.cmd. This will render the system unbootable.
Re-added and update loading-boot-scr.patch for backward compatibility

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
This commit is contained in:
Gauthier Provost 2018-11-29 13:58:39 +08:00 committed by Igor Pečovnik
commit 14452e25e6
6 changed files with 96 additions and 4 deletions

View file

@ -4,6 +4,7 @@ BOARDFAMILY="mvebu"
BOOTCONFIG="armada_38x_helios4_config"
MODULES="mv_cesa"
BUILD_DESKTOP="no"
FORCE_BOOTSCRIPT_UPDATE="yes"
KERNEL_TARGET="default,next"
CLI_TARGET="stretch,bionic:next"

View file

@ -44,7 +44,8 @@ if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/rockchip/${fdtfile}
else
if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/overlay/${overlay_prefix}-fixup.scr; then
if test -e ${devtype} ${devnum} ${prefix}dtb/overlay/${overlay_prefix}-fixup.scr; then
load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/overlay/${overlay_prefix}-fixup.scr
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${load_addr}
fi

View file

@ -17,7 +17,7 @@ case $BRANCH in
BOOTSOURCE='https://github.com/helios-4/u-boot.git'
BOOTBRANCH='branch:helios4'
BOOTDIR=$MAINLINE_UBOOT_DIR
BOOTSCRIPT='boot-mvebu-next.cmd:boot.cmd'
BOOTSCRIPT='boot-marvell.cmd:boot.cmd'
BOOTCONFIG='helios4_defconfig'
UBOOT_TARGET_MAP=";;u-boot-spl.kwb:u-boot.mmc

View file

@ -18,6 +18,8 @@ EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional p
CREATE_PATCHES="no" # wait that you make changes to uboot and kernel source and creates patches
BUILD_ALL="no" # cycle through available boards and make images or kernel/u-boot packages.
# set KERNEL_ONLY to "yes" or "no" to build all packages/all images
FORCE_BOOTSCRIPT_UPDATE="no" # update bootscript when upgrading bsp package
BSPFREEZE="" # freeze armbian packages (u-boot, kernel, dtb)
INSTALL_HEADERS="" # install kernel headers package

View file

@ -134,9 +134,28 @@ create_board_package()
[ -f "/etc/default/cpufrequtils" ] && cp /etc/default/cpufrequtils /etc/default/cpufrequtils.dpkg-old
dpkg-divert --package linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} --add --rename \
--divert /etc/mpv/mpv-dist.conf /etc/mpv/mpv.conf
exit 0
EOF
if [[ $FORCE_BOOTSCRIPT_UPDATE == yes ]]; then
cat <<-EOF >> $destination/DEBIAN/preinst
# create a bootscript backup
if [ -f /etc/armbian-release ]; then
# create a backup
. /etc/armbian-release
cp /boot/$bootscript_dst /usr/share/armbian/${bootscript_dst}-\${VERSION} >/dev/null 2>&1
echo "NOTE: You can find previous bootscript versions in /usr/share/armbian !"
fi
exit 0
EOF
else
cat <<-EOF >> $destination/DEBIAN/preinst
exit 0
EOF
fi
chmod 755 $destination/DEBIAN/preinst
# postrm script
@ -180,13 +199,36 @@ create_board_package()
if [ ! -f /boot/$bootscript_dst ]; then
echo "Recreating boot script"
cp /usr/share/armbian/$bootscript_dst /boot >/dev/null 2>&1
rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline)
rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline)
cp /usr/share/armbian/armbianEnv.txt /boot >/dev/null 2>&1
echo "rootdev="\$rootdev >> /boot/armbianEnv.txt
sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini
[ -f /boot/boot.cmd ] && mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1
EOF
if [[ $FORCE_BOOTSCRIPT_UPDATE == yes ]]; then
cat <<-EOF >> $destination/DEBIAN/postinst
else
echo "Updating bootscript"
# copy new bootscript
cp /usr/share/armbian/$bootscript_dst /boot >/dev/null 2>&1
# build new bootscript
if [ -f /boot/boot.cmd ]; then
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1
elif [ -f /boot/boot.ini ]; then
rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline)
sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini
fi
# cleanup old bootscript backup
[ -f /usr/share/armbian/boot.cmd ] && ls /usr/share/armbian/boot.cmd-* | head -n -5 | xargs rm -f --
[ -f /usr/share/armbian/boot.ini ] && ls /usr/share/armbian/boot.ini-* | head -n -5 | xargs rm -f --
EOF
fi
cat <<-EOF >> $destination/DEBIAN/postinst
fi
# now cleanup and remove old ramlog service
systemctl disable log2ram.service >/dev/null 2>&1
[ -f "/usr/sbin/log2ram" ] && rm /usr/sbin/log2ram

View file

@ -0,0 +1,46 @@
From 61ddc75ecb082cba51fe7da4d0bc4c73c56abf38 Mon Sep 17 00:00:00 2001
Message-Id: <61ddc75ecb082cba51fe7da4d0bc4c73c56abf38.1543232476.git.aditya@kobol.io>
From: Aditya Prayoga <aditya@kobol.io>
Date: Mon, 26 Nov 2018 19:07:49 +0800
Subject: [PATCH] helios4: add boot-marvell.cmd backward compatibility
On system that still use boot.scr derived from boot-marvell.cmd, new
u-boot 2018 will failed load dtb and script due to missing some
variables. This will render the system unbootable.
These changes added the missing variables.
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
---
include/config_distro_bootcmd.h | 1 +
include/configs/helios4.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 373fee7..f469b2d 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -371,6 +371,7 @@
"boot_a_script=" \
"load ${devtype} ${devnum}:${distro_bootpart} " \
"${scriptaddr} ${prefix}${script}; " \
+ "setenv boot_interface ${devtype};" \
"source ${scriptaddr}\0" \
\
"scan_dev_for_scripts=" \
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index 6943378..299c58d 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -185,6 +185,8 @@
LOAD_ADDRESS_ENV_SETTINGS \
"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"console=ttyS0,115200\0" \
+ "loadaddr=0x02000000\0" \
+ "fdt_addr=" FDT_ADDR_R "\0" \
BOOTENV
#endif /* CONFIG_SPL_BUILD */
--
2.7.4