aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlaus Kudielka <klaus.kudielka@gmail.com>2019-12-27 14:26:37 +0100
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-12-04 17:57:25 +0100
commitebe8cc2b2ae58fc90c3fb4a329a01721eb462a59 (patch)
treec1a59e09402ceeb2d3068833931b471503aa46e6
parentf10332c292c843aa8975a4209a412aada4b65044 (diff)
downloadupstream-ebe8cc2b2ae58fc90c3fb4a329a01721eb462a59.tar.gz
upstream-ebe8cc2b2ae58fc90c3fb4a329a01721eb462a59.tar.bz2
upstream-ebe8cc2b2ae58fc90c3fb4a329a01721eb462a59.zip
mvebu: fixup Turris Omnia U-Boot environment
Fixup dfa357a3de "mvebu: base-files: Update Turris Omnia U-Boot environment" which should have included this file as well. By rebasing the initial patch this file somehow disappeared. Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com> Reviewed-by: Tomasz Maciej Nowak <tomek_n@o2.pl> Tested-by: W. Michael Petullo <mike@flyn.org> (Turris Omnia "2020") Tested-by: Klaus Kudielka <klaus.kudielka@gmail.com> (Turris Omnia) [explain fixup in commit message] Signed-off-by: Paul Spooren <mail@aparcar.org> (backported from commit 485ce5bbe5cc33526e56817694a79a7d94160e01) Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
-rw-r--r--target/linux/mvebu/base-files/etc/uci-defaults/35_turris-omnia_uboot-env44
1 files changed, 44 insertions, 0 deletions
diff --git a/target/linux/mvebu/base-files/etc/uci-defaults/35_turris-omnia_uboot-env b/target/linux/mvebu/base-files/etc/uci-defaults/35_turris-omnia_uboot-env
new file mode 100644
index 0000000000..da025a200f
--- /dev/null
+++ b/target/linux/mvebu/base-files/etc/uci-defaults/35_turris-omnia_uboot-env
@@ -0,0 +1,44 @@
+# This must be sourced after 30_uboot-envtools
+
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+cznic,turris-omnia)
+ # Do nothing if this is not the old U-Boot
+ grep -q 'U-Boot 2015.10-rc2' /dev/mtd0 || exit 0
+ # Do nothing if we already have distro_bootcmd
+ fw_printenv distro_bootcmd >/dev/null 2>/dev/null && exit 0
+ # Set the complete environment, since U-Boot does not merge the default environment from its own image!
+ fw_setenv -s - <<-"EOF"
+ baudrate 115200
+ bootdelay 3
+ ethact neta2
+ fdt_high 0x10000000
+ initrd_high 0x10000000
+ bootargs earlyprintk console=ttyS0,115200 rootfstype=btrfs rootdelay=2 root=b301 rootflags=subvol=@,commit=5 rw
+ bootcmd i2c dev 1; i2c read 0x2a 0x9 1 0x00FFFFF0; setexpr.b rescue *0x00FFFFF0; if test $rescue -ge 1; then echo BOOT RESCUE; run rescueboot; else echo BOOT eMMC FS; run mmcboot; setenv bootargs; run distro_bootcmd; fi
+ rescueboot i2c mw 0x2a.1 0x3 0x1c 1; i2c mw 0x2a.1 0x4 0x1c 1; mw.l 0x01000000 0x00ff000c; i2c write 0x01000000 0x2a.1 0x5 4 -s; setenv bootargs "$bootargs omniarescue=$rescue"; sf probe; sf read 0x1000000 0x100000 0x700000; bootz 0x1000000
+ mmcboot btrload mmc 0 ${kernel_addr_r} boot/zImage @ && btrload mmc 0 ${fdt_addr_r} boot/dtb @ && setenv bootargs ${bootargs} cfg80211.freg=${regdomain} && bootz ${kernel_addr_r} - ${fdt_addr_r}
+ kernel_addr_r 0x1000000
+ scriptaddr 0x1800000
+ fdt_addr_r 0x2000000
+ boot_targets mmc0 scsi0
+ boot_prefixes / /boot/
+ boot_scripts boot.scr
+ distro_bootcmd scsi_need_init=true; for target in ${boot_targets}; do run bootcmd_${target}; done
+ bootcmd_mmc0 devnum=0; run mmc_boot
+ mmc_boot if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
+ bootcmd_scsi0 devnum=0; run scsi_boot
+ scsi_boot run scsi_init; if scsi dev ${devnum}; then devtype=scsi; run scan_dev_for_boot_part; fi
+ scsi_init if ${scsi_need_init}; then scsi_need_init=false; scsi scan; fi
+ scan_dev_for_boot_part for distro_bootpart in 1; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
+ scan_dev_for_boot echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_scripts; done
+ scan_dev_for_scripts for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
+ boot_a_script load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
+ EOF
+ ;;
+esac
+
+exit 0