From 25234d13c6f86a4ace4125c7676b2db1a9b019e6 Mon Sep 17 00:00:00 2001 From: Riku Voipio Date: Fri, 4 May 2018 14:49:29 +0300 Subject: B2260: add support Add support for B2260 images. Build command example: fai-diskimage -v --cspace /work/fai --hostname linaro-developer -S 3G \ --class SAVECACHE,STRETCH,DEBIAN,LINARO,DEVELOPER,B2260,UBOOT b2260raw Change-Id: Iccf44c89a3a4ab54368c461a2e7c4cb3a6321cfa Signed-off-by: Riku Voipio --- .../apt/sources.list.d/backports.list/BACKPORTS | 1 + files/etc/apt/sources.list.d/linaro.list/B2260 | 5 + files/uboot/b2260/u-bootrom.script | 69 ++++++++++ files/uboot/b2260/u-bootrom.script-kernel | 60 +++++++++ files/uboot/b2260/u-bootrom.script-netboot | 42 ++++++ files/uboot/b2260/u-bootrom.script-uboot | 39 ++++++ files/uboot/b2260/uEnv_sd.txt | 31 +++++ files/uboot/update_default_boot.sh | 148 +++++++++++++++++++++ 8 files changed, 395 insertions(+) create mode 100644 files/etc/apt/sources.list.d/backports.list/BACKPORTS create mode 100644 files/etc/apt/sources.list.d/linaro.list/B2260 create mode 100644 files/uboot/b2260/u-bootrom.script create mode 100644 files/uboot/b2260/u-bootrom.script-kernel create mode 100644 files/uboot/b2260/u-bootrom.script-netboot create mode 100644 files/uboot/b2260/u-bootrom.script-uboot create mode 100644 files/uboot/b2260/uEnv_sd.txt create mode 100644 files/uboot/update_default_boot.sh (limited to 'files') diff --git a/files/etc/apt/sources.list.d/backports.list/BACKPORTS b/files/etc/apt/sources.list.d/backports.list/BACKPORTS new file mode 100644 index 0000000..e075dd1 --- /dev/null +++ b/files/etc/apt/sources.list.d/backports.list/BACKPORTS @@ -0,0 +1 @@ +deb {%apt_cdn%}/debian {%release%}-backports main contrib non-free diff --git a/files/etc/apt/sources.list.d/linaro.list/B2260 b/files/etc/apt/sources.list.d/linaro.list/B2260 new file mode 100644 index 0000000..f13c1c6 --- /dev/null +++ b/files/etc/apt/sources.list.d/linaro.list/B2260 @@ -0,0 +1,5 @@ +deb http://obs.linaro.org/linaro-overlay-{%release%}/{%obs_release%}/ ./ +deb-src http://obs.linaro.org/linaro-overlay-{%release%}/{%obs_release%}/ ./ +deb http://obs.linaro.org/b2260/{%release%}/ ./ +deb-src http://obs.linaro.org/b2260/{%release%}/ ./ + diff --git a/files/uboot/b2260/u-bootrom.script b/files/uboot/b2260/u-bootrom.script new file mode 100644 index 0000000..f9b76cf --- /dev/null +++ b/files/uboot/b2260/u-bootrom.script @@ -0,0 +1,69 @@ +# u-bootrom supports u-boot.2015 commands plus few extras. +# +# Extra variables: +# script_dev_usb 'usb X.Y' default usb instance:partition to boot from. +# script_dev_mmc 'mmc X.Y' default mmc instance:partition to boot from. +# script_dev $script_usb|mmc_dev depending on media where boot script was found. +# script_fsload 'fatload' or 'ext2load' depending on which was used to load boot script. +# dram_base DDR start address +# dram_size DDR size (in bytes) +# load_addr default load address (DDR start) +# board board id ("b2120", "b2260", ...) +# +# Extra commands: +# hpen holding pen reconfiguration and kick support, for SMP boot. +# boot_optee OPTEE specific boot command +# +# > +# > help boot_optee +# +# boot_optee s_entry [s_arg0 [s_arg1 [s_arg2 [s_arg3]]]] ns_entry +# +# - boot a secure and a non secure application +# 's_entry' is the secure application entry point +# 's_arg0-3' are the 4 parameters passed to the secure application +# 'ns_entry' is the non-secure application entry point. +# ns_entry has no argument. Secure application is +# expected to provide args, if any. Secure expects +# only an physical entry point from non secure. +# > +# > help hpen +# +# hpen prepare [1stage|2stage] +# +# - prepare a 1stage or a 2stage hpen sequence. +# specifies the address of the hpen kicker to use. hexa. +# +# hpen kick hpen| +# +# - kick the loaded hpen. returns only once cores have all left +# the current hpen loop. +# +# is the target address core shall branch to. +# +# Using string "hpen" allows to enter back to the hpen sequence. +# It allows to reprogram a specific hpen setup. +# +# At u-boot entry, secondary boot core are placed in a 1stage hpen +# sequence with a local ERAM cell address as hpen kicker: 0x094100A4. +# magic value! +# > +# +# Traces considerations: +# +# u-bootrom enables silent console. To get some logs from this script one +# can disable silent mode ("setenv silent;") and re-enable silent mode +# ("setenv silent 1") in this script. +# ----------------------------------------------------------------------- +# +# This is the default install: by default, boot the kernel for current board +# + +script_path="b2260/u-bootrom.script-uboot" + +setenv silent; +echo "[bootscript] boot from $script_path" +setenv silent 1 + +$script_fsload $script_dev $load_addr $script_path +source $load_addr $filesize diff --git a/files/uboot/b2260/u-bootrom.script-kernel b/files/uboot/b2260/u-bootrom.script-kernel new file mode 100644 index 0000000..6c9c3df --- /dev/null +++ b/files/uboot/b2260/u-bootrom.script-kernel @@ -0,0 +1,60 @@ +# u-bootrom supports u-boot.2015 commands plus few extras. +# +# Extra variables: +# script_dev_usb 'usb X.Y' default usb instance:partition to boot from. +# script_dev_mmc 'mmc X.Y' default mmc instance:partition to boot from. +# script_dev $script_usb|mmc_dev depending on media where boot script was found. +# script_fsload 'fatload' or 'ext2load' depending on which was used to load boot script. +# dram_base DDR start address +# dram_size DDR size (in bytes) +# load_addr default load address (DDR start) +# board board id ("b2120", "b2260", ...) +# +# Extra commands: +# hpen holding pen reconfiguration and kick support, for SMP boot. +# boot_optee OPTEE specific boot command +# +# u-bootrom enables silent console. To get some logs from this script one +# can disable silent mode ("setenv silent;") and re-enable silent mode +# ("setenv silent 1") in this script. + +# disable silent mode to log kernel boot attempt +setenv silent; + +# images location + +fdt_path="stih410-b2260.dtb" +fdt_addr=0x47000000 + +kernel_path="uImage" +kernel_addr=0x60000000 + +# load images +echo "[bootscript] loadbooting from $script_dev using $script_fsload" + +$script_fsload $script_dev $fdt_addr $fdt_path +$script_fsload $script_dev $kernel_addr $kernel_path + +# boot images + +dcache flush; + +echo "[bootscript] prepare secondaries in holding pen: kicker at 0x094100A4" + +hpen prepare 0x094100A4 +hpen kick hpen + +setenv bootargs_sd 'console=ttyAS1,115200 CONSOLE=/dev/ttyAS1 consoleblank=0 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait mem=992M@0x40000000 vmalloc=256m ' +setenv bootargs_usb 'console=ttyAS1,115200 CONSOLE=/dev/ttyAS1 consoleblank=0 root=/dev/sda2 rootfstype=ext4 rw rootwait mem=992M@0x40000000 vmalloc=256m ' + +setenv bootargs $bootargs_sd +if test "$script_dev" = "$script_dev_usb"; then setenv bootargs $bootargs_usb; fi + +setenv fdt_high 0xFFFFFFFF + +echo "[bootscript] kernel bootargs:" +echo $bootargs +echo +echo "[bootscript] booting kernel $kernel_addr, fdt $fdt_addr" + +bootm $kernel_addr - $fdt_addr diff --git a/files/uboot/b2260/u-bootrom.script-netboot b/files/uboot/b2260/u-bootrom.script-netboot new file mode 100644 index 0000000..4cc017a --- /dev/null +++ b/files/uboot/b2260/u-bootrom.script-netboot @@ -0,0 +1,42 @@ +# u-bootrom supports u-boot.2015 commands plus few extras. +# +# Extra variables: +# script_dev_usb 'usb X.Y' default usb instance:partition to boot from. +# script_dev_mmc 'mmc X.Y' default mmc instance:partition to boot from. +# script_dev $script_usb|mmc_dev depending on media where boot script was found. +# script_fsload 'fatload' or 'ext2load' depending on which was used to load boot script. +# dram_base DDR start address +# dram_size DDR size (in bytes) +# load_addr default load address (DDR start) +# board board id ("b2120", "b2260", ...) +# +# Extra commands: +# hpen holding pen reconfiguration and kick support, for SMP boot. +# boot_optee OPTEE specific boot command +# +# u-bootrom enables silent console. To get some logs from this script one +# can disable silent mode ("setenv silent;") and re-enable silent mode +# ("setenv silent 1") in this script. + +# disable silent mode to log where we attemp to boot from +setenv silent; + +# images location + +setenv serverip 'X.X.X.X' + +script_path="boot_network_${board}.scr" + +# load images + +echo "[bootscript] fetching $script_path from tftp:$serverip" + +setenv autoload no +dhcp +tftp $load_addr $script_path + +# boot images + +echo "[bootscript] script found, source it." + +source $load_addr diff --git a/files/uboot/b2260/u-bootrom.script-uboot b/files/uboot/b2260/u-bootrom.script-uboot new file mode 100644 index 0000000..5420661 --- /dev/null +++ b/files/uboot/b2260/u-bootrom.script-uboot @@ -0,0 +1,39 @@ +# u-bootrom supports u-boot.2015 commands plus few extras. +# +# Extra variables: +# script_dev_usb 'usb X.Y' default usb instance:partition to boot from. +# script_dev_mmc 'mmc X.Y' default mmc instance:partition to boot from. +# script_dev $script_usb|mmc_dev depending on media where boot script was found. +# script_fsload 'fatload' or 'ext2load' depending on which was used to load boot script. +# dram_base DDR start address +# dram_size DDR size (in bytes) +# load_addr default load address (DDR start) +# board board id ("b2120", "b2260", ...) +# +# Extra commands: +# hpen holding pen reconfiguration and kick support, for SMP boot +# load_optee OPTEE specific formated image intallation command +# boot_optee OPTEE specific boot command +# +# u-bootrom enables silent console. To get some logs from this script one +# can disable silent mode ("setenv silent;") and re-enable silent mode +# ("setenv silent 1") in this script. + +# u-boot shall be loaded 10MB before the begining of the last 32MB of the DDR. +setexpr.l uboot_addr $dram_base + $dram_size +setexpr.l uboot_addr $uboot_addr - 0x02000000 +setexpr.l uboot_addr $uboot_addr - 0x00A00000 +uboot_path="$board/u-boot.bin" + +# load images + +$script_fsload $script_dev $uboot_addr $uboot_path + +# boot images + +dcache flush; + +hpen prepare 0x094100A4 +hpen kick hpen + +go $uboot_addr diff --git a/files/uboot/b2260/uEnv_sd.txt b/files/uboot/b2260/uEnv_sd.txt new file mode 100644 index 0000000..498e9f5 --- /dev/null +++ b/files/uboot/b2260/uEnv_sd.txt @@ -0,0 +1,31 @@ +# Init kernel and fdt config +fdt_high=0xFFFFFFFF +fdt_file=stih410-b2260.dtb +fdt_load_addr=0x47000000 +kernel_file=uImage +kernel_load_addr=0x60000000 + +# Init device settings +device_part=0:1 + +# Init error message when filesystem load or read fails +read_error_message=echo Unable to read \${part} filesystem on mmc at ${device_part} partition +load_error_message=echo ${file} not available on mmc at ${device_part} partition + +# Check device interface availability and run load action if ok +read_from_device=if \${part}ls mmc ${device_part}; then run load_kernel; else run read_error_message; fi + +# Load kernel and fdt, then launch boot action if ok +load_kernel=if \${part}load mmc ${device_part} ${kernel_load_addr} ${kernel_file}; then run load_fdt ; else setenv file ${kernel_file}; run load_error_message; fi +load_fdt=if \${part}load mmc ${device_part} ${fdt_load_addr} ${fdt_file}; then run run_boot; else setenv file ${fdt_file}; run load_error_message; fi + +# Check ethaddr and set it for kernel +check_ethaddr=if test "x$ethaddr" = "x"; then echo Set ethaddr...; readmac; if test "x$ethaddr" = "x"; then askenv ethaddr; fi; fi + +# Set bootargs and then boot +run_boot=setenv bootargs console=ttyAS1,115200 CONSOLE=/dev/ttyAS1 consoleblank=0 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait mem=992M@0x40000000 vmalloc=256m ; bootm ${kernel_load_addr} - ${fdt_load_addr} + +# Set boot command +bootcmd=run check_ethaddr; echo Load kernel and fdt to RAM...; run read_from_device + +boot diff --git a/files/uboot/update_default_boot.sh b/files/uboot/update_default_boot.sh new file mode 100644 index 0000000..18a18fe --- /dev/null +++ b/files/uboot/update_default_boot.sh @@ -0,0 +1,148 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: update_default_boot.sh +# +# USAGE: ./update_default_boot.sh [TYPE] +# [TYPE]: kernel, uboot, optee, netboot +# +# AUTHOR: Christophe Priouzeau +# ORGANIZATION: STMicroelectronics +# COPYRIGHT: Copyright (C) 2016, STMicroelectronics - All Rights Reserved +# CREATED: 08/23/2016 11:53 +#=============================================================================== +_DEFAULT_BOOTSCRIPT=u-bootrom.script +_DEFAULT_TYPE=kernel + +_TYPE= + +usage() { + echo "Usage:" + echo " $1 " + echo " type: type of boot can be \"kernel\", \"uboot\" or \"optee\" or \"netboot\"" + echo "" +} +parse_argument() { + case $1 in + kernel) + _TYPE=kernel + ;; + uboot) + _TYPE=uboot + ;; + optee) + _TYPE=optee_uboot + ;; + netboot) + _TYPE=netboot + ;; + esac +} + +ask_tftp_ip_address() { + IP_ETH0=`ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'` + echo "Please enter the IP address of your TFTP server [$IP_ETH0]: " + read _ip + + if [ -z "$_ip" ]; + then + #use ip address of eth0 + IP_ADDRESS=$IP_ETH0 + else + echo "Would you like to use this IP address '$_ip' ? [Y/n] " + read answer + if [ -z "$answer" ] + then + # yes selected + IP_ADDRESS=$_ip + elif (echo -n $answer | grep -q -e "^[yY][a-zA-Z]*$") + then + # yes selected + IP_ADDRESS=$_ip + else + echo "[EXIT] you don't validate the ip address entered." + echo "" + exit 1 + fi + fi +} +# ----------------------------------- +# Parse option + +case $# in +0) + parse_argument kernel + ;; +1) + case $1 in + -h|--help) + usage $1 + exit 1 + ;; + kernel|uboot|optee|netboot) + parse_argument $1 + shift + ;; + *) + usage $1 + exit 1 + ;; + esac + + ;; +*) + #error + usage $1 + exit 1 + ;; +esac + +if [ -z $_TYPE ]; +then + echo "FORCE type of boot to : $_DEFAULT_TYPE" + _TYPE=$_DEFAULT_TYPE +fi + +echo "" +echo " Type of boot: $_TYPE" +echo "" + +if [ "$_TYPE" == "netboot" ]; +then + ask_tftp_ip_address + echo "IP ADDRESS $IP_ADDRESS" +fi + +# generate script of mkimage +#for f in `find . -name *.script -print`; +#do +# filename="$f" +# mkimage -A arm -T script -C none -n "Open SDK Boot Script" -d $f ${filename%.*}.scr > /dev/null +#done + +for d in `find . -maxdepth 1 -type d | grep "./" | sort`; +do + BOOTSCRIPT_ROOT=`basename $d` + if [ -f $d/$_DEFAULT_BOOTSCRIPT ]; + then + # apply default configuration + if [ -f $d/$_DEFAULT_BOOTSCRIPT-$_TYPE ]; + then + echo "INFO: update $BOOTSCRIPT_ROOT/$_DEFAULT_BOOTSCRIPT script" + sed -i 's#\(script_path=\".*/'"$_DEFAULT_BOOTSCRIPT"'\).*$#\1-$_TYPE\"#g' $d/$_DEFAULT_BOOTSCRIPT + if [ "$_TYPE" == "netboot" ]; + then + if [ -f $d/$_DEFAULT_BOOTSCRIPT-$_TYPE ]; + then + sed -i 's#setenv serverip '\(.*\)'#setenv serverip '$IP_ADDRESS'#g' $d/$_DEFAULT_BOOTSCRIPT-$_TYPE + fi + fi + else + echo "ERROR: missing '$_DEFAULT_BOOTSCRIPT-$_TYPE' in $BOOTSCRIPT_ROOT folder." + echo "ERROR: skip update in $BOOTSCRIPT_ROOT/$_DEFAULT_BOOTSCRIPT script" + fi + else + echo "ERROR: missing '$_DEFAULT_BOOTSCRIPT' in $BOOTSCRIPT_ROOT folder" + echo "ERROR: cannot update default boot for $BOOTSCRIPT_ROOT folder" + fi +done -- cgit v1.2.3