aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@linaro.org>2018-05-04 14:49:29 +0300
committerRiku Voipio <riku.voipio@linaro.org>2018-05-15 22:42:11 +0300
commit25234d13c6f86a4ace4125c7676b2db1a9b019e6 (patch)
tree368cb23f8e96cc3b7e3b166381edaa67735c0205
parent9d619ae36beb8233c510dd93d5c782bebe47fac8 (diff)
downloadfai-25234d13c6f86a4ace4125c7676b2db1a9b019e6.tar.gz
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 <riku.voipio@linaro.org>
-rw-r--r--class/B2260.var1
-rw-r--r--disk_config/B22604
-rw-r--r--files/etc/apt/sources.list.d/backports.list/BACKPORTS1
-rw-r--r--files/etc/apt/sources.list.d/linaro.list/B22605
-rw-r--r--files/uboot/b2260/u-bootrom.script69
-rw-r--r--files/uboot/b2260/u-bootrom.script-kernel60
-rw-r--r--files/uboot/b2260/u-bootrom.script-netboot42
-rw-r--r--files/uboot/b2260/u-bootrom.script-uboot39
-rw-r--r--files/uboot/b2260/uEnv_sd.txt31
-rw-r--r--files/uboot/update_default_boot.sh148
-rw-r--r--package_config/B22606
-rwxr-xr-xscripts/UBOOT/60-b22608
-rwxr-xr-x[-rw-r--r--]scripts/UBOOT/70-customize3
13 files changed, 414 insertions, 3 deletions
diff --git a/class/B2260.var b/class/B2260.var
new file mode 100644
index 0000000..b0d9006
--- /dev/null
+++ b/class/B2260.var
@@ -0,0 +1 @@
+fdtfile=stih410-b2260.dtb
diff --git a/disk_config/B2260 b/disk_config/B2260
new file mode 100644
index 0000000..9ceaf63
--- /dev/null
+++ b/disk_config/B2260
@@ -0,0 +1,4 @@
+disk_config disk1 disklabel:gpt fstabkey:uuid bootable:2
+primary /boot/uboot 64 vfat rw createopts="-n BOOT"
+primary / 1G- ext4 rw createopts="-L rootfs-sd"
+
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 <addr> [1stage|2stage]
+#
+# - prepare a 1stage or a 2stage hpen sequence.
+# <addr> specifies the address of the hpen kicker to use. hexa.
+#
+# hpen kick hpen|<entrypoint>
+#
+# - kick the loaded hpen. returns only once cores have all left
+# the current hpen loop.
+#
+# <entrypoint> 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 <ERROR> Unable to read \${part} filesystem on mmc at ${device_part} partition
+load_error_message=echo <ERROR> ${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 <INFO> 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 <INFO> 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 <type>"
+ 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
diff --git a/package_config/B2260 b/package_config/B2260
new file mode 100644
index 0000000..0bc6c98
--- /dev/null
+++ b/package_config/B2260
@@ -0,0 +1,6 @@
+PACKAGES install-norec
+u-boot-menu
+u-boot-sti
+linux-image-4.16.8-00001-g70ff53be16be
+firmware-linux-free
+firmware-misc-nonfree
diff --git a/scripts/UBOOT/60-b2260 b/scripts/UBOOT/60-b2260
new file mode 100755
index 0000000..47c78f8
--- /dev/null
+++ b/scripts/UBOOT/60-b2260
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+
+if ifclass B2260
+then
+ cp -r $FAI/files/uboot/b2260 $target/boot/uboot/
+ cp $target/usr/lib/u-boot/stih410-b2260/u-boot.bin $target/boot/uboot/b2260
+fi
diff --git a/scripts/UBOOT/70-customize b/scripts/UBOOT/70-customize
index 5429175..703b738 100644..100755
--- a/scripts/UBOOT/70-customize
+++ b/scripts/UBOOT/70-customize
@@ -6,11 +6,8 @@ U_BOOT_FDT=$fdtfile
U_BOOT_PARAMETERS="rw rootwait"
EOF
-# hack - the "make deb" kernel package should handle this
for kernel in $target/boot/vmlinuz-*
do
- mv $kernel $kernel.gz
- gunzip $kernel
ver=$(echo $kernel|sed -e 's,.*vmlinuz-,,')
chroot $target /usr/sbin/update-initramfs -c -k $ver||true
done